Problem:


Score : 400 points

Problem Statement

We have N dice arranged in a line from left to right. The i-th die from the left shows p_i numbers from 1 to p_i with equal probability when thrown.

We will choose K adjacent dice, throw each of them independently, and compute the sum of the numbers shown. Find the maximum possible value of the expected value of this sum.

Constraints

1 ≤ K ≤ N ≤ 200000

1 ≤ p_i ≤ 1000

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
p_1 ... p_N

Output

Print the maximum possible value of the expected value of the sum of the numbers shown.

Your output will be considered correct when its absolute or relative error from our answer is at most 10^{-6}.

Sample Input 1

5 3
1 2 2 4 5

Sample Output 1

7.000000000000

When we throw the third, fourth, and fifth dice from the left, the expected value of the sum of the numbers shown is 7. This is the maximum value we can achieve.

Sample Input 2

4 1
6 6 6 6

Sample Output 2

3.500000000000

Regardless of which die we choose, the expected value of the number shown is 3.5.

Sample Input 3

10 4
17 13 13 12 15 20 10 13 17 11

Sample Output 3

32.000000000000



Sample input:
5 3
1 2 2 4 5


Sample output:
7.000000000000

Submission status: Runtime Error

Solution code:
N, K = map(int, A.split())
p_list = list(map(int, B.split()))

dst = 0

for i in range(N-K+1):
    print("i : {}".format(i))
    p_sum = 0
    for j in range(K):
        p = p_list[i+j]
        print("p : {}".format(p))
        p_sum += ( p/2 * (1+p)) / p
    if p_sum > dst:
        dst = p_sum
    
print(dst)

Submission status: Runtime Error

Solution code:
N,K = list(map(int,input().split(' ')))
pi = list(map(int,input().split(' ')))
value = pi[:K]
max_value = value
for i in range(K, N):
  value -= pi[i-K]
  value += pi[K]
  if value>max_value:
    max_value = value
print(max_value/float(K))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
p_list = len(map(int, input().split()))

dst = 0

for i in range(N-K+1):
  p_sum = 0
  for j in range(K):
    p = p[j]
    p_sum += p/2 * (1+p)
  if p_sum > dst:
    dst = p_sum
    
print(dst)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
pn = map(int, input().split())
tmp = 0
ans = 0
for n in K-N:
  val = sum(pn[n:n+K])
  if tmp < val):
    tmp = val
    tmp_ans = 0
    for k in N:
      num = pn[n+k]
      for n in num:
        tmp_ans += n/num 
    ans = tmp_ans
print(ans)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
pn = map(int, input().split())
tmp = 0
ans = 0
for n in N-K:
  val = sum(pn[n:n+K])
  if tmp < val):
    tmp = val
    tmp_ans = 0
    for k in K:
      num = pn[n+k]
      for n in num:
        tmp_ans += n/num 
    ans = tmp_ans
print(ans)

Submission status: Runtime Error

Solution code:
q1=list(map(int,input().split(" ")))
a1=list(map(int,input().split(" ")))

sumsum=0
for i in range(q[0]-q1[1]+1):
    sum1=sum(a1[i:i+q1[1]])
    if(sumsum<sum1):
        sumsum=sum1
sumsum+=q1[1]
print(sumsum/2)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
l = list(map(int,input().split()))
c = sum(i[:b])
for i in range(a-b):
    d = sum(l[i:i+b])
    if d > c:
        c = d
    else:
        pass
f = (c+b)/2
print(f)

Submission status: Runtime Error

Solution code:
a,b = map(int,input().split())
l = list(map(int,input().split()))
l.sort(reverse=True)
c = l[:b-1]
print((c+b)/2)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()]

sump = [0]*n
sump[0]=p[0]
for i in range(n-1):
    sump[i+1] = sump[i]+p[i+1]
ans=max(sump[i+k]-sump[i] for i in range(n-k))
print(ans)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
L=list(map(int,input().split()))
E=[(V+1)//2 for v in L]
ans=sum(E[:K])
last=E[0]
for l in E[K:]:
  ans = max(ans,ans-last+l)
  last = l
print(ans)

Submission status: Runtime Error

Solution code:
    N, K = map(int, input().split())
P = list(map(int, input().split()))
P = [(p+1)/2 for p in P]
def s(i):
    return sum(P[:i-1])

S = []
for i in range(N+1):
    S.append(s(i))
B = []
for j in range(N-K+1):
    B.append(S[j+K]-S[j])
ans = max(B)
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np
N, K = map(int, input().split())
AN = np.array(map(float, input().split()))
 
def Estimator(x):
  return (x + 1)/2
 
m = np.array([])
for i in range(N-K+1):
  B = 0
  for A in AN[i:i+K]:
    B += Estimator(A)
  m = np.append(m ,B)

print(max(m))

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
AN = list(map(int, input().split()))

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

m = []
for i in range(len(N-K+1)):
  B = 0
  for A in AN[i:i+K-1]:
    B += Estimator(A)
  m.append(B)

print(max(m))

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
pi = list(map(int,input().split()))
print((max([sum(pi[i:i+K]) for i in range(N-K)]) + K) / 2)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
pi = list(map(int,input().split()))
ans = []
for i,p in enumerate(pi[:N-2]):
  ans.append((sum(pi[i:i+K])+K)/2)
print(max(ans))

Submission status: Runtime Error

Solution code:
n,k = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
max_t = 0
ans = 0
for i in range(n - k +1):
	buf = sum(p(i:i+k))
	if max_t < buf:
		max_t = buf
		ans = 0
		for j in range(k):
			ans += (1+p[i+j]) * p[i+j] / 2
print(ans)

Submission status: Runtime Error

Solution code:
n,k = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
max_t = 0
ans = 0
for i in range(n - k +1):
  buf = sum(p(i:i+k))
  if max_t < buf:
  	max_t = buf
    ans = 0
    for j in range(k):
      ans += (1+p[i+j]) * p[i+j] / 2
print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

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

max_nums = 0

def np_moving_sum(data_1d,windowsize=3,ignoresize=0):
    '''
    1次元のリスト or np.array
    '''
    if  data_1d is None:
        data_1d = [1,2,3,5,8,13,21,34,55,89]

    if type(data_1d) == np.ndarray:
        np_data_1d=data_1d
    elif  type(data_1d) == list:
        np_data_1d=np.array(data_1d)

    # np_data_1d.shape は、(10,)
    answer = np.zeros(np_data_1d.shape)
    answer[:] = np.nan
    # vの長さが3の時
    # v[0]=0 3番目にマッピングされる
    # v[1]=1 2番目にマッピングされる
    # v[2]=0 1番目にマッピングされる

    v = np.ones(windowsize)
    v[0:ignoresize]=0
    v=np.flip(v)

    answer[: np_data_1d.shape[0] - windowsize + 1 ]=np.convolve(np_data_1d, v, mode = "valid")

    return answer

# def np_moving_average(data_1d,windowsize=3,ignoresize=0):
#     return np_moving_sum(data_1d,windowsize,ignoresize)/(windowsize-ignoresize)

#print(np_moving_sum(data_1d=nums, windowsize=K, ignoresize=0))
moving_sum = np_moving_sum(data_1d=nums, windowsize=K, ignoresize=0)
max_sum = max(moving_sum)
idx = list(moving_sum).index(max_sum)

max_list = nums[idx:idx+K]
kitai = 0

for num in max_list:
    kitai += (num+1)/2

print(kitai)

Submission status: Runtime Error

Solution code:
nk = list(map(int, input().split()))
p = list(map(int, input().split()))
n = nk[0]
k = nk[1]
s = []
e = []
for i in range(n):
    s.append(sum(p[:i+1]))

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

ans = (max(e)+k)/2

Submission status: Runtime Error

Solution code:
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

Submission status: Runtime Error

Solution code:
#N個のサイコロが左から右に一列に並べてあります。左から i番目のサイコロは 
# 1から piまでの pi種類の目がそれぞれ等確率で出ます。
#隣接する K個のサイコロを選んでそれぞれ独立に振ったとき、出る目の合計の期待値の最大値を求めてください。
N_K=input()
pn=input()
list_pn=[]
# N,K,Pnの切り出し
for i in range(len(N_K)):
    if N_K[i]==" ":
        N =int(N_K[0:i])
        K =int(N_K[i+1:len(N_K)])
a = 0
for i in range(len(pn)):
    if pn[i]==" ":
        list_pn.append(int(pn[a:i]))
        a = i
list_pn.append(int(pn[a+1:len(pn)]))
# Pnの期待値を計算
pn_ave=[]
for i in range(N):
    pn_ave.append((list_pn[i]+1)/2)
# Sj+k-Sjの累積和を用いて考える
Sj = []
Sj.append(0)
S=0
for i in range(N):
    S += pn_ave[i]
    Sj.append(S)
print(Sj)
Sk = []
for i in range(N-K+1):
    Sk.append(Sj[i+K]-Sj[i])
print(Sk)
Sk.sort()
print(Sk[-1])

Submission status: Runtime Error

Solution code:
N_K=input()
pn=input()
list_pn=[]
# N,K,Pnの切り出し
for i in range(len(N_K)):
    if N_K[i]==" ":
        N =int(N_K[0:i])
        K =int(N_K[i+1:len(N_K)])
a = 0
for i in range(len(pn)):
    if pn[i]==" ":
        list_pn.append(int(pn[a:i]))
        a = i
list_pn.append(int(pn[a+1:len(pn)]))
# Pnの期待値を計算
pn_ave=[]
for i in range(N):
    pn_ave.append((list_pn[i]+1)/2)
# Sj+k-Sjの累積和を用いて考える
Sj = []
Sj.append(0)
S=0
for i in range(N):
    S += pn_ave[i]
    Sj.append(S)
Sk = []
for i in range(N-K+1):
    Sk.append(Sj[i+K]-Sj[i])
Sk.sort()
print(Sk[-1])

Submission status: Runtime Error

Solution code:
N, M = list(map(int, input().split()))
num_array = list(map(int, input().split()))

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

print((max_exp+1)*3/2)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
numbers = list(map(int, input().split()))

maxvalue = 0
for i in range(N+1-K):
  number_sum = list(sum(numbers[i:i+K]))
    
answer = (max(number_sum) + K) / 2
print(answer)

Submission status: Runtime Error

Solution code:
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-1]
  if number_sum > maxvalue:
    maxvalue = number_sum
    
print(maxvalue)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
numbers = list(map(int, input().split()))

maxvalue = 0
for i in range(N-K):
  number_sum = sum(number[i:i+K-1]
  if number_sum > maxvalue:
    maxvalue = number_sum
    
print(maxvalue)

Submission status: Runtime Error

Solution code:
N,K = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
p
for i in b:
    p.append((i+1)/2)
s = sum(p[:K])
max_s = s
for i in range(N-K):
    max_s+=p[K+i]
    max_s-=p[i]
    if max_s<s:
        max_s=s
print(max_s)

Submission status: Runtime Error

Solution code:
from itertools import accumulate


def solve(string):
    n, k, *p = map(int, string.split())
    *p, = accumulate((1 + _p) / 2 for _p in p)
    return str(max(p2 - p1 for p1, p2 in zip(p, p[k:])))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
a = [(a[i]+1)/2 for i in range(n)]
acc = [0]+list(sum(a))
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)

Submission status: Runtime Error

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

X=[]
for i in range(N-2):
    X.append(sum(p[i:i+K]))

print((max(X)+K)/2)

Submission status: Runtime Error

Solution code:
import numpy as np
N,K = [int(i) for i in input().split()]
n = np.array([int(i) for i in input().split()])
n=(n+1)
t=np.empty(N+1)
t[0] = 0
t=np.cumsum(n)
print(max(t[K:]-t[:-K])*0.5)

Submission status: Runtime Error

Solution code:
N,K = [int(i) for i in input().split()]
n = [int(i) for i in input().split()]
max=0
idx=0
for i in range(N-K+1):
    tmp = sum(n[i:i+K]) 
    if tmp  > max:
        max=tmp 
        idx=i

tmp=0
for i in range(K):
    tmp += sum(range(1,d[i]+1))/d[i]
print(tmp)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
P = list(map(int, input().split()))
l = []

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

n = 0
for i in range(N):
    n += l[i]
    l[i] = n

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

print(ans)

Submission status: Runtime Error

Solution code:
import numpy as np

n,k = map(int, input().split())
p_list = np.fromstring(input(), int, sep=' ')

Cumulative_sum = np.zeros(n+1)
Cumulative_sum[1:] = p_list.cumsum()

length_k_sum_list = Cumulative_sum[k:] - Cumulative_sum[0:-k]

print((length_k_sum_list.max()+k)/2)

Submission status: Runtime Error

Solution code:
n, k = [int(i) for i in input().split()]
p = [sum(range(1,int(i)+1))/int(i) for i in input().split()]
max = 0
limit = len(p)-(k-1)
for i in range(limit):
    sum = p[i]+p[i+1]+p[i+2]
    if sum > max:
        max = sum
print(max)

Submission status: Runtime Error

Solution code:
N, K = map(int,input().split())
p = sorted(list(map(int,input().split())))[::-1]
p = print(sum(map(lambda x:(x+1)/2,p)[:K]))

Submission status: Runtime Error

Solution code:
n, k = [int(i) for i in input().split()]
p = [sum(range(1,i+1))/i for i in input().split()]

max = 0
limit = len(p)-3
for i in range(limit):
    sum = p[i]+p[i+1]+p[i+2]
    if sum > max:
        max = sum
print(max)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
arr = list(map(int, input().split()))
s = 0
for i in range(0, n-k + 1):
    p = 0
    for j in range(i, k + i):
        p += ((1 / arr[j]) * (arr[j] * (arr[j] + 1)) / 2))
    if p > s:
        s = p
print(s)

Submission status: Runtime Error

Solution code:
import math
n,k = map(int,input().split())
p = list(map(int,input().split()))
max_array = sum(p[0:k])
a = math.inf
u = max_array
for i in range(k, n):
    u = u + p[i]-p[i-k]
    max_array = max(max_array, u)
print((max_array+k) / 2)
print("test")

Submission status: Runtime Error

Solution code:
import numpy as np
n,k = map(int,input().split())
p = list(map(int,input().split()))
max_array = sum(p[0:k])
a = np.ceil(k)
u = max_array
for i in range(k, n):
    u = u + p[i]-p[i-k]
    max_array = max(max_array, u)
print((max_array+k) / 2)
print("test")

Submission status: Runtime Error

Solution code:
N_K=input()
pn=input()
list_pn=[]
# N,K,Pnの切り出し
for i in range(len(N_K)):
    if N_K[i]==" ":
        N =int(N_K[0:i])
        K =int(N_K[i+1:len(N_K)])
a = 0
for i in range(len(pn)):
    if pn[i]==" ":
        list_pn.append(int(pn[a:i]))
        a = i
list_pn.append(int(pn[a+1:len(pn)]))
# Pnの期待値を計算
pn_ave=[]
for i in range(N):
    pn_ave.append(list_pn[i]*(list_pn[i]+1)/2/list_pn[i])

#最大値を算出
pn_ave_total=[]
for i in range(N-K+1):
    ave = 0
    list_ave = pn_ave[i:i+K]
    for j in range(K):
        ave += list_ave[j]
    pn_ave_total.append(ave)
pn_ave_total.sort()
print(pn_ave_total[-1])

Submission status: Runtime Error

Solution code:
import numpy

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

K = A[1]
N = A[0]

P = list(map(float, input().split()))

EP = list(map(lambda x: (1+x)/2, P))

cumEP = list(numpy.cumsum(EP))

new_list = []
for val in range(N-K):
    new_list.append(cumEP[val+K]-cumEP[val])

print(max(new_list))

Submission status: Runtime Error

Solution code:
N_K=input()
pn=input()
list_pn=[]
for i in range(len(N_K)):
    if N_K[i]==" ":
        N =int(N_K[0:i])
        K =int(N_K[i+1:len(N_K)])
a =0
for i in range(len(pn)):
    if pn[i]==" ":
        list_pn.append(int(pn[a:i]))
        a = i
list_pn.append(int(pn[a+1:len(pn)]))
pn_ave=[]
for i in range(N):
    ave =0
    for j in range(list_pn[i]):
        ave += j+1
    pn_ave.append(ave/list_pn[i])
pn_ave_total=[]
total = 0
A = 0
for i in range(N-K+1):        
    while A<K:
        total+=pn_ave[A]
        A += 1
    A = A-2
    K += 1
    pn_ave_total.append(total)
    total=0
pn_ave_total.sort()
print(pn_ave_total[-1])

Submission status: Runtime Error

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

calRes = 0
calIndex = 0
expectedList = []
expectedCorList = []

for i in range(N):
    cal = list(range(1, p[i] + 1))
    expectedList.append(sum(cal) * (1 / len(cal)))

    calTemp = sum(expectedList[i:i + K])
    if calRes < calTemp:
       calRes = calTemp
       calIndex = i

for l in range(K):
    expectedCorList.append(expectedList[calIndex + l])

calCor = sum(expectedCorList)
print(calCor)

Submission status: Runtime Error

Solution code:
N,K = map(int,input().split())
PP = list(map(int,input().split()))


mind = -1
mmax = -1

sums = []
csum = 0

for i in range(N):
    p = PP[i]
    csum += (p+1)/2
    sums.append(csum)
    if i < K:
        if mmax < csum:
            mind = i
            mmax = csum
    else:
        ksum = csum - sums[(i-K)]
        if mmax < ksum:
            mind = i
            mmax = ksum
            
print(ksum)
time3 = datetime.now()

Submission status: Runtime Error

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

p_sum = [0] * (n + 1)

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

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

ans = (ans + k) / 2
print(ans)

Submission status: Runtime Error

Solution code:
import sys
from itertools import accumulate

def main():
    
    # sys.stdin = open('input154d.txt')

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

    maxp = 0
    index = 0
    for i in range(k, n):
      nowp = s[i] - s[i - k]
      if maxp < nowp:
        maxp = nowp
        index = i

    sump = 0
    for j in range(i-k, i):
      sump += p[j] * (p[j] + 1) / 2 / p[j]

    print(sump)
        
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys
from itertools import accumulate

def main():
    
    # sys.stdin = open('input154d.txt')

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

    maxp = 0
    index = 0
    for i in range(k, n):
      nowp = s[i] - s[i - k]
      if maxp < nowp:
        maxp = nowp
        index = i

    sump = 0
    for j in range(i-k, i):
      sump += p[j] * (p[j] + 1) / 2 / p[j]

    print(sump)
        
if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A = list(map(int, input().split()))

K = A[1]
N = A[0]

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

new_list = []

for val in range(N-K):
    P_list=P[val:val+K]
    new_list.append(sum(list(map(lambda x: (1+x) / 2, P_list))))

print(max(new_list))

Submission status: Runtime Error

Solution code:
a = 0
ans = 0

for i in range(n):
    c = 0
    a += p[i]
    s.append(a)
    #print(s)
    if i <= k - 1:
        continue
    else:
        c = a - s[i - k]
        c += k
        #print(c)
        if c > ans:
            ans = c
        else:
            pass

print(ans / 2)

Submission status: Runtime Error

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

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

s = []
a = 0
ans = 0

for i in range(n):
    c = 0
    a += p[i]
    s.append(a)
    
    if i <= 2:
        continue
    else:
        c = a - s[i - k + 1]
        c += k
        if c > ans:
            ans = c

print(ans / 2)

Submission status: Runtime Error

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

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

s = []
a = 0
ans = 0

for i in range(n):
    c = 0
    a += p[i]
    s.append(a)
    
    if i <= 2:
        continue
    else:
        c = a - s[i - k]
        c += k
        if c > ans:
            ans = c

print(ans / 2)

Submission status: Runtime Error

Solution code:

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

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

s = []
a = 0
ans = 0

for i in range(n):
    c = 0
    a += p[i]
    s.append(a)
    
    if i <= 2:
        continue
    else:
        c = a - s[i - k]
        c += k
        if c > ans:
            ans = c

print(ans / 2)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main(void){

  int n,k;
  vector<int> p(n);
  cin >> n >> k;
  for(int i=0; i<n ; ++i){
    cin >> p.at(i);
  }
  vector<double> exps;
  vector<double> sums;

  for(int i=0; i<n ; ++i){
    double tmp = 0.0;
    for(int j=1 ; j <= p[i] ; ++j){
      tmp += j;
    }   
    tmp /= p[i];
    exps.push_back(tmp);
  }

  for(int i=0; i<n-(k-1) ; ++i){
    double tmp = 0;
    for(int j=0; j<k ; ++j){
      tmp += exps.at(i+j);
    }   
    sums.push_back(tmp);
  }

  sort(sums.begin(), sums.end(), greater<double>());

  // for debug
//  cout << "exps" << endl;
//  for(auto a: exps){
//    cout << a << ", " ;
//  }
//  cout << endl;
//  cout << "sums" << endl;
//  for(auto a: sums){
//    cout << a << ", " ;
//  }
//  cout << endl;

  cout << sums.at(0) << endl;

  return 0;
}

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
p = [(int(i)+1.0)/2.0 for i in input().split()]
ans = 0
tmp = p[:k]
for i in range(k,n):
    tmp += p[i]-p[i-k]
    ans = max(ans, tmp)
print('{:.12f}'.format(ans))

Submission status: Runtime Error

Solution code:
# D - Dice in Line
n,k = map(int,input().split())
p = [0]*k + [*map(int,input().split())]
ans = sum = 0
for i in range(n):
    sum += p[i+k] - p[i]
    ans = max(ans, sum)
print((ans+k)/2)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
num = list(map(int, input().split()))
 
# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)
  print(expect)
 
# 累積和を作る
cs = [0]
for (i, number) in enumerate(expect):
  cs.append(cs[i] + expect[i])

for i in range(K, N+1): # 配列0番目に初期値0が増えてるので1足す
  if max < cs[i] - cs[i-K]:
    max = cs[i] - cs[i - K]
print(max)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
num = list(map(int, input().split()))
 
# 各サイコロの期待値を出す
expect = []
for i in range(N):
  expect.append((1 + num[i]) / 2)
  print(expect)
 
# 累積和を作る
cs = [0]
for i in range(N):
    cs.append(cs[i]+expect[i])
    print(cs)

for i in range(K, N+1): # 配列0番目に初期値0が増えてるので1足す
  if max < cs[i] - cs[i-K]:
    max = cs[i] - cs[i - K]
print(max)

Submission status: Runtime Error

Solution code:
buf=input().split(" ")
N=int(buf[0])
K=int(buf[1])
p=list(map(int, input().split()))
ex=[]

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

ex=sorted(ex,reverse=True)
print(sum(k[0:K]))

Submission status: Runtime Error

Solution code:
import numpy as np

N, K = map(int, input().split())
P_exp = np.array([(1+i)/2 for i in map(int, input().split())])
E_sum = np.cumsum(P_exp)

print((E_sum[K:]-E_sum[:-K]).max())

Submission status: Runtime Error

Solution code:
def main(N,K,p):
    sumi = 0
    ruiseki = [0] * (N+1)
    for i in range(N):
        ruiseki[i+1] = ruiseki[i] + p[i]
    for j in range(K):
        sumi = max(sumi, (ruiseki[j+K]-ruiseki[j]))
    return (sumi + K) /2
N,K = map(int,input().split())
p = list(map(int,input().split()))
print(main(N,K,p))

Submission status: Runtime Error

Solution code:
def calc(x):
    return (x+1)/2

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

_ans = sum(p[0:k])
ans = _ans
for x in range(n-k+1):
    _ans = _ans - p[x] + p[k]
    ans = max(ans, _ans)

print(ans)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import numpy as np

n,k = map(int,input().split())
p_list = np.fromstring(input(),int,sep=' ')

Cumulative_sum = np.zeros(n+1, int)
Cumulative_sum[1:] = p_list.cumsum()

length_k_sum_list = S[k:] - S[0:-k]

print((length_k_sum_list.max()+k)/2)

Submission status: Runtime Error

Solution code:
import numpy as np

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

Cumulative_sum = np.zeros(n+1, np.int64)
Cumulative_sum[1:] = p_list.cumsum()

length_k_sum_list = Cumulative_sum[k:] - Cumulative_sum[0:-k]

ans = (length_k_sum_list.max() + k) / 2

print(ans)

Submission status: Runtime Error

Solution code:

from itertools import accumulate
n,k = list(map(int,input().split()))
p = list(map(int,input().split()))

P = list(accumulate([(i+1)/2 for i in p]))
ans = max([P[i+k]-P[i] for i in range(n-k)])
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
P = list(map(int,input().split()))
for i in range(N):
  P[i] = (P[i]+1)/2
now = sum(P[:K])
ans = now
for j in range(N-K):
  ans = ans - P[j] + P[j+K]
  ans = max(ans,now)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
P = list(map(int,input().split()))
for i in range(N):
  P[i] = (i+1)/2
now = sum(P[:K])
ans = now
for j in range(N-K):
  ans = ans - P[j] + P[j+K]
  ans = max(ans,now)
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
P = list(map(int,input().split()))
for i in range(N):
  P[i] = (i+1)/2
now = sum(P[:K])
for j in range(N-K):
  ans = ans - P[j] + P[j+K]
  ans = max(ans,now)
  now = ans
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
K = int(input())
P = list(map(int,input().split()))
for i in range(N):
  P[i] = (i+1)/2
now = P[:K]
for j in range(N-K):
  ans = ans - P[j] + P[j+K]
  ans = max(ans,now)
  now = ans
print(ans)

Submission status: Runtime Error

Solution code:
n, k = input().split()
n = int(n)
k = int(k)
p = list(map(int, input().split()))
q = [p[0]]
for i in range(n-1):
	q.append(q[i]+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)

Submission status: Runtime Error

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

print(max(sum(p[i:i+k]) for i in range(n-k))/2+0.5*k)

Submission status: Runtime Error

Solution code:
import numpy as np

n,k = map(int,input().split())
p_list = np.fromstring(input(), np.int64, sep=' ')

Cumulative_sum = np.zeros(n+1, np.int64)
Cumulative_sum[1:] = p_list.cumsum()

length_k_sum_list = Cumulative_sum[k:] - Cumulative_sum[0:-k]

ans = (length_k_sum.max() + k) / 2

print(ans)

Submission status: Runtime Error

Solution code:
N,K=map(int,input().split())
P=list(map(int,input().split()))
L=[]
def E(n):
  e=0
  for i in range(1,n+1):
    e+=i
  e = e/n
  return e

l=sum(P[0:K])
k=0
for i in range(1,N-K+1):
  l = l-P[i-1]+P[i-1+K]
  if l>k:
    k=l
    L=P[i:i+K]

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

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
P = list(map(int,input().split()))

P = [(v+1)/2 for v in P]

acum = [0]*(n+1)
for i in range(n):
  acum[i+1] = acum[i] + P[i]
  
total = [0]*k
for i in range(k):
  total[i] = acum[i+k]-acum[i]  
  
print(max(total))

Submission status: Runtime Error

Solution code:
import numpy as np

N, K = [int(x) for x in input().split()]
ps = np.fromstring(input(), sep=" ")

exp = (ps + 1) / 2
cum_exp = exp.cumsum()
sum_exp = cum_exp[K:] - cum_exp[:-K]

print(max(sum_exp))

Submission status: Runtime Error

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

# cumulated value
c_p = [0] * N
c_p[0] = p[0]

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

max_e = 0

for i in range(N - K + 1):
    e = c_p[i + K] - c_p[i]
    if e > max_e:
        max_e = e

print((max_e + K) / 2)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int K,N;
  cin >> N >> K;
  vector<int> S(N+1);
  S.at(0)=0;
  for(int i=1; i<=N; i++){
    int p;
  	cin >> p;
    S.at(i)=S.at(i-1)+p;
  }
  int m=0;
  for(int i=K; i<=N; i++){
    m=max(m,S.at(i)-S.at(i-K));
  }
  cout << (m+K)/2.0 << endl;
}

Submission status: Runtime Error

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

# cumulated value
c_p = [0] * N
c_p[0] = p[0]
for i in range(N - 1):
    c_p[i] = c_p[i - 1] + p[i]

max_e = 0

for i in range(N - K + 1):
    e = c_p[i + K] - c_p[i]
    if e > max_e:
        max_e = e

print((max_e + K) / 2)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)    
N, K = map(int, input().split())
p = list(map(int,input().split()))
ans = 0
cum = [0]
     
for i in range(len(p)):
    ex = (1 + p[i])/2
    p[i] = ex
        
for i in  range(len(p)):
    cum.append(p[i] + cum[i])
        
for i in range(K, N+1):
    ans  = max(ans, cum[i] - cum[i-K])
     
print(ans)

Submission status: Runtime Error

Solution code:
    N, K = map(int, input().split())
    p = list(map(int,input().split()))
    ans = 0
    cum = [0]
     
    for i in range(len(p)):
        ex = (1 + p[i])/2
        p[i] = ex
        
    for i in  range(len(p)):
        cum.append(p[i] + cum[i])
        
    for i in range(K, N+1):
        ans  = max(ans, cum[i] - cum[i-K])
     
    print(ans)

Submission status: Runtime Error

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

def calc_expected_val(val):
    return float((1+val)/2)

def main():
    expected_val = 0
    expected_val_list = []
    sum_val = 0
    sum_val_list = []
    sum_K = 0
    sum_K_list = []
    max_expected_val = 0
    for i in range(N):
        expected_val = calc_expected_val(P[i])
        expected_val_list.append(expected_val)
        sum_val += expected_val
        sum_val_list.append(sum_val)

    for j in range(K, N):
        sum_K = sum_val_list[j] - sum_val_list[j-K]
        sum_K_list.append(sum_K)

    max_expected_val = max(sum_K_list)
    print(max_expected_val)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

def calc_expected_val(val):
    return (1+val)/2

def main():
    expected_val = 0
    expected_val_list = []
    sum_val = 0
    sum_val_list = []
    sum_K = 0
    sum_K_list = []
    max_expected_val = 0
    for i in range(N):
        expected_val = calc_expected_val(P[i])
        expected_val_list.append(expected_val)
        sum_val += expected_val
        sum_val_list.append(sum_val)

    for j in range(K, N):
        sum_K = sum_val_list[j] - sum_val_list[j-K]
        sum_K_list.append(sum_K)

    max_expected_val = max(sum_K_list)
    print(max_expected_val)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

def calc_expected_val(val):
    return (1+val)/2

def main():
    expected_val = 0
    expected_val_list = []
    sum_val = 0
    sum_val_list = []
    sum_K = 0
    sum_K_list = []
    max_expected_val = 0
    for i in range(N):
        expected_val = calc_expected_val(P[i])
        expected_val_list.append(expected_val)
        sum_val += expected_val
        sum_val_list.append(sum_val)

    for j in range(N-K):
        sum_K = sum_val_list[j+K] - sum_val_list[j]
        sum_K_list.append(sum_K)

    max_expected_val = max(sum_K_list)
    print(max_expected_val)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

ans=[]

for i in p:
    ex.append((1+i)/2)

for i in range(N-K+1):
    ans.append(sum(ex[i:i+K]))
    
print(max(ans))