peterverebics/CodeNet_Python_118 huggingface dataset:
import numpy

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

List=list(map(int,input().split()))
EList = []

for i in range(len(List)):
  a = List[i]
  b = (a+1)/2
  EList.append(b)
  

res = numpy.cumsum(EList)
res = numpy.insert(res,0,0)
ans = 0
for i in range(len(List)+1):
  if i < K-1:
    ans = 0
  else:
    ans = float(max(res[i] - res[i-K],ans))

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

kouho=0
lis=[0]*n
lis[0]=(1+p[0])/2
for i in range(0,n):
  if i>=1:
    lis[i]=lis[i-1]+(1+p[i])/2
  if i==k-1:
    kouho=lis[i]
  if i>k:
    if lis[i]-lis[i-k]>kouho:
      kouho=lis[i]-lis[i-k]
print(kouho)
N,K = map(int, input().split())
p = list(map(int, input().split()))
p = list(map(lambda x:(x+1)*0.5, p))
temp = []
p_sum=0
for i in range(N):
    p_sum+=p[i]
    temp.append(p_sum)
ans = []
for j in range(K,N):
    ans.append(temp[j]-temp[j-K])
if len(ans) != 0:
    print(max(ans))
else:
    print(p_sum)
n, k = map(int, input().split())
p = list(map(int, input().split()))

q = []
for i in range(n):
    q.append((p[i] + 1) * 0.5)
maxv = 0
for i in range(k):
    maxv += q[i]
cnt = maxv
for i in range(n):
    if i + k >= n:break
    cnt = cnt - q[i] + q[i + k]
    maxv = max(cnt, maxv)
print(maxv)
from itertools import accumulate
import sys
read = sys.stdin.buffer.read

def main():
  N, K, *p = map(int, read().split())
  p = [0] + list(accumulate(p))
  print((max(b - a for a, b in zip(p, p[K:])) + K) / 2)

if __name__ == '__main__':
    main()
N,K=map(int,input().split())
p=list(map(int,input().split()))
Exception_p=[]
for i in range(N):
    Exception_p.append((1+p[i])/2)
sum_Exception=[]
sum=0
for k in range(K):
    sum=(p[k]+1)/2+sum
sum_Exception.append(sum)
for i in range(N-K):
    sum=sum_Exception[i]-p[i]/2+p[i+K]/2
    sum_Exception.append(sum)
list.sort(sum_Exception)    
print(sum_Exception.pop(-1))
n, k = map(lambda x: int(x), input().split(" "))
Ps = list(map(lambda x: int(x), input().split(" ")))

result = 0
expected_list = []
temp_result = 0
for i, p in enumerate(Ps):
    temp = (p * (p + 1) / 2 )/ p
    expected_list.append(temp)
    temp_result += temp
    if i+1 >= k:
        result = max(result, temp_result)
        temp_result -= expected_list[i-k+1]

print(result)
N,K=map(int,input().split())
S=list(map(int,input().split()))

L=[0]*(N-K+1)

target=0


for i in range(N-K+1):
    if i==0:
        for j in range(K):
            target+=S[j]
        L[0]=target
    else:    
        target+=S[K+i-1]-S[i-1]
        L[i]=target
best=max(L)    
print((best+K)/2)
N, K = map(int, input().split());
p = list(map(int, input().split()));
sum = 0;
max_sum = 0;
for i in range(K):
  sum += p[i]

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

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

tmp_sum = sum(p[0:k])
ans = (tmp_sum + k) / 2
count = float(0)
for i in range(k, n):
    tmp_sum = tmp_sum + p[i] - p[i - k]
    tmp = (tmp_sum + k) / 2
    if ans <= tmp:
        ans = tmp

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

for i in range(N):
  ruiseki.append(ruiseki[i]+ex[i])


for i in range(N+1-K):
  if ans<ruiseki[i+K]-ruiseki[i]:
    ans=ruiseki[i+K]-ruiseki[i]
print(ans)
N,K = map(int,input().split())
p = list(map(int,input().split()))
E = [(1+i)/2 for i in p]
S = [0]*(N+1)
sum = 0
for i in range(N):
  sum += E[i]
  S[i+1] = sum
ans = 0
i = 0
while N-K-i >= 0:
  A = S[K+i] -S[i]
  ans = max(ans,A)
  i += 1
print(ans)
from itertools import accumulate    # 累積和: list(accumulate(num_list))

def main():
    n, k = map(int, input().split())
    num_list = list(map(int, input().split()))

    compute_list = []

    for num in num_list:
        compute_list.append((1+num)/2)

    sum_list = list(accumulate(compute_list))

    if k == n:
        print(sum_list[k-1])
        exit()

    ans = 0

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

    print(ans)

if __name__ == '__main__':
    main()
n, k = [int(elem) for elem in input().split()]
ps = [int(elem) for elem in input().split()]

sum_max = 0
for i in range(k - 1, n):
    if i == k - 1:
        sum_now = sum(ps[:i + 1])
    else:
        sum_now = sum_now + ps[i] - ps[i - k]
    sum_max = max(sum_max, sum_now)
    
print(float(sum_max + k) / 2)
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=sum(B[0:A[1]])
D=C
for i in range(A[1]-1,A[0]-1):
  D=D+B[i+1]-B[i-A[1]+1]
  C=max(C,D)
print((C+A[1])/2)
N,K = map(int, input().split())
A=list(map(int, input().split()))  
 
num = sum(A[0:K])
ind = 0
max_num =0
for i in range(N-K):
    num -= A[i]
    num += A[i+K]
    if num> max_num:
        ind = i+1
        max_num = num
 
ans = 0
for i in range(ind,ind+K):
    ans += (1+A[i])/2
    
print(ans)
from itertools import accumulate
N, K = map(int, input().split())
P = list(map(int, input().split()))
Q = [0]+list(accumulate((1+p)/2 for p in P))
print(max(Q[K+i]-Q[i] for i in range(N-K+1)))
N, K = map(int, input().split())
p = list(map(int, input().split()))

dp = [0] * (N)
dp_sub = [0] * (N)

dp[0] = (p[0] + 1) / 2
dp_sub[0] = (p[0] + 1) / 2

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

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

pe = [1] * max(p)
for i in range(1, len(pe)):
    pe[i] += (pe[i-1] + i)

for i in range(1, len(pe)):
    pe[i] *= 1/(i+1)

ans = sum([pe[pi-1] for pi in p[0:k]])
s = ans
for i, t in enumerate(range(k, n)):
    s = s + pe[p[t]-1] - pe[p[i]-1]
    ans = max(ans, s)

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())
P=list(map(lambda x: (int(x)+1)/2,input().split()))
s=sum(P[:K])
tmp=s
for i in range(K,N):
  tmp=tmp-P[i-K]+P[i]
  if tmp>s:
    s=tmp
print(s)
n, k = map(int, input().split())
p = list(map(lambda i: (i + 1) / 2, list(map(int, input().split()))))
suma = sum(p[0:k]) 
max = suma
for i in range(k, n):
    suma += (p[i] - p[i - k])
    if suma > max:
        max = suma

print('{:.8f}'.format(max))
n,k = map(int, input().split())
pn = list(map(int, input().split()))
qn = [(i+1)/2 for i in pn]
ans = sum(qn[:k])
t=ans
for i in range(1, n-k+1):
    t +=-qn[i-1]+qn[i+k-1]
    ans = max(ans, t)
print(ans)
def main():  
  import sys
  input = sys.stdin.readline
  import numpy as np #pypy不可
  n,k = map(int,input().split())
  p = np.array(input().split(),np.int32)
  np.cumsum(p,out=p)
  chk = p[k-1]
  for i in range(n-k):
    c = p[i+k]-p[i]
    chk = max(c,chk)
  print((chk+k)/2)
if __name__ == '__main__':
    main()
n, k =  map(int,input().split())

p = list(map(int,input().split()))
counter_li = []
first = 0
for i in range(k):
    first+=p[i]
counter_li.append(first)
for i in range(1,len(p)-k+1):
    counter_li.append(counter_li[i-1]+ p[i+k-1] - p[i-1])
print(max(counter_li)/2+k/2)
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
dp = [0]*N
dp[0] = sum(p[:K])
for i in range(N-K):
    dp[i+1] = dp[i] - p[i] + p[i+K]
index = dp.index(max(dp))
for i in range(index, index+K):
    ans += 0.5*p[i]*(p[i]+1)/p[i]
print(ans)
N,K=map(int,input().split())
P=list(map(int,input().split()))
X=[]
for a in P:
    X.append(a/2+0.5)
gou=sum(X[0:K])

han=-32
saigou=sum(X[N-K:N])
han=saigou
for a in range(N-K-1):

    if gou>han:
        han=gou
    gou=gou-X[a]+X[a+K]

print(han)
N,K = map(int, input().split())
P=input().split()
P = [int(p) for p in P]
maxv=0
expv=0

for i in range(K):
    expv+=P[i]

maxv=expv

for i in range(N-K):
    expv=expv-P[i]+P[i+K]
    maxv=max(maxv,expv)
    
        
print("{:.20f}".format((maxv+K)/2))
N, K = map(int, input().split())
p = list(map(int, input().split()))

sum_p = 0
sum_list = []
sum_list.append(sum_p)
for p_element in p:
    sum_p += p_element 
    sum_list.append(sum_p)

sum = 0
start = 0
for i in range(N-K+1):
    if sum < sum_list[i+K]-sum_list[i]:
        sum = sum_list[i+K]-sum_list[i]
        start = i

answer = 0
for i in range(K):
    answer += (1+p[start+i])/2
print(answer)
N,K=map(int,input().split())
tu=tuple(map(int,input().split()))
l=[0]*(N+1)
l[0]=0
ans=0
for i in range(1,N+1):
  l[i]=l[i-1]+(tu[i-1]+1)/2
  if i>=K:
    ans=max(ans,l[i]-l[i-K])
print(ans)
N, K = map(int, input().split())
p = list(map(int, input().split()))
Expected_val = []
for val in p:
    sum_val = (val * (val + 1)) // 2
    Expected_val.append(sum_val / val)
# print(Expected_val)

left = 0
right = K

ans = sum(Expected_val[left:right])
tmp_ans = ans
# print(ans)
for i in range(N - K):
    tmp_ans = tmp_ans - Expected_val[left + i] + Expected_val[right + i]
    if tmp_ans > ans:
        ans = tmp_ans
print(ans)
n,k=list(map(int,input().split()))
li=list(map(int,input().split()))

sum_=0
for i in range(k):
  sum_+=li[i]
max_=sum_

for i in range(k,len(li)):
  sum_-=li[i-k]
  sum_+=li[i]
  if max_<sum_:
    max_=sum_
max_+=k
max_/=2
print(max_)
n,k = map(int,input().split())
p_l = list(map(int,input().split()))

possibility=list(map(lambda x:(1+x)/2,p_l))


max_p=sum(possibility[0:k:1])
tmp=max_p
for i in range(1,len(possibility)-k+1):
    tmp+=possibility[i+k-1]-possibility[i-1]
    if tmp>max_p:
        max_p=tmp
        
print(max_p)
n,k=map(int,input().split())
p=list(map(int,input().split()))
ep=[(x+1)/2 for x in p]
s=[0]*n
s[0]=sum(ep[:k])
if k<n:
  for i in range(0,n-k):
    s[i+1]=s[i]+ep[k+i]-ep[i]
print(max(s))
n, k = map(int, input().split())
arr = list(map(int, input().split()))
expected = []
cumsum = []
for x in arr:
	sum = (x * (x + 1)) // 2
	ex = sum / x
	expected.append(ex)

sum = 0
maxi = 0
taken = 0
bad = 0
for x in expected:
	sum += x
	taken += 1
	if taken == k:
		 maxi = max(maxi, sum)
	elif taken > k:
		sum -= expected[bad]
		bad += 1
		maxi = max(maxi, sum)
print(maxi)
from collections import deque
n, k = map(int, input().split())
p = deque(map(int, input().split()))

adjacent = deque()
for i in range(k):
    adjacent.append(p.popleft())

ans = sum(adjacent)
count = ans

while p:
    pp = p.popleft()
    count -= adjacent.popleft()
    count += pp
    adjacent.append(pp)
    ans = max(ans, count)

print((ans + k) / 2)
import sys
import itertools


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, readline().split()))
    a = list(map(int, readline().split()))
    ls = [0] * (n + 1)
    tm = 0
    for i, v in enumerate(a):
        ls[i + 1] = (((1 + v) * v) // 2) / v
    ls = list(itertools.accumulate(ls))
    for i in range(k, n + 1):
        tm = max(tm, ls[i] - ls[i-k])
    print(tm)


if __name__ == '__main__':
    solve()
N, K = map(int, input().split())
P = list(map(int, input().split()))

ans = sum(P[0:K])
tmp = sum(P[0:K])

for i in range(1, N-K+1):
    tmp = tmp - P[i-1] + P[i+K-1]
    ans = max(tmp, ans)
print((ans + K)/2)
a,b=map(int,input().split())
d = list(map(int, input().split(" ")))
w = [0]*(len(d)+1)

# 累積和の計算
w[0] = 0
for i in range(0, len(d)):
  w[i+1] = w[i] + d[i]
  
ans = 0
for i in range(0, a-b+1):
    ans = max([ans,w[i+b]-w[i]])

d2 = 0.5*b + ans/2

if a == 1:
  print((d[0]+1)/2)
else:
  print(d2)
N, K = map(int,input().split())
p = list(map(int,input().split()))
ma = sum(p[0:K]) 
newma = ma
for i in range(N-K):
  newma = newma + p[K+i] - p[i]
  if ma < newma:
    ma = newma
print((ma+K)/2)
n,k = map(int,input().split())
p = list(map(int,input().split()))
P = [0 for x in range(n-k+1)]
P[0] = sum([p[i] for i in range(k)])

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

m = max(P)
print((m+k)/2)
N, K = map(int,input().split())
p = list(map(int,input().split()))
P = [(p[k]*(p[k]+1))/(2*p[k]) for k in range(N)]
S = [0]*N
S[0] = P[0]
for k in range(1,N):
    S[k] = S[k-1] + P[k]
S = [0] + S
ans = 0
for k in range(1,N-K+2):
    ans = max(ans,S[k+K-1]-S[k-1])
print(ans)
N,K=map(int,input().split())
_=input().split()
S=[]
for s in _:
    S.append((int(s)+1)/2) #初めから期待値で配列作成

ans=sum(S[0:K])
temp=ans

for i in range(N-K):
    temp=temp-S[i]+S[i+K]
    if ans<temp:
        ans=temp
    else:
        pass
    
print(ans)
from itertools import accumulate
N, K = map(int, input().split())
P = list(map(int, input().split()))
P = [0]+[(p+1)/2 for p in P]
S = list(accumulate(P))
B = []
for j in range(N-K+1):
    B.append(S[j+K]-S[j])
ans = max(B)
print(ans)
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] + (1+p[i])/2

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

for i in range(n - k):
  expected_value.append(expected_value[-1]-p[i]+p[i+k])
print((max(expected_value)+k)/2)
def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))
    maxI = 0
    maxV = sum(P[:K])
    curV = maxV
    for i in range(1, N-K+1):
        curV = curV + P[i+K-1] - P[i-1]
        if curV > maxV:
            maxV = curV
            maxI = i

    res = (sum(P[maxI:maxI+K]) + K) / 2.0
    print(res)

main()
N, K = map(int,input().split())
p = list(map(int,input().split()))
S = [0]
a = 0
sum1 = 0
sumMax = 0
for i in range(N):
    a += p[i]
    S.append(a)
for i in range(N-K+1):
    sum1 = S[i+K] - S[i]
    if(sumMax < sum1):
        sumMax = sum1
result = 0.5*K + 0.5*(sumMax)
print(result)
N , K = map(int,input().split())
deme = [int(i) for i in input().split() ]

cusum = [0.0] * ( N + 1 )

for x in range( len(deme) ):
    cusum[x+1] = cusum[x] + float(( deme[x] + 1 ) / 2)

ans = 0.0
for i in range( K, len(cusum)):
    if i > 0:
        pre = i - K
        kukan = cusum[i] - cusum[i-K]
        ans = max(ans, kukan)

print(ans)
# https://atcoder.jp/contests/abc154/tasks/abc154_d

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

# 初期値として0~Kのサイコロの目を最大値として保持しておく
max = x = sum(s[:K])
for i in range(N - K):
    x += (s[K + i] - s[i])
    if max < x:
        max = x

# 期待値はサイコロの目の数の合計+1*サイコロの数/2
print((max + K) / 2)
N, K = map(int,input().split())
P = list(map(float,input().split()))
for i in range(N):
    P[i] = (P[i]+1.0)/2.0

anss=0        
for i in range(N-K+1):
    #print(i)
    #ans_kari = sum(P[i:i+K])
    if i==0:
        ans_kari = sum(P[i:i+K])
    else:
        ans_kari = ans_kari - P[i-1] + P[i+K-1]
    #print(ans_kari)
    #print(i)
    if ans_kari > anss:
        anss = ans_kari

print(anss)
N, K = map(int,input().split())
p = list(map(int,input().split()))
a = []
for e in p:
    a.append((e*(e+1)/2)/e)
ans = sum(a[:K])
temp = ans
for i in range(N-K):
    temp -= a[i]
    temp += a[i+K]
    ans = max(ans,temp)
print(ans)
N,K=map(int,input().split())
p=list(map(int,input().split()))

res=0
s=sum(p[:K])
for i in range(N-K+1):
    res=max(res,(s+K)/2)
    if i!=N-K:
        s=s+p[i+K]-p[i]
print(res)
n,k = map(int, input().split())
p = [ int(x) for x in input().split()]

sm = sum(p[:k])
adj_sum = [sm]
for i in range(k,n):
  sm -= p[i-k]
  sm += p[i]
  adj_sum.append(sm)
  
mx = max(adj_sum)
print((mx+k)/2)
N,K = map(int,input().split())
P = list(map(int,input().split()))
ans = 0
D = [0]+[(p+1)/2 for p in P]
res = 0
for i in range(N+1):
    res += D[i]
    if i>=K:
        res-=D[i-K]
        ans = max(res,ans)
print(ans)
A = list(map(int , input().split()))
B = list(map(int , input().split()))
kitaiti =[(i+1)/2 for i in B]
ans = []
dd = [0]
for i in range(A[0]):
    dd.append(dd[i] + kitaiti[i])
for i in range(A[1] , A[0]+1):
    ans.append(dd[i] - dd[i - A[1]])
print(max(ans))
n, k = map(int, input().split())
p = list(map(int, input().split()))
s = [0] * (n+1)

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

s_max = -1
pos = 0
for i in range(n-k+1):
    ss = s[i+k] - s[i]
    if ss > s_max:
        s_max = ss
        pos = i

ans = 0.0
for i in range(pos, pos+k):
    ans += (p[i]+1) / 2

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

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

s = [0]
for i in range(n):
    s.append(s[i] + p_exp[i])

ans = -1

for i in range(0, n-k+1):
    k_start = i
    k_end = i + k
    
    sum_exp = s[k_end] - s[k_start]
    
    ans = max(sum_exp, ans)

print(ans)
def main():
    x,y = map(int,input().split())
    p = list(map(int,input().split()))

    number = sum(p[0:y])
    bigNumber = number

    for i in range(x-y):

        number = number - p[i] + p[i+y]

        if number > bigNumber:
            bigNumber = number

    print((bigNumber + y) / 2)

main()
# -*- coding: utf-8 -*-
a = list(map(int,input().split()))

n = a[0]
k = a[1]
p = list(map(int,input().split()))

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

ret2 = []
b = 0.0
for j in range(k):
        b += e[j]
ret2.append(b)

for i in range(n-k):
        ret2.append(ret2[i] - e[i] + e[i+k])

ret=ret2

ret.sort()
print(ret[n-k])
n,k = map(int,input().split())
p = list(map(int,input().split()))
for i in range(n):
    p[i] = (p[i]+1)/2
kset = 0
for j in range(k):
    kset += p[j]
max = -10000
if n != k:
    for l in range(n-k):
        if kset >= max:
            max = kset
        kset = kset - p[l] + p[l+k]
else:
    max = kset
    
if kset >= max:
    max = kset
print(max)
n, k = (int(x) for x in raw_input().split())
l = [int(x) for x in raw_input().split()]
pref = [0]
for i in xrange(n):
    pref.append(pref[-1] + (1 + l[i]) / 2.)
i = k
ret = 0
while i < len(pref):
    ret = max(ret, pref[i] - pref[i-k])
    i += 1
print ret
n,k=map(int,input().split())
p = list(map(int,input().split()))
def ex_even(a):
    return (a+1)/2
def ex_odd(b):
    return b//2 + 1
s = sum(p[0:k])
s_max = sum(p[0:k])
for i in range(n-k):
    s = s-p[i] + p[i+k]
    s_max = max(s_max,s)
if s_max % 2 == 0:
    print(ex_even(s_max) + 0.5*(k-1))
else:
    print(ex_odd(s_max) + 0.5*(k-1))
import numpy as np
n, k = list(map(int, input().split()))
p = np.array([0] + list(map(int, input().split())))
c = np.cumsum(p)
print((c[k:] - c[:-k] + k).max() / 2)
n,k=map(int,input().split())
p=list(map(int,input().split()))
sum1=0
a=[]
for j in range(k):
    sum1=sum1+((1+p[j])/2)
a.append(sum1)
for i in range(1,n-k+1):
    sum1=sum1-((1+p[i-1])/2)+((1+p[i+k-1])/2)
    a.append(sum1)
ans=max(a)
print(ans)
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

T = [0] * (N+1)

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

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

print(ans)
n, k = map(int, input().split())
p = list(map(int,input().split()))
b = [(1 + p[i])/2 for i in range(n)]
 
ttl = sum(b[:k])
res = ttl
for i, v in enumerate(b[k:]):
    ttl += v - b[i]
    res = max(res, ttl)
 
print("{:.10f}".format(res))
n, k = [int(x) for x in input().split()]
# ps = [int(x) for x in input().split()]

continuous_sum = (lambda n: (n + 1) * (n // 2) + (0 if n %2 == 0 else n // 2 + 1))
calc_expectedval = (lambda p: continuous_sum(p) / p)
expected_vals = [calc_expectedval(int(x)) for x in input().split()]

prevval = sum(expected_vals[0:0+k])
maxval = prevval
for i in range(n - k):
  candidate = prevval - expected_vals[i] + expected_vals[i + k]
  if candidate > maxval:
    maxval = candidate
  prevval = candidate

print(maxval)
N, K = list(map(int, input().strip().split()))
P = list(map(int, input().strip().split()))
start = 0
rec_sum = sum(P[0:K])
max_sum = rec_sum
for i in range(1, N - K + 1):
  rec_sum = rec_sum - P[i-1] + P[i+K-1]
  if rec_sum > max_sum:
    start = i
    max_sum = rec_sum
    
ans = 0.0
for _p in P[start:start+K]:
  ans += (1+_p) / 2
print(ans)
#print(P[start:start+K])
import itertools
N, K = [int(hoge) for hoge in input().split()]
P = [int(hoge) for hoge in input().split()]
PP = [0] + list(itertools.accumulate(P))
print((max([PP[X]-PP[X-K] for X in range(K,N+1)])+K)/2)
N,K=map(int,input().split())
*p,= map(int, input().split())

s=[(p[n]+1)/2 for n in range(N)]
S=[0]*(N+1)

def make_S(n):
    S=[0]*(n+1)
    S[0]=0
    for i in range(n):
        S[i+1]=S[i]+s[i]
    return S
S=make_S(N)

def max_delta(n,k):
    max=-1000000
    for i in range(n-k+1):
        delta = S[i+k]-S[i]
        if delta>max:
            max=delta
    return max

print(max_delta(N,K))
n, k = map(int, input().split())
p = list(map(int, input().split()))
max_i=0
ret = 0
p_s=sum(p[0:k])
s_max=p_s
for i in range(n-k):
  p_s=p_s-p[i]+p[i+k]
  if s_max<p_s:
    s_max=p_s

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

tmp = sum(p[0:k])
#print(tmp)
ans = tmp

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

print(0.5*k+ans/2)
N, K = map(int, input().split())
P = list(map(int, input().split()))
S = []

for num in P:
    S.append((num + 1) / 2)

ans = sum(S[0:K])
max_ans = ans

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

print(max_ans)
N,K = map(int,input().split())
p_list = list(map(int,input().split()))
ans_list = []
def E(me):
    if me == 1:
        return 1
    else:
        return ((1+me)*me/2)/me
E_list_ruisekiwa = [0,]
for i in range(N):
    E_list_ruisekiwa.append(E_list_ruisekiwa[i]+E(p_list[i]))

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

for i, j in enumerate(p):
    p[i] = (j*(j+1)/2) / j 
t_sum = sum(p[:k])
ans = t_sum
for i in range(n-k):
    t_sum = t_sum - p[i] + p[i+k]
    if ans < t_sum:
        ans = t_sum
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))
s = [0 for _ in range(n + 1)]
ans = 0
for i in range(n):
    s[i+1] = p[i] + s[i]

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

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

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

import numpy as np
cums=np.cumsum([0] + [exp(i) for i in p])

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

print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))
for i in range(n):
    p[i] = (p[i] * -~p[i]) / 2 / p[i]
ans = v = sum(p[:k])
for i in range(n - k):
    v = v - p[i] + p[k + i]
    ans = max(ans, v)
print(ans)
# ruisekiwa by itertools

from itertools import accumulate

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

b1=[0]+list(accumulate(p))

ans=[]

for i in range(N-K+1):
    ans.append(b1[K+i]-b1[i])
    
print((max(ans)+K)/2)
N, K = map(int,input().split()) # 複数の数字を変数に格納
List = list(map(int,input().split())) # 複数の数字をリストに格納

result = []
num = 0

for i in range(K):
    num += List[i]

result.append(num)
    
for i in range(N-K):
    num = num - List[i] + List[K+i]
    result.append(num)

print(max(result) / 2 + 0.5*K)
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,k = iim()
P = iil()
Psum = []
tmp = 0
for i in P:
    tmp += i
    Psum.append(tmp)

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

print((ans+k)/2)
n,k=map(int,input().split())
P=list(map(int,input().split()))
S=[0]
for i in range(n):
    s=P[i]+S[i]
    S.append(s)
a=0
for i in range(k,n+1):
    a=max(a,S[i]-S[i-k])
print((a+k)/2)
n,k = map(int, input().split())
p = [int(e) for e in input().split()]
s = sum(p[0:k])
max = s
for i in range(n-k):
  s = s - p[i] + p[i+k]
  if max < s:
    max = s
    
ex = (max+k)/2.0
print(ex)
input = raw_input
n, k = map(int, input().split(" "))
ps = map(int, input().split(" "))

means = [(1+p)/2. for p in ps]

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

print(out)
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] + 1) / 2

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