Problem:
Score : 500 points

Problem Statement

We have N bulbs arranged on a number line, numbered 1 to N from left to right.
Bulb i is at coordinate i.

Each bulb has a non-negative integer parameter called intensity.
When there is a bulb of intensity d at coordinate x, the bulb illuminates the segment from coordinate x-d-0.5 to x+d+0.5.
Initially, the intensity of Bulb i is A_i. We will now do the following operation K times in a row:

For each integer i between 1 and N (inclusive), let B_i be the number of bulbs illuminating coordinate i. Then, change the intensity of each bulb i to B_i.

Find the intensity of each bulb after the K operations.

Constraints

1 \leq N \leq 2 \times 10^5

1 \leq K \leq 2 \times 10^5

0 \leq A_i \leq N

Input

Input is given from Standard Input in the following format:

N K
A_1 A_2 \ldots A_N

Output

Print the intensity A{'}_i of each bulb i after the K operations to Standard Output in the following format:

A{'}_1 A{'}_2 \ldots A{'}_N

Sample Input 1

5 1
1 0 0 1 0

Sample Output 1

1 2 2 1 2

Initially, only Bulb 1 illuminates coordinate 1, so the intensity of Bulb 1 becomes 1 after the operation.
Similarly, the bulbs initially illuminating coordinate 2 are Bulb 1 and 2, so the intensity of Bulb 2 becomes 2.

Sample Input 2

5 2
1 0 0 1 0

Sample Output 2

3 3 4 4 3

Solution in C# (.NET Core 3.1.201) (judge verdict: Time Limit Exceeded)

/*********************************************
* c# template
* 
*********************************************/
/*********************************************
20.07.10 東京海上日動 コンテスト2020. C - Lamps

直線上で並んでいる電球たちが、
queryによって光の強さが変化する。
query操作後の各電球の光の強さを求め。

query:
1 以上 N 以下の各整数 i に対し、操作時に座標 i を照らしている電球の個数を 
Bi とする。そして、各電球 i の光の強さを Bi に変更する。

*********************************************/

namespace temp_name
{
    using System;
    using System.Linq;
    using System.Collections.Generic;
    using System.Reflection;
    using System.Text;
    using static System.Console;
    using static IOmacro.CsharpInput; 
    using static IOmacro.CppInput;

    public class Run
    {
        int[] lampLv;
        int numLamp;
        int numQry;
        
        private void init()
        {
            numLamp = cin;
            numQry = cin;
            lampLv = ("0 " + ReadLine()).Split().Select(int.Parse).ToArray();
            
        }
        
        private void refreshLampLv()
        {
            var accum = new int[numLamp + 1];
            for (int idx = 1; idx <= numLamp; idx++) {
                int lo = Math.Max(1, (int)Math.Ceiling(idx - lampLv[idx] - 0.5));
                int hi = Math.Min(numLamp, (int)Math.Truncate(idx + lampLv[idx] + 0.5));
                
                accum[lo] += 1;
                if (hi + 1 <= numLamp)
                    accum[hi + 1] -= 1;
                
            }
            for (int idx = 2; idx <= numLamp; idx++) {
                accum[idx] += accum[idx - 1];
            }
            for (int idx = 1; idx <= numLamp; idx++) {
                lampLv[idx] = accum[idx];
            }
        }
        
        private void proc()
        {
            
            
            for (int cnt = 0; cnt < numQry; cnt++)
                refreshLampLv();
            
            for (int idx = 1; idx <= numLamp; idx++)
                Write(lampLv[idx] + " ");
            WriteLine();
        }
        
        public void work()
        {
            init();
            proc();
        }
        
    }
}

class program
{
    static void Main()
    {
        var run = new temp_name.Run();
        run.work();
    }
}


namespace IOmacro
{
    //20.06.29 수정
    
    using System; 
    using System.Linq; 
    using System.IO;
    using System.Collections.Generic;
    
    public class CsharpInput 
    {
        public static StreamWriter _writer = new StreamWriter(Console.OpenStandardOutput());
        public const char separator = ' ';
        public static string _string{get{return Console.ReadLine();}}
        public static string[] _stringa{get{return (Console.ReadLine().Split(separator));}}
        public static int _int{get{return int.Parse(Console.ReadLine());}}
        public static int[] _inta{get{return Console.ReadLine().Split(separator).Select(int.Parse).ToArray();}}
        public static long _long{get{return long.Parse(Console.ReadLine());}}
        public static long[] _longa{get{return Console.ReadLine().Split(separator).Select(long.Parse).ToArray();}}    
        public static double _double{get{return double.Parse(Console.ReadLine());}}
        public static double[] _doublea{get{return Console.ReadLine().Split(separator).Select(double.Parse).ToArray();}}    
    }
    
    public class CppInput 
    {
        public static CppInput cin => new CppInput();
        public const char separator = ' ';
        private static readonly Queue<string> _input = new Queue<string>();
        private CppInput(){}
        public static implicit operator string(CppInput _) {
            if (_input.Count == 0) Console.ReadLine().Split(separator).foreachExtension(x => _input.Enqueue(x));
            return _input.Dequeue();
        }
        public static implicit operator int(CppInput _){
            if (_input.Count == 0) Console.ReadLine().Split(separator).foreachExtension(x => _input.Enqueue(x));
            return int.Parse(_input.Dequeue());
        }
        public static implicit operator long(CppInput _){
            if (_input.Count == 0) Console.ReadLine().Split(separator).foreachExtension(x => _input.Enqueue(x));
            return long.Parse(_input.Dequeue());
        }
        public static implicit operator double(CppInput _){
            if (_input.Count == 0) Console.ReadLine().Split(separator).foreachExtension(x => _input.Enqueue(x));
            return double.Parse(_input.Dequeue());
        }
    }
    
    public static class CEnumerableExtension 
    {
        public delegate void Function<in T>(T val);
        public static void foreachExtension<T>(this IEnumerable<T> enumerable, Function<T> function) {
            foreach (var x in enumerable) function(x);
        }
    }
}