peterverebics/CodeNet_Python_118 huggingface dataset:
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([])
ans = 0
for i, p in enumerate(P):
    e = (1+p) / 2
    if i >= K:
        q.popleft()
        q.append(e)
        ans = max(ans, sum(q))
    else:
        q.append(e)
print(ans)
n,k=map(int,input().split())
p=list(map(int,input().split()))
def g(x):
  return (1+x)/2

a=[]
ans=0
f=0
for i in range(k):
  f+=g(p[i])
a.append(f)
for i in range(n-k):
  a.append(a[i]+g(p[k+i])-g(p[i]))
  ans=max(ans,a[i+1])
  
print(ans)
def get_expected_value(p):
    return (p + 1) / 2.0


N, K = list(map(int, input().split()))
p = list(map(float, input().split()))
expected_value_list = list(map(get_expected_value, p))
if len(p) == K:
    q = expected_value_list
    print(sum(q))
else:
    q = [expected_value_list[i:i + K] for i in range(len(p) - K - 1)]
    print(max(map(sum, q)))
N,K=list(map(int,input().split()))
p=list(map(int,input().split()))

def kitai(dice):
	#期待値を求める
	return sum(list(range(1,dice+1)))/dice


e=[kitai(x) for x in p]
print(e)
result=[]
for i in range(K,N+1):
	result.append(sum(e[i-K:i]))

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

def main():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    ref = sum(p[:k])
    ans = ref

    for i in range(1, n - k):
        minus = p[i - 1]
        plus = p[i + k - 1]
        ref = ref - p[i - 1] + p[i + k - 1]
        if ref > ans:
            ans = ref

    print(ans/2 + k*0.5)

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

    D = []
    for p in P:
        if p==1:
            D.append(p)
        else:
            D.append(1+p)
    
    ACC_D = []
    acc = 0
    for d in D:
        acc += d
        ACC_D.append(acc)

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

    print(ans)
x = list(map(int, input().split()))
y = list(map(int, input().split()))
y = [i/2+0.5 for i in y]
max_value = 0
value = sum(y[:x[1]])
for i in range(x[1], x[0]):
  max_value = max(max_value, value)
  value += y[i]
  value -= y[i-x[1]]
print(max_value)
n, k = map(int, input().split())
p = list(map(int, input().split()))

l = list(map(lambda x: x * (x+1) * 1/2 * 1/x, p))

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

print(ans)
print(sum(max(ans)))
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)
ans = 0
for i in range(len(List)):
  if i < K-1:
    ans = 0
  else:
    ans = float(max(res[i] - res[i-K],ans))
  
print(float(ans))
i = input().split()
n = int(i[0])
nannko = int(i[1])
i2 = input().split()
nAr = [int(s) for s in i2]

for j in range(n - nannko + 1):
    li = nAr[j:j+nannko]
    sum = 0
    max = 0
    for k in range(len(li)):
        sum += (li[k] + 1)/2
        print(sum)
        if (sum > max):
        	max = sum
print(max)
N,K = map(int,input().split())
List = list(map(int,input().split()))
result = [(1+i)/2 for i in List]
Answer = 0
base = [sum(result[0:K])]
for i in range(N-K):
  counter = base[i]-result[i]+result[i+K]
  if counter > Answer:
    Answer = counter
  base.append(counter)

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

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

s = [sum(p_exp[0:i]) for i in range(n)]

ans = -1


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

print(ans)
M,N = list(map(int,input().split()))
s = list(map(int,input().split()))
count = 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):
    count = max(count,t[i]-t[i-N])

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

a = 0
for i in range(N - K + 1):
  if i == 0:
    f = i
    b = sum(p[0:K])
  else:
    b = a - p[i-1] + p[i + K - 1]
  
  if b > a:
    a = b
    f = i

ans = 0
for j in range(K):
  ans += (p[f + j] + 1) / 2

print(ans)
def main():
    #input
    N,K=map(int,input().strip().split())
    P=list(map(int,input().strip().split()))
    
    #期待値行列
    E=list(map(lambda x:(x+1)*x//2/x,P))
    S=[0 for n in range(N-K+1)]
    for n in range(K):
        S[0]+=E[n]
    
    ans=0
    for i in range(1,N-K+1):
        S[i]=S[i-1]-E[i-1]+E[i+K-1]
        ans=max(ans,S[i])
    print(ans)

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

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

sume = [0 for _ in range(n)]
for i in range(n):
    if i == 0:
        sume[i] = e[i]
    else:
        sume[i] = sume[i-1]+e[i]

ans = []
for i in range(n-k+1):
    if i == 0:
        ans.append(sume[i])
    else:
        ans.append(sume[i+k-1]-sume[i-1])   

print(max(ans))
N, K = map(int, input().split())
list=list(map(int, input().split()))
a=[]
for i in list:
    a.append(sum(range(i+1))/i)
b=[]
ma=0
for i in range(N-2):
    ma = max(ma, sum(a[i:i+3]))
print(ma)
N, K = map(int, input().split())
P = tuple(map(int, input().split()))

ES = [(1+P[0])/2]
for i in range(1, N):
    p = P[i]
    e = (1+p)/2
    ES.append(e+ES[i-1])

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

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

ht=(ans+k)/2
print('{:.20f}'.format(ht))
#!/usr/bin/env python3
def main():
    def expected_val(limit):
        return sum(range(limit + 1)) / limit

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

    lst = []
    res = 0
    for p in P:
        res += expected_val(p)
        lst.append(res)
    ans = 0
    for i in range(N - K):
        res = lst[i + K] - lst[i]
        ans = res if res > ans else ans
    print(ans)


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

import numpy as np

E = (np.array(P)+1)/2
E = np.cumsum(E)  

ans = 0.0
for i in range(0,N-K):
  ans = max(ans, E[i+K]-E[i])
print(float(ans))
import numpy as np
from decimal import Decimal

N, K = map(int, input().split())
p = np.array(list(map(lambda x: (int(x) + 1) / Decimal(2), input().split())))

p = np.cumsum(p)

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

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

p = list(map(int,input().split()))
s = []
for i in range(n-k+1):
    s += [p[i:i+k]]

print((sum(max(s))+k)/2)
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = list(map(lambda x: (((x + 1) * x) // 2) / x, l))
l = sorted(l)
print(sum(l[-k:]))
n, k = list(map(int, input().split()))
P = list(map(int, input().split()))


def solve(N, p, K):
    # ans = sum(p[:K])
    # print(P)
    ans = 0
    for i in range(K, N):

        # print(ans, i-K, i)
        # print(p[i-K:i], sum(p[i-K:i]))
        # ans = max(ans - p[i-K] + p[i], ans)
        ans = max(ans, sum(p[i-K:i]))
    return ans


print(1/2.0 * k + 1.0/2 * solve(n, P, k))
n, k = map(int, input().split())
p = list(map(int, input().split()))

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

l = 0
s = sum(e[:k-1])
for i in range(n-k):
    tmp = s + e[i+k] - e[i]
    if tmp > s:
        s = tmp
        l = i + 1

print(sum(e[l:l+k]))
N,K = map(int,input().split())
p = list(map(int,input().split()))
 
a = [0]*(N-K+1)
f = sum(p[:K])
a[0] = f

for i in range(N-K):
    f = f + p[i+K] - p[i]
    a[i+1] = f
##print(a)
num = 0

for i in range(1,N-K+1):
    if a[i] >= a[i-1]:
        num = i
ans = 0
##print(num)
##print(p[num:num+K])

for i in range(num,num+K):
    ans += (p[i]+1)/2

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


def expect(n):
    res = sum([i for i in range(1, n+1)]) / n
    return res

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

ans = list(map(expect, p[idx-k+1:idx+1]))
print(sum(ans))
N,K=map(int,input().split())
P=list(map(int,input().split()))
L=[]
M=[0]
c=0
m=0
x=0
for i in range(200100):
    c+=i
    L.append(c)
for i in P:
    m+=L[i]/i
    M.append(m)
if N!=K:
    for i in range(N-K):
        x=max(M[K+i]-M[i],x)
else:
    x=M[K]-M[0]
print(x)
total, tar = list(map(int, input().split()))
dice_array = list(map(int, input().split()))
l = [] * total

tar2 = 0
calc_before = 0
calc_now = 0
for i in range(total-tar):
  for j in range(tar):
    calc_now += dice_array[i + j]
  if calc_before < calc_now:
    tar2 = i
    calc_before = calc_now
  calc_now = 0
  
sum = 0
for i in range(tar2, tar+tar2):
  cnt = 0
  for j in range(1, dice_array[i]+1):
    cnt += j
  sum += (cnt / dice_array[i])
  
print(sum)
N, K = map(int, input().split())
P = map(int, input().split())

PP = sum(sorted([(1 + pp) / 2 for pp in P], reverse=True)[:K])
print(PP)
n, k = input().split()
p = list(map(float, input().split()))

n, k = int(n), int(k)

ans = 0
c = 0

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


print(ans / 2)
n,k=map(int,input().split())
data=list(map(int,input().split()))
new_data=[0]*n
for i in range(len(data)):
    if data[i]==1:
        new_data[i]=1
        continue
    new_data[i]=(data[i]+1)/2
temp=0
for i in range(k):
    temp+=new_data[i]
ans=0
for i in range(k,len(data)):
    temp=temp-new_data[i-k]+new_data[i]
    ans=max(ans,temp)
print(ans)
N,K = map(int,input().split())
p = list(map(int,input().split()))

#左からn番目のダイスを振ったときの期待値を求める
E = [(i+1)/2 for i in p]
E_reverse = sorted(E, reverse=True)

print(sum(E_reverse[0:K]))
n,k = map(int,input().split())
p = list(map(int,input().split()))


#pp = sorted(p)
#p.sorted()

ans = 0
place, num = 0,0
for i in range(len(p)-k):
    if sum(p[i:i+k]) >= num:
        place,num = i,sum(p[i:i+k])


for i in p[place:place+k]:
    ans += (i+1)/2
else:
    print(ans)
N, K = (int(x) for x in input().split())
p = list(map(int, input().split()))
mmax=0
msum=0
maxI=0

for i in range(N-K):
  msum=0
  if p[i]>=p[i+K]:
    j=i
  else:
    j=i+1
  msum = sum(p[j:j+K])
  if msum>mmax:
    maxI=j
    mmax=msum

ans=(mmax+K)/2
print("{:.10f}".format(ans))
N, K = map(int, input().split())
P = list(map(int, input().split()))
max = 0
S = 0
for i in range(len(P)):
    S += P[i]
    if i < K:
        pass
    else:
        S -= P[i-K]
        if max < S:
            max = S
print((max+K)/2)
import sys
n, k = map(int, sys.stdin.readline().split())
p = list(map(int, sys.stdin.readline().split()))
count=0
cumsum=0
cumsumlist=[]
for i in p:
  cumsum+=i
  cumsumlist.append(cumsum)
gouke = cumsumlist[0]
for j in range(n-k):
  gouke = cumsumlist[j+k]-cumsumlist[j]
  count = max(gouke,count)
ans = (count+k)*0.5
print(ans)
# coding: utf-8
N,K=map(int,input().split())
P=list(map(int,input().split()))


num=0
S=0
ans=0

for i in range(K):
    num=P[i]
    S=P[i]*(P[i]+1)//2
    ans+=S/num
A=[ans]
for i in range(N-K):
    m=(P[i]*(P[i]+1)//2)/P[i]
    a=(P[i+K]*(P[i+K]+1)//2)/P[i+K]
    ans-=m
    ans+=a
    A.append(ans)
ans=A[0]
for i in range(1,N-K+1):
    if A[i]>ans:
        ans=A[i]
print(A)
print(ans)
N, K = map(int, input().split())
p = list(map(int, input().split()))

M = 0
x, y = divmod(K, 2)

for i in range(x, N - x):
    a = sum(p[i - x:i + x + y])
    if a > M:
        M = a

print((M + K) / 2)
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)
ans = 0
for i in range(len(List)):
  if i < K:
    ans = 0
  else:
    ans = max(res[i] - res[i-K],ans)
  
print(ans)
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]

for i in range(N-K):
    expv=expv-P[i]+P[i+K]
    maxv=max(maxv,expv)
    
        
print("{:.12f}".format((maxv+K)/2))
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

    total = sum(A[0:K])
    total_max = 1
    for i in range(0, N-K):
        total -= A[i]
        total += A[i+K]
        total_max = max(total, total_max)

    print((total_max+K)/2)

if __name__ == '__main__':
    resolve()
n,k=map(int,input().split())
*d,=list(map(int,input().split()))
 
def e(n):
    ex=(1+n)/2
    return ex
    
dex=[e(i) for i in d]

fst=0
for i in range(k):
    fst+=dex[i]

for i in range(n-k):
    x=fst-dex[i]+dex[i+k]
    if x>fst:
        fst=x
        
print(fst)
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))
N,K=map(int, input().split())
p=list(map(int, input().split()))
 
for n in range(0,N-K+1):
  sum_list=[]
  sum=0
  for i in range(n,n+K):
    sum+=(1+p[i])/2
    sum_list.append(sum)  
    
print(max(sum_list))
N,K = map(int,input().split())
P = sorted(list(map(int,input().split())),reverse = True)

total = 0
L = []

for i in range(K):
  m = P[i]
  total += (m + 1) / 2
  
print(total)
N,K=map(int,input().split())
p=list(map(int,input().split()))
expected=[0]*N
for i in range(N):
    expected[i]=(p[i]+1)/2
accumurate=[0]*N
accumurate[0]=expected[0]
for i in range(1,N):
    accumurate[i]=accumurate[i-1]+expected[i]
M=0
for i in range(N-K):
    M=max(M,accumurate[i+K]-accumurate[i])
print(M)
n,k = map(int, input().split())
p = [int(e) for e in input().split()]

max = 0
for i in range(n-k+1):
  j = i
  s = 0
  for j in range(k):
    s += p[j]
    j += 1
  if max < s:
    max = s
    
print((max+k)/1.0)
n, k = map( int, input().split() )
p = list( map( int, input().split() ) )

def expect( n: int ):
  return sum( range( n + 1 ) ) / n

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

maxs = 0
for i in range( 1, n - k + 1 ):
  now_val = now_val - expect( p[ i - 1 ] )  + expect( p[ i + k - 1 ] )
  maxs = max( maxs, now_val )
print( maxs )
def main():
    N, K = map(int, input().split(" "))
    p = list(map(int, input().split(" ")))
    exceptation_sum = [0] * (N + 1)
    answer = 0
    for i in range(N):
        exceptation_sum[i] = (p[i] + 1) / 2 + exceptation_sum[i - 1]
    for i in range(N - K + 1):
        answer = max(answer, exceptation_sum[i + K] - exceptation_sum[i])
    print(answer)


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

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

print((max+K)//2)
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=0
tmp=sum(p[:k])
for i in range(n-k):
    tmp=tmp-p[i]+p[i+k]
    if tmp>ans:
        ans=tmp
print((ans+k)/2)
n, k = map(int, input().split())
p = list(map(int, input().split()))
exp = 0
for i in range(n - k + 1):
    s = 0
    for j in range(k):
        s += p[i+j]
    if exp <= s:
        exp = s
print((s + k) / 2)
n,k = map(int,input().split())
lis = list(map(int,input().split()))
tmp = 0
for i,l in enumerate(lis):
    if i+k <= len(lis)-1:
        #print(i,k)
        if lis[i+k]>lis[i]:
            tmp = i+1
#print(tmp)
#print(new_lis)
print((sum(lis[tmp:tmp+k])+k)/2)
def main():
    N, K = map(int, input().split(" "))
    p = list(map(int, input().split(" ")))
    exceptation_sum = [0] * N
    answer = 0
    for i in range(N):
        if not i == 0:
            exceptation_sum[i] = (p[i] + 1) / 2 + exceptation_sum[i - 1]
        else:
            exceptation_sum[i] = (p[i] + 1) / 2
    for i in range(N - K + 1):
        answer = max(answer, exceptation_sum[i + K - 1] - exceptation_sum[i - 1])
    print(answer)


if __name__ == '__main__':
    main()
N,K = map(int, input().split())
P = list(map(int,input().split()))
Px  =[]
for i in range(N):
    Px.append((1+P[i])/2)
temp_num = sum(Px[0:K])
temp_max = 0
for j in range(N-K+1):
    if temp_max <temp_num:
        temp_max=temp_num
    temp_num = temp_num-Px[j]+Px[j+K-1]
    if temp_max <temp_num:
        temp_max=temp_num
print(temp_max)
N,K=map(int,input().split())
l=list(map(int,input().split()))
a=[]
for i in range(N-K+1):
    b=sum(l[i:i+K])+K
    print(b)
    a.append(b)
    b=0
print(max(a)/2)
import numpy as np
N,K=list(map(int,input().split()))
p=list(map(int,input().split()))
p=list(map(lambda x:(x+1)/2, p))
p_cs=np.cumsum(p)
max_exp=0
for i in range(N-K):
  exp=p_cs[i+K]-p_cs[i]
  if exp>max_exp:
    max_exp=exp
print(max_exp)
n, k = map( int, input().split() )
p = list( map( int, input().split() ) )

sum_k = sum( p[ : k ] )
max_sum_k = 0

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

print( ( max_sum_k + k ) / 2 )
import numpy as np
n,k=map(int,input().split())
P=list(map(int,input().split()))
p=np.cumsum(P)
s=[0]*(n//k+1)
MAX=p[0]
res=[]
ans=0
for i in range(0,n-k):
    MAX=max(MAX,p[i+k]-p[i])
    if MAX==p[i+k]-p[i]:
        res=P[i+1:i+k+1]
for j in res:
    ans+=np.cumsum(range(1,j+1))[-1]/j
print(ans)
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 == 1 and K == 1:
    max_val = max(Ps)
    print(max_val)
elif 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)
import numpy as np

N, K = map(int, input().split())
p = np.array(list(map(int, input().split())))
ans = 0
tmp = np.sum((p[0:K]+1)/2)
last = p[0]

for n in range(1, N-K):
	tmp = tmp - last + p[n+K-1]
	if n != N - K:
		last = p[n]
	if ans < tmp:
		ans = tmp

print(ans)
def solve(_list,_k):
  _sum = -1
  tmp = sum(_list[:_k])
  for i in range(len(_list)-_k):
    s = tmp + _list[i+_k] - _list[i]
    if _sum < s:
      _sum = s
    tmp = s

  ans = (_sum+_k) / 2
  return ans


if __name__ == "__main__":
  _n, _k = map(int, input().split())
  _l = [int(i) for i in input().split()]

  result = solve(_l, _k)
  print(result)
n,k= list(map(int, input().split()))
j = list(map(int, input().split()))
s=0
sumlist=[0]*n
anslist=[0]*(n-k+1)
for i in range(n):
    s+=j[i]
    sumlist[i]=s
for i in range(len(anslist)-1):
    z=sumlist[i+k]-sumlist[i]
    anslist[i]=z
ans=max(anslist)
ans+=k
ans=ans/2
print(ans)
n, k = map(int, input().split())
P = list(map(int, input().split()))

S = [(1+P[0])/2]
for i, p in enumerate(P[1:]):
  # print(i, p, S)
  S.append(S[i] + (1+p)/2)
# print(S)
s_max = -1
for j in range(n-k):
  tmp = S[j+k] - S[j]
  if s_max < tmp:
      s_max = tmp
print(s_max)
import numpy as np
dice_list = [int(s) for s in input().rstrip().split(' ')]
ex_list = (np.array(input().rstrip().split(' '), dtype=np.float32) + 1) / 2

print(np.max(np.array([np.mean(ex_list[i:i+dice_list[1]]) for i in range(dice_list[0] - dice_list[1] + 1)])))
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)
    
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 = input().split()
input_list = [i for i in input().split()]
average_list = []

for p in input_list:
    x = 0
    y = 0
    for i in range(0,int(p)+1):
        x = x + i
    y = x / int(p)
    average_list.append(y)

avg_list = sorted(average_list, reverse=True)
print(avg_list)
answer = 0
for i in range(int(k)):
    answer = answer + avg_list[i]
print(answer)
N, K = map( int, input().split() )
P    = [int(x) for x in input().split()]

st_idx  = 0
max_sum = 0
for nn in range( K ):
    max_sum += P[nn]

tmp = max_sum
for nn in range( K, len(P) ):
    tmp -= P[nn-K]
    tmp += P[nn]
    if( tmp > max_sum ):
        st_idx = nn-K+1
    
ans = 0
for nn in range( st_idx, st_idx+K ):
    tmp = 1 + 0.5*( P[nn]-1 )
    ans += tmp
        
print( ans )
n,k=map(int,input().split())
p=[int(i) for i in input().split()]


Msum=0
tmp=sum(p[0:k])

for i in range(1,n-k):
    a=p[i-1]
    b=p[i+k]
    tmp=tmp-a+b
    Msum = max(tmp,Msum)

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

s = sum(p[0:k])
m = 0
pos = 0
for i in range(n - k + 1):
    s = s - p[i] + p[i+k-1]
    if m < s:
        m = s
        pos = i
r = 0
for i in range(k):
    v = p[pos + i]
    s = 0
    for j in range(1, v + 1):
        s += j
    r += s/v
print(r)
n,k = map(int,input().split())
p_l = list(map(int,input().split()))

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

print(possibility)

max_p=sum(possibility[0:k:1])
tmp=max_p
for i in range(1,len(possibility)-k+1):
    print(i)
    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()))
E=[]
ans=0

for i in range(N):
    E.append((sum(range(1,p[i]+1)))/p[i])

for i in range(N-K):
    ans=max(ans,sum(E[i:i+K]))
print(ans)
N, K = map(int,input().split())
P = [0]+list(map(int,input().split()))
for i in range(1,N):
  p = P[i]
  p = (1+p)/2
  P[i] = p+P[i-1]
ans = 0
for i in range(N-K+1):
  ans = max(ans,P[i+K]-P[i])
import numpy as np

N, K = map(int, input().split())
p = np.array(list(map(int, input().split())))
ans = 0
tmp = np.sum((p[0:K]+1)/2)
last = p[0]

for n in range(1, N-K):
	tmp = tmp - last + p[n+K-1]
	if n != N - K:
		last = p[n+1]
	if ans < tmp:
		ans = tmp

print(ans)
import math

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()))
Q=[]
q=0

for i in range(N-K+1):
   for j in range(K):
       a=P[i+j]
       q=q+M[a]
   Q.append(q)
   q=0

print(Q)
print(max(Q))
n,k=map(int,input().split())
a=list(map(int,input().split()))
#a=[(1+i)/2 for i in a]
import itertools
ac=itertools.accumulate(a)
ac=list(ac)

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

print((ans+k)/2)
n, k = map(int, input().split())
plis = list(map(int, input().split()))
plis = list(map(lambda p : (1+p)/2, plis))
slis = [plis[0]]
for i in range(1, n):
    slis.append(slis[-1] + plis[i])
ans = slis[k-1]
for i in range(1, n-k):
    ans = max(ans, slis[i+k-1] - slis[i-1])
print(ans)
n ,k = map(int,input().split())
a = list(map(int,input().split()))
max_i = 0
max_d = 0

for i in range(n - k + 1):
    d = 0
    for j in range(k):
        d += a[i + j]
    if d > max_d:
        max_i = i
        max_d = d
ans = 0
for i in range(max_i,max_i + k):
    ans += i
print(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] + s[i]

for i in range(N,M-N+1):
    if t[i] -t[i-N] > count:
        count = t[i] -t[i-N]
        kiroku = i
b = 0
for i in range(kiroku-N,kiroku):
    a = (1+s[i])/2
    b += a

print(b)
n, k = map(int, input().split())
p = list(map(int, input().split()))
tmp = sum(p[:k])
ans = 0

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

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

tmp = sum(L[:K])
for i in range (N-K):
    nxt = tmp + L[K+i] - L[i]
    tmp = max(nxt, tmp)

print(tmp)