peterverebics/CodeNet_Python_118 huggingface dataset:
def main():
    from itertools import accumulate
    n, k = map(int, input().split())
    p = list(map(int, input().split()))

    p_acc = tuple(accumulate(p))
    print(p, p_acc)
    p_max = 0
    for i in range(n-k):
        p_max = max(p_acc[i+k]-p_acc[i], p_max)
    print((p_max+k)/2)
    return


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


s_max = sum(P[:K])
print(s_max)
s = s_max
for i in range(K, N):
    print(P[i], P[i - K])
    s = s + P[i] - P[i - K]
    s_max = max(s_max, s)

print((s_max + K)  / 2)
n,k=map(int,input().split())
p=list(map(int,input().split()))
sum_p=[]
wk_sum_p=[]
for i in range(n):
  wk_sum_p.append(p[i])
  if len(wk_sum_p)==k:
    sum_p=wk_sum_p.copy()
  elif len(wk_sum_p)>k:
    if wk_sum_p[0]<wk_sum_p[k]:
      sum_p=wk_sum_p[1:k+1].copy()
    del wk_sum_p[0]
ans=0
for val in sum_p:
  div=val//2
  if val%2==0:
    ans+=(1+val)*div/val
  else:
    ans+=((2+val)*div+1)/val
print(ans)
import numpy as np
N,K = map(int,input().split())
p = list(map(int,input().split()))

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

a = [0] * N
a[0] = l[0]
for i in range(1,len(l)):
    a[i] = a[i-1] + l[i]

x = a.index(max(a))
print(max(a) - a[x-K],a,l)
# -*- coding: utf-8 -*-
def calc_expect(n):
    return (n+1) / 2


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

p_expect_list = list(map(calc_expect, p_list))

max_val = 0

res = [0] * len(p_expect_list)
res[0] = p_expect_list[0]
for i in range(len(res)-1):
    res[i+1] = res[i] + p_expect_list[i+1]

for i in range(len(p_expect_list)-k):
    val = res[i+k]-res[i]
    if val > max_val:
        max_val = val

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

s = 0

for j in range(K):
  s += p[j]
  
x = s

for k in range(N - K):
  t = s - p[k] + p[K + k]
  if s <= t:
    x = t
  else:
    pass
  s = t

print((x + K) / 2)
nk = list(map(int, input().split()))
p = list(map(int, input().split()))
n = nk[0]
k = nk[1]
maxnum = 0
for i in range(n-k):
    if p[i+k] >= p[i]:
        maxnum = i+k

ans = (sum(p[maxnum-k+1:maxnum+1])+k)/2
print(ans)
n = list(map(int, input().split()))
p = list(map(int, input().split()))
lists = list()
x = n[0] - n[1] + 1

for i in range(x):
  lists.append(sum(p[i:i+n[1]]))
  
print ((n[1] + max(lists) /2))
n, k = map(int, input().split())

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

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

print((ans+k)/2)
N, K = map(int, input().split())
p = list(map(int, input().split()))
p = list(map(lambda x: (x + 1)/2, p))
ans = 0
for i in range(1, len(p)):
    p[i] += p[i - 1]
for i in range(K - 1, len(p)):
    ans = max(ans, p[i] - p[i - K])
print(ans)
def su(n):
    ans=0
    for i in range(1,n+1):
        ans+=i
    return ans
n,k=map(int,input().split())
p=list(map(int,input().split()))
p=sorted(p,reverse=True)
ans=0
for i in range(k):
    ans+=su(p[i])/p[i]
print(ans)
import sys

sys.setrecursionlimit(10 ** 7)

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

P.sort(reverse=True)

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

print(ans)
n,k = map(int,input().split())
s = list(map(int,input().split()))
s.sort()
ans = 0
for i in range(1,k+1):
  ans += (s[-i]+1)/2
print(ans)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

def main():
    N, K = map(int, input().split())
    p = [((int(i)+1) * int(i) / 2)/int(i) for i in input().split()]
    dp = [0 for i in range(N-K+1)]
    dp[0] = 0
    for i in range(1, N-K+1):
        dp[i] = max(dp[i-1], sum(j for j in p[i:i+K]))
    print(max(dp))

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

tmp = sum(ps[:k])
max_ps = tmp
start = 0

for i in range(1,n-k):
    tmp = tmp-ps[i-1]+ps[i+k-1]
    if tmp >= max_ps:
        max_ps = tmp
        start = i

print(sum([(i*(i+1))/ (2*i) for i in ps[start:start+k]]))
M,N = list(map(int,input().split()))
s = list(map(int,input().split()))
count = 0
kiroku = 0

for i in range(M-N):
    if sum(s[i:i+N]) > count:
        count = sum(s[i:i+N])
        kiroku = i


b = 0
for i in range(kiroku,kiroku+N):
    a = (1+s[i])/2
    b += a
    
print(b)
#!/usr/bin/env python3
def main():
    def expected_val(limit):
        return (1 + limit) / 2

    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)
    if N - K == 0:
        print(lst[0])
        return
    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 = map(int, input().split())

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

saidai = 0
base = sum(p[0:K])

for i in range(N-K+1):
	if i+K+1 < N:
		gokei = 0
		gokei = base - p[i] + p[i+K+1]
		if saidai < gokei:
				saidai = gokei

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

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

pre=[0 for i in range (n+1)]
q=[0 for i in range (n-k+100)]


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

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

print ((ans + k) / 2)
import sys
n,k=map(int,input().split())
pp = list(map(int,input().split()))
s=[0]*n
for i,p in enumerate(pp):
  if i==0:
    s[0] = (1+p)/2
  else:
    s[i] = s[i-1]+(1+p)/2
res =0 
for i in range(n-k):
  if res < s[i+k] - s[i]:
    res = s[i+k]-s[i]
print(res)
def main():
    n,k=map(int,input().split())
    p=list(map(int,input().split()))
    kitai=[]
    ans=0
    for i in range(n):
        buf=sum(range(1,p[i]+1))/p[i]
        kitai.append(buf)
        if i<=k-1:
            ans+=buf
    x=ans
    for i in range(k,n):
        x-=kitai[i-1]
        x+=kitai[i]
        if ans<=x:
            ans=x
    print(ans)

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

def E(a):
    return a*(a+1)/2/a

new_p = [E(i) for i in p]
box=[]
for i in range(k):
    s = sum(new_p[i:i+k])
    box.append(s)
    if i+k == len(new_p)+1:
        break
print(max(box))
import numpy as np
n,k = list(map(int,input().split()))
p = np.array(list(map(int,input().split())))

P = 0
for i in range(n-k+1):
  if P < p[i:i+k].sum():
    P = p[i:i+k].sum()
    mp = p[i:i+k]

ans = 0
print(mp)
for i in mp:
  if i%2 == 0:
    ans += ((i+1) * i//2)/i
  else:
    ans += ((i+1) * (i//2) + (i//2) + 1)/i
print(ans)
n,k=map(int,input().split())
p=list(map(int,input().split()))

q=[]

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

ans=sum(q[:k])

for i in range(1,n-k+1):
  if q[i-1]<q[i-1+k]:
    ans=sum(q[i:i+k])
  
print(ans)
N, K = map(int, input().split(' '))
p = list(map(int, input().split(' ')))



cumsum = []
cumsum_diff = 0
for i in range(N):
    if i == 0:
        cumsum.append((p[i] + 1)/2)
    else:
        cumsum.append(cumsum[i - 1] +( p[i] + 1)/2)

# print(cumsum)

for i in range(N - K + 1):
    if i <= N - K:
        if cumsum_diff < cumsum[i + K - 1] - cumsum[i-1]:
            cumsum_diff = cumsum[i + K - 1] - cumsum[i-1]

print(cumsum_diff)
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 + 3) / 2)
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)
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 = list(map(int,input().split()))
a = list(map(int,input().split()))
ans = 0
for i in range(n):
    x = a[i]
    a[i] = (x*(x+1))/2/x
print(a)
for i in range(n-k+1):
    print(i,a[i:i+k])
    ans = max(ans,sum(a[i:i+k]))
print(ans)
N , K = map(int, input().split())
p = list(map(int, input().split()))
Etop = 0
E = 0
q = []
for j in p:
    q.append((j+1) / 2)

print(q)

for i in range(N-K+1):
    E = 0
    for n in range(K):
        E += q[n+i]
    if E > Etop:
        Etop = E
print(Etop)
n,k=map(int,input().split())
a=list(map(int,input().split()))
b=0
for i in range(k):
  b+=a[i]

ma=b
for i in range(n-k):
  b+=a[k]
  b-=a[i]
  ma=max(b,ma)

ans=(ma+k)/2
n = input().split()
N = int(n[0])
K = int(n[1])
a = input().split()
sum = 0
max = 0
for j in range(0, N):
    sum += int(a[j])
    if j > K - 1:
      sum -= int(a[j - K])
      if max < sum:
        max = sum
e = (max + K) / 2 if (max + K) % 2 == 0 else str(int((max + K - 1) / 2)) + '.5'
print (e)
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,N):
  S=R[i]-R[i-K]
  if ans<S:
    ans=S
print(ans)
N, K = map(int, input().split())
p = list(map(int, input().split()))
ansmax = 0
for i in range(N-K+1):
  ans = 0
  for j in range(K):
    ans += (p[i+j]+1)/2
  print(ans)
  if(ansmax < ans):
    ansmax = ans
print(ansmax)
n,k=map(int,input().split())
p=list(map(int,input().split()))
for i in range(n):
    p[i]=(p[i]+1)/2
print(p)
q=[]
for i in range(n-k+1):
    q.append(p[i:k+i])
q.sort()
print(sum(q[n-k]))
def expected_value(arr):
    print(arr)
    return ([sum(range(1, ele+1)) / ele for ele in arr])

n, k = [int(x) for x in 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)
print(expected_value(arr[max_i:max_i + k]))
print(sum(expected_value(arr[max_i:max_i + k])))
#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]))
K=float(K)
kk=float(kk)
ans=0.5*(kk+K)

print(ans)
#coding:utf-8
import numpy as np
n,k=map(int,input().split())
P=list(map(int,input().split()))

s=[(1/2)*x*(x+1)/x for x in P]
number=len(P)-k+1
print(np.max(np.convolve(s,np.ones(number)/number,mode='same'))*number)
N, K = map(int, input().split())
p_list = list(map(int, input().split()))

c_s_list = [] #Cumulative sum_list
c_sum = 0 #Cumulative sum
for dice in p_list:
    average = (dice + 1) / 2 #ダイスの期待値
    c_sum += average
    c_s_list.append(c_sum)

ans = 0
for i in range(N-K):
    tmp = c_s_list[i+K] - c_s_list[i]
    if tmp >= ans:
        ans = tmp
print(ans)
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))

max_k_expect = 0
for i in range(0, k):
    if max_k_expect < sum(total_expects[i:i+k]):
        max_k_expect = sum(total_expects[i:i+k])
print(max_k_expect)
N, K = map(int, input().split())
P = list(map(int, input().split()))

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

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

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

max_index_list = [i for i, x in enumerate(p_list) if x == max(p_list)]

max_ex_value = 0
for max_index in max_index_list :
  for i in range(max_index-k+1,max_index-1):
    x = 0
    for j in range(0, k):  
      x += (p_list[i+j]+1)/2
    if x >= max_ex_value:
      max_ex_value = x
               
print(max_ex_value)
import numpy as np
N, K = map(int, input().split(" "))
p = np.array(list(map(int, input().split(" "))))
ex = np.array([(i + 1) / 2 for i in p])
ans = np.sum(ex[0: K])
max_ans = ans
for i in range(K, N):
    diff = ex[i] - ex[i - K]
    ans += diff
    if diff > 0:
        max_ans = ans
print(max_ans)
N,K = map(int,input().split())
L=list(map(int,input().split()))
A=[0]*N


for i in range(N):
    t=(L[i]+1)*L[i]/2*(1/L[i])
    A[i]=t
s=0
t=sum(A[:K])
for i in range(N-K):
    t+=(A[i+K]-A[i])
    s=max(s,t)

print(s)
def main():
    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    sump = sum(p[0:k])
    tmp = 0
    ind = 0
    for i in range(n-k):
        #print(tmp)
        tmp = sump + (p[i+k] - p[i])
        if tmp > sump:
            sump = tmp
            ind = i+1
        
    e = 0
    for i in range(ind, ind+k):
       e += (p[i]+1) / 2 
    print(e)
    
main()
n,k = map(int, input().split())
p = list(map(int, input().split()))
m = max(p)
h = [0]*(m+1)
h[1] = 1
for i in range(1,m):
    h[i+1] = h[i]+0.5
ans = sum = 0
for i in range(n):
    if i>=k:
        sum = sum-h[p[i-k]]+h[p[i]]
        if ans<sum: ans=sum
    else:
        sum += h[p[i]]
        if i==k: ans=sum
print(ans)
n, k = map(int, input().split())
p = list(map(int, input().split()))

prev = sum(p[1:k])
ind = 0

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

    if prev < nex:
        prev = nex
        ind = i

total = 0
for i in range(ind, ind + k):
    total += (p[i] * 0.5 + 0.5)

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

def expect(p):
  return (1+p)/2

maxV = sum([expect(p) for p in P[:K]])
for i in range(N-K):
  maxV = max(maxV, maxV - expect(P[i]) + expect(P[i+K]))
print(maxV)
n,k,*p=map(int,open(0).read().split())
s=m=sum(p[:k])
for i in range(k,n):s+=p[i]-p[i-k];m=max(m,s)  
print((s+k)/2)
n,k=map(int,input().split())
p=list(map(int,input().split()))
x=sum(p[:k])
idx=0
for i in range(k,n):
  dx=x+p[i]-p[i-k]
  if x<dx:
    idx=i-k+1
    x=dx
ans=0
for i in range(idx,idx+k):
  ans+=(p[i]*(p[i]+1)//2)/p[i]
print(ans)
N,K,*P = map(int,open(0).read().split())
P = [(P[i]+1)/2 for i in range(N)]
E = [sum(P[:i]) for i in range(1,N+1)]
m = 0
for i in range(N-K):
  if m < E[i+K]-E[i]:
    m= E[i+K]-E[i]
print(m)
a,b=map(int,input().split())
d = list(map(int, input().split(" ")))
w = [0]*len(d)

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

ans = 0
for i in range(a-b):
    ans = max([ans,w[i+b]-w[i]])
d2 = 0.5*b + ans/2

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

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

def kitaiti(num):
    result = (num+1)*num/(num*2)
    return result
r = [kitaiti(p[i]) for i in range(n)]

result = [sum(r[:k])]
for i in range(k,n):
    result.append(result[-1]+p[i]-p[i-k-1])
print(max(result))
N,K=map(int,input().split())
p=list(map(int,input().split()))

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

S=[0]*N
for i in range(N):
    S[i]=sum(E[:i])

A=[0]*(N-K+1)
for i in range(N-K):
    A[i]=S[i+K]-S[i]

print(max(A))
import numpy
N, K = map(int, input().split())
p = list(map(int, input().split()))

lis = list()

p = [(i + 1)/2 for i in p ]
numpy.set_printoptions(precision=16)

cumSum = numpy.cumsum(p)

cumSum2 = list(cumSum)

cumSum2.insert(0,0)

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

print('{:.12f}'.format(int(max(lis))))
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('{:.10f}'.format(ht))
N, K = map(int, input().split())


P = list(map(int, input().split()))
P = [(1 + k)*(k/2)/k for k in P]
P.sort(reverse=True)
s = 0
for i in range(K):
    s += P[i]
print(s)
import decimal

n, k = map(int, input().split())
p_list = list(map(int, input().split()))
index = 0
value = 0

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

for i in range(k):
    value += decimal.Decimal((1 + p_list[index + i]) * (p_list[index + i] / 2)) / decimal.Decimal(p_list[index + i])

print(round(value, 12))
from collections import deque, defaultdict

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

dice = [0]
for i in range(1000):
  dice.append(1 + 0.5 * i)
  
lis = []
sum = 0
for p in P:
  sum += dice[p]
  lis.append(sum)
  
ans = 0
for i in range(N - K):
  ans = max(ans, lis[K+i] - lis[i])
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]+1, x[0]):
  max_value = max(max_value, value)
  value += y[i]
  value -= y[i-x[1]-1]
print(max_value)
N, K = map(int, input().split())
P = list(map(int, input().split()))


kitaiti = {}

k = 1.0
for i in range(1, 1001):
    kitaiti[i] = k
    k += 0.5

array = P[0:K]
index = 0

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

ans = index

for i in range(1, len(P)-K+1):
    s = index - kitaiti[P[i-1]] + kitaiti[P[i+K-1]]
    if s > index: ans = s
    index = s
print(ans)
from sys import stdin

N, K = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]

D = sum(P[:K])
index = 0

for i in range(1, N - K + 1):
    if D + P[i + K - 1] - P[i - 1] > D:
        D = D + P[i + K - 1] - P[i - 1]
        index = i

ans = 0

for i in range(K):
    ans += (1 + P[index + i]) / 2

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

def calc(n):
    return sum([i for i in range(1, n+1)]) / n
p.sort()
m = sum([calc(i) for i in p[-K:]])
print(m)
n,k = map(int,input().split())
p = list(map(int,input().split()))
m=[0,0,0];
for i in range(n-k+1):
    s=p[i:i+k]
    if(m<s):m=s
a=0;
for j in range(k):
    a += (m[j])*(m[j]+1)/2/m[j]
print(a)
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('{:.10f}'.format(ans))
N, K = map(int, input().split())
p = list(map(int, input().split()))

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

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

x = s
 
for k in range(N - K):
  t = s - p[k] + p[K + k]
  if s <= t:
    x = t
  else:
    pass
  s = t

print(x)
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)):
    if i==0:
        z=sumlist[k-1]
        anslist[i]=z
    else:
        z=sumlist[i+k-1]-sumlist[i]
        anslist[i]=z
ans=max(anslist)
ans+=k
ans=ans/2
print(ans)
import numpy as np

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

# p = np.array([1 / float(i) for i in P])
# psum = np.array([(1 / 2) * i * (i + 1) for i in P])
E = ([(1 / float(i)) * ((1 / 2) * i * (i + 1)) for i in P])

# E = p * psum
Emax = []
[Emax.append(sum(E[i:K + i])) for i in range(K)]
print(max(Emax))
n, k = map(int, input().split())
p = list(map(int, input().split()))
for i in range(n) :
    p[i] = (p[i] + 1) / 2

s = sum(p[0:k])

ans = 0


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

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

p = [int(x) for x in input().split()]

sum1 = sum(p[:k])
num = k-1

for i in range(k,n):
    before = sum1
    sum1 = sum1 - p[i-k] + p[i]
    if sum1 >= before:
        num = i

sum2 = sum(p[num-k+1:num+1])

def goukei(j):
    return 1/2 * j * (j+1)

print(float((goukei(sum2)-goukei(k-1))/(sum2 -k +1)))
x,y = map(int,input().split())
li = list(map(int,input().split()))
from collections import deque
l = []
for i in range(len(li)):
    l.append((1+ li[i])/2)
M = 0
from itertools import accumulate
a = list(accumulate(l))
for i in range(len(a)-y):
    m = a[i+y] - a[i]
    if m > M:
        M = m
print(M)
import numpy as np
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=0
l=[]
for i in p:
  l.append((i+1)/2)
t=np.cumsum(np.array(l))
for j in range(n-k):
  ans=max(ans,t[j+k]-t[j])
print(ans)
# -*- coding: utf-8 -*-
from operator import add
import copy

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


E = [0] * (N+1)
S = [0] * (N+1)
R = [0] * (N+1)
for i in range(N):
  E[i] = (1+p[i])/2
  S[i+1] = S[i] + E[i]
  if K<i+2:
    R[i] = S[i]-S[i-K]



print("{:.12f}".format(max(R)))
import numpy

n,k = map(int,input().split())
p = list(map(int,input().split()))
q = []
for i in range(n):
    q.append(((((p[i]+1)*p[i])/2)/p[i]))
res = numpy.cumsum(q)
print(q)
ans = []
ans.append(q[k-1])
for i in range(k,n):
  ans.append(res[i]-res[i-k])
print(max(ans))
import itertools


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

    P = [(1 + p) / 2 for p in P]
    accumulate_P = list(itertools.accumulate(P))

    ans = 0
    for ii in range(1, N - K):
        range_sum_P = accumulate_P[ii + K] - accumulate_P[ii]
        ans = max(ans, range_sum_P)

    print(ans)

resolve()
def Csum(a):
    b,c=[0],0
    for i in range(len(a)):
        c+=a[i]
        b.append(c)
    return b
n,k=map(int,input().split())
p=Csum(list(map(int,input().split())))
ans=0
for i in range(n-k+1):
    ans=max(ans,p[i+k]-p[i])
print(ans//2+1)
N, K = map(int, input().split())
P = list(map(int, input().split()))

ans = (sum(P[:K]) + K) / 2
for i in range(1, N - K):
    if P[i - 1] <= P[i + K - 1]:
        res = (sum(P[i: i + K]) + K) / 2
        if res < ans:
            continue
        else:
            ans = res
    else:
        continue
print(ans)
s = input().split()
n = int(s[0])
k = int(s[1])

p_n = input().split()

up_to = n - k + 1



for i in range(n):
    p_n[i] = (1 + int(p_n[i]))/2


sum_ex = 0.0

for i in range(k):
    sum_ex += p_n[i]
        
        
for i in range(k,n):
    if(p_n[i-k] < p_n[i]):
        sum_ex = sum_ex - p_n[i-k] + p_n[i]


print('{0:.6f}'.format(sum_ex))
A = list(map(int , input().split()))
B = list(map(int , input().split()))

SS = {sum(B[i:i+A[1]]):B[i:i+A[1]] for i in range(len(B)-A[1]+1)}
tes = 0
for i in range(len(max(SS.values()))):
    dice = list(range(1,max(SS.values())[i]+1))
    ex = sum([1/len(dice)*x for x in dice])
    tes += ex
print(tes)
# D
N, K = map(int, input().split())
lst = list(map(int, input().split()))
lst1 = [(lst[0] + 1) / 2]
ma = 0
for i in range(1, len(lst)):
    lst1.append(lst1[i-1] + ((lst[i]+1) / 2))
    if (i >= K):
        ma = max(ma,lst1[i] - lst1[i-K])
print(ma)
N, K = map(int, input().split())
list=list(map(int, input().split()))
m=0
for i in range(N+K-1):
    m=max(m, sum(list[i:i+K]))
    if m == sum(list[i:i+K]):
        n = i
a=list[n:n+K]
su=0
N, M = map(int, input().split())
lst = list(map(int, input().split()))
ans = []
for i in lst:
  ans.append((i*(i+1)//2)/i)
ans = sum(lst[:M])
max_ans = ans
num = 0
for i in range(M, N):
  ans = ans - lst[num] + lst[i]
  num += 1
  if ans > max_ans:
    max_ans = ans
print(max_ans)
line = list(input().split(" "))
n = int(line[0])
k = int(line[1])
p = list(input().split(" "))
result = 0
sum = 0
for i in range(k):
    sum += int(p[i])
for i in range(n-k):
    sum += int(p[i+k]) - int(p[i])
    result = max(result,sum)
print((result+k)/2)
n, k, *p_n = map(int, open(0).read().split())

for i in range(n - 1):
    p_n[i + 1] = ((p_n[i + 1] + 1) / 2) + p_n[i]
    
p_n.insert(0, 0)

exp_sum = [0] * (n - k + 1)
for i in range(n - k + 1):
    exp_sum[i] = p_n[i + k] - p_n[i]
    
print(max(exp_sum))
n,k=map(int,input().split())
p=list(map(int,input().split()))
s=0
for i in range(n-k):
    q=sum(p[i:i+k])
    if q>s:
        s=q
print((s+k)/2)
N, K = map(int, input().split())
numbers = list(map(int, input().split()))

maxvalue = 0
for i in range(N-K):
  number_sum = sum(numbers[i:i+K])
  if number_sum > maxvalue:
    maxvalue = number_sum
    
print(maxvalue + 3 / 2)
n, k = map(int, input().split())

dice = list(map(int, input().split()))
a = 0
b = 0


b = sum(dice[0: k])

res = 0
ll = 0
s = 0
mmm = range(k, len(dice))
for i in mmm:
    ss = sum(dice[i:i + k])
    if ss > b:
        b = ss
        ll = i
    s += 1

for mn in range(ll - k + 1, ll + 1):
    ss = range(dice[mn] + 1)
    res += sum(ss) / dice[mn]
print(res)