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

from itertools import accumulate

N = int(input())
S = input()

R = [0] + list(accumulate(int(s == "R") for s in S))
G = [0] + list(accumulate(int(s == "G") for s in S))
B = [0] + list(accumulate(int(s == "B") for s in S))

memo = {"R": R, "G": G, "B": B}

ans = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        if S[i] == S[j]:
            continue

        color = "RGB".replace(S[i], "").replace(S[j], "")
        C = memo[color]

        d = j - i
        x = N - j
        if d < x and S[j + d] == color:
            ans += C[N] - C[j] - 1
        else:
            ans += C[N] - C[j]

print(ans)

### FIXED CODE ###

N = int(input())
S = input()

cand = ["RGB", "RBG", "GRB", "GBR", "BRG", "BGR"]

ans = S.count("R") * S.count("G") * S.count("B")
for i in range(N - 2):
    for d in range(1, (N - i + 1) // 2):
        if S[i:i + 2 * d + 1:d] in cand:
            ans -= 1

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

S = input()

d = [i*10%13 for i in range(13)]

if S[0]=="?":
  res=[[1,1,1,1,1,1,1,1,1,1,0,0,0]]
else:
  res=[[0 if i!=int(S[0]) else 1 for i in range(13) ]]

for i in range(1,len(S)): #N
  res.append([0 for i in range(13)])
  if S[i]=="?":
    for j in range(13): #N*13
      for k in range(10): #N*13*10
        res[i][(d[j]+k)%13]+=res[i-1][j]
  else:
    for j in range(13):
      res[i][(d[j]+int(S[i]))%13]+=res[i-1][j]
      
print(res[len(S)-1][5]%(10**9+7))

### FIXED CODE ###

import sys
read=sys.stdin.buffer.read
readline=sys.stdin.buffer.readline
readlines=sys.stdin.buffer.readlines

MOD=10**9+7

S=read().rstrip().decode("utf-8")
#print("S:",S)

R=[0]*13
R_buffer=[0]*13

if S[0]=="?":
  for i in range(0,10):
    R[i]=1
else:
  R[int(S[0])]=1
#print("R:",R)

for i in range(1,len(S)):
  
  if S[i]=="?":
    for j in range(13):
      for k in range(10):
        R_buffer[(j*10+k)%13]+=R[j]
  else:
    for j in range(13):
      R_buffer[(j*10+int(S[i]))%13]+=R[j]
  
  for j in range(13):
    R[j]=R_buffer[j]%MOD
    R_buffer[j]=0
  #print("R:",R)
  
print(R[5])
### BUGGY CODE ###

N = int(input())
max = 0

for i in range(N):
    max += i

print(max)


### FIXED CODE ###

N = int(input())
max = 0


print((N-1)*N//2)
### BUGGY CODE ###

r,g,b,n = map(int,input().split())
cnt = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        c = n - i * r - j * g
        if c >= 0 and c % b == 0:
             cnt += 1
print(cnt)

### FIXED CODE ###

r,g,b,n = map(int,input().split(" "))
cnt = 0
for i in range(n // r + 1):
    for j in range(n // g + 1):
        c = n - i * r - j * g
        if c < 0:
            break
        if c % b == 0:
             cnt += 1
print(cnt)
### BUGGY CODE ###

from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N = int(input())
A = [0]*N
for i in range(N):
    A[i] = int(input())

for i in range(N):
    B = A[:]
    B.pop(i)
    print(max(B))


### FIXED CODE ###

from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

N = int(input())
A = [0]*N
for i in range(N):
    A[i] = int(input())

SortedA = sorted(A)
A_first = SortedA[N-1]
A_second = SortedA[N-2]

for i in range(N):
    if A[i] == A_first:
        print(A_second)
    else:
        print(A_first)
### BUGGY CODE ###

# coding: utf-8
N = int(input())
A = list(map(int, input().split()))

dict = {}
for i in range(N):
  if A[i] in dict.keys():
    dict[A[i]] += 1
  else:
    dict[A[i]] = 1

fact = []

fact.append(1)
for i in range(1, N):
  fact.append(fact[i-1] * i)
  
for i in range(N):
  ret = 0
  for key in dict.keys():
    val = dict[key]
    if key == A[i]:
      val -= 1
    if val < 2:
      continue
    ret += int(fact[val]/fact[val-2]/fact[2])
  print(ret)

### FIXED CODE ###

# coding: utf-8
N = int(input())
A = list(map(int, input().split()))

dict = {}
for i in range(N):
  if A[i] in dict.keys():
    dict[A[i]] += 1
  else:
    dict[A[i]] = 1

def comb(n):
  if n<2:
    return 0
  return int(n * (n - 1) / 2)

# all
ret = 0
for key in dict.keys():
  val = dict[key]
  ret += comb(val)

# i >= 0
for i in range(N):
  val_n = dict[A[i]]
  next_ret = ret - comb(val_n) + comb(val_n - 1)
  print(next_ret)
### BUGGY CODE ###

N=int(input())
A=(int(i) for i in input().split())

C=[0 for i in range(1000000000)]

for i in A:
  C[i]+=1

print(C)

### FIXED CODE ###

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

A.sort(reverse=True)

x=0
y=0
for i in range(N-1):
      if A[0]==A[1]:
          x=A[0]
          A.remove(x)
          A.remove(x)
          break
      else:
          A.remove(A[0])
if len(A)>=2:
    for i in range(len(A)-1):
        if A[0]==A[1]:
            y=A[0]
            break
        else:
            A.remove(A[0])

print(x*y)
### BUGGY CODE ###

n = int(input())
p = list(map(int,input().split()))

def smaller(x, y):
    if x>y:
        return y
    else:
        return x

def minimum(score):
    m = score[0]
    for i in range(1, len(score)):
        m = smaller(m, score[i])
    return m

count = 1
for i in range(1, n):
  if p[i]==minimum(p[0:i+1]):
    count = count + 1
print(count)

### FIXED CODE ###

n = int(input())
p = list(map(int,input().split()))

m=2*(10**5)+1
count = 0
for i in range(0, n):
  if p[i] <= m:
    m = p[i]
    count = count + 1

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

mod = 10**9 + 7

def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = (K * x) % mod 
            x = (x ** 2) % mod
            n = (n - 1) // 2
        else:
            x = (x ** 2) % mod
            n = n // 2

    return (K * x) % mod # 指数を割り続け n が 1 に至ったら終了

N = int(input())
A = list(map(int,input().split()))
cnt_1 = [0]*61
for i in range(N):
    A_tmp = A[i]
    for j in range(61):
        if (A_tmp >> j & 1):
            cnt_1[j] += 1
ans = 0
for i in range(61):
    ans += (cnt_1[i]*(N - cnt_1[i]) * pow_k(2,i)) % mod
print(ans % mod)

### FIXED CODE ###

import numpy as np
mod = 10**9+7
N = int(input())
A = list(map(int,input().split()))
A = np.array(A, dtype = np.int64)
tmp = 0
for i in range(61):
    tmp_1 = np.count_nonzero(A & 1)
    tmp += ((tmp_1)*(N - tmp_1)*(2**i)) % mod
    A = A >> 1
print(tmp % mod)
### BUGGY CODE ###

N = int(input())
A = list(int(i) for i in input().split())

A.sort()


if((A[1] - A[0]) == 0):
    min_HP = A[0]
    print(min_HP)
else:
    min_HP = A[1] - A[0]
    while((A[1] - A[0]) > 0):
        A.insert(0, A[1] - A[0])
        A.sort()
        if((A[1] - A[0]) == 0):
            break
        min_HP = A[1] - A[0]

    # そのループでまだmin_HPが更新されていない
    min_flag = False
    while(True):
        for a in A:
            if ((a % min_HP) < min_HP and (a % min_HP) > 0):
                min_HP = a % min_HP
                min_flag = True
        if( min_HP > 0 and min_flag ):
            continue
        else:
            break
    print(min_HP)

### FIXED CODE ###

N = int(input())
A = list(int(i) for i in input().split())

A.sort()


if((A[1] - A[0]) == 0):
    min_HP = A[0]
    print(min_HP)
else:
    min_HP = A[1] - A[0]
    while((A[1] - A[0]) > 0):
        A.insert(0, A[1] - A[0])
        A.sort()
        if((A[1] - A[0]) == 0):
            break
        min_HP = A[1] - A[0]

    # そのループでまだmin_HPが更新されていない
    while(True):
        min_flag = False
        for a in A:
            if ((a % min_HP) < min_HP and (a % min_HP) > 0):
                min_HP = a % min_HP
                min_flag = True
        if( min_HP > 0 and min_flag ):
            continue
        else:
            break
    print(min_HP)
### BUGGY CODE ###

x,y,z,k = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

ab = []
for a_ in a:
    for b_ in b:
        ab.append(a_+b_)

res = []
for ab_ in sorted(ab, reverse=True)[:k]:
    for c_ in sorted(c, reverse=True)[:k]:
        res.append(ab_+c_)

for x in sorted(res, reverse=True)[:k]:
    print(x)

### FIXED CODE ###

x,y,z,k = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

ab = []
for a_ in a:
    for b_ in b:
        ab.append(a_+b_)

res = []
for ab_ in sorted(ab, reverse=True)[:k]:
    for c_ in sorted(c, reverse=True)[:k]:
        res.append(ab_+c_)

for x in sorted(res, reverse=True)[:k]:
    print(x)
### BUGGY CODE ###

def main():
    def pre(n,mod):
        an=[1]*(n+1)
        a=1
        for i in range(1,n+1):
            a=(a*i)%mod
            an[i]=a
        b=pow(a,mod-2,mod)
        bs=[1]*(n+1)
        bs[n]=b
        for i in range(n,1,-1):
            b=b*i%mod
            bs[i-1]=b
        return an,bs

    n,k=map(int,input().split())
    a=sorted(list(map(int,input().split())))
    mod=10**9+7
    an,bs=pre(n,mod)
    ans=0
    for i in range(k,n+1):
        c=(an[i-2]*bs[k-2]*bs[i-k])%mod
        for j in range(0,n-i+1):
            ans=(ans+(a[i+j-1]-a[j])*c)%mod
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n,k=map(int,input().split())
    a=sorted(list(map(int,input().split())))
    mod=10**9+7
    ans=0
    for i in range(k-1,n):
        if i==k-1:
            c=1
        else:
            c=(c*i*pow(i-k+1,mod-2,mod))%mod
        ans+=(a[i]-a[n-i-1])*c
        ans%=mod
    print(ans)

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

while True:
    n=input()
    if n==0:
        break
    dp=[[0 for i in range(n)]for j in range(n)]
    flag0=0
    for i in range(n):
        j=0
        for c in raw_input():
            if c == ".":
                flag0=1
                dp[i][j]=1
            j+=1
    if flag0==0:
        print 0
    else:
        solve=1
        while True:
            flag=0
            for y in range(n-1):
                for x in range(n-1):
                    if dp[y][x]!=0:
                        old=dp[y][x]
                        dp[y][x]=min(dp[y+1][x],dp[y][x+1],dp[y+1][x+1])+1
                        if old!=dp[y][x]:
                            flag=1
            if flag==0:
                break
            solve+=1
        print solve

### FIXED CODE ###

while True:
    n=input()
    if n==0:
        break
    dp=[[0 for i in range(n+1)]for j in range(n+1)]
    for i in range(1,n+1):
        j=0
        line=" "+raw_input()
        for c in line:
            if c == ".":
                dp[i][j]=min(dp[i-1][j],dp[i][j-1],dp[i-1][j-1])+1
            j+=1
    allmax=0
    for i in range(n+1):
        if allmax<max(dp[i]):
            allmax=max(dp[i])
    print allmax
### BUGGY CODE ###

N, Q = map(int,input().split())
S = list(input())
TD = [input().split() for _ in range(Q)]
TD = [[t,d] for t, d in TD if t in S]

res = [1]*N
for t, d in TD:
  for i in range(N):
    if res[i] == 0:
      continue
    if t == S[i]:
      if d == "L":
        if i == 0:
          res[i] = 0
          break
        res[i-1] += res[i]
        res[i] = 0
      else:
        if i == N-1:
          res[i] = 0
          break
        res[i+1] += res[i]
        res[i] = 0
print(sum(res))

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, Q = map(int,input().split())
S = "0"+input()+"0"
TD = [input().rstrip().split() for _ in range(Q)]
l, r = 0, N+1
for t, d in TD[::-1]:
  if t == S[l] and d == "R":
    l -= 1
  elif t == S[l+1] and d == "L":
    l += 1
  if t == S[r] and d == "L":
    r += 1
  elif t == S[r-1] and d == "R":
    r -= 1
print(max(0, r-l-1))
### BUGGY CODE ###

import bisect
N = int(input())
a = list(map(int, input().split()))
b = [0] * (N + 1)
for i in range(N):
    b[a[i]] = i + 1
c = [0, N + 1]
ans = 0
for i in range(1, N + 1):
    m = b[i]
    x = bisect.bisect(c, m)
    y = c[x - 1]
    z = c[x]
    ans += (((z - y) * (z - y - 1) - (m - y) * (m - y - 1) - (z - m) * (z - m - 1)) // 2) * i
    bisect.insort(c, m)
print(ans)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
b = [0] * (N + 1)
for i in range(N):
    b[a[i]] = i + 1
l = [i for i in range(N + 2)]
r = [i for i in range(N + 2)]
ans = 0
for i in range(N, 0, -1):
    m = b[i]
    x = l[m]
    y = r[m]
    ans += (m - x + 1) * (y - m + 1) * i
    r[x - 1] = y
    l[y + 1] = x
print(ans)
### BUGGY CODE ###

import itertools

n = int(input())
lst = list(map(int, input().split()))

lst_accum = list(itertools.accumulate(lst))

def shaku(lst_accum, first):
    all_sum = lst_accum[-1]
    min_diff = 10**100
    for k in range(len(lst_accum)-1):
        diff = abs(all_sum - 2*lst_accum[k] + first)
        if min_diff > diff:
            index = k
            min_diff = diff
            P = lst_accum[k] - first
    return P, all_sum - P - first

min_diff = 10**100
for k in range(1, len(lst_accum)-2):
    lst_first = lst_accum[:k+1]
    lst_second = lst_accum[k+1:]
    #print('length_first: ', len(lst_first))
    P, Q = shaku(lst_first, 0)
    #print('length_second: ', len(lst_second))
    R, S = shaku(lst_second, lst_accum[k])
    min_diff = min(min_diff, max(P, Q, R, S) - min(P, Q, R, S))
print(min_diff)

### FIXED CODE ###

import itertools

n = int(input())
lst = list(map(int, input().split()))

lst_accum = list(itertools.accumulate(lst))

min_diff = 10**100
first_cut = 0
third_cut = 2
all_sum = lst_accum[-1]
for k in range(1, len(lst_accum)-2):
    second_last = lst_accum[k]
    P = lst_accum[first_cut]
    Q = second_last - P
    diff = abs(P-Q)
    while k - first_cut > 1 and diff > abs(second_last - lst_accum[first_cut+1]*2):
        first_cut += 1
        P = lst_accum[first_cut]
        Q = second_last - P
        diff = abs(P-Q)    
    
    if third_cut == k:
        third_cut += 1
    third_last = lst_accum[third_cut]
    S = all_sum - third_last
    R = third_last - second_last
    diff = abs(S-R)
    while (n-1) - third_cut > 1 and diff > abs(all_sum - lst_accum[third_cut+1]*2 + second_last):
        third_cut += 1
        third_last = lst_accum[third_cut]
        S = all_sum - third_last
        R = third_last - second_last
        diff = abs(S-R)
    
    #print(first_cut, k, third_cut)
    min_diff = min(min_diff, max(P,Q,R,S) - min(P,Q,R,S))
    #print(min_diff)
    

print(min_diff)
### BUGGY CODE ###

from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
alrdy = []
 
def is_anagrams(word1, word2):
    def get_counter(s):
        return Counter(s.upper().replace(' ', ''))
 
    return get_counter(word1) == get_counter(word2)

cnt = 0
for i in range(n):
  for j in range(n):
    if i == j:
      continue
    if is_anagrams(s[i], s[j]):
      cnt += 1
print(cnt//2)

### FIXED CODE ###

n = int(input())
s = [input() for _ in range(n)]
existed = {}
cnt = 0
for i in range(n):
  sorted_s = ''.join(sorted(s[i]))
  if sorted_s in existed:
    cnt += existed[sorted_s]
    existed[sorted_s] += 1
  else:
    existed[sorted_s] = 1
print(cnt)
### BUGGY CODE ###

import copy
S = sorted(list(input()))
T = sorted(list(input()))

tmp = copy.copy(S)
for i in tmp:
    if i in T:
        S.remove(i)
        T.remove(i)
if len(set(S)) == len(set(T)):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

from collections import Counter
S = sorted(list(input()))
T = sorted(list(input()))

if Counter(Counter(S).values()) == Counter(Counter(T).values()):
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

import math
x = int(input())

a = math.floor(x**(1/5))
while True:
    b = (x-a**5)**(1/5)
    if b % 1 == 0:
        print(a, -int(b))
        break
    a -= 1

### FIXED CODE ###

x = int(input())

for i in range(-200, 200):
    k = i**5
    for j in range(-200, 200):
        if k - j**5 == x:
            print(i, j)
            exit()
### BUGGY CODE ###

n, k = map(int, input().split())
mod = 10**9 + 7

if n + 1 == k:
    print(1)
    exit()

n_list = [i for i in range(n+1)]
ans = 0
for i in range(k, n+2): 
    min_num = sum(n_list[:i])
    max_num = sum(n_list[-i:])
    ans += (max_num - min_num + 1)
print(ans % mod)

### FIXED CODE ###

n, k = map(int, input().split())
mod = 10**9 + 7

ans = 0
for i in range(k, n+2): 
    a = 0.5 * i * (i - 1)
    b = 0.5 * i * (2 * n - i + 1)
    ans += (b - a + 1)
print(int(ans % mod))
### BUGGY CODE ###

import os
N, P = map(int, input().split())

if N == 1:
    print(P)
    os.sys.exit()
i = 2
ans = 1
while True:
    if i**N > P:
        break
    if P % i**N == 0:
        P /= i**N
        ans *= i
    else:
        i += 1

print(ans)

### FIXED CODE ###

import os
N, P = map(int, input().split())

def trial_division(n):
    if n < 2:
        return []
    prime_factors = []
    for p in range(2, int( n**0.5)):
        if p*p > n: break
        cnt = 0
        while n % p == 0:
            cnt += 1
            n //= p
        prime_factors.append([p, cnt])
    if n > 1:
        prime_factors.append([n, 1])
    return prime_factors

prime_factors = trial_division(P)
ans = 1
for p in prime_factors:
    if p[1] >= N:
        ans *= p[0]**(p[1] // N)
print(ans)
### BUGGY CODE ###

import copy
import fractions
#from functools import reduce

n=int(input())
a1=[int(i) for i in input().split()]
#高階関数reduce
#def gcd_list(numbers):
#    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    nul = numbers[0]
    for i in range(1, len(numbers)):
        nul = fractions.gcd(nul, numbers[i])
    return nul

c=1

for i in range(n):
    a2=copy.deepcopy(a1)
    a2.pop(i)
    c=max([c,gcd_list(a2)])
print(c)


### FIXED CODE ###

import fractions
from functools import reduce

n=int(input())
a1=[int(i) for i in input().split()]
a2=[]
a3=[]
nul2 = a1[0]
nul3 = a1[-1]
a2.append(nul2)
a3.append(nul3)
#nが2以上?
for i in range(1,n-1):
    nul2=fractions.gcd(nul2,a1[i])
    nul3=fractions.gcd(nul3,a1[-i-1])
    a2.append(nul2)
    a3.append(nul3)
#print(a2)
#print(a3)
c=max([a2[-1],a3[-1]])
for i in range(n-2):
    d=fractions.gcd(a2[i],a3[-i-2])
    if d>c:
        c=d
print(c)
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# D-Grid and Integers

from collections import defaultdict

def ReadInput():
	return [int(i) for i in input().split(" ")]

(R, C) = ReadInput()
N = int(input())
RowIdx = set()
ColIdx = set()
CoverGrid = set()
Grid = defaultdict(list)
RowGrid = defaultdict(list)
ColGrid = defaultdict(list)
for i in range(N):
	(r, c, a) = ReadInput()
	RowGrid[r].append(c)
	ColGrid[c].append(r)
	Grid[(r, c)] = a
	RowIdx.add(r)
	ColIdx.add(c)	

for row in RowIdx:
	if (len(RowGrid[row]) == 1):
		continue
	TempRow = RowGrid[row]
	for pointer in TempRow:
		TempCol = TempRow.copy()
		TempCol.remove(pointer)
		for pair in TempCol:
			dif = Grid[(row, pointer)] - Grid[(row, pair)]
			ObjCol = ColGrid[pointer].copy()
			ObjCol.remove(row)
			for obj in ObjCol:
				val = Grid[(obj, pointer)]- dif 
				if (val < 0):
					print("No")
					exit()
				if ((obj, pair) in Grid):
					if (val != Grid[(obj, pair)]):
						print("No");
						exit()
					else:
						continue
				else:
					Grid[(obj, pair)] = val
					RowGrid[obj].append(pair)
					ColGrid[pair].append(obj)
print("Yes")


### FIXED CODE ###

from collections import defaultdict
import sys
sys.setrecursionlimit(10**6)

def ReadInput():
	return [int(i) for i in input().split(" ")]

(R, C) = ReadInput()
N = int(input())
VectorSet = set() 
Grid = defaultdict(list)
for i in range(N):
	(r, c, a) = ReadInput()
	Grid[("R", r)].append((("C", c), a))
	Grid[("C", c)].append((("R", r), a))
	VectorSet.add(("R", r))
	VectorSet.add(("C", c))

def iteration(vector):
	VectorSet.discard(vector)
	for (v, a) in Grid[vector]:
		temp = a - VectorCover[vector]
		if (v in VectorCover):
			if(temp != VectorCover[v]):
				print("No")
				exit()
		else:
			VectorCover[v] = temp
			iteration(v) 

while(len(VectorSet) != 0):
	vector = VectorSet.pop()
	VectorCover = dict() 
	VectorCover[vector] = 0
	iteration(vector)
	minR = min(a for (p, a) in VectorCover.items() if (p[0] == "R"))
	minC = min(a for (p, a) in VectorCover.items() if (p[0] == "C"))
	if (minR + minC < 0):
		print("No")
		exit()

print("Yes")
### BUGGY CODE ###

import math
n, k = map(int, input().split())
a_in = list(map(int, input().split()))

diff_list = [0 for num in range(n)]
diff_list[0] = a_in[0]
for i in range(1, n):
    diff_list[i] = a_in[i] - a_in[i-1]

itr = k
if k > 10*math.log(n):
    itr = int(10*math.log(n))
for i in range(itr):
    new_list = [0 for num in range(n)]
    d_sum = 0
    for j, d in enumerate(diff_list):
        d_sum += d
        if j-d_sum > 0:
            new_list[j-d_sum] += 1
        else:
            new_list[0] += 1
        if d_sum+j+1 < n:
            new_list[j+d_sum+1] -= 1
    # print(new_list)
    diff_list = new_list.copy()

ans = 0
for d in diff_list:
    ans += d
    print(ans, end= ' ')


### FIXED CODE ###

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

diff_list = [0 for num in range(n)]
diff_list[0] = a_in[0]
for i in range(1, n):
    diff_list[i] = a_in[i] - a_in[i-1]

itr = k
if k > 41:
    itr = 41
for i in range(itr):
    new_list = [0 for num in range(n)]
    d_sum = 0
    for j, d in enumerate(diff_list):
        d_sum += d
        if j-d_sum > 0:
            new_list[j-d_sum] += 1
        else:
            new_list[0] += 1
        if d_sum+j+1 < n:
            new_list[j+d_sum+1] -= 1
    # print(new_list)
    diff_list = new_list.copy()

ans = 0
for d in diff_list:
    ans += d
    print(ans, end= ' ')
### BUGGY CODE ###

# エラトステネスの篩を使う！O(nloglogn)
N = int(input())
A = list(map(int,input().split()))

listA = [0] * (10**6+100)
ans = 0
for i in A:
    for j in range(i,10**6+100,i):
        if listA[j] != 0:
            listA[j] = 2
            continue
        else:
            listA[j] += 1

for i in A:
    if listA[i] == 1:
        ans += 1

print(ans)


### FIXED CODE ###

# エラトステネスの篩を使う！O(nloglogn)
N = int(input())
A = list(map(int,input().split()))

listA = [0] * (10**6+10)
ans = 0
for i in A:
    if listA[i] != 0:
            listA[i] = 2
            continue
    for j in range(i,10**6+10,i):
        listA[j] += 1

for i in A:
    if listA[i] == 1:
        ans += 1

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

#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N,S=map(int, input().split())
    A = list(map(int,input().split()))
    mod = 998244353
    dp = [[0]*(S+1) for i in range(N+1)]
    dp[0][0]=1
    for i in range(N):
        vi = A[i]
        for j in range(S+1):
            dp[i+1][j] += 2 * dp[i][j]
            dp[i+1][j] %= mod
            if j+vi<=S:
                dp[i+1][j+vi] += dp[i][j]
                dp[i+1][j+vi] %= mod

    print(dp[N][S])

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

def main():
    N,S=map(int, input().split())
    A = list(map(int,input().split()))
    mod = 998244353
    dp = [[0]*(S+1) for i in range(N+1)]
    dp[0][0]=1
    for i in range(N):
        vi = A[i]
        for j in range(S+1):
            dp[i+1][j] += 2 * dp[i][j]
            dp[i+1][j] %= mod
            if j+vi<=S:
                dp[i+1][j+vi] += dp[i][j]
                dp[i+1][j+vi] %= mod

    print(dp[N][S])

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

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

for k in range(K):
    for i in range(N):
        if A[i] != N:
            break
    else:
        break

    B = [0] * N
    for i in range(N):
        d = A[i]
        left = max(0, i - d)
        right = min(N-1, i + d)
        B[left] += 1
        if right + 1 < N:
            B[right+1] -= 1
    for i in range(1, N):
        B[i] += B[i-1]
    A = B
print(" ".join(map(str, A)))


### FIXED CODE ###

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

for k in range(K):
    for i in range(N):
        if A[i] != N:
            break
    else:
        break

    B = [0] * N
    for i in range(N):
        d = A[i]
        left = max(0, i - d)
        right = min(N-1, i + d)
        B[left] += 1
        if right + 1 < N:
            B[right+1] -= 1
    for i in range(1, N):
        B[i] += B[i-1]
    A = B
print(" ".join(map(str, A)))