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

import collections

N, X, Y = map(int, input().split())
x = X-1
y = Y-1
dist = dict()
for i in range(N-1):
    for j in range(i+1, N):
        dist_ = min(abs(j-i), abs(x-i) + 1 + abs(j-y), abs(y-i) +1 + abs(j - x))
        dist[i, j] = dist_

out = collections.Counter(dist.values())
for i in range(N-1):
    print(out[i+1])



### FIXED CODE ###

N, X, Y = map(int, input().split())
x = X-1
y = Y-1
dist = [0] * N
for i in range(N-1):
    for j in range(i+1, N):
        dist_ = min(abs(j-i), abs(x-i) + 1 + abs(j-y), abs(y-i) +1 + abs(j - x))
        dist[dist_] += 1
for i in range(N-1):
    print(dist[i+1])
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
from collections import Counter
readline = sys.stdin.buffer.readline


def sum_d(d):
    total = 0
    for k, v in d.items():
        total += k * v
    return total


N = int(readline())
A = map(int, readline().split())
Q = int(readline())
d = Counter(A)

answer = [0] * Q

for i in range(Q):
    B, C = map(int, readline().split())

    if B in d:
        if C in d:
            d[C] = d[C] + d.pop(B)
        else:
            d[C] = d.pop(B)

    answer[i] = sum_d(d)

print(*answer, sep='\n')


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import Counter
readline = sys.stdin.buffer.readline

N = int(readline())
A = list(map(int, readline().split()))
Q = int(readline())
d = Counter(A)

total = sum(A)

for _ in range(Q):
    B, C = map(int, readline().split())

    total -= B * d[B]
    total += C * d[B]

    d[C] += d[B]
    d[B] = 0

    print(total)
### BUGGY CODE ###

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

prev = 0
ind = 0

for i in range(n - k + 1):
    nex = sum(p[i:i + k])

    if prev < nex:
        prev = nex
        ind = i

total = 0
for i in range(ind, ind + k):
    total += (p[i] * 0.5 + 0.5)

print(total)

### FIXED CODE ###

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

prev = sum(p[1:k])
current = sum(p[1:k])
ind = 0

for i in range(1, n - k + 1):
    current = current - p[i - 1] + p[i + k - 1]

    if prev < current:
        prev = current
        ind = i

total = 0
for i in range(ind, ind + k):
    total += p[i] / 2 + 0.5

print(total)
### BUGGY CODE ###

import math
A,B,N=map(int,input().split())
result=0
if B<=N:
	x=B-1
	while x<=N:
	  tmp=math.floor(A*x/B)-A*math.floor(x/B)
	  if tmp>result:
	    result=tmp
	  x+=B
if B>N:
	result=math.floor(A*N/B)-A*math.floor(N/B)
if B==1:
  print(0)
else:
  print(result)


### FIXED CODE ###

import math
A,B,N=map(int,input().split())
result=0
if B<=N:
	x=(N//B)*B-1
	result=math.floor(A*x/B)-A*math.floor(x/B)
if B>N:
	result=math.floor(A*N/B)-A*math.floor(N/B)
if B==1:
  print(0)
else:
  print(result)
### BUGGY CODE ###

import itertools
n = int(input())
A = list(map(int, input().split()))
a = list(itertools.combinations(A,2))
MOD = 10**9+7
ans = 0
for i,j in a:
  ans = (ans + (i*j)%MOD)%MOD
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
t = sum(a)
MOD = 10**9+7
ans = 0
for i in range(n-1):
  t -= a[i]
  ans = (ans+(a[i]*t%MOD))%MOD
print(ans)
### BUGGY CODE ###

from collections import Counter

s=input()
n=len(s)
ok=False
for i in range(n-1):
    ct=Counter()
    for j in range(i,n):
        ct[s[j]]+=1
        d=j-i+1
        #print(d)
        if d//2<ct[s[j]] and d>=2:
            print(i+1,j+1)
            ok=True
            exit()
            break

if not ok:
    print(-1,-1)


### FIXED CODE ###

s=input()
n=len(s)
a=b=-1
for i in range(n-1):
    if s[i]==s[i+1]:
        a,b=i+1,i+2
        break
    elif i+2<n and s[i]==s[i+2]:
        a,b=i+1,i+3
        break

print(a,b)
### BUGGY CODE ###

k,s=map(int,input().split())
cnt=0
for i in range(0,k+1):
    for j in range(0,k+1):
        for k in range(0,k+1):
            if i+j+k==s:
                cnt+=1
print(cnt)

### FIXED CODE ###

k,s=map(int,input().split())
cnt=0
for x in range(0,k+1):
    for y in range(0,k+1):
        z = s-x-y
        if z >= 0 and z <= k:
            cnt+=1
print(cnt)
### BUGGY CODE ###

N_A_B = list(map(int, input().split()))
N = N_A_B[0]
A = N_A_B[1]
B = N_A_B[2]

count = 0
retu = []
while count < 10 ** 100 and count < N:
    count += 1
    for index in range(A):
        retu.append(1)
    for index in range(B):
        retu.append(0)
retu = retu[0:N]
print(sum(retu))


### FIXED CODE ###

N_A_B = list(map(int, input().split()))
N = N_A_B[0]
A = N_A_B[1]
B = N_A_B[2]

"""
count = 0
retu = []
while count < 10 ** 100 and count < N:
    count += 1
    for index in range(A):
        retu.append(1)
    for index in range(B):
        retu.append(0)
retu = retu[0:N]
print(sum(retu))
"""

if N % (A + B) == 0:
    print(N // (A + B) * A)
elif N % (A + B) > A:
    print(N // (A + B) * A + A)
else:
    print(N // (A + B) * A + N % (A + B))
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().strip()

def main():
    N, K = map(int, input().split())
    A = [0] + list(map(int, input().split()))
    """
    （aが不要なカード）＝（A-{a}からK-a以上の最小の部分和を取った時、それがK以上）
    まで言い換えてドボン。。。
    部分和の全列挙しなくても和がKまでで打ち切っていいんだから、ここでdpの発想が出なかったのは切腹。
    まずは部分点解法を実装してみる。
    """
    ans = 0
    for k in range(1, N + 1):
        # dp[i][j] = (i個使って(ただしA[k]を除く)部分和jが作れるか)
        dp = [1] + [0] * K
        for i in range(1, N + 1):
            if i == k: continue
            dp2 = [0] * (K + 1)
            for j in range(K + 1):
                if dp[j] == 1:
                    dp2[j] = 1
                    dp2[min(K, j + A[i])] = 1
            dp = dp2

        
        no_need = True
        for j in range(max(0, K - A[k]), K):
            if dp[j] != 0:
                no_need = False
                break
        if no_need: ans += 1
    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
from itertools import accumulate
def input(): return sys.stdin.readline().strip()

def main():
    N, K = map(int, input().split())
    A = [0] + list(map(int, input().split()))
    """
    （aが不要なカード）＝（A-{a}からK-a以上の最小の部分和を取った時、それがK以上）
    まで言い換えてドボン。。。
    部分和の全列挙しなくても和がKまでで打ち切っていいんだから、ここでdpの発想が出なかったのは切腹。
    まずは部分点解法を実装してみる。

    →次に二分探索でdpを行う回数を削減する。ai <= ajに対してajが不要ならばaiも不要なことが対偶を取って分かる。
    そこでAをソートしたうえで必要と不要の境目を見つければよい。

    →PypyだとO(NKlogN)は通らなかったので、O(NK)解法を実装。
    一度二分探索できる話は忘れて、A-{a}から作れる部分和は(aの左側からの部分和)+(aの右側からの部分和)と
    かけることに注意すれば、左側からとれる部分和と右側からとれる部分和を前計算しておけばよい。
    rdpのテーブルメモリが重くてMLEするので（信じられん）、rdp_shiftに1になった瞬間のiを記録することにする。
    """
    rdp_shift = [N + 1] * K  # rdp_shift[j] = (右からi個を使って部分和jを作れるような最初のi)
    rdp_shift[0] = 0
    rdp = [0] * K  # rdp[i][j] = (a(-1),...,a(-i)の部分和でjを作れるか)
    rdp[0] = 1
    for i in range(1, N):
        rdp2 = [0] * K
        for j in range(K):
            if rdp[j] == 1:
                rdp2[j] = 1
            elif (j >= A[-i] and rdp[j - A[-i]] == 1):
                rdp2[j] = 1
                rdp_shift[j] = i
        rdp = rdp2

    ldp = [0] * K  # ldp[i][j] = (a1,...,aiの部分和でjを作れるか)
    ldp[0] = 1
    S = [0] * (K + 1)
    ans = 0
    for i in range(1, N + 1):
        # A[i]が不要かチェック
        for j in range(K):
            S[j + 1] = S[j]
            if rdp_shift[j] <= N - i:
                S[j + 1] += 1
        no_need = True
        for lval in range(K):
            if ldp[lval] == 0: continue
            rval = S[K - lval] - S[max(0, K - A[i] - lval)]
            if rval > 0:
                no_need = False
                break
        if no_need: ans += 1

        # ldp[i][:]の計算
        ldp2 = [0] * K
        for j in range(K):
            if ldp[j] == 1 or (j >= A[i] and ldp[j - A[i]] == 1):
                ldp2[j] = 1
        ldp = ldp2
    print(ans)
    

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

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

hats = A[:]
import copy
from collections import defaultdict
d = defaultdict(lambda: 0)

for h in hats:
    d[h] += 1

h1 = hats[0]
 
def search(now1, now2, count, d):
    try: 
        now1, now2 = now2, now1^now2
        if d[now2] > 0:
            if count == N:
                return True
            else:
                d[now1] -= 1
                return search(now1, now2, count+1, d)
        else:
            return False
    except:
        return False
    

ans = False
for h2 in hats[1:N//2+1]:
    if search(h1, h2, 2, copy.copy(d)):
        ans = True

if ans:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

hats = A[:]
import copy
from collections import defaultdict
d = defaultdict(lambda: 0)

for h in hats:
    d[h] += 1

def f():
    if len(d) == 3:
        xor = 0
        for key in d:
            xor ^= key
        if xor == 0:
            lsit_d = list(d.keys())
            if d[lsit_d [0]] == d[lsit_d [1]] and d[lsit_d [0]] == d[lsit_d [2]]:
                return 'Yes'
            else:
                return 'No'
        else:
            return 'No'

    if len(d) == 1:
        lsit_d = list(d.keys())
        if lsit_d [0] == 0:
            return 'Yes'
        
    if len(d) == 2:
        if d[0] * 2 == N - d[0]:
            return 'Yes'
    
    return 'No'
    
print(f())
### BUGGY CODE ###

import fractions
K = int(input())

result = 0
for k in range(1, K + 1):
  for l in range(1, K + 1):
    for m in range(1, K + 1):
      gcd_kl = fractions.gcd(k, l)
      gcd_klm = fractions.gcd(gcd_kl, m)
      result += gcd_klm

print(result)


### FIXED CODE ###

def euclid(a, b):
  division = a if (a > b) else b
  divider = b if (a > b) else a
  reminder = 0
  while divider != 0:
    reminder = division % divider
    division = divider
    divider = reminder
  
  return division

K = int(input())

result = 0
for k in range(1, K + 1):
  for l in range(1, K + 1):
    for m in range(1, K + 1):
      gcd = euclid(euclid(k, l), m)
      result += gcd

print(result)
### BUGGY CODE ###

n=int(input())
import fractions 
from functools import reduce
arr = list(map(int,input().split()))
 
 
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
 
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
    
a = lcm(arr)
 
ans = 0
 
for i in range(n):
    ans+= a//arr[i]
    
print(ans %(1000000000+7))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7
 
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
 
a = 1
for i in range(N):
    a = lcm(a, A[i])
 
ans = 0
for i in range(N):
    ans += a * pow(A[i], mod-2, mod)
 
print(ans % mod)
### BUGGY CODE ###

# D - Anything Goes to Zero
import sys
sys.setrecursionlimit(10**8)

N = int(input())
X = str(input())

def check(n, r):
    if n == 0:
        return print(r)
    d = str(bin(n)).count('1')
    check(n%d, r+1)

ones = X.count('1')
for i in range(N):
    e = -1
    if X[i] == '0':
        e = 1
    num = int(X, 2) + e * pow(2, N-1-i)
    check(num, 0)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)

N = int(input())
X = str(input())
ones = X.count('1')
intX = int(X, 2)
def check(n, r):
    if n == 0:
        return print(r)
    d = str(bin(n)).count('1')
    check(n%d, r+1)

if ones > 1:
    Xplus = intX % (ones + 1)
    Xminus = intX % (ones - 1)
else:
    Xplus = intX % (ones + 1)
    Xminus = intX

for i in range(N):
    e = 1
    if X[i] == '0':
        num = (Xplus + pow(2, N-1-i, ones + 1)) % (ones + 1)
    elif X[i] == '1' and ones > 1:
        num = (Xminus - pow(2, N-1-i, ones - 1)) % (ones - 1)
    else:
        num = (Xminus - pow(2, N-1-i))
        e = 0
    check(num, e)
### BUGGY CODE ###

def sum1(a):
  t = list(range(a))
  return sum(t)
def sum2(b,n):
  s = list(range(n-b+1,n+1))
  return sum(s)

N,K = map(int,input().split())
x = [0]*(N+2)
for k in range(K,N+2):
  x[k] = sum2(k,N) - sum1(k) + 1

print(sum(x) % (10**9 + 7))  

### FIXED CODE ###

N,K = map(int,input().split())
x = [0]*(N+2)
x[1] = 1
ans = 0
for i in range(2,N+2):
  x[i] = i + x[i-1]
for k in range(K,N+2):
  small = x[k]
  big = x[N+1] - x[N-k+1]
  ans += big - small + 1

print(ans % (10**9 + 7))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
# from itertools import accumulate #A = [0]+list(accumulate(A))
# import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

n = line_to_int()
a = line_to_list()
ans = a[0]

if 0 in a:
    print(0)
else:
    for i in range(1,n):
        ans = ans * a[i]
    if ans <= 10**18:
        print(ans)
    else:
        print(-1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
# from itertools import accumulate #A = [0]+list(accumulate(A))
# import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

n = line_to_int()
a = line_to_list()

# from functools import reduce, partial
# from operator import mul

# prod = partial(reduce, mul)

# if 0 in a:
#     print(0)
# else:
#     if prod(a) <= 10**18:
#         print(prod(a))
#     else:
#         print(-1)
ans = a[0]
limit = 10**18
if 0 in a:
    print(0)
else:
    for i in range(1,n):
        if ans <= limit:
            ans = ans * a[i]
        else:
            print(-1)
            exit()
    if ans <= limit:
        print(ans)
    else:
        print(-1)
### BUGGY CODE ###

"""
https://qiita.com/drken/items/03c7db44ccd27820ea0d


"""
def main():
        
    S = input()
    T = input()

    """
    dp[i+1]][j+1]
    Sのi番目とtのｊ番目まで見たときの共通する部分列の最大長さ
    """
    dp = [[0 for _ in range(len(T)+1)] for _ in range(len(S)+1)]

    prev = {}
    # 部分列の最大長さを求める
    for i, s in enumerate(S):
        for j, t in enumerate(T):
            if s == t:
                #i番目とｊ番目が同じなら、dp[i+1][j+1]はそれまでの最大長さ＋１
                dp[i+1][j+1] = dp[i][j] + 1
                prev[(i+1, j+1)] = (i,j)
            else:
                #異なる場合はdp[i][j]かd[i+1][j]かdp[i][j+1]のどれかだけども、後者ふたつがi,jより小さいことはないから後ろ二つの大きいほうを採用
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])
                prev[(i+1, j+1)] = (i+1,j) if dp[i+1][j] >= dp[i][j+1] else (i,j+1)

    i, j = len(S), len(T)

    substr = ""
    while i != 0 and j != 0:
        if S[i-1] == T[j-1]:
            substr +=S[i-1] 
        i,j = prev[(i,j)]

    print(substr[::-1])

if __name__ == "__main__":
    main()

### FIXED CODE ###

"""
https://qiita.com/drken/items/03c7db44ccd27820ea0d


"""
def main():
        
    S = input()
    T = input()

    """
    dp[i+1]][j+1]
    Sのi番目とtのｊ番目まで見たときの共通する部分列の最大長さ
    """
    dp = [[0 for _ in range(len(T)+1)] for _ in range(len(S)+1)]

    #prev = {}
    # 部分列の最大長さを求める
    for i, s in enumerate(S):
        for j, t in enumerate(T):
            if s == t:
                #i番目とｊ番目が同じなら、dp[i+1][j+1]はそれまでの最大長さ＋１
                dp[i+1][j+1] = dp[i][j] + 1
                #prev[(i+1, j+1)] = (i,j)
            else:
                #異なる場合はdp[i][j]かd[i+1][j]かdp[i][j+1]のどれかだけども、後者ふたつがi,jより小さいことはないから後ろ二つの大きいほうを採用
                dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])
                #prev[(i+1, j+1)] = (i+1,j) if dp[i+1][j] >= dp[i][j+1] else (i,j+1)

    i, j = len(S), len(T)
    """
    なんかi+1,j+1がどのDPノードから更新されてできたのかをたどって、S[i],T[j]が同じであればそれを部分列に加えられるから～みたいな感じで部分列の後ろから作って最後にひっくり返すといいらしい
    
    """

    substr = ""
    while i != 0 and j != 0:
        # 同じ文字で＋１になっていた場合、その文字を部分列に加える
        if S[i-1] == T[j-1]:
            substr += S[i-1]
            i,j = i-1, j-1
        else:
            i,j = (i, j-1) if dp[i][j-1] >= dp[i-1][j] else (i-1, j)


    #TLEなのでやめた
    """
    while i != 0 and j != 0:
        if S[i-1] == T[j-1]:
            substr +=S[i-1] 
        i,j = prev[(i,j)]
    """
    print(substr[::-1])

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

n = int(input())
def factorization(n):
    res = 1
    tmp = n
    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 1
            while tmp % i == 0:
                cnt += 1
                tmp //= i

            res *= cnt

        if tmp == 1:
            break
    if tmp != 1:
        res *= 2

    return res

ans = 0
for k in range(1, n+1):
    ans += k * factorization(k)

print(ans)

### FIXED CODE ###

n = int(input())

ans = 0
for i in range(1, n+1):
    x = n // i
    ans += i * x * (x + 1) // 2

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

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w = map(int, input().split())
ch,cw = map(int, input().split())
dh,dw = map(int, input().split())
ch -= 1
cw -= 1
dh -= 1
dw -= 1
rows,cols = h,w

OK = "."
NG = "#"

from collections import defaultdict

ns = defaultdict(set)
ss = [None] * rows
for i in range(rows):
    s = input()
    ss[i] = s
n = rows * cols
start = ch*w+cw
goal = dh*w+dw
seen = [None]*n
seen[start] = 0
from heapq import heappop as hpp, heappush as hp
q = [(0, start)] # ワープ回数, 現在位置, 最後の道の位置
# dx = [0,1,0,-1]
# dy = [1,0,-1,0]
dx = []
dy = []
vvs = []
e = 10**-9

for i in range(3):
    for j in range(-2,3):
        if not (i==j==0):
            dx.append(i)
            dy.append(j)
            if abs(i)+abs(j)>1:
                vvs.append(1)
            else:
                vvs.append(e)
data = []
rs = []
cs = []
for pu in range(n):
    ux,uy = divmod(pu,w)
    if ss[ux][uy]=="#":
        continue
    for xx,yy,vv in zip(dx,dy,vvs):
        x,y = ux+xx, uy+yy
        if x<0 or y<0 or x>=h or y>=w or ss[x][y]=="#":
            continue
        u = x*w + y
        data.append(vv)
        rs.append(pu)
        cs.append(u)
        
import scipy.sparse
m = scipy.sparse.csr_matrix((data, (rs, cs)), shape=(n, n))
ans = scipy.sparse.csgraph.dijkstra(m, indices=start, directed=False) # startからの最短路木を求める
if ans[goal]>10**9:
    print(-1)
else:
    print(int(ans[goal]))

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


h,w = map(int, input().split())
ch,cw = map(int, input().split())
dh,dw = map(int, input().split())
ch -= 1
cw -= 1
dh -= 1
dw -= 1
rows,cols = h,w

OK = "."
NG = "#"

from collections import defaultdict

ns = defaultdict(set)
ss = [None] * rows
for i in range(rows):
    s = input()
    ss[i] = s
n = rows * cols
start = ch*w+cw
goal = dh*w+dw
seen = [None]*n
seen[start] = 0
from heapq import heappop as hpp, heappush as hp
q = [(0, start)] # ワープ回数, 現在位置, 最後の道の位置
# dx = [0,1,0,-1]
# dy = [1,0,-1,0]
dx = []
dy = []
vvs = []
for i in range(-2,3):
    for j in range(-2,3):
        if not (i==j==0):
            dx.append(i)
            dy.append(j)
            if abs(i)+abs(j)>1:
                vvs.append(1)
            else:
                vvs.append(0)
while q:
    pnum,pu = hpp(q)
    ux,uy = divmod(pu,w)
    # print(pnum,divmod(pu,w))
    if pu==goal:
        break
    for xx,yy,vv in zip(dx,dy,vvs):
#         x = ux+xx
#         y = uy+yy
        x,y = ux+xx, uy+yy
        u = x*w + y
        num = pnum+vv
        if x<0 or y<0 or x>=h or y>=w or ss[x][y]=="#":
            continue
#         print(x,y)
        if seen[u] is None or seen[u]>num:
            seen[u] = num
            hp(q, (num, u))
val = seen[goal]
if val is None:
    print(-1)
else:
    print(val)
### BUGGY CODE ###

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

a = [0] * N
for k in range(K):
    if a[0] >= N:
        break
    a = [0] * N
    for i in range(N):
        a[max(0, i - A[i])] += 1
        if N - 1 >= (A[i] + i + 1):
            a[A[i] + i + 1] -= 1
    for j in range(N):
        A[j] = A[j - 1] if j > 0 else 0
        A[j] += a[j]
    # print("k=", k, A)


for i in range(N):
    print(A[i], end="")
    if i < N - 1:
        print(" ", end="")
print()


### FIXED CODE ###

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

a = [0] * N
for k in range(K):
    for i in range(N):
        a[max(0, i - A[i])] += 1
        if N - 1 >= (A[i] + i + 1):
            a[A[i] + i + 1] -= 1

    if a[0] == N:
        A = [N] * N
        break
    for j in range(N):
        A[j] = A[j - 1] if j > 0 else 0
        A[j] += a[j]
        a[j] = 0
    # print("k=", k, A)


for i in range(N):
    print(A[i], end="")
    if i < N - 1:
        print(" ", end="")
print()
### BUGGY CODE ###

import collections

a = int(input())
b = []
for _ in range(a):
  b.append(list(input()))

ans = 0
for i in range(a):
  for j in range(i+1, a):
    check = True
    if collections.Counter(b[i]) != collections.Counter(b[j]):
      check = False
    if check == True:
      ans += 1
print(ans)

### FIXED CODE ###

a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

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

s = input()
li = []
for i in range(len(s)):
    for j in range(len(s)):
        if s[i] == "A" and s[j] == "Z" and i < j:
            li.append(j - i + 1)
print(max(li))

### FIXED CODE ###

s = input()
for i in range(len(s)):
    if s[i] == "A":
        start = i
        break
for j in range(len(s) - 1, -1, -1):
    if s[j] == "Z":
        end = j
        break
print(end - start + 1)
### BUGGY CODE ###

n,k=map(int,input().split())
h=[int(input()) for i in range(n)]
h.sort()
ans=1000000000
for j in range(len(h)-2):
    c=h[j:j+k]
    ans=min(ans,c[-1]-c[0])
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
h=[int(input()) for i in range(n)]
h.sort()
print(min([x-y for (x,y) in zip(h[k-1:],h[:-k+1])]))
### BUGGY CODE ###

import bisect
n,m=map(int,input().split())
A=list(map(int,input().split()))
for _ in range(m):
  A[A.index(max(A))]//=2
print(sum(A))

### FIXED CODE ###

import heapq
n,m=map(int,input().split())
A=list(map(int,input().split()))
hq=[]
for i in A:
  heapq.heappush(hq,-i)
for _ in range(m):
  m=-((-heapq.heappop(hq))//2)
  heapq.heappush(hq,m)
print(-sum(hq))
### BUGGY CODE ###

import sys
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
P = [i for i in P if 1 <= i and i <= 10**3]
Q = [] # 期待値リスト
R = []
r = 0
if not 1 <= K <= N <= 2*10**5:
    sys.exit()
for i in range(N):
    q = (1 + P[i]) / 2
    Q.append(q)
for j in range(N-K+1):
    r_max = sum(Q[j:j+K])
    if r <= r_max:
        r = r_max
print(r)

### FIXED CODE ###

import sys

N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
P = [i for i in P if 1 <= i and i <= 10**3]
Q = [] # 期待値リスト
S = [] # 累積和
T = [] # 隣接するK個の期待値
s=0

if not 1 <= K <= N <= 2*10**5:
    sys.exit()

for i in range(N):
    # q = sum(range(1, P[i]+1)) / P[i]
    q = (1 + P[i]) / 2
    Q.append(q)
    s += q
    S.append(s)
    if i == K-1:
        T.append(S[i])
    if i > K-1:
        T.append(S[i]-S[i-K])
print(max(T))