peterverebics/CodeNet_Python_118 huggingface dataset:
n, k = map(int, input().split())
p = list(map(int, input().split()))
 
def S(n):
  return n * (n + 1) // 2
 
b = 0
s = sum(p[:k])
for i in range(k, n):
  tmp = s - p[i - k] + p[i]
  if tmp > s:
    s = tmp
    b = i - k + 1
ans = 0
for i in range(b, b + k):
  ans += S(p[i]) / p[i]
  
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))


def calc(value):
    return value * (value + 1) / value


max_value = 0
for i in range(k):
    max_value += calc(p[i])

cur = max_value
for l in range(k, n):
    cur += (calc(p[i]) - calc(p[l]))
    max_value = max(max_value, cur)
print(max_value)
N, K = map(int, input().split())
ilist = list(map(int,input().split()))
max_dice = sum(ilist[:K])
ind = 0
i = 1
if N == K:
    print((sum(ilist)+K)/2)
else:
    while True:
        s = max_dice - ilist[i-1] + ilist[i+K-1]
        if s > max_dice:
            max_dice = s
            ind = i
        if i == N-K:
            break
        else:
            i += 1
    max_p = (sum(ilist[ind:ind+K])+K)/2
    print(max_p)
n,k=map(int,input().split())
l=list(map(int,input().split()))

lis=[0]*n
for i in range(len(l)):
  lis[i]+=(l[i]+1)+lis[i-1]

ans=0

for i in range(n-k):
  num=lis[i+k]-lis[i]
  ans=max(num,ans)
  
print(ans/2)
N, K = map(int, input().split())
P = [(int(i)+1)/2 for i in input().split()]

wa_temp = sum(P[0:K])
max_wa = wa_temp

for i in range(N-K):
    wa_temp = wa_temp - P[i] + P[i+K]
    if wa_temp > max_wa:
        max_wa = wa_temp
    print(max_wa)
print(max_wa)
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())
def NIJIGEN(H): return [list(input()) for i in range(H)]
N,M=MAP()
L=LIST()
maxa=-1002
sums=sum(L[:M])+M
for i in range(N-M):
  sums=sums-L[i]+L[i+M]
  maxa=max(maxa,sums)
print(maxa/2)
n,k=map(int,input().split())
*d,=list(map(int,input().split()))
 
def e(n):
    ex=(1+n)/2
    return ex
    
dex=[e(i) for i in d]

fst=0
for i in range(k):
    fst+=dex[i]

for i in range(n-k):
    x=fst-dex[i]+dex[i+k]
    fst=max(x,fst)
        
print(fst)
N, K = map(int, input().split())
p = input().split()
ex = [0 for i in range(N)]
E=0
S=0
def expectation(n):
    return (n+1)/2


for i in range(N):
    p[i] = int(p[i])
    ex[i] = expectation(p[i])

X = N-K+1
for i in range(X):
    newS = 0
    k =0
    for j in range(K):
        newS += p[i+j] 
        

    if newS > S:
        S = newS
        k=i

for j in range(K):
    E += ex[k+j]

print(E)
n,k = map(int, input().split())
p = [int(e) for e in input().split()]

e = [(q+1.0)/2 for q in p]

max = 0
for i in range(n-k+1):
  j = i
  s = 0
  for j in range(k):
    s += e[j]
    j += 1
  if max < s:
    max = s
    
print(max)
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines  

N, K = map(int, input().split())
P = list(map(int, input().split()))
P = [(1+p)/2 for p in P]

ans = 0
for i in range(N-K):
  ans = max(ans, sum(P[i:i+K]))
print(ans)
N,K = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
for i in range(N):
    p[i] = (1+p[i])/2
s = sum(p[:K])
max_s = s
for i in range(N-K):
    if max_s < sum(p[i:K+i]):
        max_s = sum(p[i:K+i])

print(max_s)
N, K = map(int,input().split())
p = list(map(int, input().split()))
num = 0
exp = 0
for i in range(N-K):
  if p[i]<p[i+K]: num = i+K  
for i in range(K):
  exp += (p[num-i]+1)/2
print(exp)
N,K = map(int,input().split())
ds = list(map(int,input().split()))
out = 0
for i in range(N-2):
    out = max(out,sum(ds[i:i+K]))
print((out+K)/2)
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

sum = 0
ans = 0

for i in range(a[0]):
    sum += (1 + b[i])/2
    if i > a[1]-1:
        sum -= (1 + b[i-a[1]])/2
        if ans < sum:
            ans = sum

print(ans)
#154_D
n, k = map(int, input().split())
p = [(int(x)+1) / 2 for x in input().split()]
p.sort(reverse= True)
print(sum(p[:k]))
N, K = map(int, input().split())
P = list(map(int, input().split()))

wa = sum(P[:K])
ind = 0
for i in range(1, N - K+1, 1):
    tmp = wa + P[i+K-1] - P[i-1]
    if tmp > wa:
        wa = tmp
        ind = i
    else:
        pass

# 期待値を求める
ans = 0

for i in range(ind, ind+K, 1):
    now = P[i]
    ans += (now+1) * now / (2 * now)
print("{:.10f}".format(ans))
def main():
    """"ここに今までのコード"""
import sys
input = sys.stdin.readline

N,K=map(int,input().split())
p=list(map(int,input().split()))
t=0
k=sum(p[0:K])

for i in range(N-K):
  k-=p[i]
  k+=p[i+K]
  if k>t:
    t=k
    
print((K+t)/2)

if __name__ == '__main__':
    main()
n, k = map(int, input().split())
p_list = list(map(float, input().split()))

S_i = []
S_i.append((p_list[0] + 1) / 2)

for i in range(1, n):
    S_i.append(S_i[i-1] + ((p_list[i] + 1) / 2))    

result_max = 0
for j in range(n):
    cad_max = S_i[j] - S_i[j-k]
    result_max = max(cad_max, result_max)

print(result_max)
n,k = map(int, input().split())
p = list(map(int, input().split()))
tmp = sum(p[0:k])
for i in range(n-k):
    tmp = max(tmp, tmp-p[i]+p[i+k])
    #print(sum(p[i:i+k-1]))
print((tmp+k)/2)
A = list(map(int, input().split()))
B = list(map(int, input().split()))
k = [(i+1)/2 for i in B]
h = []
z = []
m = 0
for l in range(A[0]):
  m = m + k[l]
  h.append(m)
for l in range(A[1]-1, A[0]):
	x = h[l] - h[l-(A[1])]
	z.append(x)
print(max(z))
n,k = map(int,input().split())
P = list(map(int,input().split()))
ans_list = []
for i in range(k):
  ans = (sum(P[i:k+i])/2) + (k/2)
  ans_list.append(ans)
print(max(ans_list))
N, K = map(int, input().split())
p = list(map(int, input().split()))

max_val = 0
max_idx = 0
for i in range(1,N-K+1):
  tmp = sum(p[i-1:i-1+K])
  if tmp > max_val:
    max_val = tmp
    max_idx = i
    
expect = 0.0
for i in range(max_idx, 2*max_idx+1):
  tmp = 0.0
  for j in range(1,p[i-1]+1):
    tmp += j
  expect += tmp/p[i-1]
print(expect)
N, K = map(int, input().split())
pi = list(map(int, input().split()))

max = 0
for i in range(N - K):
    tmp = sum(pi[i : i + K])
    if tmp > max:
        max = tmp

if N == K:
    max = sum(pi)

out = (max + K) / 2

print(out)
def main():
    n, k = map(int, input().split())
    dice_num = list(map(int, input().split()))
    result = 0

    dice_num.sort(reverse=True)
    for i in range(0, k):
        dice = dice_num[i]
        dice_sum = 0
        for i in range(1, dice + 1):
            dice_sum += i
        if dice_sum != 0:
            result += dice_sum / dice

    print(result)


if __name__ == "__main__":
    main()
def solve():
    N,K = [int(i) for i in input().split()]
    P = [int(i) for i in input().split()]
    prev_K_sum = max_K_sum = sum(P[:K])
    start = 0
    for i in range(N-K):
        cur_K_sum = prev_K_sum - P[i] + P[K]
        if cur_K_sum > max_K_sum:
            start = i + 1
        prev_K_sum = cur_K_sum
    target = P[start:start+K]
    ans = sum([(num+1)/2.0 for num in target])
    print(ans)

if __name__ == "__main__":
    solve()
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
p.sort(reverse=1)
print((sum(p[:k])+k)/2)
n,k = map(int,input().split())
P = list(map(int,input().split()))
P.sort(reverse=True)
print(P)
print(sum(P[:k])/2 + k/2)
nk = input().split()
tmp = input().split()
n = int(nk[0])
k = int(nk[1])

s = [0]*n
hai = [0]*n
max = 0

for i in range(n):
  hai[i] = (sum(range(int(tmp[i])))+int(tmp[i]))/int(tmp[i])
print(s)
for i in range(n):
  for j in range(4):
   t = sum(hai[(i-j):(i+k-j)])
   if max < t :
      max = t
print(max)
N,K=map(int,input().split())
p=list(map(int,input().split()))

def E(x):
    z=1/x*(1+x)*x/2
    return z
p.sort(reverse=True)
c=0
for i in range(K):
    z=E(p[i])
    c+=z
print(c)
N, K= map(int, input().split())
p = list(map(int, input().split()))

exp_v = []
for dice in p:
    val = 0
    for i in range(1,dice+1):
        val += i
    exp_v.append(val/dice)

ans = 0

for k in range(1,N-K+1):
    ans = max(ans,sum(exp_v[k:k+K]))
# print(exp_v)
print(ans)
N, K=map(int, input().split())
Pn=list(map(int, input().split()))
V = [0] * N
ans = 0
for n in range(N-K):
    tmp = 0
    for i in range(K):
        V[n+i] = (0.5*Pn[n+i]*(Pn[n+i]+1))/Pn[n+i]
        tmp += V[n+i]
    ans = max(ans, tmp)

print(ans)
N, K = map(int, input().split())
p = list(map(int, input().split()))
max_val = 0
temp = 0
index = 0

for i in range(0, N-K):
    for j in range(i, i+K):
        temp += p[j]
    if max_val < temp:
        max_val = temp
        index = i

sum_value = 0

for i in range(index, index+K):
    sum_value += (p[i]+1) / 2
print(sum_value)
N, K = map(int, input().split())
p_list = list(map(int, input().split()))

c_s_list = [] #Cumulative sum_list
c_sum = 0 #Cumulative sum
for dice in p_list:
    average = (dice + 1) / 2 #ダイスの期待値
    c_sum += average
    c_s_list.append(c_sum)

ans = 0
for i in range(N-K):
    tmp = c_s_list[i+K] - c_s_list[i]
    if tmp > ans:
        ans = tmp
print(ans)
nk = input().split()
tmp = input().split()
n = int(nk[0])
k = int(nk[1])

hai = [0]*n
max = 0

for i in range(n):
  hai[i] = (sum(range(int(tmp[i])))+int(tmp[i]))/int(tmp[i])
  if k<=i:
   for j in range(k):
    t = sum(hai[(i-j):(i+k-j)])
    if max < t :
       max = t
print(max)
import numpy as np

NK = input().split()
N = int(NK[0])
K = int(NK[1])
P = input().split()
P = np.array([int(p) for p in P])
sP = np.sort(P, kind='quick_sort')[::-1]
per = 1/sP
wa = sP*(sP+1)/2

s = wa*per
s = s[0:K].sum()
print(s)
# 和の期待値は期待値の和
# それぞれ期待値を出したあとは大きさKの区間和の最大値
# n(n+1)/2
n, k = map(int, input().split())
p = []
for x in list(map(int, input().split())):
    p.append((x * (x + 1) // 2) / x)

ans = 0
tmp = 0
for i in range(n):
    tmp += p[i]
    if i >= k:
        tmp -= p[i - k]
        ans = max(ans, tmp)

print(ans)
N, K = map(int, input().split())
list=list(map(int, input().split()))
m=0
for i in range(N+K-1):
    m=max(m, sum(list[i:i+K-1]))
    if m == sum(list[i:i+K-1]):
        n = i
a=list[n:n+K]
print(a)
su=0
for i in a:
    su+=(i*(1/2)+1)
print(su)
N,K = list(map(int,input().split()))
P = list(map(int,input().split()))

A =[]
for i in range(N):
    A.append(P[i]+1)

from itertools import accumulate
B = list(accumulate(A))
#print(A)

ans = 0
if len(A) == K:
    ans = sum(A)/2
else:
    for i in range(K,N):
        ans=max(ans,(A[i]-A[i-K])/2)
print(ans)
N,K=map(int,input().split())
*p,= map(int, input().split())

def ex(n):
    return (1+n)/2
def  ex3(p):
    return sum([(n+1)/2 for n in p])
dp=[0 for _ in range(N)]

mi=0
dp[0]=sum(p[0:K])
for i in range(N-K):
    if p[i]<p[i+K]:
        dp[i+1]=dp[i]+p[i+K]-p[i]
        mi=i+1
    else:
        dp[i+1]=dp[i]
print(ex3(p[mi:mi+K]))
n,k = map(int, input().split())
p = [int(e) for e in input().split()]

max = 0
for i in range(n-k+1):
  j = i
  s = 0
  for j in range(k):
    s += p[j]
    j += 1
  if max < s:
    max = s
  i += 1
    
print((max+k)/1.0)
#!/usr/bin/env python3
def main():
    def expected_val(limit):
        return sum(range(limit + 1)) / limit

    N, K = map(int, input().split())
    P = [int(x) for x in input().split()]

    lst = []
    res = 0
    for p in P:
        res += expected_val(p)
        lst.append(res)
    ans = 0
    for i in range(N - K):
        for k in range(K + 1):
            ans = max(ans, lst[i + k] - lst[i])
    print(ans)


if __name__ == '__main__':
    main()
N,K = map(int,input().split())
pi = list(map(int,input().split()))
pi.sort(reverse=True)

ans = 0
for p in pi[:K]:
  ans += (p+1)/2
print(ans)
def dice_in_line(k, p_list):
    max_line = [0 for i in range(k+1)]
    for i in range(len(p_list)-2):
        if sum(p_list[i:i+k]) > max_line[-1]:
            max_line = p_list[i:i+k]
            max_line.append(sum(max_line[0:k]))
    return (max_line[-1]+k)/2.0

n, k = [int(i) for i in input().split()]
p_list = [int(p) for p in input().split()]

print(float(dice_in_line(k, p_list)))
import numpy as np
N, K = map(int, input().split())
P = np.array(input().split(), dtype=int)
# 期待値に変換
Q = P/2 + 0.5
# 累積和をとる
S = Q.cumsum()
# K範囲での最大値
if N==K:
    S[-1]
else:
	T = S[K:] - S[:-K]
	print(max(T))
n, k = map( int, input().split() )
p = list( map( int, input().split() ) )

sum_k = sum( p[ : k ] )
max_sum_k = 0

for i in range( k, n ):
    sum_k += p[ i ] - p[ i - k ]
    if sum_k > max_sum_k:
        print( i )
        max_sum_k = sum_k

print( ( max_sum_k + k ) / 2 )
import sys

def main():
    
    #sys.stdin = open('input154d.txt')

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

    sortp = sorted(p, reverse=True)

    sum = 0
    for i in range(k):
        sum += sortp[i] * (sortp[i] + 1) / 2 / sortp[i]
        
    print(sum)
if __name__ == '__main__':
    main()
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
p = 0
q = 0
ma = 0
for i in range(1,N-K):
  for j in range(K):
    q += P[j+i]
    if ma < q:
      p = i
      ma = q
#print(p)
s = 0
for i in range(p, p+K):
  for j in range(1, 1+P[i]):
    s += (j)*(1/P[i])
print(s)
def kitai(num):
    k = 0.0000000000
    for ni in range(1, num + 1):
        k += ni / num
    return k

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

max_sum = 0
ind = 0
for i in range(n-k+1):
    tmp_sum = sum(p[i:i+k])
    if(max_sum < tmp_sum):
        ind = i

nums = p[ind: ind+k]

r = 0.0000000000
for num in nums:
    r += kitai(num)

print(r)
n,k = map(int,input().split())
p_list = list(map(int,input().split()))
ans = 0
save = 0
sum = 0
ans_o = 0
for j in range(k):
    ans_o += p_list[0 + j]
for i in range(1,n-k+1):
    ans = ans_o-p_list[i-1]+p_list[i+k-1]
#    print(ans)
    if ans > ans_o:
        save = i
    ans_o = ans
for i in range(save,save+k):
    sum += p_list[i]*0.5 + 0.5
print(sum)
N, K = map(int, input().split())
p = list(map(int, input().split()))

for i in range(N):
  p[i] = (p[i]+1)/2

# 累積和を用いる
S = [0]*N
S[0] = p[0]
for i in range(N-1):
  S[i+1] = S[i] + p[i+1]
print(p, S)

ans = 0
for i in range(N-K):
  ans = max(ans, S[i+K]-S[i])

print(ans)
N = input()
M = list(map(int,input().split()))
X = set(M)
Y = len(X)

if N == Y:
    print("YES")
else:
    print("NO")
# 初期入力
#import numpy as np
import sys
input = sys.stdin.readline
N,K = (int(i) for i in input().split())
p = list(map(int, input().split()))

expected_value =[(i+1)/2 for i in p] #各さいころの期待値

#隣接する数列の和
adjacent_sum =[0]*N
adjacent_sum[0] =sum(expected_value[:K])
ans =[0]*N
ans[0] =adjacent_sum[0]/K
for i in range(1,N-K+1):
    adjacent_sum[i] =adjacent_sum[i-1] -expected_value[i-1] +expected_value[i+K-1]
    ans[i] =adjacent_sum[i] 
print(max(ans))
import sys
input = sys.stdin.readline
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
E = [0]*N

for i in range(N-K+1,N):
  E[i] = (p[i]+1)/2

for i in range(N-K+1):
  E[i] = (p[i]+1)/2
  if i == 0:
    ans = sum(E[i:i+K])
  else:
    ans = max(ans,sum(E[i:i+K]))
print(ans)
N, K = map(int, input().split())
dices = list(map(int, input().split()))

exv = [(e+1)/2 for e in dices]
temp = sum(dices[0:K])
result = temp
for i in range(N-K):
    temp -= dices[i]
    temp += dices[i+K]
    if temp > result:
        result = temp
print(result)
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
B = A[-K:]
print((1/2)*(sum(B)+K))
n, k = map(int, input().split())
p = list(map(int, input().split()))

kitaiti = [0 for _ in range(n)]
ruisekiwa = [0 for _ in range(n)]
l = 0
r = k - 1
max = 0

for i in range(n):
    kitaiti[i] = (p[i]+1) / 2
    if i == 0:
        ruisekiwa[0] = kitaiti[0]
    else:
        ruisekiwa[i] = ruisekiwa[i-1] + kitaiti[i]
    if i > r:
        now = ruisekiwa[i] - ruisekiwa[i-r-1]
        if now > max:
            max = now
print(max)
N,K=map(int,input().split())
p = list(map(int,input().split()))

pp=[0]*N
for i in range(N):
    pp[i]=(p[i]+1)/2
sum=0
for i in range(0,K):
    sum+=pp[i]
for i in range(0,N-K):
    sum=max(sum,sum-pp[i]+pp[i+K])
print(sum)
n, k = map(int, input().split())
pl = list(map(int, input().split()))

def cal_p(x):
    return x*(x+1)/2/x

tmp = []
ans = 0
for p in pl:
    tmp. append(cal_p(p))

for i in range(k, n):
    psum = sum(tmp[i+1-k:i+1])
    if psum > ans:
        ans = psum

print(ans)
N,K=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]
e=[(i+1)*0.5 for i in p]
ex=[]

for i in range(N):
  if i==0:
    ex.append(e[0])
  else:
    ex.append(ex[i-1]+e[i])

ans=0
for i in range(N-K):
  if ans<ex[i+K]-ex[i]:
    ans=ex[i+K]-ex[i]
print(ans)
def DE(n):
    return float((n+1)/2)

def main():
    N,K = map(int,input().split())
    p = list(map(int,input().split()))
    ls = p[:K]
    ans = sum(list(map(DE,ls)))
    for i in range(K,N):
        tmp = ans - DE(p[i-K]) + DE(p[i])
        if tmp >= ans:
            ans = tmp
    print(ans)

if __name__ == '__main__':
    main()
n, k = map(int, input().split())
p = list(map(int, input().split()))

num_li = [0]*n
ans = 0
num = 0

for i in range(n):
    num_li[i] = ((p[i]*(p[i]+1))/2)/p[i]

num = sum(num_li[:k])


for j in range(n-k):
    num = num-num_li[j]+num_li[j+k]
    ans = max(num,ans)

print(ans)
n,k = map(int,input().split())
p = list(map(int,input().split()))
sum = [0]*n
sum[0] = (1+p[0])/2
ans = 0

for i in range(n-1):
  sum[i+1] += sum[i] + (1+p[i+1])/2
  
for j in range(k,n):
  ans = max(ans,sum[j]-sum[j-k])
  
print(ans)
#模範解答の通りにやってみる
N,K=map(int,input().split())
P=list(map(int,input().split()))
S=[]
if K==1:
	print((max(P)+1)/2)
elif N==K:
	print((sum(P)+N)/2)
else:
	for k in range(1,N+1):
		S.append(sum(P[0:k]))
	print(S)
	T=[S[K-1]]
	for n in range(0,N-K):
		T.append(S[n+K]-S[n])
	print(T)
	print((max(T)+K)/2)
n, k = map(int, input().split())
l = list(map(int, input().split()))
max_l = 0
max_i = 0
ans = 0
if k == 1:
    a = max(l)
    print(a * (a + 1) / 2 / a)
else:
    for i in range(n - k + 1):
        if max_l < sum(l[i:i+k]):
            max_i = i
            max_l = sum(l[i:i+k])
for i in range(k):
    a = l[max_i + i]
    ans += a * (a + 1) / 2 / a
print(ans)
n,k =map(int,input().split())
p = list(map(int,input().split()))
kitai = []
for i in range(1,n+1):
    sum_k = 0
    for j in range(1,p[i-1]+1):
        sum_k += j *(1/p[i-1])
    kitai.append(sum_k)
ans = []
sum_ans = 0
for i in range(k):
    sum_ans += kitai[i]
ans.append(sum_ans)
j = 0
cnt = 0
for i in range(k,len(kitai)-1):
    sum_ans = ans[cnt]
    sum_ans -=kitai[j] 
    sum_ans += kitai[i]
    j +=1
    cnt+=1
    ans.append(sum_ans)
print(max(ans))
if __name__ == '__main__':
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    acc = 0
    acc_P = []
    
    if N==1:
        print((1+P[0]/2))
        quit()

    for p in P:
        acc += p
        acc_P.append(acc)
    max_sum = 0
    for i in range(N-K):
        max_sum = max(max_sum, (K+acc_P[i+K]-acc_P[i])/2)
    ans = max_sum
    print('{:.16f}'.format(ans))
N, K = map(int, input().split())
P = list(map(int, input().split()))

res = 0

P2 = []
for i in P:
  P2.append(1 + 0.5 * (i - 1))
num = 0
for i in range(K):
  num += P2[i]
res = num
for i in range(1,N-K+1):
  temp = num + P2[i+K-1] - P2[i-1]
  if temp > num:
    res = temp
  num = temp
  
print(res)
N, K = list(map(int, input().split()))
P = list(map(int, input().split()))
p = 0
q = 0
ma = 0
for i in range(0,N-K+1):
  for j in range(K):
    q += P[j+i]
    if ma < q:
      p = i
      ma = q
#print(p)
s = 0
for i in range(p, p+K):
  for j in range(1, 1+P[i]):
    s += (j)*(1/P[i])
print(s)
n, k = map(int, input().split())
p = list(map(int, input().split()))

l = 0
r = k
tmp = sum(p[:k])
ans = sum(p[:k])
ansl = 0
ansr = 0
for i in range(n - k + 1):
    tmp = sum(p[i:i + k])
    # print(i,i+k,tmp)
    if tmp > ans:
        ansl = i
        ansr = i + k-1
# print(ansl, ansr)
ans2 = 0
for i in range(ansl, ansr + 1):
    ans2 += (p[i] + 1) / 2
print(ans2)
n,k=map(int,input().split())
a=[int(s) for s in input().split()]
b=[0]*k
c=0
v=[0]*n
v[0]=a[0]
for i in range(n-1):
    v[i+1]=v[i]+a[i+1]
mx=v[k-1]
for i in range(k,n):
    g=v[i]-v[i-k]
    print(mx)
    print(g)
    mx=max(mx,g)  
    
print((mx+k)/2)
N, K = map(int, input().split())
P = list(map(int, input().split()))

max_idx_left = 0
for i in range(1, N-K+1):
    if P[i+K-1] > P[i-1]:
        max_idx_left = i

print(sum([(1+p)/2 for p in P[max_idx_left:max_idx_left+K]]))
N, K = map(int, input().split())
P = list(map(int, input().split()))
total = 0
index = 0

if (K == 1):
    print(max(P))
    exit()


for i in range(len(P) - (K - 1)):
    tmp = sum(P[i: i + K])

    if (tmp > total):
        index = i
        total = tmp

answer = (sum(P[index: index + K]) + K) / 2

print(answer)
def Csum(a):
    b,c=[0],0
    for i in range(len(a)):
        c+=a[i]
        b.append(c)
    return b
n,k=map(int,input().split())
p=Csum(list(map(int,input().split())))
ans=0
for i in range(n-k+1):
    ans=max(ans,p[i+k]-p[i])
print(ans)
print((ans+k)/2)
import sys
from collections import defaultdict
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

d = defaultdict(float)
for i in range(1, 1000):
    j = i
    while 0 < j:
        t = j * (1 / i)
        d[i] += t
        j -= 1

sum = [0.0]*(n+1)
for i in range(n):
    sum[i+1] = sum[i] + d[p[i]]

ans = 0
for i in range(k-1, n+1):
    tmp = sum[i] - sum[i-k]
    ans = max(ans,tmp)

print('{:6f}'.format(ans))
N, K = map(int, input().split())
p = [int(x) for x in input().split()]

P = sum(p[:K])
n = 0
for i in range(1, N-K+1):
  a = P - p[i-1] + p[i+K-1]
  if P < a:
   P = a
   n = i

ans = 0
for j in range(K):
  ans += (p[n+j] + 1) /2
print(ans)
from decimal import Decimal

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

e = []
for i in p:
    e.append((1+i)*i/2/i)

l = 0
s = sum(e[:k-1])
for i in range(n-k):
    tmp = s + e[i+k] - e[i]
    if tmp > s:
        s = tmp
        l = i + 1

print(sum(e[l:l+k]))
N, K = map(int, input().rstrip().split())
Ps = [int(x) for x in input().rstrip().split()]

Ps_sum_list = []
Ps_sum = 0
for x in Ps:
    Ps_sum += x
    Ps_sum_list.append(Ps_sum)

max_val = 0
for i in range(N-K):
    val = Ps_sum_list[i+K] - Ps_sum_list[i]
    if val > max_val:
        max_val = val
print((max_val + K) / 2)
n,k = map(int,input().split())
p = list(map(int,input().split()))

p.reverse()

c=0

for i in range(0,k):
  z=0
  for j in range(0,p[i]+1):
    z+=j
#  print(z)
#  print(p[i])
  c+=z/p[i]
print(c)
N,K = map(int,input().split())
p = list(map(int,input().split()))
an = 0
if K == 1:
  ans = (max(p)+1)/2
  
  flag = False
else:
  for i in range(N-K+1):
    su = sum(p[i:i+K])
    print(su)
    if su > an:
      an = su
      print("kousin")
    if i+K+1 <= N-1:
      su -= p[i] - p[i+K+1]
  ans = an/2 + K/2
print(ans)
def kitaiti(number):
    count = 0
    for i in range(1,number + 1):
        count += (i / number)
    return count
def dp(mylist,K,N):
    i = 0
    count = sum(mylist[i:K + i])
    while K + i < N:
        i += 1
        if mylist[i -1] < mylist[i-1 + K]:
            count = sum(mylist[i:K + i])
    return count
N,K = (int(i) for i in input().split())
p = [int(x) for x in input().split()]

kitaiti = [kitaiti(x) for x in p]

print(dp(kitaiti,K,N))
N,K=map(int,input().split())
p=list(map(int,input().split()))
def P(x):
    return (x+1)/2
a=0
y=0
for i in range(N-K+1):
    y+=P(p[i])
    if i>=K:
        y-=P(p[i-K])
    if a<y:
        a=y
print(a)
N, K = map(int, input().split())
A = [int(i) for i in input().split()]

def ev(n):
    return (n+1)/2

A = [ev(i) for i in A]

if N == K:
    print(sum(A))

i = 0
total = sum(A[0:K])
mx = total

#N = 4
#K = 3


while i < N - K:
    total += A[i+K] - A[i]
    mx = max(mx, total)
    i += 1

print(mx)
n, k = map(int, input().split())
arr = list(map(int, input().split()))
s = 0
for i in range(0, n-k):
    p = 0
    for j in range(i, k + i):
        p += ((1 / arr[j])* (arr[j] * (arr[j] + 1)) / 2)
    if p > s:
        s = p
print(s)
N, K = map(int, input().split())
p = list(map(int, input().split()))

rp = sum(list(p[0:K]))
rm = 0
ans = rp
for i in range(N-K):
  if rp - rm > ans:
    ans = rp - rm
  rp += p[i+K]
  rm += p[i]

print((ans+K)/2)