peterverebics/CodeNet_Python_118 huggingface dataset:
import numpy as np
N, K = map(int, input().split())
plist = list(map(int, input().split()))
kitaiti = np.array([(0.5*(p+1)) for p in plist])
ans = 0
val = sum(kitaiti[:K])
ans = max(ans, val)
for i in range(1, N-K+1):
    # print(i-1, i+K)
    val -= kitaiti[i-1]
    val += kitaiti[i+K-1]
    ans = max(ans, val)
print(ans)
N,K=map(int, input().split())
S=list(map(int, input().split()))
s=sum(S[:K])
dp=[0]*(N-K+1)
dp[0]=s
for i in range(1,N-K+1):
    s=s-S[i-1]+S[i+K-1]
    if s>dp[i-1]:
        dp[i]=s
print((max(dp)+K)/2)
N,K=map(int,input().split())
lp=list(map(int,input().split()))
maxsum=sum(lp[:K])
befsum=maxsum
for i in range(1,N-K+1):
    tmpsum=befsum-lp[i-1]+lp[i+K-1]
    if tmpsum>maxsum:
        maxsum=tmpsum
    befsum=tmpsum
print((maxsum+K)/2)
from collections import deque

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

Q = deque([(p + 1) / 2 for p in ps[:K]])

max_ = sum(Q)
now = max_
for p in ps[K:]:
    p = (p + 1) / 2
    head = Q.popleft()
    now = now - head + p
    Q.append(p)
    max_ = max(max_, now)

print(max_)
# -*- coding: utf-8 -*-
N, K = map(int, input().split())
p = list(map(int, input().split()))

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

total_K = 0
max_i = 0
for i in range(N-K+1):
  if i == 0:
    total_K = total[K-1]
  else:
    if total[i+K-1] - total[i-1] > total_K:
      total_K = total[i+K-1] - total[i-1]
      max_i = i

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

i = 0
s = 0
while i < K:
	s += p_list[i]
	i += 1

m = 0
while True:
	if m < s:
		m = s
	if i == N:
		break
	s += p_list[i] - p_list[i - K]
	i += 1

print((K + m) / 2)
n, k = map(int, input().split(" "))
p = list(map(int, input().split(" ")))
p = map(lambda x: sum(range(1,x+1))/x, p)
 
l = [0]
for i,v in enumerate(p):
    prev = l.pop()
    l.append(prev)
    l.append(prev + v)
 
ans = 0
for i in range(k, len(l)):
    tmp = l[i] - l[i-k]
    if ans < tmp:
        ans = tmp
 
print(ans)
n,k=map(int,input().split())
p=list(map(int,input().split()))

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

s=[0]*(n+1)
for i in range(n):
    s[i+1]=s[i]+e[i]

ans=0
for i in range(n-k+1):
    total=s[i+k]-s[i]
    if total >= ans:
        ans=total
        
print(ans)
n, k = map(int, input().split())
l = list(map(int, input().split()))
 
tmp = sum(l[:k])
now = tmp
 
for i in range(n-k):
  tmp -= l[i]
  tmp += l[i+k]
  now = max(tmp, now)
  
print((now + k) / 2)
import numpy as np

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

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


index = 0
goukei = sum(p[0:k])
max = goukei
for j in range(n-k):
    goukei = (goukei - p[j] + p[j+k])
    if goukei > max:
        max = goukei
        index = j+1

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

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

ans_index = 0
total = sum(P[0:K])
prev = total
for i in range(N-K):
    tmp = prev + P[i+K] - P[i]
    if tmp > total:
        total = tmp
    prev = tmp

print((total + K) * 0.5)
n,k = map(int, input().split())
p = list(map(int, input().split()))
dp = [0]*(n+1)
j = 0
for i in range(k):
    j += p[i]
dp[k] = j
for i in range(k, n):
    dp[i+1] = dp[i] + p[i] - p[i-k]
print((max(dp) + k) / 2)
N, K = map(int,input().split())
p = list(map(int,input().split()))
now = sum(p[:K])
t = [now]
for i in range(N-K):
    now += p[K+i]-p[i]
    t.append(now)
ma = (max(t)+K)/2
print(ma)
N,K = list(map(int, input().split()))
A = list(map(int, input().split()))

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

ans = L

for i in range(N-K):
    L  = L+A[K+i]-A[i]
    ans = max(ans, L)
ans += K
ans /= 2
print(ans)
N,K = map(int,input().split())
P = list(map(int,input().split()))
memo = {}

exp = [0]
for p in P:
  exp.append(exp[-1]+(1+p)/2)

res = 0
for i in range(K,N+1):
  res = max(res, exp[i]-exp[i-K])

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

maxs = target = sum( p[ : k ] )
for i in range( 1, n - k + 1 ):
  target += - p[ i - 1 ]  + p[ i + k - 1 ]
  maxs = max( maxs, target )
ans = ( maxs + k ) / 2 # 各々の期待値は( p + 1 ) /2で求まるから
print( ans )
n, k = map(int, input().split())
pis = list(map(int, input().split()))
sum_max = 0
sum_cd = 0
for i in range(k):
  sum_max += pis[i]
  sum_cd += pis[i]
for j in range(1,n-k+1):
  sum_cd -= pis[j-1]
  sum_cd += pis[j+k-1] 
  if sum_cd > sum_max:
    sum_max = sum_cd
expect = sum_max/2 + k / 2
print(expect)
n = input().split()
N = int(n[0])
K = int(n[1])
a = input().split()
sum = 0.0
max = 0.0
for j in range(0, N):
  sum += float(a[j])
  if j > K - 1:
    sum -= float(a[j - K])
  if max < sum:
    max = sum
print ((max + K) / 2)
N,K = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
B = []

for p_item in p:
  B.append(float((p_item+1)/2))
  
Max = sum(B[:K])
tmp = sum(B[:K])

for i in range(len(B)-K):
    tmp = tmp - B[i] + B[i+K]
    if Max < tmp:
      Max = tmp

print(Max)
N,K=map(int,input().split())
P=[int(i)+1 for i in input().split()]
left = 0
right = K
max_=sum(P[:K])
ans=max_
#print(max_)
for _ in range(N-K):
    ans=max(ans,max_ - P[left] + P[right])
    max_=max_ - P[left] + P[right]
    left += 1
    right += 1
print(ans/2)
N,K=map(int,input().split())
P=list(map(int,input().split()))

maxind=-1
cur=sum(P[:K])
maxval=cur
for i in range(K,N):
  cur=cur+P[i]-P[i-K]
  if cur>maxval:
    maxval=cur
    maxind=i

# i-K+1～iまでの期待値を求める
ans=0
for i in range(maxind-K+1,maxind+1):
    ans+=(P[i]*(P[i]+1)//2)/P[i]
    
print(ans)
N, K = map(int, input().split())
P = list(map(int, input().split()))

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

for i in range(1, N-K+1):
    M.append(M[i-1] - P[i-1]/2 + P[i-1+K]/2)


print(max(M))
n, k = [int(x) for x in input().split()]
arr = list(map(int,input().split()))

m = sum(arr[0:k])
sump = m

for i in range(1, n-k+1):
    sump = sump - arr[i-1] + arr[i+k-1]
    if m < sump:
        m = sump

ans = (m + k) / 2

print(ans)
# numpy使うときは、PyPyは不可
import numpy as np

N, K = map(int, input().split())
P = (np.array(list((map(int, input().split())))) + 1)

"""
ans = 0

for num in range(len(p)):
    tmp = p[num:num+K].sum()
    if ans < tmp:
        ans = tmp

print(float(ans))

"""

# 回答
Pcum = np.zeros(N + 1, np.int32)
Pcum[1:] = P.cumsum()

length_K_sums = Pcum[K:] - Pcum[0:-K]
print(length_K_sums.max() / 2)
import itertools

n, k = map(int, input().split())
p = list(map(int, input().split()))
# s = [0] + list(itertools.accumulate(p))
e = []

ans = 0
# temp = s[1]
l = 1
r = 1
# prev =

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

for i in range(n):
    e.append(getExp(p[i]))

s = [0] + list(itertools.accumulate(e))

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

# print(s)
# print(e)

print(ans)
all_num, select_num = map(int, input().split())
dice = [int(a) for a in input().split()]

for i in range(all_num - (select_num - 1)):
    if i == 0:
        max_sum = this_sum = sum(dice[i:(i + select_num)])
    else:
        this_sum = this_sum - dice[i - 1] + dice[i + select_num - 1]

        if this_sum > max_sum:
            max_sum = this_sum

print((max_sum + select_num) * 0.5)
n,k=map(int,input().split())
p=list(map(int,input().split()))
dp=[0]*n
s=0
for i in range(n):
    p[i]=(p[i]+1)/2
    if i<=k-1:
        s+=p[i]
        if i==k-1:
            dp[i]=s
    else:
        s=s-p[i-k]+p[i]
        dp[i]=max(s,dp[i-1])
print(dp[n-1])
N,K=map(int,input().split())
p=list(map(int,input().split()))
def P(x):
    return (x+1)/2
a=0
y=0
for i in range(N):
    y+=P(p[i])#区間内の期待値の和
    if i>=K:
        y-=P(p[i-K])
    if a<y:
        a=y
print(a)
def main():
    n,k=map(int,input().split())
    P=list(map(int,input().split()))
    ave=[(p+1)/2 for p in P]
    s=sum(ave[:k])
    ans=s
    for left in range(n-k):
        s -= ave[left]
        s += ave[left+k]
        if s>ans:
            ans = s
    print(ans)
main()
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = [sum(p[:K])]
for i in range(N-K):
  ans.append(ans[-1]-p[i]+p[i+K])
print(max(ans)/2+K/2)
n, k = map(int, input().split())
p = list(map(int, input().split()))
l = [0 for i in range(n)]
ans = 0
cnt = 0
for i in range(n):
  l[i] = p[i]*(p[i]+1)/(2*p[i])
if n == k:
  ans = sum(l)
else:
  ans = sum(l[:k])
  cnt = ans
  for i in range(n-k):
    cnt = cnt - l[i] + l[i+k]
    if cnt > ans:
      ans = cnt
print(ans)
N, K = map(int, input().split())
p_list = list(map(int, input().split()))
EV_p_list = [0] * len(p_list)

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

# 最初のsum
sum_EV = 0
for i in range(K):
  sum_EV = sum_EV + EV_p_list[i]

# それ以降の比較
max_EV = sum_EV
for i in range(1, N - K + 1):
  sum_EV = sum_EV - EV_p_list[i - 1] + EV_p_list[i + K - 1]
  if sum_EV > max_EV:
    max_EV = sum_EV

print(max_EV)
N, K = [int(s) for s in input().split()]
P = [int(s) for s in input().split()]

# Piの期待値 (1 + Pi) // 2
E = list(map(lambda x: (x + 1) / 2, P))
E_SUMS = [E[0]]
for i in range(1, N):
    E_SUMS.append(E_SUMS[i - 1] + E[i])

m = E_SUMS[K - 1]
for i in range(K, N):
    m = max(m, E_SUMS[i] - E_SUMS[i - K])

print(m)
S_n = lambda n:n*(n+1)//2

def solve():
  N,K = map(int, input().split())
  P = list(map(int, input().split()))
  Q_idx = 0
  Q = P[:K]
  sum_Q = sum(Q)
  sum_Q_ = sum(Q)
  for i in range(N-K):
    sum_Q_ = sum_Q_ - P[i] + P[K+i]
    if sum_Q < sum_Q_:
      Q_idx = i+1
      sum_Q = sum_Q_

  Q = P[Q_idx:Q_idx+K]
  # print(Q)
  print(sum(S_n(q)/q for q in Q))
  
solve()
def sumA(n):
	return n*(n+1)//2

n, k = map(int, input().split())
p = list(map(int, input().split()))
s = [0 for i in range(k)]
ans = 0
mm = 0
j = 0

for i in range(n):
  if j < k:
    s[j] = sumA(p[i])/p[i]
    mm+=s[j]
  else:
    mm-=s[j%k]
    mm+= sumA(p[i])/p[i]
    if ans < mm:
      ans = mm
    s[j%k] = sumA(p[i])/p[i]
  j+=1
  
print(max(mm, ans))
import sys
input = sys.stdin.readline

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

for ai in a:
    acc.append(acc[-1]+ai)
    
ans = 0

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

print(ans)
n,k=map(int,input().split())
p=list(map(int,input().split()))
dp=[0]*(n-k+1)
dp[0]=sum(p[:k])
for i in range(n-k):
    dp[i+1]=dp[i]+p[k+i]-p[i]
print((max(dp)+k)/2)
import numpy as np
N, K = map(int, input().split())
p_list = list(map(int, input().split()))
expect_list = np.array(p_list)
expect_list = (expect_list + 1)/2
sum_list = []
#print(expect_list)
sum=0
for i in range(K):
    sum += expect_list[i]

sum_list.append(sum)

for i in range(1,N-K+1):
    sum -= expect_list[i-1]
    sum += expect_list[i+K-1]
    sum_list.append(sum)

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

total = 0
ans = 0
for i,a in enumerate(P):
    total += (a+1)/2
    if i >= k:
        total -= (P[i-k]+1)/2
    if i >= k-1:
        ans = max(total,ans)
    
print(ans)
N,K = map(int,input().split())
A = list(map(int,input().split()))
ans = [0.0]
for i in range(N):
    ans.append(ans[-1]+A[i]/2.0+0.5)
ANS = 0

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

maxsum = -1
cul = sum(pe[0:k])
maxsum = cul
for i in range(1,n-k+1):
    cul = cul - pe[i-1] + pe[i+k-1]
    if cul > maxsum:
        maxsum = cul
print(maxsum)
N,K=map(int, input().split())
p = list(map(int, input().split()))

p = [(n+1)/2 for n in p]
import numpy as np
s = np.cumsum(p)

e=s[K-1]
max_e=e
for i in range(0,N-K):
  e=s[i+K]-s[i]
  max_e = max(max_e, e)
    
print(max_e)
n,k = map(int,input().split())
p = list(map(int,input().split()))
max=0
sump=0
mxpst=0
ans=0
for i in range(k):
    max+=p[i]
sump=max
for i in range(n-k):
    sump=p[i+k]+max-p[i]
    if sump>max:
        max=sump
        mxpst=i+1
for i in range(k):
    for j in range(1,p[mxpst+i]+1):
        ans+=j/p[mxpst+i]
print(ans)
from decimal import Decimal
n, k = map(int, input().split())
p = list(map(int, input().split()))

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

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

num = sum(num_li[:k])

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

print('{:.10f}'.format(ans))
M,N = list(map(int,input().split()))
s = list(map(int,input().split()))
count = 0
kiroku = 0

t = [0 for i in range(M+1)]
for i in range(M):
    t[i+1] = t[i] + (1+s[i])/2

for i in range(N,M-N+1):
    if t[i] -t[i-N] > count:
        count = t[i] -t[i-N]

print(count)
n, k = map(int, input().split())
p = list(map(int, input().split()))
p.sort(reverse = True)
ans = 0
for i in range(k):
    ans += (p[i] + 1) / 2
print('{:.12f}'.format(ans))
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans_temp = 0
ans_list = []
for i in range(n):
    try:
        if ans_temp < sum(p[i:i+k]):
            ans_temp = sum(p[i:i+k])
            ans_list = p[i:i+k]
    except:
        pass
ans = 0
for i in range(k):
    ans += (ans_list[i]*(ans_list[i]+1)/2)/ans_list[i]
    print((ans_list[i]*(ans_list[i]+1)/2))
print(ans)
import numpy as np
N,K = (int(x) for x in input().split())
p1 = np.array(list(map(int, input().split())))
p2 = (p1+1) / 2
p3 = np.array([np.sum(p2[i:i+K],dtype=np.float32) for i in range(N-K+1)])
print(np.amax(p3))
N,K=map(int,input().split())
p=list(map(int,input().split()))
P=sorted([(1+i)/2 for i in p])
count=0
for i in range(K):
  count+=P[-1-i]
  
print(count)
n,k = map(int,input().split())
sai = sorted(list(map(int,input().split())),reverse=True)
for x in range(len(sai)):
    sai[x] = ((sai[x]+1)*sai[x])/2/sai[x]

print(sum(sai[:k]))
import numpy as np

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

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

cum_exp = np.cumsum(exp)

max = cum_exp[0]
for i in list(range(K, N)):
    val = cum_exp[i] - cum_exp[i - K]
    if val > max:
        max = val

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

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

ans=(sum(p[maxim:maxim+k])+k)/2
print(ans)
n,k=map(int, input().split())
p=[(int(i)+1.0)/2.0 for i in input().split()]
ans=0
for i in range(k):ans+=p[i]
tmp1=ans
for i in range(k, n-k+1):
  tmp2 = (tmp1- p[i-k])+p[i]
  ans = max(ans, tmp2)
  tmp1=tmp2
print('{:.12f}'.format(ans))
def calc(n):
  return (n+1)/2.0

N,K=map(int,input().split())
P=list(map(int,input().split()))
Q=list(map(calc,P))
print(Q)
cnt=0.0
for i in range(N-K+1):
  S=sum(Q[i:i+K])
  cnt=max(cnt,S)

print(cnt)
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
ans = [0] * k
s = sum(p[0:k])
s_max = 0
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))
M=[]
for i in range(1001):
   m=(i+1)/2
   M.append(m) 

N,K=map(int,input().split())
P=list(map(int,input().split()))
S=[]
s=0
for i in range(N):
    a=P[i]
    s=s+M[a]
    S.append(s)
Q=[]
Q.append(S[0])
q=0
for i in range(N-K):
    q=S[i+K]-S[i] 
    Q.append(q)
    q=0
print(max(Q))
N,K = map(int,input().split())
ps = list(map(int,input().split()))

dicesSum=[]
l1=ps[0:K]
dicesSum.append(sum(l1))

if K==1:
    exp= (1+ dicesSum[0])/2
    print(exp)
else:
    for i in range(1,N-K):
        dicesSum.append(dicesSum[i-1]-ps[i-1]+ps[i+K-1])
    max_value = max(dicesSum)
    exp= (K+ max_value)/2
    print(exp)
n,k=map(int,input().split())
p=list(map(int, input().split()))
for i in range(n):
	p[i]=(1+p[i])/2
cs=[]
sum=0
for i in range(n):
	sum+=p[i]
	cs.append(sum)
ans=0
for i in range(n-k+1):
	ans=max(ans,cs[i+k-1]-cs[i-1])
print('{:.8f}'.format(ans))
n, k = map(int, input().split())
p_bef = list(map(int, input().split()))
p_aft = sorted(p_bef, reverse = True)
ans = 0
for i in range(k):
   ans += (1 + p_aft[i]) / 2
print(ans)
n, k = map(int, input().split())
a = list(map(int, input().split()))

sum_tmp = sum(a[:k])
sum_max = sum_tmp
for i in range(3,len(a)):
    sum_tmp += a[i] - a[i-k]
    if sum_tmp > sum_max:
        sum_max = sum_tmp
print((sum_max + k)/2)
n, k = map(int, input().split())
p = list(map(int, input().split()))

total_expects = []
# 1回のサイコロについて
for i in range(0, n):    
    # 1個のサイコロの期待値リスト
    expect = [q * (1 / p[i]) for q in range(1, p[i]+1)]
    total_expects.append(sum(expect))

print(max([sum(total_expects[i:i+k]) for i in range(0, k)]))
n,k = map(int,input().split())
arr = list(map(int,input().split()))

pro = 0
for i in range(k):
    pro += arr[i]


ans = pro
for i in range(k,n):
    pro = pro + arr[i]-arr[i-k]
    if arr[i-k] < arr[i]:
        ans = pro

print("{:.12g}".format((ans+k)/2))
import sys
sys.setrecursionlimit(10 ** 7)

S, T = list(map(int,(input().split())))
p = list(map(int,(input().split())))
ans = 0
anss = []
temp_sum= 0
sum_max = []
for i in range(T):
  ans = 0
  samp = p[i:T+i]
  if temp_sum < sum(samp):
    temp_sum = sum(samp)
    sum_max = samp
    
#print(sum_max)
for i in sum_max:
  x =(list(range(1,i+1)))
  ans += sum(x)/len(x)
  
print(ans)
n,k=map(int,input().split())
p=list(map(int,input().split()))
s=[0 for _ in range(n-k+1)]
q=sum(p[:k])
s[0]=q
m=q
f=0
for i in range(1,n-k+1):
  q=q-p[i-1]+p[i-1+k]
  s[i]=q
  if q>m:
    f=i
ans=0
for i in range(f,f+k):
  ans+=(p[i]+1)/2






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

def kitai(dice):
	#期待値を求める
	S=0
	for p in range(dice):
		S+=p+1
	return S/dice


result=[]
for i in range(K):
	if (K+i)<=N:
		m=p[i:(K+i)]
		Sum=0
		for j in m:
			Sum+=kitai(j)
		result.append(Sum)
print(max(result))
n, k = map(int, input().split())
p_list = list(map(lambda x: (float(x) + 1) / 2, input().split()))

S_i = [0]
for i in range(n):
    S_i.append(S_i[i] + p_list[i])    

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

print(result_max)
import numpy as np
N,K=map(int,input().split())
P=list(map(int,input().split()))
Q=[]
def ex(A):
  return (1+A)/2.0
for i in range(N):
  Q.append(ex(P[i]))
Q=np.array(Q)
R=Q.cumsum()
ans=0
for i in range(K-1,N):
  S=R[i]-R[i-K]
  if ans<S:
    ans=S
print(ans)
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
ans = 0
for i in range(m):
    ans += (1/2)*(a[i]+1)

print(ans)
N,K = map(int, input().split())
pi = list(map(int, input().split()))
#期待値列
E=[(p+1)/2 for p in pi]
F=[]
cal=0
for i in range(N-K+1):
    F.append(cal)
    cal=0
    for j in range(K):
        cal += E[i+j]
print(float(max(F)))
n,k=map(int,input().split())
p=list(map(int,input().split()))
#q=[x-1 for x in p]
ans=0
s=sum(p[:k])
for i in range(n-k):
  s=s+p[k+i]-p[i]
  ans=max(ans,s)
print(ans/2+k/2)
def culc_expected_value(num):
  output = 0
  if num != 1:
    for i in range(1, num+1):
      output += i/num
  else:
    output = 1
  return output

n, k = map(int, input().split())
desc_p_list = sorted(map(int, input().split()), reverse=True)
targets = desc_p_list[:k]
# print(targets)

ans = 0
for t in targets:
  ans += culc_expected_value(t)
  # print(ans)

print(ans)
x=0
N,K=map(int,input().split())
P=list(map(int,input().split()))
S=[]
for i in range(N):
  S.append((1+P[i])/2)
#print(S)
i=1
while i+K<N+1:
  #T.append(sum(S[i:i+K]))
  x=max(x,sum(S[i:i+K]))
  i=i+1
#print(S)
#print(T)
print("{0:.12f}".format(x))
n,k=map(int,input().split())
p=list(map(int,input().split()))

an=0
an2=0
an3=0
flug=0
t=0

if k==1:
    print(int(max(p))*0.5+0.5)
    exit()

for i in range(n):
    if i<k:
        an+=p[i]
    else:
        t=p[i-k]
        if an+p[i]-t>an:
            an2=an+p[i]-t
            flug=(i-k)
        an=an+p[i]-t
            
print((an2*0.5)+(k*0.5))
def DE(n):
    return float((float(n)+1)/2)

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

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

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

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

a = n - k + 1
b = k - 1

for i in range(a):
    for j in range(b):
        score.append(List[i+j])
    pre = sum(score)

    if max < pre:
        max = pre
        index = i
        pre = 0
    else:
        pre = 0
    score.clear()

for i in range(index, index+k):
    res += 1 + 0.5 * (List[i]-1)

print(res)
nk = list(map(int, input().split()))
p = list(map(int, input().split()))
s=0
summo=0
l = []
for i in range(1,1001):
    s += i
    l.append(s/i)

for i in range(nk[1]):
    summo += l[p[i]-1]
now = 0
for i in range(nk[0]-nk[1]):

    now = summo-l[p[i]-1]+l[p[nk[1]+i]-3]
    if summo<=now:
        summo = now
print(summo)
n,k=map(int,input().split())
P=list(map(int,input().split()))

dp=[0]*n
ans=0
for i in range(n):
  dp[i]=((1/2)*P[i]*(P[i]+1)) / P[i]
  if i>k:
    ans=max(ans,sum(dp[i-k:i]))
print(ans)
buf=input().split(" ")
N=int(buf[0])
K=int(buf[1])
p=list(map(int, input().split()))
ex=[]

for i in range(N):
  ex.append((p[i]*(p[i]+1)/2)/p[i])

ex=sorted(ex,reverse=True)
print("{:.12f}".format(sum(ex[0:K])))
N = list(map(int,input().split()))
n = N[0]
k = N[1]

X = list(map(int,input().split()))

i=0
E = []
#期待値のリスト
for e in X:
  E.append((1+e)/2)
  i += 1

j = 0
T=[]
T.append(0)
#期待値の累積和
for t in E:
  T.append(T[j] + t)
  j += 1

max_val = 0
max_st = 0
for i in range(0,j-k):
  tmp_val = T[i+k] - T[i]
  if tmp_val >= max_val :
    max_st = i
    max_val = tmp_val


print(max_val)
N, K = (int(i) for i in input().split())
p = [int(i) for i in input().split()]
p_ex = [(i+1)/2 for i in p]
sum_list = [sum(p_ex[0:K]),sum(p_ex[N-K:N])]
tmp_num = sum_list[0]
if N == K:
  print(sum(p_ex))
else:
  for i in range(1,N-K):
    #print("i:"+str(i))
    tmp_num = tmp_num - p_ex[i-1] + p_ex[i+K]
    #print("  tmp_num = tmp_num - "+str(p_ex[i-1])+" + "+str(p_ex[i+K]))
    sum_list.append(tmp_num)
  print(max(sum_list))
import numpy
a,b = map(int,input().split())
li = list(map(int,input().split()))
L = [(i**2+i)/(2*i) for i in li]
dp=[0]*a
res = numpy.cumsum(L)
dp[0] = res[b-1]-res[0]
for i in range(1,a-b+1):
    dp[i] = res[i+b-1]-res[i-1]
print(max(dp))
N,K=map(int,input().split())
*p,= map(int, input().split())

def ex(n):
    return sum(range(1,n+1))/n    
def  ex3(p):
    return sum([ex(n) for n in p])

dp=[0 for _ in range(N)]

M,mi=0,0
for i in range(N-K+1):
    s=sum(p[i:i+K+1])
    if s>M:
        M=s
        mi=i
print(mi)
print(ex3(p[mi+1:mi+K+1]))
N = list(map(int,input().split()))
n = N[0]
k = N[1]

X = list(map(int,input().split()))

#----
#max_val = 0
#max_st = 0
#for i in range(0,n-k):
#  tmp_val = X[i] + X[i+1] + X[i+2]
#  if tmp_val >= max_val :
#    max_st = i
#    max_val = tmp_val

#max_p = (1+X[i])/2 + (1+X[i+1])/2 + (1+X[i+2])/2
#print(max_p)
#---

X.sort()
max_p = 0
for i in range(1,k+1):
  max_p += (1+X[n-i])/2
  
print(max_p)
n,k,*p=map(int,open(0).read().split())
s=[p[0]]*n
for i in range(1,n):
  s[i]=s[i-1]+p[i]
ans=0
for i in range(n-k):
  ans=max(ans,s[i+k]-s[i])
print((ans+k)/2)
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    l = list(itertools.accumulate(A))
    
    if A[0] == 1 and len(A) == 1:
        return 1
    
    ans = 0
    for i in range(M, N):
        ans = max(ans, l[i] - l[i-M])
    
    ans = (ans+1) / 2
    
    return ans

print(solve())
N, K = map(int, input().split())
listp = list(map(int, input().split()))
listans1 = []
for n in range(N-K+1):
    b = sum(listp[n:n+K])
    listans1.append(b)
print(listans1) 
print((max(listans1)+K)/2)