peterverebics/CodeNet_Python_118 huggingface dataset:
N, K = map(int, input().split())
P = list(map(int, input().split()))

#期待値L
L = [0 for _ in range(N)]
for i in range(N):
    L[i] = (1+P[i])/2

#累積和S
S = [0 for i in range(N)]
S[0] = L[0]
for i in range(1, N):
    S[i] = S[i-1] + L[i]

total = S[K-1]
for i in range(N-K):
    tmp = S[i+K]-S[i]
    if total < tmp:
        total = tmp

print(total)
n, k = map(int, input().split())
p = list(map(int, input().split()))
l = []

num = 0
for j in range(k):
    num += p[j]
l.append(num)

for i in range(n-k):
    l.append(l[i]-p[i]+p[i+k])

print((max(l)+k)/2)
n ,k = map(int ,input().split())
hai = list(map(lambda x:(int(x)+1)/2 ,input().split()))
hait= hai[:k]
ans = tmp = sum(hait)
for i in range(k,n):
  tmp = tmp - hai[i-k] + hai[i]
  if ans < tmp:
    ans = tmp
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))

ansl = 0
ansr = k-1
ans = 0
tmp = sum(p[:k])
# print(tmp)
for i in range(1,n - k+1):
    tmp = tmp - p[i-1] + p[i + k-1]
    # print(i,i+k-1,tmp)
    if tmp > ans:
        ansl = i
        ansr = i + k - 1
        ans = tmp
# 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())
p=list(map(int,input().split()))
e=[]
for pp in p:
    ex=(pp+1)/2
    e.append(ex)
ans=0
for i in range(n-k+1):
    if i==0:
        t=sum(e[:k])
        ans+=t
        continue
    t-=e[i-1]
    t+=e[i+k-1]
    ans=max(ans,t)

print(ans)
n, k = map(int, input().split())
lis = list(map(int, input().split()))

su = [0] * (n + 1)

for i in range(n):
    su[i + 1] = su[i] + ((lis[i] + 1) / 2)

res = 0
for j in range(n - k + 1):
    res = max(res, su[j + k] - su[j])
    
print('{:.12f}'.format(res))
import numpy as np
n, k = map(int,input().split())
p = list(map(int,input().split()))

e = [(i+1)/2 for i in p]
e = np.cumsum(e)
e = np.append(0,e)
ans = 0
for i in range(n-k+1):
    ans = max(e[i+k]-e[i],ans)
print(ans)
from itertools import accumulate
N,K = map(int,input().split())
P = [(int(i) + 1) / 2 for i in input().split()]
ans = []
hope = [0] + list(accumulate(P))

for j in range(N-K+1):
  ans.append(hope[j+K]-hope[j])
print(max(ans))
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
e = [(pi + 1) / 2 for pi in p]

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

print(ans)
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=0
for i in range(k):
    ans+=(p[i]+1)/2

tmp=ans
for i in range(k,n):

    tmp-=(p[i-k]+1)/2
    tmp+=(p[i]+1)/2
    ans=max(ans,tmp)
print(ans)
n, k =map(int, input().split())
p = list(map(int, input().split()))
lista = [(i + 1) / 2 for i in p]
listb = [0]
ans = 0
for i in range(n):
    listb.append(lista[i] + listb[i])
for i in range(n - k + 1):
    ans = max(ans, listb[i + k] - listb[i])
print(ans)
N, K = map(int, input().split())
P = [(int(x)+1)/2 for x in input().split()]

Q=[0]*(N+1)
for n in range(N):
  Q[n+1]=Q[n]+P[n]

ans=0
for n in range(K,N+1):
  ans=max(ans, Q[n]-Q[n-K])

print(ans)
n, k = map(int, input().split())

ps = list(map(int, input().split()))
cur = 0
for i in range(k):
    cur += ps[i] + 1

mx = cur

for i in range(n-k):
    j = i+k
    cur += -ps[i] + ps[j]
    mx = max(mx, cur)

print(mx / 2)
# ruisekiwa by numpy

import numpy as np

N,K = map(int,input().split())
p = np.array(list(map(int,input().split())))

b=np.concatenate([np.array([0]),np.cumsum(p)])

K_sum = b[K:] - b[:-K]
    
print((max(K_sum)+K)/2)
#!/usr/bin/env python3
n, k, *P = map(int, open(0).read().split())
p = [(i + 1) / 2 for i in P]
s = [float()]
for i in range(n):
    s.append(s[i] + p[i])
print(max(s[i + k] - s[i] for i in range(n - k + 1)))
import sys
readline = sys.stdin.readline

N, K = map(int, readline().split())
P = list(map(int, readline().split()))
AP = P[:]
for i in range(1, N):
    AP[i] += AP[i-1]
AP = [0] + AP
ans = 0
for st in range(N-K+1):
    en = st+K
    ans = max(ans, AP[en] - AP[st])

print((ans+K)/2)
ex = []
for i in range(1001):
    e = 0
    j = i 
    while j != 0:
        e += j / i
        j-=1
    ex.append(e)

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

total = 0
mx = 0

for i in range(n):
    if i < k:
        total += ex[p[i]]
    else:
        total = total + ex[p[i]] - ex[p[i-k]]
    if mx < total:
        mx = total

print(mx)
# D - Dice in Line
from itertools import accumulate #累積和
n,k,*p = map(int,open(0).read().split())
ac = [0] + list(accumulate(p))
a = 0
for i in range(n-k+1): a = max(a, ac[i+k] - ac[i])
print((a+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, 1001):
    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('{:.12f}'.format(ans))
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

L = [0] * N

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

ans = 0

k = 0
for i in range(K):
  k += L[i]

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

print(ans)
N,K = (int(i) for i in input().split())
P = [int(i) for i in input().split()]
P_expect_sum = [0 for i in range(N)]

P_pred = 0
for i in range(N):
  P_expect = (1+P[i])/2
  P_expect_sum[i] = P_pred + P_expect
  P_pred = P_expect_sum[i]

ans = P_expect_sum[K-1]
for i in range(K-1,N):
  ans = max(ans, P_expect_sum[i] - P_expect_sum[i-K])
print(ans)
N, K = map(int, input().split())
p = list(map(int, input().split()))
r = [0]*N
r[0] = (p[0] + 1) / 2
for i in range(1, N):
    r[i] = r[i-1] + (p[i] + 1) / 2
ans = r[K-1]
for i in range(K, N):
    ans = max(ans, r[i] - r[i - K])
print(ans)
N,K=map(int,input().split())
P=list(map(int,input().split()))
from itertools import accumulate
acc=[0]+list(accumulate(P))
print((max(b-a for a,b in zip(acc,acc[K:]))+K)/2)
N, K = map(int, input().split())
p = list(map(int, input().split()))

s = []
for i in range(K):
    s.append(p[i])

m = sum(s)
t = m
for i in range(K, N):
    t += p[i] - p[i - K]
    if m < t:
        m = t

m += K

print(m / 2)
n,k = map(int, input().split())
p = list(map(int, input().split()))

m = sum(p[:k])
index = 0
tmp = sum(p[:k])
for i in range(n-k):
    tmp -= p[i]
    tmp += p[i+k]
    if tmp > m:
        m = tmp
        index = i+1

def calc_exp(p):
    return ((p * (p+1)) / 2) / p
        
exp = 0
for i in range(index,index+k):
    exp += calc_exp(p[i])

print(exp)
import numpy as np
N,K = map(int,input().split())
q = list(map(int,input().split()))
q = np.array(q)

p = (q + 1) /2
p = p.tolist()
a = sum(p[:K])
mx = a

for i in range(0,N-K):
    a = a - p[i] + p[i+K]
    if a > mx:
        mx = a

print(mx)
from itertools import accumulate
N, K = map(int, input().split())
P = list(map(int, input().split()))
acc = [0] + list(accumulate(P))
print((max(b - a for a, b in zip(acc, acc[K:])) + K) / 2)
from copy import copy
N,K = map(int, input().split())
p=list(map(int, input().split()))
expP = [(1+i)/2 for i in p]
id_H = N-K
id_T = N
minus = sum(expP[:id_H])
minimum = minus
for i in range(id_H):
    minus -= expP[id_H - i -1]
    minus += expP[id_T - i -1]
    if minus < minimum:
        minimum = copy(minus)
ans = sum(expP) - minimum
print(ans)
N, K = map(int, input().split())
*P, = map(int, input().split())
expectations = [(p + 1) / 2 for p in P]
ans = 0
S = sum(expectations[:K])
for i in range(N - K):
    ans = max(ans, S)
    S = S - expectations[i] + expectations[i + K]
ans = max(ans, S)
print(ans)
N, K = map(int, input().split())

def calculate_Expectation(n):
    n = int(n)
    p = 1/n
    e = p * (n*(n+1)/2)
    return e

E = list(map(calculate_Expectation, input().split()))
if N == K:
    print(sum(E))
else:
    S = [0]
    for i, e in enumerate(E):
        S.append(S[i]+e)

    sum_of_E = []
    for left in range(1, N+1-K):
        right = left + K
        sum_of_E.append(S[right]-S[left])
    print(max(sum_of_E))
N, K = map(int, input().split())
ps = input().split()
ans = 0
temp = 0
for i in range(K):
  temp += (1+int(ps[i]))/2
ans = temp
for i in range(N-K):
  temp = temp + (1+int(ps[i+K]))/2 - (1+int(ps[i]))/2
  ans = max(ans, temp)
print(ans)
N ,K = list(map(int, input().split()))
p = list(map(lambda x: (1+int(x))/2, input().split()))
s = [0]*N
s[0]=p[0]
for i in range(1,N):
  s[i] = s[i-1]+p[i]

l = [s[K-1]]
for i in range(N-K):
  l.append(s[i+K]-s[i])

print(max(l))
N,K=map(int,input().split())
p=list(map(int,input().split()))
ans=0
temp=0
for i in range(K):
    temp+=(1+p[i])/2
ans=temp
for j in range(N-K):
    temp=temp-(1+p[j])/2+(1+p[j+K])/2
    if temp>ans:
        ans=temp
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))
def expect(a):
  return 0.5 * (a+1)

total = 0
for i in range(k):
  total += expect(p[i])

r = [total]

for j in range(n-k):
  total = total-expect(p[j])+expect(p[j+k])
  r.append(total)

print(max(r))
n, k, *p = map(int, open(0).read().split())

q = []
for p_i in p:
  q.append((p_i+1)/2)
  
s = [0]
pre_s = 0
for q_i in q:
  pre_s += q_i
  s.append(pre_s)

ans = 0
for i in range(n-k+1):
  if ans < (s[i+k] - s[i]):
    ans = s[i+k] - s[i]
    
print(ans)
N,K = map(int,input().split())
P = list(map(int,input().split()))

Q = [(P[i]+1)/2 for i in range(N)]

max,tmp = sum(Q[0:K]),sum(Q[0:K])
for i in range(N-K):
    tmp = tmp + Q[K+i] - Q[i]
    if max < tmp:
        max = tmp

print(max)
n,k = map(int, input().split())
p = list(map(int, input().split()))
from itertools import accumulate
cum = [0] + list(accumulate(p))
ans = 0
for i in range(n-k+1):
    ans = max(ans, cum[i+k]-cum[i])
print((ans+k)/2)
n, k = list(map(int, input().split()))
P = list(map(int, input().split()))
E = [0, ]
tot = 0
for i in range(n):
    tot += P[i] * (P[i] + 1) / (2 * P[i])
    E.append(tot)
ans = 0
for i in range(n - k + 1):
    ans = max(ans, E[i + k] - E[i])
print(ans)
n,k=map(int,input().split())
p=list(map(int,input().split()))

b=[0]
for i in range(1,n+1):
  b.append(b[i-1]+p[i-1])

max_i=-1
max_v=0
for i in range(1,n+1-k):
  if b[i+k]-b[i]>max_v:
    max_i=i
    max_v=b[i+k]-b[i]
ans=0
for i in range(k):
  ans+=(p[max_i+i]+1)/2
print(ans)
import numpy as np
n,k = map(int,input().split())
p = list(map(int,input().split()))
cs = []
for x in p:
    cs.append(((x+1)*x//2)/x)
cs = [0]+np.cumsum(cs).tolist()
ans = 0
for i in range(k, n+1):
    ans = max(ans, cs[i]-cs[i-k])
print(ans)
N,K = map(int,input().split())
p = list(map(int,input().split()))

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

next_end = K

num = sum(P[:next_end])

max_num = num

for start in range(1, N - K + 1):
    num -= P[start - 1]
    num += P[next_end]
    max_num = max(num, max_num)
    next_end += 1

print((max_num + K) / 2)
N, K = map(int, input().split())
p = list(map(int, input().split()))
def expect(i):
    return (i+1) / 2


S=[0]

for i, x in enumerate(p, start=1):
    S.append(S[i-1] + expect(x))
    
ans = 0    

for i in range(N - K + 1):
    r = S[i+K] - S[i]
    if r > ans:
        ans = r
print(ans)
import itertools
n, k = (int(i) for i in input().split())
P = [int(i) for i in input().split()]

probs = list(itertools.accumulate([(1+p)/2 for p in P]))
probs.insert(0,0)

ans = 0

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

print(ans)
n,k=map(int,input().split())
p=list(map(int,input().split()))
a=[]
b=[0]*n
q=0
for i in range(n):
  a.append((1/2)*(p[i]+1))
for j in range(k):
  q+=a[j]

b[0]=q

for l in range(1,n-k+1):
  b[l]=b[l-1]-a[l-1]+a[k+l-1]
print(max(b))
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
INF = 10**9

n, k = map(int, input().split())
p = [int(item) for item in input().split()]
total = 0
for i in range(k):
    total += p[i]
max_t = total
l = 0; r = k
for i in range(k, n):
    total += p[i] - p[i-k]
    if total > max_t:
        max_t = total
        l = i - k
        r = i

print(0.5 * k + max_t / 2.0)
N,K = map(int,input().split())

p = list(map(int,input().split()))
max = 0
for i in range(K):
    max += (1+p[i])/2
tmp = max
for i in range(K,len(p)):
    tmp -= (1+p[i-K])/2
    tmp += (1+p[i])/2
    #print(max)
    if max < tmp:
        max = tmp
    #print(max)    
print(max)




#ロケットペンシル方式
N, K = map(int, input().split())
p = list(map(int, input().split()))
E = [(1+p[i])/2 for i in range(N)]
S = [0]
for i in range(0,N):
  S.append(S[i]+E[i])

maxnum = 0
for i in range(N+1):
  if i+K >= N+1:
    break
  maxnum = max(S[i+K]-S[i], maxnum)
print(maxnum)
N, K = map(int, input().split())
P = list(map(int, input().split()))
memo = sum(P[:K])
ans = memo

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

print(K-1+((ans-K+1) - 0.5*((ans-K+1)-1)))
import sys
input = sys.stdin.readline

(n, k), s, res, sm = map(int, input().split()), list(map(lambda x: (int(x) + 1) / 2, input().split())), 0, 0
for i in range(n):
	if i < k: sm += s[i]
	else: sm += s[i]; sm -= s[i-k]
	res = max(res, sm)
print(f'{res:.10f}')
# print(f'{max([sum(s[i:i+k]) for i in range(n - k + 1)]):.10f}')
from itertools import accumulate

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

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

b=[0]+list(accumulate(x))

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

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

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

print(0.5+(0.5*ans)+(k-1)*0.5)
N,K= map(int,(input().split()))
p = list(map(int,input().split()))
rui_p=[]
rui_p.append(0)
sum_p=[]
for i in range(N):
  rui_p.append(rui_p[i]+p[i])
for j in range(K,N+1):
  sum_p.append(rui_p[j]-rui_p[j-K])

msp=max(sum_p)
ans=(msp/2)+(0.5*K)
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))
a = sum(p[0:k])
l = [a]
for i in range(n-k):
    a = a-p[i]+p[i+k]
    l.append(a)
print((max(l)+k)/2)
from itertools import accumulate

N, K = list(map(int, input().split()))
P = list(map(lambda x: int(x) + 1, input().split()))
P_cumsum = [0] + list(accumulate(P))
print(max([P_cumsum[i+K]-P_cumsum[i] for i in range(N-K+1)])/2)
n,k=map(int,input().split())
p=list(map(int,input().split()))

b=[0]
for i in range(1,n+1):
 b.append(p[i-1]+b[i-1])

mm=0
inx=-1
for i in range(len(b)-k):
 if b[i+k]-b[i]>=mm:
  inx=i
  mm=b[i+k]-b[i]


ans=0
for j in range(inx,inx+k):
  ans+=((p[j]*(p[j]+1))*0.5)*(1/p[j])

print(ans)
N,K = map(int,input().split())
p = list(map(int,input().split()))
summ = sum(p[i] for i in range(K))
sum_list = [summ]
maximum = 0

for i in range(N - K):
    summ += p[i + K] - p[i]
    sum_list.append(summ)

maximum = max(sum_list)

print("{}".format((maximum + K) / 2))
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # スコアの累積和
    l = list(itertools.accumulate(A))

    score = sum(A[:M])
    for i in range(1, N-M):
        score = max(score, l[i+M] - l[i])
        
    ans = (M + score) / 2

    return ans

print(solve())
n, k = [int(i) for i in input().split()]
p = [(int(i) + 1) * 0.5 for i in input().split()]
m = sum(p[:k])
s = m
for i in range(k, n):
    s = s + p[i] - p[i-k]
    m = max(m, s)
print('{:.7f}'.format(m))
N,K = map(int,input().split())
P = list(map(int,input().split()))

cums = [0]
for p in P:
    cums.append(cums[-1] + (p+1)/2)
ans = 0
for i in range(N-K+1):
    ans = max(ans, cums[i+K] - cums[i])
print(ans)
N,K = list(map(int,input().split()))
pi = list(map(int,input().split()))
value = sum(pi[:K])
max_value = value
for i in range(N-K):
  value += pi[i+K] - pi[i]
  max_value = max(value, max_value)
print((max_value+K)/2)
def main():
    N,K = map(int, input().split())
    p = [int(i) for i in input().split()]

    tmp_max = sum(p[:K])
    tmp = sum(p[:K])
    for i in range(N-K):
        tmp += p[K+i]
        tmp -= p[i]

        if tmp > tmp_max:
            tmp_max = tmp

    ans = (tmp_max + K) / 2
    print(ans)


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

# 期待値:マス目の総和／マス目の数, マス目の最大値+最小値[1]／2
l = [(i+1)/2 for i in l] # 期待値に変換

# 累積和を取得
from itertools import accumulate
cum = [0] + list(accumulate(l))

# 差分を考慮しつつ k個の和をリストする → 最大値が ans
sum_k = []
for j in range(n-k+1):
    sum_k.append(cum[k+j] - cum[j])

print(max(sum_k))
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+k)/2)
n, k = map(int, input().split())
p = list(map(int, input().split()))

cnt = 0
for i in range(n):
    if i <= k - 1:
        cnt += p[i]
        tmp = cnt
        end = i + 1
    else:
        cnt = cnt - p[i - k] + p[i]
        if cnt >= tmp:
            tmp = cnt
            end = i + 1

ans = 0
L = p[end - k: end]
for i in L:
    ans += sum(range(1, i + 1)) / i

print(ans)
n,k = map(int,input().split())
P = list(map(int,input().split()))



def E(x):
    # ans = 0
    tmp = (x*(x+1))/2 if x % 2 == 0 else x+(((x-1)*(x))/2)
    return tmp/x
ans = 0
for i in range(len(P)):
    P[i] = round(E(P[i]),1)
max_v = tmp = sum(P[:k])
l = 0
r = k
for i in range(1,len(P)-k+1):
    tmp = tmp-P[i-1]+P[r]
    max_v = max(max_v, tmp)
    r += 1
print(max_v)
def main():
    from itertools import accumulate
    n, k = map(int, input().split())
    *exp, = map(lambda x: (int(x) + 1) / 2, input().split())
    l = accumulate(exp)
    l = list(l)
    ll = [l[k - 1]] + [j - i for i, j in zip(l, l[k:])]
    ans = max(ll)
    print(ans)


if __name__ == '__main__':
    main()
N, K = map(int, input().split())
p = [int(i) for i in input().split()]

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

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

ret = 0
for i in range(K, N + 1) :
  ret = max(ret, p[i] - p[i-K])
  
print(ret)
n, k = map(int, input().split())

p = [(x+1)/2 for x in map(int, input().split())]

ans = sum(p[0:k])
prev = ans

for i in range(1, n - k + 1):
    prev = prev - p[i - 1] + p[i + k - 1]
    if ans < prev:
        ans = prev

print(ans)
n,k=map(int,input().split())
P=list(map(int,input().split()))

S=[0]
for i in range(n):
   S.append(S[i]+P[i])
ans=0
for j in range(n-k+1):
   ans=max(ans,(S[j+k]-S[j]))

print((ans+k)/2)
n,k = map(int, input().split())
p = list(map(int, input().split()))

saikoro = [0] * 1001
for i in range(1, 1001):
    saikoro[i] = (saikoro[i-1] + i)

s = [0] * (n + 1)
for u in range(1,n + 1):
    s[u] = saikoro[p[u - 1]] / p[u - 1] + s[u - 1]

ans = 0
for j in range(k - 1,n):
    ans = max(ans, s[j + 1] - s[j + 1 - k])
 
print(ans)
N, K = map(int, input().split())
P = list(map(int, input().split()))
E = [0] * N
E[0] = sum(P[:K])

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

E[N-K] = sum(P[N-K:])
maxE = max(E)
#print(E)
print((maxE - K) / 2.0 + K)
n, k = map(int, input().split())
ns = list(map(int, input().split()))
cnt = sum(ns[:k])
max_cnt = cnt
for i in range(n - k):
    cnt += ns[i+k]
    cnt -= ns[i]
    max_cnt = max(max_cnt, cnt)
print((max_cnt+k)/2)
n,k = map(int, input().split())
p = list(map(int, input().split()))
b = p[:k]
#print(b)
for i in range(k):
    b[i] = (b[i]+1)/2
a = sum(b)
a_max = sum(b)
#print(a)
for i in range(n-k):
    a -= (p[i]+1)/2
    a += (p[i+k]+1)/2
    if (a > a_max):
        a_max = a
print(a_max)
N, K = map(int, input().split())
p = list(map(int, input().split()))

m = [(e + 1) / 2 for e in p]

t = sum(m[0:K])
result = t
for i in range(N - K):
    t -= m[i]
    t += m[i + K]
    if t > result:
        result = t
print(result)
#n = int(input())
#s = input()
n, m = map(int,input().split())
da = list(map(int,input().split()))

now = 0
for i in range(m):
    now += da[i]/2 + 0.5
ans = now
for i in range(m,n):
    now -= da[i-m]/2 - da[i]/2
    ans = max(ans, now)
print(ans)
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()
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)
def dice_in_line(k, p_list):
    max_line = [0 for i in range(k+1)]
    max_sum = 0
    sum_list = [0]
    for i in range(len(p_list)):
        sum_list.append(p_list[i]+sum_list[i])
    for i in range(len(p_list)-k+1):
        if max_sum < sum_list[i+k]-sum_list[i]:
            max_sum = sum_list[i+k]-sum_list[i]
        
    return (max_sum+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)))
n, k = map(int, input().split())
p = list(map(int, input().split()))


def expectation(value):
    return 0.5 * (value + 1)


res = 0
for l in range(k):
    res += expectation(p[l])

cur = res
for l in range(k, n):
    cur += expectation(p[l]) - expectation(p[l-k])
    res = max(res, cur)
print(res)
x,y = map(int,input().split())
li = list(map(int,input().split()))
from collections import deque
l = []
for i in range(len(li)):
    l.append((1+ li[i])/2)
from itertools import accumulate
a = list(accumulate(l))
M = a[y-1]
for i in range(len(a)-y):
    m = a[i+y] - a[i]
    if m > M:
        M = m
print(M)
N, K = map(int, input().split())
S = list((num+1)/2 for num in map(int, input().split()))
temp = 0
ans = 0
for i in range(K):
    temp += S[i]
ans = temp
for i in range(K, N):
    temp = temp + S[i] - S[i-K]
    ans = max(ans, temp)
print(ans)
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque

n,k = [int(x) for x in stdin.readline().rstrip().split()]
p = [(int(x)+1)/2 for x in stdin.readline().rstrip().split()]

m = sum(p[0:k])
maxm = m

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

print(maxm)
n,k=map(int,input().split())
p=list(map(int,input().split()))
p=[(i+1)/2 for i in p]
ans=0
cur_sum=0
for i in range(0,k):
  cur_sum+=p[i]
ans=cur_sum
for i in range(k,n):
  cur_sum+=p[i]
  cur_sum-=p[i-k]
  ans=max(ans,cur_sum)
print(ans)
n,k=map(int,input().split())
p=[int(i) for i in input().split()]
ans=chk=0
w=[0]*(n+1)
for i in range(n):
    w[i+1]=w[i]+p[i]
for i in range(k,n+1):
    chk=max(chk,w[i]-w[i-k])
print((chk+k)/2)
import numpy as np
N,K = (int(x) for x in input().split())
p1 = np.array(list(map(int, input().split())))
s1 = p1.cumsum()
s2 = np.append(0, s1)
p2 = np.array([(s2[i+K] - s2[i]) for i in range(N-K+1)])
max = np.amax(p2)
print((max+K) / 2)
N, K = map(int, input().split())
P = list(map(int, input().split()))

ans = sum([(p+1)/2 for p in P[:K]])
tmp = ans
for i in range(N-K):
    tmp = tmp - (P[i]+1)/2 + (P[K+i]+1)/2
    ans = max(ans, tmp)

print(ans)
n,k=map(int,input().split())
P=list(map(int,input().split()))
now=sum(P[:k])
m=now
for i in range(n-k):
    now+=P[k+i]
    now-=P[i]
    m=max(m,now)
E=(m+k)/2
print(E)
N,K = map(int,input().split())
p = list(map(int,input().split()))
def maxexp(p,K):
    s = 0 
    for i in range(0,K):
        s = s + p[i]
        t = s
    for j in range(0,len(p)-K):
        s = s - p[j] + p[j+K]
        t = max(s,t)
    return (t+K)/2
print(maxexp(p,K))
n,k=map(int,input().split())
P=list(map(int,input().split()))
S=[0]*(n+1)
for i in range(n):
   S[i+1]=S[i]+P[i]
ans=0
for i in range(n-k+1):
   ans=max(ans,S[i+k]-S[i])
print((ans+k)/2)