peterverebics/CodeNet_Python_118 huggingface dataset:
import itertools
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
k = [(1+i)/2 for i in p]
a = list(itertools.accumulate(k))
max = a[K-1]
for i in range(K,N):
    if max < a[i] - a[i-K]:
        max = a[i] - a[i-K]
print(max)
n,k=list(map(int,input().split()))
m=list(map(int,input().split()))

s=sum(m[:k])
mx=s
for i in range(1,n-k+1):
    s-=m[i-1]
    s+=m[i+k-1]
    mx=max(mx,s)
print((mx+k)/2)
n, k = map(int, input().split())
dat = list(map(int, input().split()))

dat2 = []
m = -1
#print(dat[:k])
n = sum(dat[:k])
dat2.append(n)
m = n
mind = 0
for i in range(1, len(dat) - k ):
    #print("in/out")
    #print(dat[k+i])
    #print(dat[i])
    n += dat[k+i]
    n -= dat[i]
    dat2.append(n)
    if n > m:
        m = n
        mind = i + 1


#print(dat2)
#print(m)
#print(mind)

r = 0
for i in range(mind, mind + k):

    r += (dat[i] + 1) / 2

print(r)
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)
    ans = l[k - 1]
    for i in range(0, n - k):
        x = l[i + k] - l[i]
        ans = max(ans, x)
    print(ans)


if __name__ == '__main__':
    main()
#!/usr/bin/env python3

import numpy as np

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

for i in range(n):
    #exps.append(sum(list(range(1, p[i]+1)))/p[i])
    exps.append((1+p[i])/2)

exps = np.array(exps)
cumexps = exps.cumsum()
cumexps = np.insert(cumexps, 0, 0)

#print(exps)
#print(cumexps)

ans = -1
for i in range(n-k+1):
    tmp = -cumexps[i] + cumexps[i+k]
    if ans <= tmp:
        ans = tmp 

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

m=0

for i in range(0,K):
    m=m+p[i]+1

A=[]
A.append(m)

if N==K:
    print(A[0]/2)
else:
    for i in range(1,N-K+1):
        s=A[i-1]-p[i-1]+p[i+K-1]
        A.append(s)
    print(max(A)/2)
n,k = map(int,input().split())
p = list(map(int,input().split()))
kitaichi = []
for i in range(n):
    P = p[i]
    kitai = 1+P
    kitaichi.append(kitai)
m = [0,]
a = 0
for j in range(n):
    a += kitaichi[j]
    m.append(a)
ans = 0
for l in range(n-k+1):
    temp = m[l+k]-m[l]
    if temp> ans:
      ans = temp
print(ans/2)
N,K = list(map(int, input().split()))
p = list(map(int, input().split()))
p2 = [p[i]*0.5 + 0.5 for i in range(N)]
size = N + 1
cusum = [0] * size
max = 0

for i in range(N):
    cusum[i+1] = cusum[i] + p2[i]

for i in range(N-K+1):
    tmp = cusum[i+K] - cusum[i]
    if max < tmp:
        max = tmp
print(max)
a,b=map(int, input().split())
c=list(map(int, input().split()))
l =[]
ans = 0

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

cb = list(map(abc,c))

s = sum(cb[:b])
l.append(s)

for i in range(b,a):
    s = s - cb[i-b] + cb[i]
    l.append(s)

L = sorted(l)
print(L[-1])
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))

def expec(n):
    return ((1/2 * n * (n+1) )/ n)

def maxSum(arr, n, k): 
    res = 0
    for i in range(k): 
        res += expec(arr[i])
    curr_sum = res 
    for i in range(k, n):       
        curr_sum += expec(arr[i]) - expec(arr[i-k])
        res = max(res, curr_sum) 
    return res 
  
print(maxSum(p, N, K))
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

data = np.fromstring(read(), np.int64, sep=' ')

N, K  = data[:2]
P = np.hstack([[0], data[2:] + 1])

Pcum = P.cumsum()
x = Pcum[K:] - Pcum[0:-K]
print(x.max() / 2)
N, K = map(int, input().split())
p = list(map(int, input().split()))

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

result = m[K - 1]
for i in range(N - K):
    t = m[K + i] - m[i]
    if t > result:
        result = t
print(result)
n, k = map(int, input().split())
pl = list(map(int, input().split()))

dp = [0] * (n + 1)

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

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

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

s = 0
for i in range(K):
    s += p[i]
maxSum = s
j = 0

for i in range(K, N):
    s = s + p[i] - p[i-K]
    maxSum = max(maxSum, s)
print(maxSum)
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
#  = int(input())
n, k  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

q = sum(p[:k])
max_ = (q, 0, k)
for i in range(k, n):
    q = q + p[i] - p[i-k]
    if max_[0] < q:
        max_ = (q, i-k+1, i+1)

ans = 0
for p_ in p[max_[1]:max_[2]]:
    ans += 1 + (p_ - 1) * 0.5

#print(max_)
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
s = [0]
for i in range(n):
  if i==0:
    s.append(p[0])
  else:
    s.append(s[-1]+p[i])
pmax = 0
for i in range(n-k+1):
  if s[i+k]-s[i]>pmax:
    pmax = s[i+k]-s[i]
print(pmax)
N, K = map(int, input().split())
p = list(map(int, input().split()))

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

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

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

s = 0
for i in range(K):
    s += p[i]
ans = (K+s)/2

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

print(ans)
import queue

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

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

queue = queue.Queue()
currentSum = 0
maxSum = 0
for i in range(len(p)):
    currentSum = currentSum + p[i]
    queue.put(p[i])
    if i >= K:
        currentSum = currentSum - queue.get()

    if i >= K - 1:
        maxSum = max(maxSum, currentSum)

print("{:.12f}".format(maxSum / 2))
N, K = map(int, input().split())
P = list(map(int, input().split()))
e = []

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

for p in P:
    e.append(expect(p))

ans = sum(e[:K])
tmp = ans
#print(e, e[:K])
for i in range(K, N):
    tmp = tmp - e[i-K] + e[i]
    ans = max(ans, tmp)
    #print(tmp, ans, e[i-K], e[i])

print(ans)
n,k = (int(x) for x in input().split())
ln = list(map(float, input().split()))
ln_mean=[1+0.5*(x-1) for x in ln]
#print(ln_mean)

if n == k:
  print(sum(ln_mean))
else:
  lnk = [0]*(n-k+1)
  m_in = 0
  for i in range(k):
    m_in += ln_mean[i]
  m_max = m_in
  tmp_max = m_in
  for i in range(n-k):
    tmp_max = tmp_max - ln_mean[i] + ln_mean[i+k]
    if m_max < tmp_max:
      m_max = tmp_max
  print(m_max)
N, K = map(int,input().split())
p = list(map(int,input().split()))
 
exp = [(x+1)/2 for x in p]
 
sums = 0
ls =[0]

for n in range(N):
  sums += exp[n]
  ls.append(sums)

ans = 0
for n in range(N-K+1):

  ans_candidate = ls[n+K]-ls[n]

  if ans < ans_candidate:
    ans = ans_candidate 
print(ans)
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))

ans = 0
for e in p[0:k]:
  ans += (e + 1) / 2
anses = [ans]

for i in range(n - k):
  ans -= (p[i] + 1) / 2
  ans += (p[k + i] + 1) / 2
  anses.append(ans)

print(max(anses))
import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))
    
    pi_table = [0] + [(i * (i + 1) // 2) / i for i in range(1,1001)]
    
    pe = [None] * N
    for i in range(N):
        pe[i] = pi_table[p[i]]
    
    tmp = sum(pe[:K])
    ans = tmp
    for i in range(K, N):
        tmp += (pe[i] - pe[i - K])
        ans = max(ans, tmp)
        
    print(ans)



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

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

S = []

a = 0
for i in range(N):
  a += P[i]
  S.append(a)

B = []
for i in range(N-K+1):
  if i == 0:
    B.append(S[K-1])
  else:
    B.append(S[(K-1)+i]-S[-1+i])

print(max(B)/2 + K/2)
n, k = map(int, input().split())
p = list(map(int, input().split()))
now = sum(p[:k])
ans = (now + k) / 2
for i in range(k, n):
    now += p[i] - p[i - k]
    ans = max(ans, (now + k) / 2)
print(ans)
N,K = map(int, input().split())
p = [int(x) for x in input().split()]

pe_sum = 0.0
pe_sum_max = 0.0

for i in range(K):
    pe_sum += p[i] / 2 + 0.5

pe_sum_max = pe_sum

for i in range(K,N):
    pe_sum += (p[i] / 2 + 0.5) - (p[i-K] / 2 + 0.5)
    pe_sum_max = max(pe_sum,pe_sum_max)

print(pe_sum_max)
#154d
N,K = map(int, input().split())
p_list = list(map(int, input().split()))

#各サイコロの期待値算出
exp_value_list = list()
for i in range(N):
    exp_value_list.append(((p_list[i])+1)/2)

#初項の期待値算出
ans = 0
for i in range(K):
    ans += exp_value_list[i]

#1個ずつずらして、最大値を求める。
selected = ans
for i in range(0,N-K):
    selected -= exp_value_list[i]
    selected += exp_value_list[i+K]
    ans = max(ans,selected)
    
print(ans)
import numpy as np
from collections import deque

N, K = map(int, input().split())
p = [float(x) for x in input().split()]
p = np.array(p)

p = (1.+p)/2.
q = deque()

ans = 0.
tmp = 0.
for i in range(len(p)) : 
    q.append(p[i])
    tmp += p[i]
    if ( len(q) == K ) : 
        ans = max(ans, tmp)
        tmp -= q.popleft()

print("{:.10f}".format(ans))
def calc(x):
    return (x+1)/2

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

_ans = sum(p[0:k])
ans = _ans
for x in range(n-k):
    # print(x, x + k)
    _ans = _ans - p[x] + p[x + k]
    ans = max(ans, _ans)

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

max_value = 0
for i in range(k):
    max_value += (p[i] + 1) * 0.5

l, r = 1, k
cur = max_value
while r < n:
    cur += (p[r] - p[l-1]) * 0.5
    max_value = max(max_value, cur)
    l += 1
    r += 1
print(max_value)
n,k = map(int,input().split())
p = list(map(int,input().split()))
x = sum(p[:k])
ans = x
for i in range(k,n) :
    x += p[i] - p[i-k]
    if x > ans :
        ans = x
print((ans+k)/2)
# D - Dice in Line
from itertools import accumulate


def main():
    N, K, *P = map(int, open(0).read().split())
    # cumsum[i] = cumulative sum of expected values in [0, i]
    cumsum = tuple(accumulate([0] + [i * (1 + i) / (2 * i) for i in P]))
    ans = max(right - left for left, right in zip(cumsum, cumsum[K:]))
    print(ans)


if __name__ == "__main__":
    main()
N, K = map(int, input().split())
p = list(map(int, input().split()))

p_K = []
p_K.append(sum(p[0:K]))

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

print((max(p_K) + (K)) / 2)
N, K = map(int, input().split())
P = list(map(int, input().split()))
# print(P)
E = [(p*(p+1))/(2*p) for p in P]
# print([sum(E[i:i+K]) for i in range(N-K+1)])
S = [0]
for i in range(N):
    S.append(S[i] + E[i])
print(max([S[i+K] - S[i] for i in range(N-K+1)]))
n, k = map(int, input().split())
e = list(map(lambda x: (1 + int(x)) / 2, input().split()))
mt = sum(e[:k])
mf = mt
for i in range(1, n - k + 1):
  mt -= e[i - 1]
  mt += e[i - 1 + k]
  if mt > mf:
    mf = mt
print(mf)
N,K=map(int,input().split())
p=list(map(int,input().split()))
ans=sum(p[:K])
cnt=sum(p[:K])
for i in range(N-K):
    cnt+=p[K+i]
    cnt-=p[i]
    if cnt>ans:
        ans=cnt
print(K+(ans-K)/2)
from itertools import accumulate
n, k = map(int,input().split())
P = list(map(lambda x:(int(x)+1)/2,input().split()))
A = list(accumulate([0]+P))
B = []
for i in range(n-k+1):
    B.append(A[i+k]-A[i])

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

E = [(1 + p) / 2 for p in p]
curr_sum = sum(E[:K])
curr_max = curr_sum

for i in range(N - K):
    curr_sum += (E[i + K] - E[i])
    curr_max = max(curr_max, curr_sum)

print(curr_max)
n,k=map(int,input().split())
ps=list(map(int,input().split()))
tmp=sum(ps[:k])
res=tmp
for p,s in zip(ps,ps[k:]):
  tmp+=s-p
  res=max(res,tmp)
print((res+k)/2)
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))


def expect(n):
    res = (n + 1) / 2
    return res

p = list(map(expect, p))
ans_sum = sum(p[:k])
tmp_sum = ans_sum
idx = 0

for i in range(k, n):
    tmp_sum = tmp_sum + p[i] - p[i-k]
    if tmp_sum > ans_sum:
        ans_sum = tmp_sum

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

m = max(p)
l = [0]
for i in range(1,m + 1):
    l.append(l[-1] + i)
for i in range(1,len(l)):
    l[i]/=i
for i in range(n):
    p[i] = l[p[i]]

#累積和
for i in range(1,len(p)):
    p[i]+=p[i - 1]
p=[0]+p

ans = 0
for i in range(len(p) - k):
    ans = max(ans,p[i + k] - p[i])

print(ans)
n,k=map(int,input().split())
p = [(int(v)+1)/2 for v 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))
import sys
input = sys.stdin.buffer.readline

def main():
    N,K = map(int,input().split())
    a = list(map(int,input().split()))
    cum = [0]
    for num in a:
        cum.append(cum[-1]+num)
    M = 0
    for i in range(N-K+1):
        M = max(M,cum[i+K]-cum[i])
    
    print((M+K)/2)
    
if __name__ == "__main__":
    main()
n,k=map(int,input().split())
p=[int(x) for x in input().split()]
#さいころの出目の和を集計
for i in range(n):
    p[i]+=1

sdict={}
sdict[0]=p[0]

for i in range(n-1):
	sdict[i+1]=sdict[i]+p[i+1]
j=0
ans=0
if n!=k:
	while (j+k <n):
		dif=sdict[j+k]-sdict[j]
		ans=max(dif,ans)
		j+=1
else:
	ans=sum(p)
print(ans/2)
N,K = map(int,input().split())
P = list(map(int,input().split()))

summ = sum(P[0:K])
maxi = summ
idx = 0
ans = []
for i in range(N-K):
    summ = summ - P[i] + P[K+i]
    if summ > maxi:
        maxi = summ
        idx = i+1
for j in range(K):
    ans.append((P[idx+j]+1)/2)
print(sum(ans))
N, K = map(int, input().split())
P = list(map(int, input().split()))

max_sub = sum(P[0:K])
sub = max_sub
l = 0

for n in range(N-K):
    sub += P[n+K] - P[n]

    if max_sub < sub:
        max_sub = sub
        l = n + 1

print((sum(P[l:l+K])+K) / 2)
n,k = map(int,input().split())
p = list(map(int,input().split()))
s = m = k
for i in range(n):
	s += p[i] - p[i - k] * (i >= k)
	m = max(m,s)
print(m/2)
N, K = list(map(int, input().split()))
E = list(map(lambda x: (float(x) + 1) / 2, input().split()))
res = sum(E[:K])
t = res
for i in range(K, N):
    t += -E[i - K] + E[i]
    res = max(res, t)
print(res)
#!/usr/bin python3
# -*- coding: utf-8 -*-

import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    Et = [0]*(N+1)
    for i in range(N):
        Et[i+1] = Et[i] + (1+P[i])/2
    ret = 0
    for i in range(N-K+1):
        ret = max(ret, Et[i+K]-Et[i])
    print(ret)

if __name__ == '__main__':
    main()
from itertools import accumulate

N, K = map(int, input().split())
P = map(int, input().split())
acc_P = list(accumulate(P))
ans = (acc_P[K-1] + K) / 2

for i in range(N-K):
    ans = max(ans, (acc_P[i+K] - acc_P[i] + K) / 2)

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

sum_p = 0
sum_p_list =[]

for i in range(K):
    sum_p += p[i]

sum_p_list.append(sum_p)

for j in range(K,N):
    sum_p -= p[j - K]
    sum_p += p[j]
    sum_p_list.append(sum_p)
    

ex = (max(sum_p_list) - K + 2)/2

print(ex + K - 1)
n,k = map(int,input().split())
p = list(map(int, input().split()))
kt = [0]*n
ans = sum(p[0:k])
prev = sum(p[0:k])

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

sum_p = 0

for i in range(K):
    sum_p += p[i]

max_p = sum_p

for j in range(K,N):
    sum_p -= p[j - K]
    sum_p += p[j]
    max_p = max(max_p,sum_p)

ex = (max_p - K + 2)/2

print(ex + K - 1)
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)
n, k = map(int, input().split())
p = list(map(int, input().split()))

ans = sum(p[:k])

psum = [0] * n
psum[0] = p[0]
for i in range(1, n):
  psum[i] = psum[i-1] + p[i]

anss = [0] * n
for i in range(n-k):
  anss[i] = psum[i+k] - psum[i]

print((max(ans, max(anss))+k)/2)
N,K=map(int,input().split())
P=list(map(int,input().split()))

s=(sum(P[:K])+K)/2
ans=s

for i in range(1,N-K+1):
    ans=max(ans,s-(P[i-1]+1)/2+(P[i+K-1]+1)/2)
    s=s-(P[i-1]+1)/2+(P[i+K-1]+1)/2
print(ans)
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
a = inpl()
for i in range(n):
    a[i] = (a[i]+1)/2
cnt = sum(a[:k])
res = cnt
for i in range(n-k):
    cnt -= a[i]
    cnt += a[k+i]
    res = max(res,cnt)
print(res)
N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

MAX = 0
for i in range(N-K+1):
    if i == 0:
        SUM = 0
        for j in range(K):
            SUM += (A[i+j]+1)/2

    else:
        SUM += (A[i+K-1]+1)/2
        SUM -= (A[i-1]+1)/2
    
    if MAX < SUM:
        MAX = SUM

print(MAX)
n,k = map(int,input().split())
p = list(map(int,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((m+k)/2)
def resolve():
    N,K=map(int,input().split())
    P=[int(i) for i in input().split()]
    PP= [i*(i+1)/2/i for i in P]
    mx = sum(PP[:K])
    sm=mx
    for i in range(K,N):
        sm+=PP[i]
        sm-=PP[i-K]
        mx=max(sm,mx)
    print(mx)





if __name__ == "__main__":
    resolve()
def main():
    N, K = map(int, input().split())
    p = list(map(int, input().split()))

    p = [(p_i+1)/2 for p_i in p]
    ans = 0
    for i in range(N-K+1):
        if i == 0:
            sum_ = sum(p[i:i+K])
        else:
            sum_ = sum_ + p[i+K-1] - p[i-1]
        ans = max(ans, sum_)

    print(ans)

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

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

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

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())
Dice = list(map(int, input().split()))
Exv = [(n*(n+1)/2)/n for n in Dice]
ExvL = [0]
for i in Exv:ExvL.append(ExvL[-1]+i)
ans=0.0
for i in range(0,n-k+1):
    ans=max(ans,ExvL[i+k]-ExvL[i])
print(ans)
N,K=map(int,input().split())
*P,=map(int,input().split())

ans=(sum(P[:K])+K)/2
now=ans
i=K
while i<N:
    now=now+(P[i]+1)/2-(P[i-K]+1)/2
    ans=max(now,ans)
    i+=1

print(ans)
n, k = map(int, input().split())
nums = [int(i) for i in input().split()]
# n, k = 10, 4
# nums = [17, 13, 13, 12, 15, 20, 10, 13, 17, 11]

expected_values = [num * (num + 1) / 2 / num for num in nums]

accums = [0]
for e in expected_values:
    accums.append(accums[-1] + e)

m = 0
for i in range(n-k+1):
    m = max(m, accums[i+k] - accums[i])
print(m)
n, k = map(int, input().split()) 
p_list = list(map(int, input().split()))
e_list = [(p + 1) / 2 for p in p_list]

s = sum(e_list[:k])
ans = s
for i, e in enumerate(e_list[k:]):
    s = s - e_list[i] + e
    ans = max(ans, s)
print(ans)
from sys import stdin
import sys

N, K = [int(x) for x in stdin.readline().rstrip().split()]
s = list(map(int, input().split()))
ans = [0]*N
sum
for i in range(0, K):
    ans[i] = (s[i]+1)/2
sum = sum(ans)
mx = sum
for i in range(K, N):
    ans[i] = (s[i]+1)/2
    sum = sum+ans[i]-ans[i-K]
    if mx < sum:
        mx = sum
# print(s, ans, mx)
print(mx)
n,k = map(int,input().split())
p = list(map(int,input().split()))
for i in range(n):
    p[i] = (1 + p[i]) / 2
ans = 0.0
tmp = 0.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())
p=list(map(int,input().split()))
ans=0
for i in range(k):
    ans+=p[i]
pre=ans
for i in range(k,n,1):
    pre=(pre+p[i]-p[i-k])
    if ans<pre:
        ans=pre
print((ans+k)*0.5)
N, K = map(int, input().split())
P = list(map(int, input().split()))
M = sum(P[0:K])
m = M
for i in range(0, N-K):
  m = m - P[i] + P[i+K]
  if m >= M:
    M = m
print((M+K)/2.0)
N, K = map(int, input().split())
P = list(map(int, input().split()))
sub = sum(P[:K])
max_ = sub
for i in range(K, N):
    sub = sub - P[i - K] + P[i]
    max_ = max(max_, sub)
print((max_ + K) / 2)
n,k=[int(i) for i in input().split()]
p=[int(i) for i in input().split()]

ex=[0]*1001
tmp=0
for i in range(1,1001):
  tmp+=i
  ex[i]=tmp/i

sumEx=[0]*(n+1)
for i in range(n):
  sumEx[i+1]=sumEx[i]+ex[p[i]]

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


def calc(x):
    return (x+1)/2


pe = []
for i in range(N):
    pe.append(calc(p[i]))

cs = [pe[0]] + [0]*(N-1)

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

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

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

#累積和を出す
t = [0] * (len(p) + 1)
for i in range(len(p)):
  t[i + 1] = t[i] + p[i]

#連続するK個の和で、最大の値を取得する。
maximum = -1
start = -1

for i in range(len(p) - k + 1):
  temp = t[i + k] - t[i]
  if temp > maximum:
    maximum = temp
    start = i

#期待値
exp = 0
for i in range(start, start + k):
  temp = 1 / 2 * p[i] * (p[i] + 1)
  exp += temp / p[i]

print(exp)
import sys
from itertools import accumulate


def solve():
    N, K = map(int, sys.stdin.readline().split())
    cusum_p = (0,) + tuple(accumulate(map(int, sys.stdin.read().split())))
    return (max(i - j for i, j in zip(cusum_p[K:], cusum_p[:-K])) + K) / 2


if __name__ == "__main__":
    answer = solve()
    print(answer)
n, k = map(int, input().split())
p = list(map(int, input().split()))
exp_list = []
for i in p:
    expect = (i+1)/2
    exp_list.append(expect)
s = sum(exp_list[0:k])
ans = s
for j in range(n-k):
    s -= exp_list[j]
    s += exp_list[j+k]
    if s > ans :
        ans = s
print(ans)
N, K = map(int, input().split())
P = list(map(int, input().split()))
E = [(p+1)/2.0 for p in P]
tmp = sum(E[0:K])
ans = tmp
for i in range(1, N-K+1):
    tmp = tmp - E[i-1] + E[i+K-1]
    ans = max(ans, tmp)
print(ans)
import sys
 
ma = {}
def _sum(n):
    if not n in ma:
        ma[n] = sum(range(1,n+1))
    return ma[n]

def ev(v):
    return _sum(v) * 1.0/v
 
N, K = [int(x) for x in sys.stdin.readline().strip().split(" ")]
p = [ev(int(x)) for x in sys.stdin.readline().strip().split(" ")]
 

cur = sum([p[i] for i in range(K)])
_max = cur

i = K-1
j = 0

while i < N - 1:
    cur -= p[j]
    i += 1
    j += 1
    cur += p[i]
    if _max < cur:
        _max = cur

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

expect = [(e + 1) / 2 for e in A]
window = sum(expect[0:K])
max_s = window
for i in range(N - K):
    window -= expect[i]
    window += expect[i + K]
    if window > max_s:
        max_s = window
print(max_s)
n,k=map(int,input().split())
P=[(int(i)+1)/2 for i in input().split()]
S=[P[0]]
for i in range(n-1):
    S.append(S[i]+P[i+1])
ans=0
S.insert(0,0)
for i in range(n-k+1):
    ans=max(ans,S[i+k]-S[i])
print(ans)
n,k = map(int,input().split())
a = list(map(int,input().split()))
e = [0]*n
b = [0]*(n-(k-1))
for i in range(n):
  e[i] = (1+a[i])/2

b[0] = sum(e[0:k])
for i in range(1, len(b)):
  b[i] = e[i+k-1] + b[i-1] - e[i-1]
print(max(b))