peterverebics/CodeNet_Python_118 huggingface dataset:
N, K = map(int,input().split())
P = list(map(int,input().split()))
Ex = [0 for _ in range(N)]
for i in range(N):
    Ex[i] = P[i]*(P[i]+1)/(2*P[i])
wa = 0
for i in range(K):
    wa += Ex[i]
maxi = wa
for i in range(N-K):
    wa = wa - Ex[i] + Ex[K+i]
    maxi = max(maxi,wa)
print(maxi)
from itertools import accumulate
N, K = map(int, input().split())
p = [int(i) for i in input().split()]

expected = []
for i in range(N):
    expected.append((p[i]+1)/2)
m = [0] + list(accumulate(expected))
ans = 0
for i in range(1, len(m)-K+1):
    ans = max(ans, m[i+K-1] - m[i-1])
print(ans)
N, K = map(int, input().split())
p = list(map(int, input().split()))
prospect = []
for k in range(N):
  if p[k]%2 == 1:
    prospect.append((p[k]+1)>>1)
  else:
    prospect.append((p[k]+1)/2)
S = sum(prospect[:K])
ans = 0 + S
for k in range(N-K):
  S += prospect[k+K] - prospect[k]
  ans = max(ans, S)
print(ans)
n,k = map(int,input().split())

p = [int(x) for x in input().split()]

sum1 = sum(p[:k])
num = k-1
max1 = sum1

for i in range(k,n):
    sum1 = sum1 - p[i-k] + p[i]
    if sum1 >= max1:
        max1 = sum1
        num = i
    #print(max1,sum1,i)

sum2 = sum(p[num-k+1:num+1])

def goukei(j):
    return 1/2 * j * (j+1)

print(float((goukei(sum2)-goukei(k-1))/(sum2 -k +1)))
N, K = map(int, input().split())
list=list(map(int, input().split()))
a=[]
sum=0
for i in list:
    sum+=((i-1)*(1/2)+1)
    a.append(sum)
ma=a[K-1]
for i in range(N-K):
    ma = max(ma, a[i+K]-a[i])
print(ma)
N, K = map(int, input().split())
cnt = [int(x) * 0.5 + 0.5 for x in input().split()]

add = [0]
for i in cnt:
    add.append(add[-1]+i)

ans = [add[i+K]-add[i] for i in range(N-K+1)]

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

max_value = sum((p_i + 1) / 2 for p_i in p[:k])
cur = max_value
for i in range(k, n):
    cur += ((p[i] + 1) / 2 - (p[i-k] + 1) / 2)
    max_value = max(max_value, cur)
print(max_value)
n,k =map(int,input().split())
p = list(map(int,input().split()))
kitai = []
for i in range(n):
    sum_k = 0
    sum_k = (1 + p[i])/2
    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)):
    sum_ans = ans[cnt]
    sum_ans -=kitai[j] 
    sum_ans += kitai[i]
    j +=1
    cnt+=1
    ans.append(sum_ans)
print(max(ans))
n,k = map(int, input().split())
dice = list(map(int, input().split()))
dice_sum = [0]
for i in dice:dice_sum.append(dice_sum[-1]+(i+1)/2)
def SumArea(r, l):
    return dice_sum[l]-dice_sum[r]

ans = 0
for i in range(n-k+1):
    tmp = SumArea(i, i+k)
    if tmp >= ans:
        ans = tmp
print(ans)
n, k = input().split()
n = int(n)
k = int(k)
p = list(map(int, input().split()))

exp = 0
for i in range(k):
  exp += (1 + p[i]) / 2
  exp_true = exp

for i in range(n-k):
  exp += (1 + p[i+k]) / 2
  exp -= (1 + p[i]) / 2
  if exp_true < exp:
    exp_true = exp

print(exp_true)
N,K= map(int, input().split())
List = list(map(int, input().split()))
num=0
s=0
for i in range(K):
    s+=(List[i]+1)
num=0
#print(s)
if N==K:
    print(s/2)
else:
    
    for i in range(N-K):
        a=List[i+K]-List[i]
        #print(a)
        n1=s+a
        s=n1
        n1=n1/2
        if n1>=num:
            num=n1
    print(num)
n , k = map(int, input().split())
p = list(map(int, input().split()))
p_accu = [p[0] + 1]

if k == 1:
    print((max(p) + 1 ) / 2 )
    exit()
elif k == n:
    print((sum(p) + n ) / 2 )
    exit()

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

S = p_accu[k-1]

for i in range(n - k):
    if S < p_accu[i+k] - p_accu[i]:
        S = p_accu[i+k] - p_accu[i]
    
print(S/2)
import sys
from collections import deque
input = sys.stdin.readline
N, K = [int(x) for x in input().strip().split()]
P = [int(x) for x in input().strip().split()]
q = deque([])
cur = 0
ans = 0
for i, p in enumerate(P):
    e = (1+p) / 2
    q.append(e)
    cur += e
    if i >= K-1:
        ans = max(ans, cur)
        e_ = q.popleft()
        cur -= e_
print(ans)
n,k = map(int,input().split())
L = list(map(int,input().split()))
LL = []
for i in range(n):
    kitai = L[i]*(L[i]+1)//2/L[i]
    LL.append(kitai)
#print(LL)
k_sum = sum(LL[:k])
num = []
num.append(k_sum)
for i in range(1,n-k+1):
    k_sum += (LL[k+i-1] - LL[i-1])
    #print(LL[k+i-1],LL[i-1])
    num.append(k_sum)
print(max(num))
n, k = map(int, input().split())
a = list(map(int, input().split()))
s = sum(a[:k])
mx = s
for i in range(k, n):
    s += a[i] - a[i - k]
    mx = max(mx, s)
print((mx + k) / 2)
N, K = map(int, input().split())
P = list(map(int, input().split()))
l = []

for i in range(N):
    l.append((P[i] + 1) / 2)

n = 0
for i in range(N):
    n += l[i]
    l[i] = n

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

print(ans)
# print(l)
import numpy as np

n,k = map(int,input().split())
lst = list(map(int,input().split()))
exp_val = [(l+1)/2 for l in lst]

cumsum = np.cumsum(exp_val)

for i in range(k-1, n):
    if i==k-1:
        val = cumsum[i]
    else:
        val = max(val, cumsum[i] - cumsum[i-k])
print(val)
n,k = tuple(map(int,input().split())) 
N = list(map(int,input().split()))
s = sum(N[0:k])
m = sum(N[0:k])

for i in range(0,n-k):
    s = s-N[i]+N[i+k]
    m = max(m,s)   
print((m+k)/2)
dummy = list(map(int, input().split(" ")))
N = dummy[0]
K = dummy[1]
p = list(map(int, input().split(" ")))
p = [(dummy + 1) / 2 for dummy in p]
dummy = sum(p[:K])
convert = []
for i in range(N - K + 1):
    convert.append(dummy)
    if(i < N - K):
        dummy = dummy - p[i] + p[K + i]

print(max(convert))
n, k = map(int, input().split())
p = list(map(int, input().split()))
tmp = 0.0
for i in range(k):
    tmp += (p[i]+1)/2
ans = tmp
for i in range(k, n):
    tmp += (p[i]-p[i-k])/2
    if ans < tmp:
        ans = tmp

print(ans)
import itertools

N, K = map(int, input().split())
P = list(map(int, input().split()))
Q = [(p+1)/2 for p in P]
A = list(itertools.accumulate(Q))
A = [0] + A
mx = 0
for i in range(N-K+1):
    mx = max(mx, A[i+K]-A[i])
print(mx)
N, K = map(int,input().split())
l = list(map(int, input().split()))
c = sum(l[0:K])
ans = c
for i in range(N-K):
  c = c - l[i] + l[i + K]
  if c > ans:
    ans = c
print((ans+K)/2)
n, k = map(int, input().split())
p = list(map(int, input().split()))

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

    ans = max(p_sum, ans)

ans = (ans + k) / 2

print(ans)
import sys
import numpy as np
input = sys.stdin.readline

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

pn1 = p - 1

ans = sum(pn1[:K])
spb = ans
for i in range(N-K):
    sp = spb -pn1[i] + pn1[i+K]
    #print(sp,spb,pn1[i],pn1[i+K])
    ans = max(sp,ans)
    spb = sp
print(ans/2+K)
N,K = map(int,input().split())
p = list(map(int,input().split()))
s = sum(p[0:K])
r = s

for i in range(N-K):
  s = s-p[i]+p[i+K]
  r = max(r,s)
  
print((r+K)/2)
n,k=map(int,input().split())
l=list(map(int,input().split()))
ans=sum(l[:k])
kai=sum(l[:k])
for i in range(n-k):
    kai+=l[i+k]-l[i]
    ans=max(ans,kai)
print((ans+k)*0.50)
N,K = map(int,input().split())
p = list(map(int,input().split()))
result = 0
p_t = [0]
for i in range(N):
    p_t.append(p[i]+p_t[i])
ans = p_t[K] - p_t[0]

for i in range(N-K):
    tmp = p_t[i+1+K] - p_t[i+1]
    if ans < tmp:
        ans = tmp
print((ans+K)/2)
"""
int(input())
map(int,input().split())
list(map(int,input().split()))

"""

n,k=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    b.append((a[i]+1)/2)
c=[]
s=sum(b[0:k])
for i in range(k-1,n):
    c.append(s)
    if(i==n-1):
        break
    s=s+b[i+1]-b[i-k+1]

print(max(c))
N,K = map(int,input().split())
p = list(map(int,input().split()))

S = sum(p[:K])
S_MAX = S

for i in range(N-K):
    S += p[K+i] - p[i]
    if S_MAX < S:
        S_MAX = S

E = (S_MAX + K)/2

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

foo = sum(P[0:K])
ans = foo
for i in range(K,N):
    foo += P[i] -P[i-K]
    if ans < foo:
        ans = foo
print((ans+K)/2)
n,k=map(int,input().split())
p=list(map(int,input().split()))
a=p[:k]
cnt=0
tmp=[]
for i in a:
  cnt+=(1+i)/2
tmp+=[cnt]
for i in range(n-k):
  cnt-=(1+p[i])/2
  cnt+=(1+p[i+k])/2
  tmp+=[cnt]
print(max(tmp))
N, K = map(int, input().split())
p = list(map(int, input().split()))
if N == K:
    print((sum(p) + N) / 2)
else:
    s = sum(p[:K])
    ans = s
    for i in range(N - K):
        s += p[i + K] - p[i]
        ans = max(ans, s)
    print((ans + K) / 2)
N, K = map(int, input().split())
P = [int(i) for i in input().split()]

E = [0 for i in range(N+1)]
for i in range(N):
    E[i+1] = E[i] + (P[i] + 1) / 2
    
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()))

def f(p):
    #(p*(p+1)/2)/p
    return (p+1)/2


p2 = []

for p_tmp in p:
    p2.append(f(p_tmp))

p3 = [p2[0]]

for i in range(1,len(p2)):
    p3.append(p2[i]+p3[i-1])

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

print('{:.20f}'.format(ans))
n, k = map(int, input().split())
p = list(map(int, input().split()))
a = []
for i in p:
    a.append((1 + i) / 2)

buf=0
for i in range(k):
    buf+=a[i]

ans = buf

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

print(ans)
N, K = map(int, input().split())
P = list(map(int, input().split()))

ans = 0
P_sum = 0

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

for j in range(K):
  P_sum += P[j]

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

print(ans)
N, K = [int(n) for n in input().split(" ")]
lst = [int(n) for n in input().split(" ")]

sum_max = 0
temp = 0

for i in range(K):
    temp += (lst[i]+1)/2
    sum_max = temp
for j in range(0,N-K):
        temp += (lst[j+K]-lst[j])/2
        if temp > sum_max:
            sum_max = temp
            
print(sum_max)
from collections import deque
n,k = map(int,input().split())
p = list(map(int,input().split()))
s = deque()
s.append(0)
tot = 0
for i in p:
    tot += i
    s.append(tot)

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

print((top+k)/2)
N, K = map(int, input().split())
p = list(map(int, input().split()))

kk = sum(p[:K])
res = kk

for i in range(N-K):
    kk += p[K+i] - p[i]
    res = max(res, kk)

res = res/2 + K/2
print(res)
import itertools


def resolve():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

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

    ans = 0
    for ii in range(N - K + 1):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

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

if n>1:
    m = sum(prr[:k])
    cur = m
    for i in range(n-k):
        cur += -prr[i] + prr[k+i]
        m = max(m,cur)
else:
    m = prr[0]

print((m+k)/2.0)
def cumsum(xs):
    result = [xs[0]]
    for x in xs[1:]:
        result.append(result[-1] + x)
    return result

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

if a==b:
    print((sum(c)+a)/2)
    exit()

d=[]

c=[(i+1)/2 for i in c]
n=cumsum(c)

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


print(max(m))
from itertools import accumulate

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

ac = [0] + list(accumulate(map(lambda x: (1 + x) / 2, p)))
ans = max(ac[i+k] - ac[i] for i in range(n - k + 1))
print(ans)
N,K=map(int,input().split())
A=list(map(int, input().split())) 
ans0=sum(A[0:K])
ans=ans0
for i in range(0,N-K):
  ans=ans-A[i]+A[K+i]
  if ans>ans0:
    ans0=ans
    
ans=(ans0+K)*0.5
print(ans)
import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))
    answer = sum(p[0:K])
    r = answer
    for i in range(N-K):
        answer = answer - p[i] + p[i+K]
        r = max(r, answer)
    print((r+K)/2)


if __name__ == '__main__':
    main()
from itertools import accumulate
n,k=map(int, input().split())
A=[((int(i)*(int(i)+1))/2)/int(i) for i in input().split()]
al = list(accumulate(A))
ans = al[k-1]
for i in range(k, n):ans=max(ans, al[i]-al[i-k])
print(ans)
N,K=map(int,input().split())
p=list(map(int,input().split()))
ave=[0]*(N-K+1)
tmp=0
for i in range(K):
    tmp+=(p[i]+1)/2
ave[0]=tmp
for i in range(1,N-K+1):
    ave[i]=ave[i-1]-(p[i-1]+1)/2 + (p[i+K-1]+1)/2
print(max(ave))
from itertools import accumulate

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

p_sum = [0] * (n + 1)

for i in range(n):
    p_sum[i+1] = p_sum[i] + p[i]

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

ans = (ans + k) / 2
print(ans)
import sys
def input():
    return sys.stdin.readline()[:-1]
N,K=map(int,input().split())
p=list(map(int, input().split()))
t=sum(p[:K])
M=(t+K)/2
for i in range(N-K):
    t-=p[i]
    t+=p[i+K]
    M=max(M,(t+K)/2)
print(M)
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces
gi = lambda : list(map(int,input().split()))
n, k = gi()
a = gi()
ans = 0
temp = 0
for j in range(k):
	ans += (a[j] * (a[j] + 1)) / (2 * a[j])
temp = ans
for j in range(k, n):
	temp -= (a[j - k] * (a[j - k] + 1)) / (2 * a[j - k])
	temp += (a[j] * (a[j] + 1)) / (2 * a[j])
	ans = max(ans, temp)
print(ans)
n,k=map(int,input().split())
A=list(map(int,input().split()))
for i in range(n):
    A[i]+=1

for i in range(n-1):
    A[i+1]+=A[i]

ans=0.0
A.reverse()
A.append(0)
A.reverse()

for i in range(n-k+1):
    now=A[i+k]-A[i]
    if now>ans:
        ans=now

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

import numpy as np

Ps = np.array(Ps)

Exp_each_p = (Ps + 1) /2

sum_Exp = [sum(Exp_each_p[0:k])]
if n == 1:
    print(sum_Exp[0])
else:    
    for id in range(1, n - k + 1):
        sum_Exp.append(sum_Exp[id - 1] - Exp_each_p[id - 1] + Exp_each_p[id + k - 1])

    print(max(sum_Exp))
N, K = map(int, input().split())
p = list(map(lambda x: (int(x)+1)/2, input().split()))

_sum = sum(p[:K])
ans = _sum
for i in range(N-K):
    _sum -= p[i]
    _sum += p[i+K]
    ans = max(ans, _sum)
print(ans)
N,K = map(int,input().split())
p = list(map(int,input().split()))
lis = [0]*N
for i in range(N):
    if p[i]%2 == 1:
        lis[i] = p[i]//2+1
    else:
        lis[i] = (p[i]+1)/2
ans = sum(lis[:K])
temp = sum(lis[:K])
for j in range(N-K):
    temp -= lis[j]
    temp += lis[j+K]
    if temp > ans:
        ans = temp
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))
R = [0] * n
R[0] = p[0]
for i in range(1, n):
    R[i] = R[i - 1] + p[i]

tmp = 0
m = 0
index = 0
for i in range(n - k + 1):
    if m < R[i + k - 1] - tmp:
        m = R[i + k - 1] - tmp
        index = i
    tmp = R[i]
ans = 0

for i in range(index, index + k):
    ans += (p[i] + 1) / 2
print(ans)
MOD = 1000000007
INF = float("inf")

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

for i in range(len(A)):
    A[i] = (A[i]+1)/2

start = 0
end = k-1
cur_sum = sum(A[start:end+1])
ans = cur_sum

for i in range(len(A)-k):
    cur_sum = cur_sum - A[start] + A[end+1]
    ans = max(ans, cur_sum)
    end += 1
    start += 1

print(ans)
N,K=map(int,input().split())
p=list(map(int,input().split()))
for i in range(N):
  p[i] = (p[i]+1)/2
C = [ 0 for _ in range(N+1) ]
C[0] = 0
for i in range(1,N+1):
  C[i] = p[i-1] + C[i-1]
ans = 0
for i in range(0,N-K+1):
  ans = max( C[i+K]-C[i], ans )
print(ans)
N,K = map(int,input().split())
A = list(map(int,input().split()))
wa = [0] * (N+1)
for i in range(N):
    wa[i+1] = wa[i] + (A[i]+1)/2
Max = 0
for i in range(N-K+1):
    Max = max(Max,wa[K+i]-wa[i])
print(Max)
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()]


if n==k:
    print(sum(p))
else:
    sump = [0]*n
    sump[0]=p[0]
    for i in range(n-1):
        sump[i+1] = sump[i]+p[i+1]
    ans=max(sump[i+k]-sump[i] for i in range(n-k))
    print(ans)
n, k = map(int, (input().split()))
p = [int(i) for i in input().split()]

s = sum(p[:k])
m = s

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

print((m + k) / 2)
n, k = map(int, input().split())
p = [int(i) for i in input().split()]
amax = sum(p[0:k])
bmax = sum(p[0:k])
for i in range(k,n):
    bmax -= p[i-k]
    bmax += p[i]
    amax = max(amax, bmax)
print((amax+k)/2)
n,k = map(int,input().split())
p = list(map(int,input().split()))
P1 = sum(p[:k])
ans = P1
for i in range(k,n):
    P1 +=(p[i]-p[i-k])
    if ans < P1:
        ans = P1
print((ans+k)/2)
n, k = map(int, input().split())
p = list(map(int, input().split()))
e = []
for i in range(n):
    e.append((p[i]+1)/2)
cumsum  = []
sm = 0
for j in range(n):
    sm += e[j]
    cumsum.append(sm)
ans = cumsum[k-1]
for i in range(n-k):
    s = cumsum[i+k] - cumsum[i]
    if ans < s:
        ans = s
print(ans)
N, K = map(int, input().split())
ps = list(map(int, input().split()))
es = [(p+1)/2 for p in ps]
rs = []
s = sum(es[0:K])
rs.append(s)
for i in range(N-K):
  s = s-es[i]+es[i+K]
  rs.append(s)
#print(rs)
r = max(rs)
print(r)
import sys
def input(): return sys.stdin.readline().rstrip()
import numpy as np
def main():
    n,k=map(int,input().split())
    P=np.array([int(_) for _ in input().split()])
    PP=(P+1)/2
    PP_cum=np.cumsum(PP)
    PP_cum=np.insert(PP_cum,0,0)
    print(np.max(PP_cum[k:]-PP_cum[:n-k+1]))

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

s = 0
ans = 0

for i, j in enumerate(p):
    s+= (j+1)/2
    if i == k-1:
        ans = s
    if i > k-1:
        s -= (p[i-k]+1)/2
        ans = max(ans, s)
print(ans)
n,k = map(int, input().split())
p = list(map(int, input().split()))
for i in range(n):
    p[i] = (p[i] + 1)/2
ans = 0
tmp = 0
for i in range(k):
    tmp += p[i]
    ans += p[i]
for i in range(1,n - k + 1):
    tmp = tmp - p[i - 1] + p[i + k - 1]
    if ans < tmp:
        ans = tmp
print("{:.12f}".format(ans))
n,k = map(int,input().split())
p = list(map(int,input().split()))
num = [(i+1) for i in p]
ans = sum(num[:k])
ch = ans
for i in range(n-k):
    ch += num[i+k] - num[i]
    ans = max(ans, ch)
print(ans/2)
n,k = map(int, input().split())
p = list(map(int, input().split()))

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

ans = [0]*(n)
tem = 0
for i in range(n):
    tem = tem
    if i < k:
        tem = tem + p[i]
    else:
        tem = tem + p[i] - p[i-k]
    ans[i] = tem

print(max(ans))
#D
import numpy as np
n, k = map(int, input().split())
p = list(map(int, input().strip().split()))
p = np.array(p)
def calc_E(p):
    return ((p+1)/2)

q = (p+1)/2

#print(q)
sum = np.cumsum(q)

sum2 = np.zeros((n+1))
sum2[1:] = sum
max = -1
for i in range(k,n+1):
    tmp = sum2[i] - sum2[i-k]
    if max < tmp:
        max = tmp

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


j = n-k
s = p[0:k]
max = sum(s)
su = max

for i in range(j):
    t = su+p[i+k]
    u = t-p[i]
    if max < u:
        max = t-p[i]
        s = p[i+1:i+1+k]

    su = u

def summ(i):
    return i*(i+1)/2

ss = 0


for i in s:
    ss += summ(i)/i

print(ss)
N,K = map(int,input().split())
p = list(map(int,input().split()))


def cal_expect(value):
    return ((value*(value+1))/2)*(1/value)

expect_value = [0]*N
expect_value[0] = cal_expect(p[0])

for i in range(1,K):
    expect_value[i] += expect_value[i-1] + cal_expect(p[i])

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

print(max(expect_value))
N,K = map(int,input().split())
P = [int(x) for x in input().split()]
L = []
l = 0
for i in range(N):
    l += P[i]
    L.append(l)
ANS = []
ANS.append(L[K-1])
for i in range(N-K):
    ANS.append(L[i+K] - L[i])
ans = max(ANS) + K
print(ans/2)
n,k=map(int,input().split())
p=list(map(int,input().split()))
x=sum(p[:k])
max_x=x
idx=0
for i in range(k,n):
  x=x+p[i]-p[i-k]
  if max_x<x:
    idx=i-k+1
    max_x=x
ans=0
for i in range(idx,idx+k):
  ans+=(p[i]*(p[i]+1)//2)/p[i]
print(ans)
import numpy as np
N, K = map(int, input().split())
A = list(map(int, input().split()))
 
r=sum(A[0:K])
re=r
for i in range(N-K):
    r=r+A[K+i]-A[i]
    if r > re:
        re=r
        
print((re+K)/2)
N,K = map(int,input().split())
p = list(map(int,input().split()))
want = sum(p[0:K])
change = sum(p[0:K])

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

print((K+want)/2)
N,K = map(int,input().split())
Pi = list(map(int,input().split()))

Sim = [0]
for i in range(0,N):
  Sim.append(Sim[i]+Pi[i])
MAX = max(Sim[i+K] - Sim[i] for i in range(N+1-K))

print((MAX+K)/2)
N,K= list(map(int, input().split()))
Ps = list(map(int, input().split()))

ruisekiwa = [0]

for P in Ps:
    ruisekiwa.append(P + ruisekiwa[-1])

#print(ruisekiwa)
ans = 0
for i in range(N-K+1):
    ans = max(ans, (ruisekiwa[i+K] - ruisekiwa[i] + K) / 2)
#    print(ans)
print(ans)
from functools import reduce
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
tmp_max = sum([i / 2 + 0.5 for i in p[0:k]])
tmp = tmp_max
idx = 0
for i in range(1, len(p) - k + 1):
	tmp -= p[i - 1] / 2 + 0.5
	if i + k - 1 < len(p):
		tmp += p[i + k - 1] / 2 + 0.5
	tmp_max = max(tmp_max, tmp)
print(tmp_max)
n,k = [int(i) for i in input().split()]
l = [int(i) + 1 for i in input().split()]

ans = [0 for _ in range(n+1)]
for i in range(n):
    ans[i+1] = ans[i]+ l[i]

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

cuml=[]
cum=0
for i in range(n):
    cum+=(pl[i]+1)/2
    cuml.append(cum)
mx=0
#cumsum
for i in range(n-(k-1)):
    if i==0:
        mx=max(cuml[i+k-1],mx)
    else:
        mx=max(cuml[i+k-1]-cuml[i-1],mx)
print('{:.9f}'.format(mx))
x,y=list(map(int, input().split()))
z=list(map(int, input().split()))
ans=0
chk=0
for i in range(y):
	ans=ans+z[i]
	chk=ans
for i in range(x-y):
	chk=chk-z[i]+z[i+y]
	if chk>ans:
		ans=chk
print((ans+y)/2)
def main():
	N, K = [int(x) for x in input().split(" ")]
	P = [int(p) for p in input().split(" ")]
	E = [sum(P[:K])]
	for i in range(N - K):
		E.append(E[-1] - P[i] + P[i + K])
	print((max(E) + K)/2)

main()
n, k = map(int, input().split())
P = list(map(int, input().split()))
L = [(p+1)/2 for p in P]
t = sum(L[:k])
ans = t
for i in range(k, n):
  t -= L[i-k]
  t += +L[i]
  ans = max(ans, t)
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))
l = 0
r = k
t = sum(p[l:r])
ans = (t+k)/2
for _ in range(n-k):
    t -= p[l]
    t += p[r]
    l += 1
    r += 1
    ans = max(ans, (t+k)/2)
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))

import numpy as np
exps = np.array(p) / 2 + 0.5

s = exps[:k].sum()
m = s
for i in range(1, n - k + 1):
    s = s - exps[i-1] + exps[i+k-1]
    if s > m:
        m = s
print(m)
from functools import reduce

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

max_mean = reduce(lambda a, b: a + 0.5 * (b + 1), p[:k], 0)
cur = max_mean
for i in range(k, n):
    cur += 0.5 * (p[i] - p[i-k])
    max_mean = max(max_mean, cur)
print(max_mean)
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, k = inintm()
P = inintl()

s = [0]*(n+1)
ans = 0

for i in range(n):
    s[i+1] = s[i]+(1 + (P[i]-1)*0.5)

for i in range(n-k+1):
    if s[i+k] - s[i] > ans:
        ans = s[i+k] - s[i]

print(ans)
num,renzoku=map(int,input().split())
dices=list(map(int,input().split()))
expects=[0]*num
Si=[0]*(num+1)
for i in range(1,num+1):
  Si[i]=Si[i-1]+(1+dices[i-1])/2
max_Si=0
for i in range(0,num-renzoku+1):
  if max_Si<Si[i+renzoku]-Si[i]:
    max_Si=Si[i+renzoku]-Si[i]
print(max_Si)