peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import math
a, b, h, m = map(int,input().split())
ms = m//60
ma = m%60
h = h + ms
ha =h%12 + ma/60
rh = ha*math.pi/6
rm = ma*math.pi/30
x = math.cos(rh - rm)
ans = math.sqrt(a**2 + b**2 - 2*a*b*x)
print(ans)
# Judge status: Accepted
s=list(input())
t=input()
n,m=len(s),len(t)
def match(a,b):
    for i in range(len(a)):
        if a[i]!=b[i] and a[i]!="?":
            return False
    return True
flag=True
for i in range(n-m,-1,-1):
    if match(s[i:i+m],t):
        for j in range(m):
            s[j+i]=t[j]
        flag=False
        break
if flag:
    print("UNRESTORABLE")
    exit()
for i in range(n):
    if s[i]=="?":
        s[i]="a"
print(*s,sep="")
# Judge status: Accepted
N,M=map(int,input().split())
#S=N,C=M
print(min(((2*N)+M)//4,M//2))
# Judge status: Accepted
def main():
    d, n = map(int, input().split())
    answer = 100 ** d
    if 0 < d:
        while 0 < n:
            if answer % (100 ** d) == 0 and answer % (100 ** (d + 1)) > 0:
                n -= 1
            answer += 100 ** d
        answer -= 100 ** d
    else:
        answer = n if n < 100 else 101
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
x,y,z = map(int,input().split())

print(x//(y+z))
# Judge status: Accepted
A, B = input().split()
c = int(A) * round(float(B)*100)
ans = c // 100
print(int(ans))
# Judge status: Accepted
n,p = map(int,input().split())
a = [int(i) for i in input().split()]
odd = 0
evil = 0
for i in a:
    if i % 2== 0:
        evil += 1
    else:
        odd += 1
if p==1 and odd ==0:
    print(0)
elif evil ==n:
    print(pow(2,n))
else:
    print(pow(2,n-1))
# Judge status: Accepted
L, R = map(int, input().split())
R = min(R, L+4038)
ans = 2018
for i in range(L, R):
    for j in range(i+1, R+1):
        ans = min((i*j)%2019, ans)
print(ans)
# Judge status: Accepted
x,y,z = (int(x) for x in input().split())
cnt = 0

while x >= y*cnt+z*(cnt+1):
	if x == y*cnt+z*(cnt+1):
		print(str(cnt))
		break
	cnt+=1
else:
	print(str(cnt-1))
# Judge status: Accepted
s = input()

while len(s) > 2:
    s = s[:-2]
    x = len(s) // 2
    if s[:x] == s[x:]:
        print(len(s))
        break
# Judge status: Accepted
A,B = map(int,input().split())

if A == 1:
    A += 13
if B == 1:
    B += 13

if A == B:
    print("Draw")
elif A < B:
    print("Bob")
else:
    print("Alice")
# Judge status: Accepted
N,A,B = map(int,input().split())

c = 0
if A == 0:
    print(0)
    exit()
if B == 0:
    print(N)
    exit()

x = N // (A+B)
y = N % (A+B)
c = x * A
if A <= y:
    c += A
else:
    c += y

print(c)
# Judge status: Wrong Answer
W,H,x,y=map(int,input().split())
xx = min(W-x,x)
yy = min(H-y,y)
A1 = H*xx
A2 = W*yy
res = max(A1,A2)
if A1 == A2:
  print(res,1)
else:
  print(res,0)
# Judge status: Wrong Answer
#C - Attention
N = int(input())
S = input()
DP_w= []
DP_e = []
tmp = 0
tmpw = 0
tmpe = 0
ans = 0
# for i in range(N):
#     if S[i] == "W":
#         tmpw += 1
#         DP_w.append(tmpw)
#         DP_e.append(tmpe)
#     else:
#         tmpe += 1
#         DP_w.append(tmpw)
#         DP_e.append(tmpe)

for i in range(N):
    tmpw = S[:i].count('W')
    tmpe = S[i:].count('E')
    ans = max(ans,tmpw+tmpe)

print(ans)
# Judge status: Wrong Answer
N=int(input())
ans=0
while N:
    if 12<=N<=14:
        N-=6
        ans+=1
    if 1458<=N<=1511:
        N-=729
        ans+=1
    if 13122<=N<=14336:
        N-=6561
        ans+=1
    i=0
    while 9**i<=N:
        i+=1
    i-=1
    j=0
    while 6**j<=N:
        j+=1
    j-=1
    N-=max(9**i,6**j)
    ans+=1

print(ans)
# Judge status: Accepted
S = input()

if S[0]==S[1] and S[0]==S[2]:
    ans = 'No'
else:
    ans = 'Yes'
print(ans)
# Judge status: Accepted
import statistics
import math

N = int(input())
a = []
b = []
for i in range(N):
    A, B = map(int,input().split())
    a.append(A)
    b.append(B)

if N%2 == 1:
    ans = statistics.median(b) - statistics.median(a) + 1
else:
    ans = (statistics.median(b) - statistics.median(a))*2 + 1
print(int(ans))
# Judge status: Accepted
import sys
readline = sys.stdin.readline
from collections import Counter
MOD = 2019

def main():
    S = list(map(int, list(readline().rstrip())))
    N = len(S)
    T = [0] * (N+1)
    e = 1
    for i in range(N-1, -1, -1):
        T[i] = (T[i+1] + int(S[i]) * e) % MOD
        e = e * 10 % MOD
    
    T = [t % MOD for t in T]
    c = Counter(T)
    ans = 0
    for k, v in c.items():
        ans += (v * (v-1)) // 2
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
r=int(input())
print(int((3.14*r*r)/3))
# Judge status: Wrong Answer
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

N=int(input())
print(N*(N-1)/2)
# Judge status: Accepted
from collections import defaultdict
if __name__ == "__main__":
    x,n = map(int,input().split())
    l = list(map(int,input().split()))
    if n == 0 :
        print(x)
    else :
        l.sort()
        count = 0
        dist = 999
        ans = -100
        for i in range(-100,201) :
            if i in l :
                continue
            if dist > abs(x - i) :
                dist = abs(x - i)
                ans = i 
        print(ans)
# Judge status: Accepted
n = int(input())

nn = n
nnn = n 

e = []
while n % 2 == 0:
    e.append(2)
    n = n // 2
p = 3
while p * p <= n:
    if n % p == 0:
        e.append(p)
        n = n // p
    else:
        p = p + 2
if n != 1:
    e.append(n)

ue = set(e)
cnt = 0
for f in ue:
    tmpf = f
    while nn % f == 0:
        cnt = cnt + 1
        nn = nn // f
        f = f*tmpf

if nnn == 1:
    print(0)
else:
    print(cnt)
# Judge status: Wrong Answer
n=int(input())
a = list(map(int, input().split()))

al=0
bo=0
for i in range(n):
  if i%2==0:
    al+=a[i]
  else:
    bo+=a[i]
print(al-bo)
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = [True] * (N + 1)
for _ in range(M):
    a = int(input()) - 1
    A[a] = False

dp = [0] * (N + 1)

dp[0] = 1
for i in range(N):
    for j in range(i + 1, min(N, i + 2) + 1):
        if A[j] is True:
            dp[j] += dp[i]
            dp[j] %= 10 ** 9 + 7

print(dp[N])
# Judge status: Wrong Answer
n, m = map(int, input().split())
ans = (n-2)*(m-2)
if ans < 0:
    ans = 0
print(ans)
# Judge status: Accepted
S = input()
print(S[0],S[1],S[2],sep="")
# Judge status: Accepted
n,m = map(int,input().split())
a_array = [int(x) for x in input().split()]
d = dict()
for a in a_array:
    d.setdefault(a, 0)
    d[a] += 1
for _ in range(m):
    b,c = map(int, input().split())
    d.setdefault(c, 0)
    d[c] += b
key = sorted(d.keys(),reverse=True)
ans = 0
index = 0
while n > 0:
    num = key[index]
    if d[num] >= n:
        ans += num * n
        break
    ans += num * d[num]
    n -= d[num]
    index += 1

print(ans)
# Judge status: Accepted
from collections import deque 
n = int(input())
a = list(map(int,input().split()))

a.sort()
fir = a[n-1]

sco = 0
sit = deque([fir])
for i in range(n-1):
    sco += sit.popleft()
    sit.append(a[n-i-2])
    sit.append(a[n-i-2])
print(sco)
# Judge status: Accepted
import math

N, K = map(int, input().split(' '))
ans=0
# 1からNまでのどれかがでる、そっから倍々にしてKに
for i in range(1,N+1):
    t=max(0,math.ceil(math.log2(K/i)))
    ans+=(0.5**t)/N
print(ans)
# Judge status: Wrong Answer
N= int(input())
n = N
ans = 0
i = 0
while n:
    j = i
    i = n%10
    if i > 11-i:
        ans += 10-i
    else:
        ans += i
    n//= 10
if (j > 5 and i <= 5) or (j <= 5 and i > 5):
    ans += 1

print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
import math
print(math.ceil((a + b) / 2))
# Judge status: Accepted
a,b = map(int, input().split())
s = input()
if len(s) == a+b+1 and s.count("-") == 1 and s[a] == "-":
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from collections import deque

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

graph = [[] for i in range(n+1)]
dist = [-1] * (n+1)
dist[0] = 0
dist[1] = 0

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

d = deque()
d.append(1)

while d:
    v = d.popleft()
    for i in graph[v]:
        if dist[i] != -1:
            continue
        dist[i] = dist[v]+1
        d.append(i)

print('Yes')
for i in range(2,n+1):
    print(dist[i])
# Judge status: Accepted
N, K = list(map(int, input().split()))
D = set(input().split())
num = {str(i) for i in range(10)} - D

while True:
    if set(str(N)) <= num:
        ans = N
        break
    else:
        N += 1
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = [0] * n
b = [0] * n
sa = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())
c = b.copy()
c.sort()
wa = 0
for i in c:
    wa += a[b.index(i)]
    if wa > b[b.index(i)]:
        print("No")
        exit()
print("Yes")
# Judge status: Accepted
# https://atcoder.jp/contests/arc091/tasks/arc091_a

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

peremeter = 0
if n == 1 and m == 1:
    pass 
elif n == 1 or m == 1:
    peremeter += 2
else:
    peremeter += (n - 1) * 2
    peremeter += (m - 1) * 2
ans = n * m - peremeter
print(ans)
# Judge status: Wrong Answer
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections


n = int(input())
A = [int(input()) for i in range(n)]
flag = [False for i in range(n)]
flag[0] = True
cnt = 0
for i in range(n):
    if flag[i] == False:
        continue
    flag[A[i]-1] = True
    cnt += 1
    if flag[1] == True:
        break
if flag[1] == False:
    print(-1)
else:
    print(cnt)
# Judge status: Accepted
# -*- coding: utf-8 -*-
import queue
K = int(input())
q = queue.Queue()

count = 0
for i in range(1, 10):
  q.put(i)

a = 0
while count < K:
  
  a = q.get()
  fp = int(str(a)[-1])
  if fp == 0:
    q.put(a*10)
    q.put(a*10 + 1)
  elif fp == 9:
    q.put(a*10 + 8)
    q.put(a*10 + 9)
  else:
    q.put(a*10 + fp - 1)
    q.put(a*10 + fp)
    q.put(a*10 + fp + 1)
  count += 1

print(a)
# Judge status: Accepted
n=int(input())

ans=0
Dic={}
for i in range(1,n+1):
    s=str(i)
    d=(s[0],s[-1])
    if d in Dic.keys():
        Dic[d]+=1
    else:
        Dic[d]=1

for a in Dic.keys():
    b=(a[1],a[0])
    if b in Dic.keys():
        ans+=Dic[a]*Dic[b]
print(ans)
# Judge status: Accepted
def resolve():

    n=int(input())
    H=list(map(int,input().split()))
    def main():
        if n == 1:
            return 'Yes'
        maxval=0
        for i in range(n):
            if maxval-2>=H[i]:
                return 'No'
            else:
                maxval=max(maxval,H[i])
        return 'Yes'
    print(main())


resolve()
# Judge status: Wrong Answer
import math

n = int(input())
mat = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for idx in range(n-1, -1, -1):
    a,b = mat[idx]
    a += ans
    if a <= b:
        score = b - a
    else:
        score = b*math.ceil(a/b) - a
    ans += score

print(ans)
# Judge status: Accepted
from math import sqrt
N=int(input())
ans=0
for i in range(1,N+1,2):
  d=[]
  for j in range(1,int(sqrt(i))+1):
    if i%j==0:
      d.append(j)
      d.append(N//j)
  d=list(set(d))
  if len(d)==8:
    ans+=1
print(ans)
# Judge status: Accepted
import sys
import math
from pprint import pprint

A, B, N = map(int, sys.stdin.readline().strip().split())

def func(x):
    # return math.floor(A*x/B) - A*math.floor(x/B)
    return A*x//B - A*(x//B)

print(func(min(B-1, N)))
# Judge status: Wrong Answer
A,B = map(int,input().split())
c = 1

for i in range(2,int(max(A,B)**0.5)+2):
    k = 0
    while(A % i == 0 and B % i == 0):
        k = 1
        A = A//i
        B = B//i
    c += k

for i in range(2,int(A**0.5)+2):
    while(A % i == 0):
        A = A//i

for i in range(2,int(B**0.5)+2):
    while(B % i == 0):
        B = B//i

if A == B:
    c += 1
    
print(c)
# Judge status: Accepted
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    P = [int(p) for p in input().split()]
    diff = 0
    for i in range(N):
        if P[i] != i + 1: diff += 1
    if diff <= 2: print("YES")
    else: print("NO")

    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
n, X = map(int, input().split())
l = list(map(int, input().split()))

sumList = [0]
for i in range(n):
    s = sumList[i]+l[i]
    if s > X:
        break
    sumList.append(s)

print(len(sumList))
# Judge status: Accepted
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
p = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

def main():
    r = ni()

    print(2 * math.pi * r)

if __name__ == '__main__':
    main()
# Judge status: Accepted
w,h,n = map(int,input().split())
p = [0,w,0,h]
for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        p[0] = max(x,p[0])
    if a == 2:
        p[1] = min(x,p[1])
    if a == 3:
        p[2] = max(y,p[2])
    if a == 4:
        p[3] = min(y,p[3])
print(max(0,p[1]-p[0])*max(0,p[3]-p[2]))
# Judge status: Accepted
n = int(input())
a = int(input())
coin = n%500
if a >= coin:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    n, l = map(int, input().split())
    s = []
    for i in range(n):
        s.append(input())
    s.sort()
    print("".join(s))

if __name__ == "__main__":
    main()
# Judge status: Accepted
n, p = map(int, input().split())
a = list(map(int, input().split()))
even_cnt = 1
odd_cnt = 0
for i in range(n):
  if a[i] % 2 == 0:
    even_cnt *= 2
    odd_cnt *= 2
  else:
    k = even_cnt
    l = odd_cnt
    even_cnt = k + l
    odd_cnt = k + l
if p == 0:
  print(even_cnt)
else:
  print(odd_cnt)
# Judge status: Accepted
from itertools import combinations_with_replacement

n,m,q = map(int,input().split())

L = [i+1 for i in range(m)]
li = [input().split() for i in range(q)]

for i in range(q):
    li[i] = [int(x) for x in li[i]]

ans = 0
for v in combinations_with_replacement(L,n):
    sum1 = 0
    for i in li:
        if v[i[1]-1] - v[i[0]-1] == i[2]:
            sum1 +=i[3]
    ans = max(ans,sum1)
print(ans)
# Judge status: Accepted
from math import gcd
N = int(input())
A = [0]+list(map(int, input().split()))+[0]
L = [0]*(N+1)
R = [0]*(N+1)
for i in range(1, N+1):
    L[i] = gcd(L[i-1], A[i])
    R[N-i] = gcd(R[N+1-i], A[N+1-i])
# print(L)
# print(R)

ans = 0
for i in range(1, N+1):
    ans = max(ans, gcd(L[i-1], R[i]))
print(ans)
# Judge status: Accepted
S = input()
N = len(S)
for d in range(1,N-1):
    if (N-d)&1: continue
    m = (N-d)//2
    for i in range(m):
        if S[i] != S[m+i]: break
    else:
        print(N-d)
        exit()
# Judge status: Wrong Answer
A,B,N=map(int,input().split())

import math
M = 0
for x in range(max(N-100,0),N+1):
    Z = math.floor(A * x / B) - A * math.floor(x / B)
    if M < Z:
        M = Z
print(M)
# Judge status: Accepted
h = int(input())

import numpy as np

def solve(num):

    if num==1:
        return 1

    return 1+2 * solve(np.floor(num/2))

print(solve(h))
# Judge status: Accepted
N,M = map(int, input().split())
A = list(map(int, input().split()))

hw = sum(A)

if N>=hw:
	print(N-hw)
else:
	print(-1)
# Judge status: Accepted
a,b,c=map(int,input().split())
if a>b:
    a,b=b,a
print("Yes" if a<c<b else "No")
# Judge status: Wrong Answer
n=int(input())

gohan=800*n
if n>=15:
    cnt=n//15
    total=gohan-200*cnt
    print(total)
# Judge status: Accepted
k, x = map(int, input().split())
print(*[i for i in range(x-k+1, x+k)])
# Judge status: Wrong Answer
#ごり押し

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
import numpy as np
from collections import Counter

N, X, Y = map(int, input().split())

start = list(range(0, N-1)) + list(range(1, N)) + [X, Y] 
end = list(range(1, N)) + list(range(0, N-1)) + [Y, X]
cost = [1] * len(start)

graph = csr_matrix((cost, (start, end)))
lengths = dijkstra(graph, directed = False)
c = Counter(lengths.astype(np.int64).reshape(-1))
for k in range(1, N):
    print(c[k])
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))
m=max(l)
if m%2!=0:
  med=(m+1)//2
else:
  med=m//2
mi=m
for ll in l:
  mi=min(mi,abs(ll-med))
if med+mi in l:
  print(m,med+mi)
else:
  print(m,med-mi)
# Judge status: Accepted
from collections import deque

S = deque(input())
Q = int(input())

rev = False

for _ in range(Q):
    T, F, C, *_ = input().split() + [None, None]

    if int(T) == 1:
        rev = not rev
    else:
        F = int(F)
        if rev:
            F = F % 2 + 1

    if F == 1:
        S.appendleft(C)
    else:
        S.append(C)

if rev:
    S.reverse()

print(*[x for x in S if x], sep='')
# Judge status: Wrong Answer
n,m=list(map(int,input().split()))
if m==0:
  print('1'+'0'*(n-1))
  exit(0)
d=[-1]*4
for _ in range(m):
  s,c=list(map(int,input().split()))
  if d[s]!=-1 and d[s]!=c:
    print(-1)
    exit(0)
  d[s]=c
ans=0
for i in range(1,n+1):
  if d[i]==-1:
    if ans==0:d[i]=1
    else:d[i]=0
  ans=10*ans+d[i]
if len(str(ans))==n:
  print(ans)
else:
  print(-1)
# Judge status: Accepted
X,K,D=(int(x) for x in input().split())
x=abs(X)
a=x//D

b=x-a*D
B=abs(x-(a+1)*D)

if b>B:
  a=a+1

if a>=K:
  print(abs(x-K*D))

else:
  c=K-a
  if c%2 == 0:
    print(abs(x-a*D))
  else:
    d=abs(x-(a-1)*D)
    e=abs(x-(a+1)*D)
    print(min(d,e))
# Judge status: Accepted
import numpy as np
import math

N = int(input())

X=[]
for i in range(N):
    X.append(list(map(int, input().split())))
X = np.array(X)

gokei = 0
for i in range(N):
    for j in range(i+1, N):
        gokei += np.linalg.norm(X[i]-X[j])

print(gokei*math.factorial(N-1)*2/math.factorial(N))
# Judge status: Accepted
n, k = map(int,input().split())

q = []
for i in range(n):
    q.append(list(map(int, input().split())))

q = sorted(q, key=lambda x:x[0])
cnt = 0
i = 0
while cnt < k:
    a, b = q[i]
    cnt += b
    i += 1
print(a)
# Judge status: Wrong Answer
n = int(input())
s = list(input())
cnt = 0
for i in s:
    if i == "R":
        cnt += 1
    else:
        break

print(s.count("R")-cnt)
# Judge status: Accepted
A,B,C = map(int,input().split())
X = C - A + B
if X < 0:
    X = 0
print(X)
# Judge status: Accepted
S = list(map(int, input()))
K = int(input())
count = 0
for a in S:
    if a == 1:
        count += 1
        if count == K:
            print(1)
            exit()
    else:
        print(a)
        exit()
# Judge status: Accepted
from collections import defaultdict
mod = 10**9+7
n = int(input())
s = list(input())
ans = 1
dd = defaultdict(lambda:0)
for i in s:
    dd[i] += 1
for key in dd:
    ans *= dd[key]+1
    ans %= mod
ans -= 1
print(ans)
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))
h[0] -= 1
for i in range(1, n-1):
    if h[i] == h[i+1] + 1:
        if h[i-1] != h[i]:
            h[i] -= 1
        else:
            print('No')
            exit()
    elif h[i] < h[i+1] + 1:
        if h[i-1] != h[i]:
            h[i] -= 1
    else:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
s = input()
a = 0
b = 0
c = 0
for i in s:
    if i == "a":
        a += 1
    if i == "b":
        b += 1
    if i == "c":
        c += 1

if max(a,b,c)-min(a,b,c) <= 1:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))
suml = sum(l)
maxl = max(l)
lestl = suml-maxl
if maxl<lestl:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
#!/usr/bin/env python3

N = int(input())
# S = input()
# N, K = map(int, input().split())
# A = list(map(int, input().split()))
mod = 10 ** 9
from functools import reduce
from fractions import gcd

def main():
    T = list(set([int(input()) for _ in range(N)]))
    if len(T) == 1:
        print(T[0])
        exit()
    ans = (T[0] * T[1]) // gcd(T[0], T[1])
    for i in range(len(T) - 2):
        ans = ans // (gcd(ans, T[i])) * T[i]
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input(), 10)
live_pos_list = list(map(int, input().split()))


def cost(live_pos, held_pos):
    return (live_pos - held_pos) ** 2

mean_pos = round(sum(live_pos_list) / n)
print(sum(map(lambda live_pos: cost(live_pos, mean_pos), live_pos_list)))
# Judge status: Accepted
n = int(input())

print(n // 2 * (n - n // 2))
# Judge status: Accepted
n,k=map(int,input().split())
a=[int(i) for i in input().split()]
k=min(k,41)

for j in range(k):
    b=[0 for i in range(n)]
    for i in range(n):
        l=max(0,i-a[i])
        r=min(n-1,i+a[i])
        b[l]+=1
        if r+1<n:
            b[r+1]-=1
    for i in range(1,n):
      b[i]+=b[i-1]
    a=b
print(" ".join(map(str,a)))
# Judge status: Accepted
A,B,K = map(int, input().split())

if B-A+1<= 2*K:
    print(*range(A,B+1), sep="\n")
else:
    a = list(range(A,A+K))
    b = list(range(B-K+1,B+1))
    C = sorted(set(a+b))
    print(*C, sep="\n")
# Judge status: Accepted
N = int(input())
sum = 0

for i in range(N):
    if (i + 1) % 3 != 0 and (i + 1) % 5 != 0:
        sum += (i + 1)

print(sum)
# Judge status: Accepted
N=int(input())
S=list(map(int,input().replace('#','1').replace('.','0')))
 
cum=[0]
for i in range(N):
  cum.append(cum[-1]+S[i])
  
ans=10**20
for i in range(N+1):
  b = cum[i]
  w = N-i-(cum[-1]-cum[i])
  ans = min(ans,b+w)
  
print(ans)
# Judge status: Accepted
N = int(input())
a_ls=list(map(int, input().split()))

a=sorted(a_ls,reverse=True)

ans=0

if N%2==0:
	ans+=a[0]
	for i in range((N-2)//2):
		ans+=(a[1+i]*2)

if N%2==1:
	ans+=a[0]
	for i in range((N-1)//2):
		ans+=(a[1+i]*2)
	
	ans-=a[((N-1)//2)]

print(ans)


# 2darray [[0] * 4 for i in range(3)]
# Judge status: Accepted
a, b = [int(x) for x in input().split()]
print((b-a)*(b-a+1)//2 - b)
# Judge status: Wrong Answer
n,m,k=map(int,input().split())

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

suma=[]
tmp=0
for aa in a:
    tmp+=aa
    suma.append(tmp)

sumb=[]
tmp=0
for bb in b:
    tmp+=bb
    sumb.append(tmp)

ans=0

for i in range(n):
    if suma[i]<=k:
        for j in range(m):
            if suma[i]+sumb[j]<=k:
                ans=max(ans,i+j+2)
            else:
                break
print(ans)
# Judge status: Wrong Answer
import numpy as np
n = int(input())
a = np.array(input().split(), int)

print(str(a.argsort() + 1)[1:-1])
# Judge status: Wrong Answer
def triplets_brute(n):
    counter = 0
    upper = round(n**0.5)
    for x in range(1, upper+1):
        for y in range(1, upper+1):
            for z in range(1, upper+1):
                if x**2+y**2+z**2+x*y+y*z+z*x==n:
                    counter += 1
    return counter
print(triplets_brute(int(input())))
# Judge status: Accepted
import math
N,X = map(int,input().split())
x = list(map(int,input().split()))
y = [abs(x[i]-X) for i in range(N)]
if N == 1:
    print(y[0])
    exit(0)
ans = math.gcd(y[0],y[1])
for i in range(2,N):
    ans = min(ans,math.gcd(y[i],ans))
print(ans)
# Judge status: Accepted
X,Y=map(int,input().split())
mod = 10**9+7

if 2*X < Y or 2*Y < X:print(0)
elif (X+Y) % 3 != 0:print(0)
else:
  n = (X+Y) // 3
  X,Y=X-n,Y-n
  
  factorial=[1 for i in range(X+Y+1)]
  for i in range(1,X+Y+1):
    if i==1:factorial[i]=1
    else:factorial[i] = factorial[i-1]*i % mod
  print(factorial[X+Y]*pow(factorial[X]*factorial[Y],-1,mod)%mod)
# Judge status: Accepted
K = int(input())
S = list(input())
if len(S) > K:
    ans = S[0:K]
    ans.append("...")
    print("".join(ans))
else:
    print("".join(S))
# Judge status: Accepted
from collections import deque

n, m = map(int, input().split())
a = [[] for _ in range(n)]
for i in range(m):
    x, y = map(int, input().split())
    a[x - 1].append(y - 1)
    a[y - 1].append(x - 1)
c = [0] * n
que = deque([])
que.append(0)
while len(que) > 0:
    e = que.popleft()
    for i in a[e]:
        if c[i] > 0:
            continue
        c[i] = e + 1
        que.append(i)
print("Yes")
for i in range(1, n):
    print(c[i])