peterverebics/CodeNet_Python_118 huggingface dataset:
N,K = map(int,input().split())
P = list(map(int,input().split()))

num = sum(P[0:K])
ls = P[0:K]
ans = [0]*K
for i in range(N-K+1):
    if num < sum(P[i:i+K]):
        ls = P[i:i+K]
for j in range(K):
    ans[j]=(ls[j]+1)*ls[j]/(2*ls[j])
print(sum(ans))
N, K = map(int, input().split())
p = list(map(int, input().split()))
ansmax = 0
for i in range(N-K):
  ans = 0
  for j in range(K):
    ans += (p[i+j]+1)/2
  if(ansmax < ans):
    ansmax = ans
print(ansmax)
N,K = map(int,input().split())
D = list(map(int,input().split()))
L = []
n = 0
l = 0
 
for p in range(N-K+1):
  for q in range(K):
    for r in range(D[p+q]+1):
      n = n + r
    f = n/D[p+q]
    l = l + f
    n = 0
  L.append(l)
  l = 0
N,K = map(int, input().split())
P=[(int(x)+1)/2 for x in input().split()]
max=0
kitai=0
for i in range(K-1):
    kitai+=P[i]
for i in range(N-K):
    kitai+=P[i+K-1]
    if max<kitai:
        max=kitai
    kitai-=P[i]
print(max)
N, K = [int(n) for n in input().split(" ")]
lst = [int(n) for n in input().split(" ")]

sum_max = 0
temp = 0

for i in range(K):
    temp += (lst[i]+1)/2
for j in range(0,N-K):
        temp += (lst[j+K]-lst[j])/2
        if temp > sum_max:
            sum_max = temp
            
print(sum_max)
#At coder 2020/2/9 D

# 入力
N,K= map(int, input().split())
p = list(map(int, input().split())) 
#p2 = sorted(p, reverse=True)
#print(p2)
kk=0.0
for ii in range(N-K):
    kk=max(kk,sum(p[ii:K+ii]))
ans=0.5*((kk)+K)

print(ans)
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 = input().split()
n = int(n)
k = int(k)
p = input().split()
pre = []
sum1 = 0
ans = 0

for i in range (n) :
    sum1 += int(p[i]) + 1
    pre.append(sum1)

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

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

sc=list(map(int,input().split()))
c=[]
t=[]

for i in range(n):
  c.append((1+sc[i])/2)
t.append(c[i])
for i in range(1,n):
  t.append(c[i]+t[i-1])
total = 0
for i in range(n-k):
  if total < t[i+k] - t[i]:
    total = t[i+k] - t[i]
print(total)
A = input().split()
B = map(int, A)
C = list(B)
K = C[0]
N = C[1]

P = list(map(float, input().split()))
P_list = P[K-1:N-1]

print(sum(list(map(lambda x: x / 2, P_list))))
from collections import deque

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

cml_sum = deque([(P[0]+1)/2.0])
for i in range(1, N):
    cml_sum.append(cml_sum[i-1] + (P[i]+1)/2.0)

ans = 0
for i in range(N-K):
    target = cml_sum[i+K] - cml_sum[i]
    if ans < target:
        ans = target

print(ans)
import numpy as np
N, K = map(int, input().split())
P = list(map(lambda x: (int(x)+1)/2, input().split()))

if True:
    # if (K > N/2):
    #     ans = 0
    #     for i in range(N-K+1):
    #         a = sum(P[i:i+K])
    #         ans = a if a > ans else ans
    #     print(P)
    # else:
    ar = []
    for i in range(K):
        ar.append(P[i:i+K])
    s = np.sum(ar, axis=0)
    print(max(s))
import numpy
N, K = map(int, input().split())
p = list(map(int, input().split()))

lis = list()

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

cumSum = numpy.cumsum(p)

cumSum2 = list(cumSum)

cumSum2.insert(0,0)

for i in range(0, N-K+1):
    print(i)
    lis.append(cumSum2[K+i] - cumSum2[i])

print(max(lis))
n,k  = map(int,input().split())
p = list(map(int, input().split()))
current_best = 0
sum_list = [(1+p[0])/2]

if n == 1:
  print(sum_list[0])
  exit()
#累積和の計算
for i in range(n-1):
  sum_list.append(sum_list[-1]+(1+p[i+1])/2)

for j in range(n-k):
  expect = sum_list[j+k]-sum_list[j]
  if expect > current_best:
    current_best = expect
print(current_best)
N,K = map(int,input().split())
p = list(map(int,input().split()))
if K == 1:
    temp = max(p)
    siguma = 0.5*p[0]*(p[0]+1)
    kitaiti = siguma/float(p[0])
    print(kitaiti)
else:
    old_x = p[:K]
    for i in range(1,N-K+1):
        x = p[i:i+K]
        if sum(old_x) < sum(x):
            old_x = x
    res = 0
    for i in old_x:
        siguma = 0.5*float(i)*(float(i)+1)
        res += siguma/i
    print(res)
n,k = map(int, input().split())
p = [int(e) for e in input().split()]
s = sum(p[0:k])
max = 0
for i in range(n-k):
  s = s - p[i] + p[i+k]
  if max < s:
    max = s
    
print(float(max+k)/2.0)
n, k = map(int, input().split())
ps = list(map(int, input().split()))

# 初期化
pnmax = 0
for i in range(k):
  pnmax += ps[i]

for i in range(0, n-k):
  if(ps[i+k] > ps[i]):
    pnmax = 0
    for j in range(k):
      pnmax += ps[i+j+1]

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

p_=[]
for i in range(len(p)):
  p_.append((1+p[i])/2)
 
import itertools
c=list(itertools.accumulate(p_))

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

sum_list = []
sum_tmp = 0

init_tmp = 0
max_sum = init_tmp

for i in range(k):
	init_tmp += p_list[i]

tmp = init_tmp

for s in range(k, n):
	tmp = tmp + p_list[s] - p_list[s-k]

	if max_sum < tmp:
		max_sum = tmp


print((max_sum+k)/2)
import sys
input = sys.stdin.readline
N,K = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
for i in range(N):
    l = p[i]
    p[i] = ((1+p[i]) * p[i])//2
    p[i] = p[i]/l
ans = 0
print(p)
for i in range(K):
    ans +=p[i]
l = ans
for i in range(K,N):
    ans = ans + p[i] - p[i-K]
    l = max(l,ans)
print('{:.8f}'. format(l))
#!/usr/bin/env python3

N, K = map(int, input().split())
p = list(map(int, input().split()))
# print(N, K)
# print(p)
p_sorted = sorted(p, reverse=True)

def e_dice(n):
    res = 0
    for i in range(1, n+1):
        res += i * (1 / n)
    return res

res = 0
for i in range(K):
    res += e_dice(p_sorted[i])

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

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=map(int,input().split())
a=list(map(int,input().split()))

rui=[0]
for i in a:
  rui.append(rui[-1]+i)
hantei=0
for i in range(0,len(rui)-k):
  if hantei<=rui[i+k]-rui[i]:
    hantei=rui[i+k]-rui[i]
    l=i
    r=i+k
ans=0
print(l,r-1)
for i in range(l,r):
  ans+=(a[i]+1)/2
  
print(ans)
import sys
input = lambda: sys.stdin.readline().rstrip()
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0

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

for i in range(1, n-k+1):
    e = (s_list[i+k] - s_list[i] + k)/2
    if ans < e:
        ans = e
print(ans)
import numpy
N, K = map(int, input().split())
p = list(map(int, input().split()))

lis = list()

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

cumSum = numpy.cumsum(p)

cumSum2 = list(cumSum)

cumSum2.insert(0,0)

for i in range(0, N-K+1):
    print(i)
    lis.append(cumSum2[K+i] - cumSum2[i])

print('{:.08f}'.format(max(lis)))
def Ex(x):
    return (1/2)*(x+1)
N,K = map(int,input().split())
plist = list(map(int,input().split()))
Alist = [0]*N
Ans = sum(plist[0:K])
An = [0,K]
for j in range(0,N-K+1):
    Ans2 = Ans - plist[j-1] + plist[K+j-1] 
    if Ans != max(Ans,Ans2):
        Ans = max(Ans,Ans2)
        An = [j,j+K]
Answer = 0
for i in plist[An[0]:An[1]]:
    Answer += Ex(i)
print(Answer)
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+1,len(li)):
  sum_-=li[i-k-1]
  sum_+=li[i]
  if max_<sum_:
    max_=sum_
max_+=k
max_/=2
print(max_)
import numpy as np
N, K = map(int, input().split())
P = list(map(lambda x: (int(x)+1)/2, input().split()))

if True:
    # if (K > N/2):
    #     ans = 0
    #     for i in range(N-K+1):
    #         a = sum(P[i:i+K])
    #         ans = a if a > ans else ans
    #     print(P)
    # else:
    ar = []
    for i in range(K):
        ar.append(P[i:i+K])
    print(ar)
    s = np.sum(ar, axis=0)
    print(s)
    print(max(s))
import numpy as np

N, M = list(map(int, input().split()))
num_array = np.cumsum(list(map(lambda x: (x+1)/2, list(map(int, input().split())))))

max_exp = 0
for i in range(len(num_array)-M):
    tmp = num_array[i+M] - num_array[i]
    if max_exp < tmp:
        max_exp = tmp

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

acc = [0] * (N+1)
for i in range(0, N):
    acc[i+1] = acc[i] + P[i]

print(acc)

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

saidai = 0
gokei = sum(p[0:K])
#print(gokei)

for i in range(0,N-K):
	if i+K < N:
		gokei = gokei - p[i] + p[i+K]
		#print(gokei)
		if saidai < gokei:
				saidai = gokei
	#print(saidai)
print(float(saidai+K)/float(2))
n,k=map(int,input().split())
p=list(map(int, input().split()))
for i in range(n):
	p[i]=(1+p[i])/2
p.sort(reverse=True)
print('{:.8f}'.format(sum(p[:k])))
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
    if i >= 1:
        sum_exp = s[k_end] - s[k_start - 1]
    else:
        sum_exp = s[0]
    ans = max(sum_exp, ans)

print(ans)
import collections

def get_input_line():
    return list(map(int, input().split()))
n, k = get_input_line()
p_list = get_input_line()

def calc_dice_score(p):
    return 0.5*(p+1)

def calc_score(score_list):
    return sum(score_list)

dice_scores = [0] * n

max_score = 0

for i in range(k):
    dice_scores[i] = 0.5*(p_list[i]+1)

for i in range(n- k + 1):
    dice_scores[i+k-1] = 0.5*(p_list[i+k-1]+1)
    max_score = max(max_score, 1)#sum(dice_scores[i:i+k]))
print(max_score)
N,K = map(int,input().split())
P = list(map(int,input().split()))
ans = list()
ans1 = list()

##for i in range(max(P)):
##    ans.append(((i+1)(i+2)/2)(i+1))
##print(ans)
for i in range(N+1-K):
    ans.append(sum(P[i:i+K]))
ansidx = ans.index(max(ans))
for j in range(K):
    ans1.append((P[ansidx+j]*(P[ansidx+j]+1)/2)/P[ansidx+j])
sum(ans1)
N,K=map(int,input().split())
P=list(map(int,input().split()))
P.sort()
S=sum(P[:-K])
ans=(K+S)/2
print(ans)
from itertools import accumulate



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


def main():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    for i in range(n):
        p[i] = expectation(p[i])
    p = list(accumulate(p))
    answer = 0
    for i in range(n - k + 1):
        answer = max(answer, p[i + k - 1] - p[i - 1])
    print(answer)


if __name__ == '__main__':
    main()
N, K = [int(i) for i in input().split(" ")]
dice_nums = [(int(i)+1)/2 for i in input().split(" ")]
idx = 0
for i in range(N-K):
    if dice_nums[i] < dice_nums[i+K]:
        idx = i + 1
print(sum(dice_nums[idx:idx+K]))
n,k=map(int,input().split())
P=list(map(int,input().split()))
R=[0]*n
ma=0
R[0]=P[0]
for i in range(1,n):
    R[i]=R[i-1]+P[i]
for i in range(n-k):
    ma=(max(ma,R[i+k]-R[i]))
print((ma+k)/2)
N, K  = map(int, input().split())
p = [int(i) for i in input().split()]
k = [0] * N


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

def cumsum(l):
    c = [0] * len(l)
    for i in range(len(l)):
        c[i] = c[i-1] + l[i]
    return c

c = cumsum(k)

ans = c[0]

for i in range(N-K):
    t = c[i+K] - c[i]
    if t > ans:
        ans = t

print(ans)
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    l = list(itertools.accumulate(A))

    ans = 0
    for i in range(M, N):
        ans = max(ans, l[i] - l[i-M])
    ans = (ans+M) / 2
    
    return ans

print(solve())
n, k = input().split()
n = int(n)
k = int(k)
p = list(map(int, input().split()))
if n==k:
	print((sum(p)+n)/n)
else:
	q = []
	for i in range(n):
		q.append(sum(p[:i+1]))
	r = []
	for i in range(n-k):
		r.append(q[i+k]-q[i])
	r.sort()
	print((r[n-k-1]+k)/2)
n, k = map(int, input().split())
p = list(map(int, input().split()))
p = sorted(p)
print((sum(p[n-k:])+k)/2)
N, K = map(int, input().split())
p = list(map(int, input().split()))

S = [0]
E = []

for i in range(N+1):
    S.append(sum(p[0:i]))

for i in range(N-K+1):
    E.append(S[i+K]-S[i])


print((max(E)+K)/2)
N,K=map(int,input().split())
E=lambda x:(x+1)/2
p=list(map(int,input().split()))
P=[E(n) for n in p]
print(P)
M=0
for i in range(N-K+1):
    m=sum(P[i:i+K])
    M=max(M,m)
print(M)
x, y = map(int,input().split())
li = list(map(int, input().split()))
p = [0]*x
a = 0
ans = 0
for i in range(x):
    p[i] =  li[i]*(li[i]+1)//2/li[i]
    
a = sum(p[0:0+y])
for i in range(1,x-y+1):
    a = a-p[i-1]+p[i+y-1]    
    ans = max(ans,a)
    
print(ans)
# 自分の
N, K = map(int, input().split())
p_arr = list(map(int, input().split()))

# 最高値を算出
max_sum = 0
for i in range(N-K+1):
    if sum(p_arr[i:i+K])>max_sum:
        max_sum = sum(p_arr[i:K])

answer = (max_sum + K) / 2
print(answer)
# 初期入力
N,K = (int(x) for x in input().split(" "))
A = list(map(int, input().split()))

# 左からa番目のサイコロの期待値
kitaiti = []

# kitaiti.append ( sum([ j for j in range(1,i +1)] ) /i)
kitaiti =[ sum([ j for j in range(1,i +1)] ) /i for i in A ]

# 隣接するK個の期待値を足す
sum_K =[]
sum_K = [sum(kitaiti[i:K +i])  for i in range(K) ]
sum_K_max = max(sum_K)
# print(kitaiti)
# print(sum_K)
print(sum_K_max)
N, K = map(int,input().split())
p = list(map(int,input().split()))

exp = [(x+1)/2 for x in p]

ls =[]
print(exp)
for n in range(1,N+1):
  ls.append(sum(exp[:n]))



ans = 0
for n in range(N-K):
  ans_candidate = ls[n+K]-ls[n]
  
  if ans < ans_candidate:
    ans = ans_candidate

print(ans)
n,k=map(int,input().split())
p=list(map(int,input().split()))
pp=[]
su=0
for i in range(n):#累積和
    if i<k:
        su+=p[i]
    else:
        pp.append(su)
        su=su-p[i-k]+p[i]
ans=0.0
for i in range(len(pp)):
    j=(pp[i]+k)/2
    if ans<j:
        ans=j
print(ans)
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
while (j+k <=n):
	if j+k==n:
		ans=sum(p)
		break
	dif=sdict[j+k]-sdict[j]
	ans=max(dif,ans)
	j+=1
print(ans/2)
n,k=map(int,input().split())
p=list(map(int,input().split()))
q=[p[0]]
for i in range(1,n):
    q+=[q[-1]+p[i]]
s=0
for i in range(n-k):
    r=q[i+k]-q[i]
    if s<r:
        s=r
print((s+k)/2)
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    B=0
    S = (sum(A[0:K])+K)/2
    for i in range(K,(N-K+1)):
        S +=  (A[i]+1)/2
        S -= (A[i-K]+1)/2
        if B<S:
            B=S
    print(B)

main()
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 = 0
for i in range(K - 1, N):
    val = cum_exp[i] - cum_exp[i - K]
    if val > max:
        max = val

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

e = []

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

ans = sum(e[0:k])
s = ans
print(e)
for i in range(k,n):
  aaa = s + e[i] - e[i-k]
  if ans < aaa:
    ans = aaa
  s = aaa
print(ans)
import itertools
n,k = map(int,input().split())
p = list(map(int,input().split()))
acc = list(itertools.accumulate([x for x in p]))
 
 
ans=max(acc[i]-acc[i-k] for i in range(k-1,n))
answer=ans/2+k/2
print(answer)
n, k = map(int, input().split())
p = list(map(int,input().split()))

sum_p =[0]
tmp = 0
for i in p:
    tmp += i
    sum_p.append(tmp)

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

ans = (k + max_expect)/2
print(ans)
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+1)
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+1):
    M=max(M,accumurate[i+K]-accumurate[i])
print(M)
n,k = [int(x) for x in input().split()]
arr = [int(j) for j in input().split()]

arr = sorted(arr)
ex = 0 
for x in range(n-k,n):
    for j in range(1,arr[x]+1):
        ex += j/arr[x]
print(ex)
N, K = map(int, input().split())
P = list(map(int, input().split()))

wa = sum(P[:K])
ind = 0
for i in range(1, N - K+1, 1):
    tmp = wa + P[i+K-1] - P[i-1]
    if tmp > wa:
        wa = tmp
        ind = i
    else:
        pass
# 期待値を求める
ans = 0

for i in range(ind, ind+K, 1):
    now = P[i]
    ans += (now+1) / 2
print("{:.10f}".format(ans))
N, K = map(int, input().split())
P = list(map(int, input().split()))
E = 0
Elist = []
for p in P[0:3]:
    plist = list(range(1, p+1))
    Elist.append(sum(plist) / len(plist))
E = sum(Elist)
print(E)
oldE = E
count = 2
for p in P[3:]:
    count += 1
    plist = list(range(1, p+1))
    Elist.append(sum(plist) / len(plist))
    E -= Elist[count - 3]
    E += Elist[count]
    if oldE <= E:
        oldE = E
print(E)
n,k = map(int, input().split())
p = [int(e) for e in input().split()]

s = sum(p[0:k+1])
max = s
for i in range(n-k):
  s = s - p[i] + p[k-i]
  if max < s:
    max = s
    
print((max+k)/2.0)
def main():
    N,K = map( int, input().split())
    P = list(input().split())
    max_num = 0
    
    for i in range(N-K+1):
        sum_num = sum(int(P[j]) for j in range(i,i+K))
        if sum_num>max_num:
            tmp = i

    sum_exp = sum((float(P[j])+1)/2 for j in range(tmp,tmp+K))
    print(sum_exp)
        

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


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

d = {}
for i in range(1, 1001):
    d[i] = (i + 1) * (i / 2) / i

cum = list(accumulate(P))

mx = 0
idx = 0
for i in range(N-K+1):
    if cum[i+K-1] - cum[i] > mx:
        mx = max(mx, cum[i+K-1] - cum[i])
        idx = i

ans = 0
for j in range(K):
    ans += d[P[idx+j]]

print(ans)
def main():
    n,k = map(int,input().split())
    li = list(map(int,input().split()))
    wk = list(map(lambda x:(x+1)/2,li))
    kai = []

    for x in range(0,n-k+1):
        kai.append(sum(wk[x+1:x+k+1]))
    print(max(kai))

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


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

S = p_accu[k-1]

for i in range(n - k):
    if S < p_accu[i+k] - p_accu[i]:
        S = p_accu[i+k] - p_accu[i]
    
print(S/2)
n,k = (int(x) for x in input().split())
list = [int(i) for i in input().split()]
sumlist = []
sum = 0;ans = 0
for l in range(n):
    list[l] = (1+list[l])/2

for i in range(n):
    sum += list[i]
    sumlist.append(sum)

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

print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))
ans = []
for i in range(0, n-k+1):
    ans.append(sum(p[(i):(k+i)]))
print(print((k+max(ans))/2))
# -*- coding: utf-8 -*-

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

check = 0
for i in range(n-k):
    if check < sum(p[i:i+k]):
        check = i

#print(p[check:check+k])

ans = 0
for i in p[check:check+k]:
    ans += (i+1)/2
print(ans)
N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
for i in range(N-K+1):
    print(i)
    kitaichi = 0
    for j in range(i, i+K):
        kitaichi += (p[j]+1)/2
    ans = max(ans, kitaichi)
print("{:.20f}".format(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
    m=q
ans=0
for i in range(f,f+k):
  ans+=(p[i]+1)/2






print(ans,s,f)
n, k = map(int, input().split())
arr = list(map(int,input().split()))

sum_tmp = [sum(arr[i:i+k]) for i in range(n - (k - 1))]
max_v = max(sum_tmp)
max_i = sum_tmp.index(max_v)
ans = 0
for j in arr[max_i:max_i+k]:
  ans += sum(range(1, j+1)) / j
  print(ans)
N, K = map(int, input().split())
plist = [((num*(num+1))//2)/num for num in list(map(int, input().split()))]
print(plist)
ans = 0
for i in range(K):
    ans += plist[i]
_ = ans
for i in range(N-K):
    temp = _
    temp -= plist[i]
    temp += plist[i+K]
    # print(i, i+K, ans, temp)
    ans = max(ans, temp)
    _ = temp
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))

dicesum = 0
maxsum = 0
for i in range(n):
	if i < k:
		dicesum += p[i]
	else:
		dicesum += p[i]
		dicesum -= p[i-k]
		maxsum = max(maxsum, dicesum)

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

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


p2 = []

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

ans = 0
tmp = 0
#p3 = []
for i in range(n):
    if(i<k):
        tmp = tmp + p2[i]
    else:
        tmp = tmp - p2[i-k] + p2[i]
        ans = max(ans,tmp)
    #p3.append(tmp)

#print(p2)
#print(p3)
print(ans)
import math

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

mx = 0
cs = 0
for i in range(k):
    cs += pL[i]
    mx = cs
for i in range(1, len(pL) - k + 1):
    cs = cs - pL[i - 1] + pL[i + k - 1]
    print(cs)
    mx = max(mx, cs)
print((mx + k) / 2)
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
p.sort(reverse=True)

print(sum(p[0:k])/k+1)
N,K=map(int,input().split())
p=list(map(int,input().split()))
e=[float((1+i)/2) for i in p]
ans=0
new=0
for i,v in enumerate(e):
	new=sum(e[:i+1+K])-sum(e[:i+1])
	if ans<new:
		ans=new
print(ans)
import numpy as np
N, K = list(map(int, input().split()))
p = list(map(int, input().split()))

max_sum_val = 0
sum_list = []
for j in range(len(p) - K + 1):
    sum_list.append(sum(p[j:K+j]))
index = np.argmax(np.array(sum_list))

plist = p[index:K+index]
prod = np.prod(np.array(plist))
sum_val = 0
for i in range(len(plist)):
    sum_val += prod * (plist[i] + 1) / 2 
print(sum_val / prod)
N, K = map(int,input().split())
list_p = [int(x) for x in input().split()]

total = sum(list_p[0:K])
max = total

for i in range(0,N-K+1) :
    total = total - list_p[i] + list_p[i+K-1]
    if total > max :
        max = total

print((max+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(1, 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()))
ans = 0
now = sum(p[:k-1])
for i in range(n - k):
    now += p[i + k]
    if now > ans:
        ans = now
    now -= p[i]
ans += k
ans /= 2
print(ans)
n,k=map(int,input().split())
P=list(map(int,input().split()))
dp=[0]*(n+1)
for i in range(n):
    dp[i+1]=dp[i]+P[i]
ma=0
for i in range(1,n-k+1):
    ma=max(ma,dp[i+k]-dp[i])
print((ma+k)/2)
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])
print(s[0])
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 = (int(x) for x in input().split())
p = list(map(int, input().split()))
max=0
sum=0
maxI=0

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

ans=0
for i in range(maxI,maxI+K):
  sum=0
  for j in range(1,p[i]+1):
    sum+=j
  sum/=p[i]
  ans+=sum
print("{:.7f}".format(ans))
n,k=map(int,input().split())
p=list(map(int,input().split()))
f=lambda x:0.5*(x+1)
p=sorted(list(map(f,p)))
print(sum(p[-k:]))