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)

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace Tokiomarine2020
{
    using static Ex;
    public class Solve
    {
        public static void Main(string[] args)
        {
            new Tokiomarine2020_C();
        }
    }
    public class Tokiomarine2020_A
    {
        public Tokiomarine2020_A()
        {
            var s = Read;
            s.Substring(0, 3).Cw();
        }
    }
    public class Tokiomarine2020_B
    {
        long a, b, v, w, t;
        public Tokiomarine2020_B()
        {
            (a, v) = ReadLongArray().ToTpl2();
            (b, w) = ReadLongArray().ToTpl2();
            t = ReadLong;

            bool bo = false;
            var d = v - w;
            if (v > w)
            {
                bo = t * d >= Math.Abs(a - b);
            }
            bo.YESNO();
        }
    }
    public class Tokiomarine2020_C
    {
        long n, k;
        long[] a;
        public Tokiomarine2020_C()
        {
            (n, k) = ReadLongArray().ToTpl2();
            a = ReadLongArray();

            var arr = new long[n];

            //操作時に座標iを照らしている電球の個数をBiとする。そして、各電球iの光の強さをBiに変更
            for (long i = 0; i < k; i++)
            {
                if (i % 2 == 0) I(ref a, ref arr);
                else I(ref arr, ref a);
            }
            if (k % 2 == 0) string.Join(" ", a).Cw();
            else string.Join(" ", arr).Cw();
        }

        void I(ref long[] a, ref long[] arr)
        {
            var pq = new PriorityQueue<(double, long)>();

            //座標xに光の強さdの電球があるとき、その電球は座標x−d−0.5から座標x+d+0.5まで
            for (long x = 0; x < n; x++)
            {
                pq.Push((n - (x + a[x] + .5), x));
                var v = pq.Peek;
                var j = n - v.Item1;
                while (j < x)
                {
                    pq.Pop();
                    if (pq.Count == 0) break;
                    v = pq.Peek;
                    j = n - v.Item1;
                }
                arr[x] = pq.Count;
            }
            //string.Join(" ", arr).Cw();
            pq = new PriorityQueue<(double, long)>();
            for (long x = n - 1; x >= 0; x--)
            {
                if (pq.Count == 0)
                {
                    pq.Push((x - a[x] - .5, x));
                    continue;
                }
                var v = pq.Peek;
                var j = v.Item1;
                //$"0: {v.Item2} {j}".Cw();
                while (j > x)
                {
                    pq.Pop();
                    if (pq.Count == 0) break;
                    v = pq.Peek;
                    j = v.Item1;
                    //$"1: {v.Item2} {j}".Cw();
                }
                arr[x] += pq.Count;
                //$"pq.Count{pq.Count}".Cw();
                pq.Push((x - a[x] - .5, x));
            }
        }
    }
    public class Tokiomarine2020_D
    {
        public Tokiomarine2020_D()
        {
        }
    }

    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }



        public static bool Mins<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
        public static bool Maxs<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
        public static void Swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
        public static void Swap<T>(List<T> list, int i, int j) { T tmp = list[j]; list[j] = list[i]; list[i] = tmp; }


        static long Gcd(long m, long n) { if (n == 0) return m; return Gcd(n, m % n); }
        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static void yesno(this bool b) { (b ? "yes" : "no").Cw(); }
        public static void YesNo(this bool b) { (b ? "Yes" : "No").Cw(); }
        public static void YESNO(this bool b) { (b ? "YES" : "NO").Cw(); }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var v = new string[N]; for (long i = 0; i < N; ++i) v[i] = Read; return v; }
        public static int[] ReadIntArray(long N) { var v = new int[N]; for (long i = 0; i < N; ++i) v[i] = ReadInt; return v; }
        public static long[] ReadLongArray(long N) { var v = new long[N]; for (long i = 0; i < N; ++i) v[i] = ReadLong; return v; }

        public static (T, T) ToTpl2<T>(this T[] v) { return (v[0], v[1]); }
        public static (T, T, T) ToTpl3<T>(this T[] v) { return (v[0], v[1], v[2]); }
        public static (T, T, T, T) ToTpl4<T>(this T[] v) { return (v[0], v[1], v[2], v[3]); }
        public static (T, T, T, T, T) ToTpl5<T>(this T[] v) { return (v[0], v[1], v[2], v[3], v[4]); }


        public static int LowerBound<T>(T[] a, T v)
        {
            return LowerBound(a, v, Comparer<T>.Default);
        }

        public static int LowerBound<T>(T[] a, T v, Comparer<T> cmp)
        {
            var l = 0;
            var r = a.Length - 1;
            while (l <= r)
            {
                var mid = l + (r - l) / 2;
                var res = cmp.Compare(a[mid], v);
                if (res == -1) l = mid + 1;
                else r = mid - 1;
            }
            return l;
        }

        /// <summary>
        /// lower_boundは、探索したいkey以上のイテレータを返す
        /// upper_boundは、探索したいkeyより大きいイテレータを返す
        public static int UpperBound<T>(List<T> a, T v)
        {
            return UpperBound(a, v, Comparer<T>.Default);
        }

        public static int UpperBound<T>(List<T> a, T v, Comparer<T> cmp)
        {
            var l = 0;
            var r = a.Count - 1;
            while (l <= r)
            {
                var mid = l + (r - l) / 2;
                var res = cmp.Compare(a[mid], v);
                if (res <= 0) l = mid + 1;
                else r = mid - 1;
            }
            return l;
        }

        public class PriorityQueue<T> where T : IComparable<T>
        {
            List<T> list = new List<T>();
            void PushHeap(T v)
            {
                int n = list.Count;
                list.Add(v);

                while (n != 0)
                {
                    int i = (n - 1) / 2;
                    if (list[n].CompareTo(list[i]) > 0)
                        Swap(list, i, n);
                    n = i;
                }
            }
            void PopHeap()
            {
                int n = list.Count - 1;
                list[0] = list[n];
                list.RemoveAt(n);

                for (int i = 0, j; (j = 2 * i + 1) < n;)
                {
                    if ((j != n - 1) && (list[j].CompareTo(list[j + 1]) < 0))
                        j++;
                    if (list[i].CompareTo(list[j]) < 0)
                        Swap(list, i, j);
                    i = j;
                }
            }
            public void Push(T elem) { PushHeap(elem); }
            public T Pop() { var v = Peek; PopHeap(); return v; }
            public T Peek { get { return list[0]; } }
            public int Count { get { return list.Count; } }
        }
    }
}