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

combNum = 0
calcResult = 0
n,x = map(int, input().split())
numList1 = list(range(1,n+1,1))
numList2 = list(range(1,n+1,1))
numList3 = list(range(1,n+1,1))
while True:
    if n is x is 0:
        break
    else:
        for index1 in range(n):
            for index2 in range(n):
                for index3 in range(n):
                    #index = [numList1[index1], numList2[index2], numList3[index3]]
                    if numList1[index1] is numList2[index2] or numList1[index1] is numList3[index3] or numList2[index2] is numList3[index3] or numList1[index1] is numList2[index2] is numList3[index3]:
                    #if index.count(numList1[index1])>1 or index.count(numList1[index2])>1 or index.count(numList1[index3])>1:
                        pass                
                    else:
                        if numList1[index1]<numList2[index2]<numList3[index3]:
                            calcResult = numList1[index1] + numList2[index2]+numList3[index3]
                            if calcResult == x:
                                combNum =combNum+1
                        else:
                            pass
print(combNum)


### FIXED CODE ###

dataNum = 0
combNum = [0] * 100
while True:
    n,x=map(int, input().split())
    if n is x is 0:
        break
    else:
        for a in range(1,n-1):
            for b in range(a+1,n):
                for c in range(b+1,n+1):
                    calcResult = a + b + c
                    if calcResult == x:
                        combNum[dataNum] += 1
                    else:
                        pass
    dataNum += 1

for index in range(dataNum):
    print(combNum[index])
### BUGGY CODE ###

n = int(input())
s = input()
ans = n
for i in range(n):
    left_w = s[:i].count("W")
    right_e = s[i+1:].count("E")
    sum = left_w+right_e
    if sum < ans:
        ans = sum
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
sum_w = s.count("W")
ans = n
lw = [0]*n
count = 0
for i in range(n):
    lw[i] = count
    if s[i] == "W":
        count += 1
for i in range(n):
    left_w = lw[i]
    right_w = sum_w-left_w
    if s[i] == "W":
        right_w -= 1
    right_e = (n-i-1)-right_w
    sum = left_w+right_e
    if sum < ans:
        ans = sum
print(ans)
### BUGGY CODE ###

import collections

n, k = map(int, input().split())
h = []
for i in range(n):
    a, b = map(int, input().split())
    h.append((a,b))
h.sort(key=lambda x: -x[1])
fav=h[0:k]
tb={}
for t,d in sorted(h[k:], key=lambda x: (-x[0], -x[1])):
    tb[t] = tb.get(t, []) + [d]
alt = []
for t,ds in tb.items():
    alt.append((t,max(ds)))
alt.sort(key=lambda x: -x[1])

# print("h: ",h)
# print("fav: ",fav)
# print("alt: ",alt)


var = len(set([x[0] for x in fav]))

bestscore = var**2 + sum([x[1] for x in fav])

while(len(alt) > 0):
    c = collections.Counter([x[0] for x in fav])
    temp = sorted(filter(lambda x: c[x[0]] > 1, fav), key=lambda x: -x[1])
    if(len(temp) == 0):
        break
    while(len(alt) > 0):
        t1, d1 = alt.pop(0)
        if(c[t1] == 0):
            break
    if(c[t1] != 0):
        break
    t2, d2 = temp[-1]


    fav.remove((t2,d2))
    fav.append((t1, d1))
    var += 1

    bestscore = max(bestscore, var**2 + sum([x[1] for x in fav]))

    # print("fav: ",fav)
    # print("alt: ",alt)

print(bestscore)

### FIXED CODE ###

n, k = map(int, input().split())
h = []
for i in range(n):
    t, d = map(int, input().split())
    h.append((t,d))
h.sort(key=lambda x: -x[1])

taste = 0
typen = 0
typecnt = {}
bad = []


for i in range(k):
    typecnt[h[i][0]] = typecnt.get(h[i][0], 0) + 1
    if(typecnt[h[i][0]] == 1):
        typen += 1
    else:
        bad.append(h[i][1])
    taste += h[i][1]

# print(h)
# print(typecnt)
# print(bad)

ans = taste + typen**2

for i in range(k, n):
    if(len(bad) == 0):
        break
    cnt = typecnt.get(h[i][0], 0)
    if(cnt != 0):
        continue
    else:
        typecnt[h[i][0]] = cnt + 1
    typen += 1
    taste -= bad.pop()
    taste += h[i][1]
    ans = max(ans, taste + typen**2)

print(ans)
### BUGGY CODE ###

import sys
import math
from copy import deepcopy
from collections import deque
sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    boxes = [0] * (N+1)
    ans_boxes = [0]
    [ans_boxes.append(x) for x in list(map(int, input().split()))]

    count = 0
    ans = []

    def judge(n):
        s = 0
        for b in range(len(boxes)):
            if b % i == 0:
                s += boxes[b]

        if s % 2 == ans_boxes[i]:
            return True
        else:
            return False

    for i in reversed(range(1, len(boxes))):
        if judge(i):
            continue

        else:
            count += 1
            ans.append(i)
            boxes[i] += 1
            if judge(i):
                pass
            else:
                print(-1)
                sys.exit()

    print(count)
    if ans:
        print(*ans, sep=' ')


if __name__ == '__main__':
    main()



### FIXED CODE ###

import sys
import math
from copy import deepcopy
from collections import deque
sys.setrecursionlimit(20000000)


def main():
    N = int(input())
    boxes = [0] * (N+1)
    ans_boxes = [0]
    [ans_boxes.append(x) for x in list(map(int, input().split()))]

    count = 0
    ans = []

    def judge(n):
        s = 0

        nn = n
        while nn < len(boxes):
            s += boxes[nn]
            nn += n

        if s % 2 == ans_boxes[i]:
            return True
        else:
            return False

    for i in reversed(range(1, len(boxes))):
        if judge(i):
            continue

        else:
            count += 1
            ans.append(i)
            boxes[i] += 1
            if judge(i):
                pass
            else:
                print(-1)
                sys.exit()

    print(count)
    if ans:
        print(*ans, sep=' ')


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

n = int(input())
A = [list(map(int,input().split())) for _ in range(n)]
count=0
index=[0 for _ in range(n)]
match=0
max_match=n*(n-1)//2
flag=True
while(match!=max_match):
    s=set()
    for i in range(1,n+1):
        if index[i-1]!=n-1 and (not {i,A[i-1][index[i-1]]}&s):
            j = A[i-1][index[i-1]]
            if i==A[j-1][index[j-1]]:
                match+=1
                s|={i,j}
                index[i-1]+=1
                index[j-1]+=1
    if not s:
        flag = False
        break
    count+=1
print(count if flag else -1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from itertools import product
    n=int(input())
    match=[[0]*n for _ in range(n)]
    V=0 # V=n(n-1)/2
    for i,j in product(range(n),repeat=2):
        if(i>=j): continue
        match[i][j]=V
        V+=1

    def toID(i,j):
        if(i>j): i,j=j,i
        return match[i][j]

    E=[[] for _ in range(V)]
    for i in range(n):
        A=list(map(lambda x:int(x)-1,input().split()))
        for j in range(1,n-1):
            E[toID(i,A[j-1])].append(toID(i,A[j]))
    # あとは頂点VのグラフをdfsしてLongest pathの長さを求める
    # -1: unchecked, -2: checked and uncalculated
    dp=[-1]*V
    flag=True
    def dfs(v):
        global flag
        dp[v]=-2
        length=0
        for nv in E[v]:
            if(dp[nv]==-2):
                print(-1)
                exit()
            if(dp[nv]==-1):
                dfs(nv)
            length=max(length,dp[nv]+1)
        dp[v]=length
    # calculate
    for i in range(V): dfs(i)
    print(max(dp)+1 if(flag) else -1)
resolve()
### BUGGY CODE ###

from sys import stdin
 
def main():
    n = int(input())
    l = list(map(int, input().split()))
    l.sort()
    # print(l)
    ans = 0
    for i in range(len(l)-2):
        first = l[i]
        for j in range(i + 2, len(l)):
            second = l[j]
            s = i + 1
            e = j 
            # print("start",s, e)
            while(True):
                mid = int((s + e) / 2)
                # print("S",s, e, mid)
                
                if s == e:
                    break
                else:
                    if second >= first + l[mid]:
                        if s == mid:
                            s = e
                        else:
                            s = mid
                    else:
                        e = mid
            # print(s)
            ans += j - s
            # print("ans", ans)
    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

from sys import stdin
 
def main():
    n = int(input())
    l = list(map(int, input().split()))
    l.sort()
    # print(l)
    ans = 0
    for i in range(len(l)-2):
        first = l[i]
        for j in range(i + 2, len(l)):
            second = l[j]
            s = i + 1
            e = j 
            # print("start",s, e)
            while(True):
                mid = int((s + e) / 2)
                # print("S",s, e, mid)
                
                if s == e:
                    break
                else:
                    if second >= first + l[mid]:
                        if s == mid:
                            s = e
                        else:
                            s = mid
                    else:
                        e = mid
            # print(s)
            ans += j - s
            # print("ans", ans)
    print(ans)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
for i in range(q):
    l,r=map(int,input().split())
    t=s[l-1:r]
    print(t.count('AC'))
    


### FIXED CODE ###

n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n):
  t[i+1]=t[i]+(1 if s[i:i+2]=='AC' else 0)
for j in range(q):
  l,r=map(int,input().split())
  print(t[r-1]-t[l-1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

h, w, m = map(int,input().split())

row = [0]*h
col = [0]*w
enemy = []

for i in range(m):
    hh, ww = map(lambda x:int(x)-1,input().split())
    row[hh] += 1
    col[ww] += 1
    enemy.append((hh,ww))

enemy = set(enemy)
rmax = max(row)
cmax = max(col)

rind = [i for i,v in enumerate(row) if v == rmax]
cind = [i for i,v in enumerate(col) if v == cmax]

ans = 0
for r in rind:
    for c in cind:
        if (r, c) in enemy:
            ans = max(ans, rmax+cmax-1)
        else:
            ans = max(ans, rmax+cmax)
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

h, w, m = map(int,input().split())

row = [0]*h
col = [0]*w
enemy = []

for i in range(m):
    hh, ww = map(lambda x:int(x)-1,input().split())
    row[hh] += 1
    col[ww] += 1
    enemy.append((hh,ww))

enemy = set(enemy)
rmax = max(row)
cmax = max(col)

on_r = row.count(rmax)
on_c = col.count(cmax)

on = 0
for hh, ww in enemy:
    if row[hh] == rmax and col[ww] == cmax:
        on += 1
if on == on_r*on_c:
    print(rmax+cmax-1)
else:
    print(rmax+cmax)
### BUGGY CODE ###

n, m = map(int, input().split())
s = input()
dp = [[-1, float("inf")] for _i in range(n+1)]
dp[0] = [0,0]
for i in range(1, n+1):
    if i <= m:
        if s[i]=="0":
            dp[i] = [0, 1]
        continue
    for j in range(max(0,i-m), i):
        if s[j]=="0" and dp[j][0] >= 0:
            if dp[i][1] > dp[j][1]+1:
                dp[i][0] = j
                dp[i][1] = dp[j][1] + 1 
            elif dp[i][1] == dp[j][1]+1:
                dp[i][0] = min(dp[i][0], j)

if dp[n][0] >= 0:
    r = []
    p = n
    while p > 0:
        nex = dp[p][0]
        r.append(p-nex)
        p = nex
    print(*r[::-1])
else:
    print(-1)

### FIXED CODE ###

n, m = map(int, input().split())
s = input()
dp = [-1 for _i in range(n+1)]
dp[0] = 0
f = 0
from collections import deque
q = deque([0])
c = 0
for i in range(1, n+1):
    if s[i]=="0":
        c = 0
        while i-f > m:
            f = q.popleft()
        dp[i] = f
        q.append(i)
    else:
        c += 1
        if c >= m:
            break

if dp[n] >= 0:
    r = []
    p = n
    while p > 0:
        nex = dp[p]
        r.append(p-nex)
        p = nex
    print(*r[::-1])
else:
    print(-1)
### BUGGY CODE ###

N=int(input())
ans=1
for i in range(1,N+1):
    ans*=i
print(ans%(10**9+7))

### FIXED CODE ###

N=int(input())
ans=1
for i in range(1,N+1):
    ans*=i
    ans%=(10**9+7)
print(ans)
### BUGGY CODE ###

n,w=map(int,input().split())
u,m=[list(map(int,input().split()))for _ in range(n)],0
for i in u:m+=i[1]
dp=[[0]+[10000001]*m]+[[0]*(m+1)for _ in range(n)]
h=0
for i in range(1,n+1):
  a,b=map(int,u[i-1])
  for j in range(1,m+1):
    if j>=b:dp[i][j]=min(dp[i-1][j],dp[i-1][j-b]+a)
    else:dp[i][j]=dp[i-1][j]
a=0
for i in range(m+1):
  if dp[-1][i]<=w:a=max(a,i)
print(a)

### FIXED CODE ###

n,w=map(int,input().split())
dp=[[100000000001]*100001for _ in range(n+1)]
dp[0][0]=0
for i in range(1,n+1):
  a,b=map(int,input().split())
  for j in range(100001):
    if j>=b:dp[i][j]=min(dp[i-1][j],dp[i-1][j-b]+a)
    else:dp[i][j]=dp[i-1][j]
i=10**5
while dp[n][i]>w:i-=1
print(i)
### BUGGY CODE ###

K = int(input())

total = 0
# 3つ同じ
for i in range(K):
  total += i+1

# 2つ同じ
total += 6*(K-1)
for i in range(1,K-1):
  for j in range(i+1,K):
    tmp = 0
    for k in range(1,i+2):
      if (i+1)%k == 0 and (j+1)%k == 0:
        tmp = k
    total += tmp*6

# バラバラ
total += int(6*(K-1)*(K-2)/2)
for i in range(1,K-2):
  for j in range(i+1,K-1):
    for k in range(j+1,K):
      if (j+1)%(i+1) == 0 and (k+1)%(i+1) == 0:
        total += (i+1)*6
      else:
        tmp = 0
        for l in range(1,i+1):
          if (i+1)%l == 0 and (j+1)%l == 0 and (k+1)%l == 0:
            tmp = l
        total += tmp*6
print(total)
  


### FIXED CODE ###

K = int(input())

total = 0
for i in range(1,K+1,1):
  for j in range(1,K+1,1):
    tmp1 = i
    tmp2 = j
    while tmp1 % tmp2 != 0:
      tmp = tmp1 % tmp2
      tmp1 = tmp2
      tmp2 = tmp
    for k in range(1,K+1,1):
      tmp1 = k
      tmp3 = tmp2
      while tmp1 % tmp3 != 0:
        tmp = tmp1 % tmp3
        tmp1 = tmp3
        tmp3 = tmp
      total += tmp3
print(total)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

N = int(input())
u = []
v = []
w = []
for _ in range(N-1):
	tu, tv, tw = map(int ,input().split())
	u.append(tu)
	v.append(tv)
	w.append(tw)

inf = float("inf")
E = [[inf for _ in range(N+1)] for _ in range(N+1)]
for i in range(N-1):
	t = w[i] % 2
	E[u[i]][v[i]] = t
	E[v[i]][u[i]] = t

flg = [inf for _ in range(N+1)]
flg[0] = 0

def dfs(q):
	cp = q.pop()
	next = [i for i in range(1,N+1) if E[cp][i] != inf]

	for np in next:
		if flg[np] == inf:
			if E[cp][np] == 0:
				flg[np] = flg[cp]
			else:
				flg[np] = flg[cp] * (-1)

			q.append(np)
	if len(q) == 0:
		return

	dfs(q)

flg[1] = 1
dfs([1])

for i in range(1,N+1):
	if flg[i] == 1:
		print(1)
	else:
		print(0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

N = int(input())
u = []
v = []
w = []
for _ in range(N-1):
	tu, tv, tw = map(int ,input().split())
	u.append(tu)
	v.append(tv)
	w.append(tw)

inf = float("inf")
E = [[] for _ in range(N+1)]
for i in range(N-1):
	if w[i] % 2 == 0:
		E[u[i]].append(v[i])
		E[v[i]].append(u[i])
	else:
		E[u[i]].append(v[i] * (-1))
		E[v[i]].append(u[i] * (-1))

flg = [inf for _ in range(N+1)]
flg[0] = 0

def dfs(q):
	cp = q.pop()
	next = E[cp]

	for np in next:
		if flg[abs(np)] == inf:
			if np > 0:
				flg[abs(np)] = flg[cp]
			else:
				flg[abs(np)] = flg[cp] * (-1)
			q.append(abs(np))

	if len(q) == 0:
		return

	dfs(q)

flg[1] = 1
dfs([1])

for i in range(1,N+1):
	if flg[i] == 1:
		print(1)
	else:
		print(0)
### BUGGY CODE ###

N = int(input())
ans=1
for i in range(1,N+1):
    ans *= i
print(ans%(10**9+7))

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    ans=1
    for i in range(1,N+1):
        ans = ans%(10**9+7) * i%(10**9+7)
        
    print(ans%(10**9+7))

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

d=[0]*13
d[0]=1
mul=1
mulmod=1
t=list(input())
t.reverse()
zero=[0]*13
for c in t:
    e=zero[:]

    for i in (range(10) if c=="?" else[int(c)]):
        for j in range(13):
            #e[(i*mul+j)%13]+=d[j]
            e[(i*mulmod+j)%13]+=d[j]
            
    d=[e%(10**9+7)for e in e]
    mul*=10
    mulmod=mul%13
print(d[5])



### FIXED CODE ###

# coding: utf-8
# Your code here!
 
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意
 
s = input()
l = len(s)
MOD = 10**9+7
 
dp = [0]*13
dp[0] = 1
for i in s:
    new = [0]*13
    if i == "?":
        for i in range(10):
            for j in range(13):
                new[(10*j+i)%13] += dp[j]
    else:
        i = int(i)
        for j in range(13):
            new[(i+10*j)%13] += dp[j]
    
    for i in range(13):
        new[i] %= MOD
    dp,new = new,dp
#    print(dp)
 
print(dp[5]%MOD)
### BUGGY CODE ###

import math
k = int(input())
ans = 0
t = 0
for i1 in range(1, k+1):
    for i2 in range(1, k+1):
        for i3 in range(1, k+1):
            ans = math.gcd(i1, i2)
            ans = math.gcd(ans, i3)
            t+=ans
print(t)


### FIXED CODE ###

from math import gcd
k = int(input())
ans = 0
t = 0
for i1 in range(1, k+1):
    for i2 in range(1, k+1):
        for i3 in range(1, k+1):
            t += gcd(gcd(i1, i2), i3)
print(t)
### BUGGY CODE ###

K, S = map(int,input().split())

count = 0
for x,y,z in [(x,y,z) for x in range(0,K + 1) for y in range(0,K + 1) for z in range(0,K + 1)]:
    if x + y + z == S:
        count += 1

print(count)

### FIXED CODE ###

import itertools
    
K, S = map(int,input().split())

count = 0
for x,y in itertools.product(range(0,K + 1),range(0,K + 1)):
    z = S - x - y
    if 0 <= z <= K:
        count += 1

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

N=int(input())
mod=998244353

FACT=[1]
for i in range(1,N+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(N,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod

SC=0
for i in range(N//2+1,N+1):
    SC+=Combi(N,i)*pow(2,N-i,mod)

print((pow(3,N,mod)-SC*2)%mod)

### FIXED CODE ###

N=int(input())
mod=998244353

FACT=[1]
for i in range(1,N+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(N,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

POW=[1]
for i in range(N):
    POW.append(POW[-1]*2%mod)

def Combi(a,b):
    return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod

SC=0
for i in range(N//2+1,N+1):
    SC+=Combi(N,i)*POW[N-i]

print((pow(3,N,mod)-SC*2)%mod)
### BUGGY CODE ###

def judgePrime(n):
  result = True
  for i in xrange(2, int(round(n))):
    if n % i == 0:
      result = False
      break
  return result

def getPrimeNumFromList(list):
  count = 0
  for i in xrange(len(list)):
    target = 0
    if i == 0:
      target = list[0]
      if judgePrime(target):
        count += 1
      else:
        pass

  return count

n = int(raw_input())
list = []
for i in xrange(n):
  list.append(int(raw_input()))
list.sort()

count = 0
for i in xrange(n):
  if judgePrime(list[i]):
    count += 1
print count

# print judgePrime(list[len(list) - 1])

### FIXED CODE ###

import pdb

n = int(raw_input())
count = 0
for x in xrange(n):
  target = int(raw_input())
  # pdb.set_trace()
  if target == 2:
    count += 1
  elif target < 3 or not target & 1:
    continue
  else:
    if pow(2, target - 1, target) == 1:
      count += 1

print count
### BUGGY CODE ###

s = input()
ans = 0
for i in range(len(s) - 3):
  for j in range(i + 3, len(s) + 1):
    if int(s[i : j]) % 2019 == 0:
      ans += 1
print(ans)

### FIXED CODE ###

s = input()[::-1]
current = 0
a = [0] * 2019
a[0] = 1
digit = 1
for i in s:
  current += int(i) * digit
  digit *= 10
  digit %= 2019
  current %= 2019
  a[current] += 1
ans = 0
for i in a:
  ans += i * (i - 1) // 2
print(ans)
### BUGGY CODE ###

n = int(input())
xs = list(map(int, input().split()))
ans = -100000000000000000000000000000000000000
for i in range(n+1):
    head = sorted(xs[:n+i])
    tail = sorted(xs[n+i:])
    ans = max(ans, sum(head[-n:])-sum(tail[:n]))
print(ans)

### FIXED CODE ###

import heapq
n = int(input())
xs = list(map(int, input().split()))
head = [(x, x) for x in xs[:n]]
heapq.heapify(head)
body = xs[n:-n]
tail = [(-x, x) for x in xs[-n:]]
heapq.heapify(tail)

def f(heap, body, sign, initial):
    answer = [initial]
    acc = initial
    for b in body:
        heapq.heappush(heap, (sign*b, b))
        _, x = heapq.heappop(heap)
        acc = acc + b - x
        answer.append(acc)
    return answer
 
print(max(x - y for x, y in zip(
    f(head, body, 1, sum(xs[:n])),
    f(tail, body[::-1], -1, sum(xs[-n:]))[::-1])))
### BUGGY CODE ###

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

for _ in range(m):
    b, c = map(int, input().split())
    a += [c]*b
a = sorted(a)

print(sum(a[-n:]))


### FIXED CODE ###

n, m = map(int, input().split())
a = [(1, int(x)) for x in input().split()]

for _ in range(m):
    b, c = map(int, input().split())
    a += [(b, c)]

from operator import itemgetter
a = sorted(a, key=itemgetter(1))

ans = 0
t = 0
while n-t > 0:
    (k, x) = a.pop()
    ans += x * min(k, n-t)
    t += k

print(ans)
### BUGGY CODE ###

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

for i in range(k):
  b=[0]*n
  if min(a)>=n:
    for j in range(n):
      a[j]+=k-i      
  for j in range(n):
    for m in range(j-a[j],j+a[j]+1):
      if 0<=m<=n-1:
        b[m]=b[m]+1
  a=b
for i in a:
  print(i,end=' ')

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
for _ in range(min(k,41)):
  b=[0]*(n+1)
  for i in range(n):
    l=max(0,i-a[i])
    r=min(n,i+a[i]+1)
    b[l]+=1
    b[r]-=1
  for i in range(n-1):
    b[i+1]+=b[i]
  a=b[:n]
print(*a)
### BUGGY CODE ###

K, S = map(int, input().split())

count = 0

for z in range(K, -1, -1):
    for y in range(K, -1, -1):
        for x in range(K, -1, -1):
            if x + y + z == S:
                count += 1

print(count)

### FIXED CODE ###

K, S = map(int, input().split())

count = 0

for z in range(K, -1, -1):
    for y in range(K, -1, -1):
        x = S - z - y
        if z >= y and y >= x and x >= 0:
            if x == y == z:
                count += 1
            elif (x == y and y != z) or (y == z and z != x):
                count += 3
            else:
                count += 6

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

N, K = map(int, input().split())
A = [int(i) for i in input().split()]

ans = A
for k in range(K):
    temp = [0 for _ in range(N)]
    for i in range(N):
        a = ans[i]
        temp[max(i-a, 0)] += 1
        if i + a + 1 < N:
            temp[i+a+1] -= 1

    ans[0] = temp[0]
    for j in range(1, N):
        ans[j] = ans[j-1] + temp[j]

for i in range(N):
    print(ans[i], end=" ")

### FIXED CODE ###

N, K = map(int, input().split())
A = [int(i) for i in input().split()]

ans = A
for k in range(K):
    temp = [0 for _ in range(N)]
    for i in range(N):
        a = ans[i]
        temp[max(i-a, 0)] += 1
        if i + a + 1 < N:
            temp[i+a+1] -= 1

    ans[0] = temp[0]
    for j in range(1, N):
        ans[j] = ans[j-1] + temp[j]

    if ans.count(N) == N:
        break

for i in range(N):
    print(ans[i], end=" ")