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 = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
a = []
for i in range(len(p)-k):
  mx = sum(p[:i+k]) - sum(p[:i])
  a.append(mx)
max_a = max(a)
ans = (max_a + k)/2
print(ans)

Submission status: Runtime Error

Solution code:
n,k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
a = []
for i in range(len(p)-k):
  mx = p[i+k] - p[i]
  a.append(mx)
max_a = max(a)
ans = (max_a + k)/2
print(ans)

Submission status: Runtime Error

Solution code:
n,k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
a = []
for i in range(len(c)-k):
  mx = c[i+k] - c[i]
  a.append(mx)
max_a = max(a)
ans = (max_a + k)/2
print(ans)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(n):
  a = p[i:i+k]
  ans = (max(ans,sum(a))
  if i+k == n:
       break
       
print(ans)

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
p = list(map(int,input().split()))
ans = 0
for i in range(n):
  a = p[i:i+k]
  ans (max(ans,sum(a))
  if i+k == n:
       break
print(ans)

Submission status: Runtime Error

Solution code:
N, K = map(int, input().split())
P = list(map(int, input().split()))
a = []
i = 0
While K+i <= N:
  k = P[i:K+i]
  a.append(k)
  i += 1
a_max = max(a)
print((a_max+K)/2)

Submission status: Runtime Error

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

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

max_a = max(array)

ans=(max_a)
print(ans)

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
A = list(map(int, input().split()))
for a in A:
a = (1+a)/2
sumK = []

for i in range(len(A)):
  b = A[i:i+K]
  sumK.append(sum(b))
print(max(sumK))

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
A = [map(int, input().split())]
for a in A:
a = (1+a)/2
sumK = []
for i in range(len(A)):
  b = A[i:i+K]
  sumK.append(sum(b))
print(max(sumK))

Submission status: Runtime Error

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

a =[]
for i in range(n-k):
  sum_k = sum(p[i:i+k])
  a.append(sum_k)
ans = (max(a)+k)/2

print(ans)

Submission status: Runtime Error

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

a =[]
for i in range(n-k):
  sum_k = sum(p[i:i+k])
  a.apprnd(sum_k)
ans = (max(a)+k)/2

print(ans)

Submission status: Runtime Error

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

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

max_a = max(array)

ans=(max_a)
print(ans)

Submission status: Runtime Error

Solution code:
n.k = map(int,input().split())
P = list(map(int,input().split()))
ans = 0
import itertools
import math
cnt_nPk = math.factorial(n)/math.factorial(k)
P_nPk = list(itertools.permutations(n,k))

sum_P_nPk = sum(P_nPk)

print(sum_P_nPk / cnt_nPk)

Submission status: Runtime Error

Solution code:
n.k = map(int,input().split())
P = list(map(int,input().split()))
ans = 0
import itertools
import math
cnt_nPk = math.factorial(n)/math.factorial(k)
P_nPk = list(itertools.permutations(n,k))

for i in range(n):
  a = sum(P_nPk[i])
  ans += a

print(ans / cnt_nPk)

Submission status: Runtime Error

Solution code:
n.k = map(int,input().split())
P = [map(int,input().split())]
ans = 0
import itertools
import math
cnt_nPk = math.factorial(n)/math.factorial(k)
P_nPk = list(itertools.permutations(n,k))

for i in range(n):
  a = sum(P_nPk[i])
  ans += a

print(ans / cnt_nPk)

Submission status: Runtime Error

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

E = [0] * 1000

ans = 0

for i in range(1, 1000):
    E[i] = sum(range(1, i+1)) / i

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

print(ans)

Submission status: Runtime Error

Solution code:
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

N,K = map(int,input().split())
def kitai(num):
    return (1+float(num)/2)
P = list(map(kitai,input().split()))	  

S = []

for i in range(N):
    S[i+1]=S[i]+P[i]
for i in range(N-K+1):
    ans = ans(ans,S[i+1]-S[i])
print(S[i])

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
A = [(1+int(x))/2 for x in input().split()]
wa = []
w = 0
for i in range(0,K):
    w = w+A[i]
wa.append(w)
for j in range(N-k):
    w = w + wa[j+K] - wa[j]
    wa.append(w)
print(max(wa))

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
import numpy as np
l ={}
N,K = map(int,input().split())
#P = list(map(int,input().split()))
P = np.asarray(list(map(int,input().split())))
#print(P)
P_ = []
#print(P_)

def kitai(num):
    x = 0
    for j in range(num):
        x += num-j
    return x/num
for i in P:
    P_.appendkitai(i)
#print(type(P_))


#print(P)
for i in range(0,N-K+1):
    #print(P[i:i+K])
    l[sum(P_[i:i+K])]=i
#print(l)
max = max(l.keys())
print(max)
import sys
def input():
    return sys.stdin.readline()[:-1]

Submission status: Runtime Error

Solution code:
N ,K = list(map(int, input().split()))
p = list(map(lambda x: (1+int(x))/2, input().split()))
s = [0]*N
s[0]=p[0]
for i in range(1,N):
  s[i] = s[i-1]+p[i]

l = []
for i in range(N-K):
  l.append(s[i+K]-s[i])
  
print(max(l))

Submission status: Runtime Error

Solution code:
import numpy as np
N ,K = list(map(int, input().split()))
p = list(map(lambda x: (1+int(x))/2, input().split()))
s = [0]*N
s[0]=p[0]
sum = 0
for i in range(1,N):
  s[i] = s[i-1]+p[i]

l = []
for i in range(N-K):
  l.append(s[i+K]-s[i])
  
print(max(l))

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

INF = float('inf')

def exp(num):
    return sum(range(1, num+1)) / num

def solve():
    n, k = MI()
    P = LI()

    _max = -1
    idx = None
    for i in range(n-k):
        p = P[i:i+k]
        _sum = sum(p)
        if _max < _sum:
            idx = i

    ans = 0
    for i in range(idx, idx+k):
        ans += exp(P[i])
    print(ans)

if __name__ == '__main__':
    solve()

Submission status: Runtime Error

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

p = [sum(p[0+i:k+i]) for i in range(n-k+1)]
l = []
a = sum(p[0:k])
for i in range(n-k+1):
    a = a+p[i]-p[i+k-1]
    l.append(a)
print((max(l)+k)/2)

Submission status: Runtime Error

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


ruisekiwa_list = []
ruisekiwa = 0
for saikoro in p_list:
    ruisekiwa += (1 + saikoro) / 2
    ruisekiwa_list.append(ruisekiwa)
sum_K_max = 0

ans_lis = []
for i in range(N-K):
    sum_K = ruisekiwa_list[i + K] - ruisekiwa_list[i]
    ans_lis.append(sum_K)
print(max(ans_lis))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
N, K = map(int, input().split())
p = list(map(int, input().split()))
e = []
for i in range(N-K+1):
    E = 0
    for k in range(K+1):
        E += sum(range(1, p[i+k]))/p[i+k]
    e.append(E)
print(max(e))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,k = map(int,input().split())
a = list(map(int,input().split()))
e = [0]*n
b = [0]*n-(k-1)
for i in range(n):
  e[i] = (1+a[i])/2

b[0] = sum(e[0:k])
for i in range(1, len(b)):
  b[i] = e[i] + b[i-1] - e[i-1]
print(max(b))

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
p = list(map(int, input().split()))
dnum = [0] * n
tsum = 0
for i in range(n):
  tsum += (p[i] + 1) / 2.0
  dnum[i] = tsum
kdlist = []
for j in range(n - k):
  kdiff = dnum[j + k] - dnum[j]
  kdlist.append(kdiff)
print(max(kdlist))

Submission status: Runtime Error

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

p_mx=0

for i in range(k):
    p_sm += p[i]

p_mx=p_sm

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

print((p_mx+k)/2)

Submission status: Runtime Error

Solution code:
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
q = [0] * (n + 1)
for i in range(n):
    q[i+1] = q[i] + p[i]
mx = 0
mx_num = 0
for i in range(n-2):
    if mx < q[i+3] - q[i]:
        mx_num = i

ans = 0
for i in range(3):
    t = p[mx_num + i]
    ans += (t + 1) / 2

print(ans)

Submission status: Runtime Error

Solution code:
import numpt as np
n, k = map(int,input().split())
p = np.array(input().split(),dtype=int)

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

Submission status: Runtime Error

Solution code:
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 = sum(Px[0:K])
for j in range(N-K+1):
    temp_num = temp_num-Px[j]+Px[j+K]
    if temp_max <temp_num:
        temp_max=temp_num
    if j==(N-K-1):
        break
print(temp_max)

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
P = list(map(int,input().split()))
Px  =[0]*N
Pxx = []
for i in range(N):
    Px[i] = (1+P[i])/2
for j in range(N-K+1):
    temp_num = sum(Px[j:j+K])
    Pxx.append(temp_num)
print(Pxx)
print(f'{max(Pxx):.12f}')

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
P = list(map(int,input().split()))
Px  =[0]*N
Pxx = []
sumx = 0
for i in range(N):
    Px[i] = (1+P[i])/2
for j in range(N-K+1):
    for k in range(K):
        sumx += Px[j+k]
        Pxx.append(sumx)
    sumx = 0
print(f'{max(Pxx):.12f}')

Submission status: Runtime Error

Solution code:
from itertools import accumulate
n, k = map(int, input().split())
l = list(map(int, input().split()))
l = list(map(lambda x: (((x + 1) * x) / 2) / x, l))
s = list(accumulate(l))
l_2 = [s[k - 1]]
for i in range(len(l) - (k - 1) - 1):
    l_2 += [s[i + k] - s[i]]
print(max(l_2)

Submission status: Runtime Error

Solution code:
num,renzoku=map(int,input().split())
dices=list(map(int,input().split()))
max_renzoku=[]
for i in range(0,num-renzoku):
  max_renzoku.append(sum(dices[i:i+renzoku]))
print((max(max_renzoku)+renzoku)/2)

Submission status: Runtime Error

Solution code:
n, k = map(int, input().split())
A = list(map(int, input().split()))
B = [0]*1001
B[1] = 1
for i in range(2, 1001):
    B[i] = B[i-1] + 0.5
ans = 0
for i in range(n-(n-k)):
    t = 0
    for j in range(k):
        t+=B[A[i+j]]
    ans = max(ans, t)
print(ans)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
A = list(map(int, input().split()))
B = [0]*1001
for i in range(1, 1001):
    a = 0
    for j in range(1, i+1):
        a += j
    B[i] = a/i
ans = 0
for i in range(n-(n-m)):
    t = 0
    for j in range(m):
        t+=B[A[i+j]]
    ans = max(ans, t)
print(ans)

Submission status: Runtime Error

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
from itertools import accumulate
import numpy as np
def main():
    n,k=map(int,input().split())
    P=[int(_) for _ in input().split()]
    P_num=np.array(P)
    PP=(P_num+1)/2
    PP_cum=np.cumsum(PP)
    ans=PP_cum[k:]-PP_cum[:n-k]
    print(max(max(ans),PP_cum[k-1]))

if __name__=='__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    n, k = list(map(int, input().split()))
    daice = list(map(int, input().split()))
    daice_kitai = [0]

    tmp = 0
    for i in range(1, 7):
        tmp += i
        daice_kitai.append(tmp * (1 / i))
    for i in range(0, len(daice) - k + 1):
        count = 0
        tmp = 0
        for j in range(i, i + k):
            tmp += daice_kitai[daice[j]]
        count = tmp if tmp > count else count
    print(count)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N,V = list(map(int,input().split()))
from collections import deque
listA = list(map(int,input().split()))
listB = deque()
max_number = 0
total = 0
for i in range(N-V+1):
    listB.append(sum(listA[i:i+V]))
max_number = listB.index(max(listB))
for i in listA[max_number:max_number+V]:
    total += (1+i) * (i/2) / i
print(total)

Submission status: Runtime Error

Solution code:
import numpy as np
N, K = list(map(int, input().split()))
P = np.array(list(map(int, input().split())))
E = (P+1)/2.0

r = K
l = r - K
argmaxl = l
argmaxr = r
maxE = 0
while r <= N:
    e = np.sum(E[l:r])
    if maxE < e:
        maxE = e
        argmaxl = l
        argmaxr = r
    if r == N:
        break
    l = r
    r += K
    if r > N:
        r = N

if l < K:
    l = 0
else:
    l = argmaxl - K + 1
r = l + K

maxE = 0
for i in range(l, argmaxr+K):
    e = np.sum(E[i:i+K])
    if EK < e:
        EK = e

print(EK)

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
sump=0
P = list(map(int,input().split()))
P.sort(reverse=True)
for i in range(K):
    p = P[i]*(P[i]+1)/(2*P[i])
    sump += p
print(f'{sump:.12f}')

Submission status: Runtime Error

Solution code:
N,K = map(int, input().split())
sump=0
P = list(map(int,input().split()))
P.sort(reverse=True)
for i in range(K):
    p = P[i]*(P[i]+1)/(2*P[i])
    sump += p
print(f'{sump:.12f}')

Submission status: Runtime Error

Solution code:
import numpy as np
n,k=map(int,input().split())
p=np.array[map(int,input().split())]

p_list=p[:k]
s=p_list.sum()
index=0
for i in range(n-k+1):
  p_list=p[i:i+k]
  if p_list.sum() > s:
    s = p_list.sum()
    index = i
b=p[index : index + k]
ans=b.sum()/2+k/2
print(ans)

Submission status: Runtime Error

Solution code:
1526.72
1526.8
1526.88
1526.96
1527.04
1527.1200000000001
1527.2
1527.28
1527.3600000000001
1527.44
1527.52
1527.6000000000001
1527.68
1527.76
1527.84
1527.92
1528.0
1528.08
1528.16
1528.24
1528.32
1528.4
1528.48
1528.56
1528.64
1528.72
1528.8
1528.88
1528.96
1529.04
1529.1200000000001
1529.2
1529.28
1529.3600000000001
1529.44
1529.52
1529.6000000000001
1529.68
1529.76
1529.8400000000001
1529.92
1530.0
1530.08
1530.16
1530.24
1530.32
1530.4
1530.48
1530.56
1530.64
1530.72
1530.8
1530.88
1530.96
1531.04
1531.1200000000001
1531.2
1531.28
1531.3600000000001
1531.44
1531.52
1531.6000000000001
1531.68
1531.76
1531.8400000000001
1531.92
1532.0
1532.08
1532.16
1532.24
1532.32
1532.4
1532.48
1532.56
1532.64
1532.72
1532.8
1532.88
1532.96
1533.04
1533.1200000000001
1533.2
1533.28
1533.3600000000001
1533.44
1533.52
1533.6000000000001
1533.68
1533.76
1533.8400000000001
1533.92
1534.0
1534.08
1534.16
1534.24
1534.32
1534.4
1534.48
1534.56
1534.64
1534.72
1534.8
1534.88
1534.96
1535.04
1535.1200000000001
1535.2
1535.28
1535.3600000000001
1535.44
1535.52
1535.6000000000001
1535.68
1535.76
1535.8400000000001
1535.92
1536.0
1536.08
1536.16
1536.24
1536.32
1536.4
1536.48
1536.56
1536.64
1536.72
1536.8
1536.88
1536.96
1537.04
1537.1200000000001
1537.2
1537.28
1537.3600000000001
1537.44
1537.52
1537.6000000000001
1537.68
1537.76
1537.8400000000001
1537.92
1538.0
1538.08
1538.16
1538.24
1538.32
1538.4
1538.48
1538.56
1538.64
1538.72
1538.8
1538.88
1538.96
1539.04
1539.1200000000001
1539.2
1539.28
1539.3600000000001
1539.44
1539.52
1539.6000000000001
1539.68
1539.76
1539.8400000000001
1539.92
1540.0
1540.08
1540.16
1540.24
1540.32
1540.4
1540.48
1540.56
1540.64
1540.72
1540.8
1540.88
1540.96
1541.04
1541.1200000000001
1541.2
1541.28
1541.3600000000001
1541.44
1541.52
1541.6000000000001
1541.68
1541.76
1541.8400000000001
1541.92
1542.0
1542.08
1542.16
1542.24
1542.32
1542.4
1542.48
1542.56
1542.64
1542.72
1542.8
1542.88
1542.96
1543.04
1543.1200000000001
1543.2
1543.28
1543.3600000000001
1543.44
1543.52
1543.6000000000001
1543.68
1543.76
1543.8400000000001
1543.92
1544.0
1544.08
1544.16
1544.24
1544.32
1544.4
1544.48
1544.56
1544.64
1544.72
1544.8
1544.88
1544.96
1545.04
1545.1200000000001
1545.2
1545.28
1545.3600000000001
1545.44
1545.52
1545.6000000000001
1545.68
1545.76
1545.8400000000001
1545.92
1546.0
1546.08
1546.16
1546.24
1546.32
1546.4
1546.48
1546.56
1546.64
1546.72
1546.8
1546.88
1546.96
1547.04
1547.1200000000001
1547.2
1547.28
1547.3600000000001
1547.44
1547.52
1547.6000000000001
1547.68
1547.76
1547.8400000000001
1547.92
1548.0
1548.08
1548.16
1548.24
1548.32
1548.4
1548.48
1548.56
1548.64
1548.72
1548.8
1548.88
1548.96
1549.04
1549.1200000000001
1549.2
1549.28
1549.3600000000001
1549.44
1549.52
1549.6000000000001
1549.68
1549.76
1549.8400000000001
1549.92
1550.0
1550.08
1550.16
1550.24
1550.32
1550.4
1550.48
1550.56
1550.64
1550.72
1550.8
1550.88
1550.96
1551.04
1551.1200000000001
1551.2
1551.28
1551.3600000000001
1551.44
1551.52
1551.6000000000001
1551.68
1551.76
1551.8400000000001
1551.92
1552.0
1552.08
1552.16
1552.24
1552.32
1552.4
1552.48
1552.56
1552.64
1552.72
1552.8
1552.88
1552.96
1553.04
1553.1200000000001
1553.2
1553.28
1553.3600000000001
1553.44
1553.52
1553.6000000000001
1553.68
1553.76
1553.8400000000001
1553.92
1554.0
1554.08
1554.16
1554.24
1554.32
1554.4
1554.48
1554.56
1554.64
1554.72
1554.8
1554.88
1554.96
1555.04
1555.1200000000001
1555.2
1555.28
1555.3600000000001
1555.44
1555.52
1555.6000000000001
1555.68
1555.76
1555.8400000000001
1555.92
1556.0
1556.08
1556.16
1556.24
1556.32
1556.4
1556.48
1556.56
1556.64
1556.72
1556.8
1556.88
1556.96
1557.04
1557.1200000000001
1557.2
1557.28
1557.3600000000001
1557.44
1557.52
1557.6000000000001
1557.68
1557.76
1557.8400000000001
1557.92
1558.0
1558.08
1558.16
1558.24
1558.32
1558.4
1558.48
1558.56
1558.64
1558.72
1558.8
1558.88
1558.96
1559.04
1559.1200000000001
1559.2
1559.28
1559.3600000000001
1559.44
1559.52
1559.6000000000001
1559.68
1559.76
1559.8400000000001
1559.92
1560.0
1560.08
1560.16
1560.24
1560.32
1560.4
1560.48
1560.56
1560.64
1560.72
1560.8
1560.88
1560.96
1561.04
1561.1200000000001
1561.2
1561.28
1561.3600000000001
1561.44
1561.52
1561.6000000000001
1561.68
1561.76
1561.8400000000001
1561.92
1562.0
1562.08
1562.16
1562.24
1562.32
1562.4
1562.48
1562.56
1562.64
1562.72
1562.8
1562.88
1562.96
1563.04
1563.1200000000001
1563.2
1563.28
1563.3600000000001
1563.44
1563.52
1563.6000000000001
1563.68
1563.76
1563.8400000000001
1563.92
1564.0
1564.08
1564.16
1564.24
1564.32
1564.4
1564.48
1564.56
1564.64
1564.72
1564.8
1564.88
1564.96
1565.04
1565.1200000000001
1565.2
1565.28
1565.3600000000001
1565.44
1565.52
1565.6000000000001
1565.68
1565.76
1565.8400000000001
1565.92
1566.0
1566.08
1566.16
1566.24
1566.32
1566.4
1566.48
1566.56
1566.64
1566.72
1566.8
1566.88
1566.96
1567.04
1567.1200000000001
1567.2
1567.28
1567.3600000000001
1567.44
1567.52
1567.6000000000001
1567.68
1567.76
1567.8400000000001
1567.92
1568.0
1568.08
1568.16
1568.24
1568.32
1568.4
1568.48
1568.56
1568.64
1568.72
1568.8
1568.88
1568.96
1569.04
1569.1200000000001
1569.2
1569.28
1569.3600000000001
1569.44
1569.52
1569.6000000000001
1569.68
1569.76
1569.8400000000001
1569.92
1570.0
1570.08
1570.16
1570.24
1570.32
1570.4
1570.48
1570.56
1570.64
1570.72
1570.8
1570.88
1570.96
1571.04
1571.1200000000001
1571.2
1571.28
1571.3600000000001
1571.44
1571.52
1571.6000000000001
1571.68
1571.76
1571.8400000000001
1571.92
1572.0
1572.08
1572.16
1572.24
1572.32
1572.4
1572.48
1572.56
1572.64
1572.72
1572.8
1572.88
1572.96
1573.04
1573.1200000000001
1573.2
1573.28
1573.3600000000001
1573.44
1573.52
1573.6000000000001
1573.68
1573.76
1573.8400000000001
1573.92
1574.0
1574.08
1574.16
1574.24
1574.32
1574.4
1574.48
1574.56
1574.64
1574.72
1574.8
1574.88
1574.96
1575.04
1575.1200000000001
1575.2
1575.28
1575.3600000000001
1575.44
1575.52
1575.6000000000001
1575.68
1575.76
1575.8400000000001
1575.92
1576.0
1576.08
1576.16
1576.24
1576.32
1576.4
1576.48
1576.56
1576.64
1576.72
1576.8
1576.88
1576.96
1577.04
1577.1200000000001
1577.2
1577.28
1577.3600000000001
1577.44
1577.52
1577.6000000000001
1577.68
1577.76
1577.8400000000001
1577.92
1578.0
1578.08
1578.16
1578.24
1578.32
1578.4
1578.48
1578.56
1578.64
1578.72
1578.8
1578.88
1578.96
1579.04
1579.1200000000001
1579.2
1579.28
1579.3600000000001
1579.44
1579.52
1579.6000000000001
1579.68
1579.76
1579.8400000000001
1579.92
1580.0
1580.08
1580.16
1580.24
1580.32
1580.4
1580.48
1580.56
1580.64
1580.72
1580.8
1580.88
1580.96
1581.04
1581.1200000000001
1581.2
1581.28
1581.3600000000001
1581.44
1581.52
1581.6000000000001
1581.68
1581.76
1581.8400000000001
1581.92
1582.0
1582.08
1582.16
1582.24
1582.32
1582.4
1582.48
1582.56
1582.64
1582.72
1582.8
1582.88
1582.96
1583.04
1583.1200000000001
1583.2
1583.28
1583.3600000000001
1583.44
1583.52
1583.6000000000001
1583.68
1583.76
1583.8400000000001
1583.92
1584.0
1584.08
1584.16
1584.24
1584.32
1584.4
1584.48
1584.56
1584.64
1584.72
1584.8
1584.88
1584.96
1585.04
1585.1200000000001
1585.2
1585.28
1585.3600000000001
1585.44
1585.52
1585.6000000000001
1585.68
1585.76
1585.8400000000001
1585.92
1586.0
1586.08
1586.16
1586.24
1586.32
1586.4
1586.48
1586.56
1586.64
1586.72
1586.8
1586.88
1586.96
1587.04
1587.1200000000001
1587.2
1587.28
1587.3600000000001
1587.44
1587.52
1587.6000000000001
1587.68
1587.76
1587.8400000000001
1587.92
1588.0
1588.08
1588.16
1588.24
1588.32
1588.4
1588.48
1588.56
1588.64
1588.72
1588.8
1588.88
1588.96
1589.04
1589.1200000000001
1589.2
1589.28
1589.3600000000001
1589.44
1589.52
1589.6000000000001
1589.68
1589.76
1589.8400000000001
1589.92
1590.0
1590.08
1590.16
1590.24
1590.32
1590.4
1590.48
1590.56
1590.64
1590.72
1590.8
1590.88
1590.96
1591.04
1591.1200000000001
1591.2
1591.28
1591.3600000000001
1591.44
1591.52
1591.6000000000001
1591.68
1591.76
1591.8400000000001
1591.92
1592.0
1592.08
1592.16
1592.24
1592.32
1592.4
1592.48
1592.56
1592.64
1592.72
1592.8
1592.88
1592.96
1593.04
1593.1200000000001
1593.2
1593.28
1593.3600000000001
1593.44
1593.52
1593.6000000000001
1593.68
1593.76
1593.8400000000001
1593.92
1594.0
1594.08
1594.16
1594.24
1594.32
1594.4
1594.48
1594.56
1594.64
1594.72
1594.8
1594.88
1594.96
1595.04
1595.1200000000001
1595.2
1595.28
1595.3600000000001
1595.44
1595.52
1595.6000000000001
1595.68
1595.76
1595.8400000000001
1595.92
1596.0
1596.08
1596.16
1596.24
1596.32
1596.4
1596.48
1596.56
1596.64
1596.72
1596.8
1596.88
1596.96
1597.04
1597.1200000000001
1597.2
1597.28
1597.3600000000001
1597.44
1597.52
1597.6000000000001
1597.68
1597.76
1597.8400000000001
1597.92
1598.0
1598.08
1598.16
1598.24
1598.32
1598.4
1598.48
1598.56
1598.64
1598.72
1598.8
1598.88
1598.96
1599.04
1599.1200000000001
1599.2
1599.28
1599.3600000000001
1599.44
1599.52
1599.6000000000001
1599.68
1599.76
1599.8400000000001
1599.92
-1
(base) YonoMac-mini:158 yo-castle$ 
(base) YonoMac-mini:158 yo-castle$ 
(base) YonoMac-mini:158 yo-castle$ cd ..
(base) YonoMac-mini:AtCoder_Problems yo-castle$ mkdir 142
(base) YonoMac-mini:AtCoder_Problems yo-castle$ cd 142
(base) YonoMac-mini:142 yo-castle$ ll
(base) YonoMac-mini:142 yo-castle$ ll
(base) YonoMac-mini:142 yo-castle$ touch c.py
(base) YonoMac-mini:142 yo-castle$ touch input.txt
(base) YonoMac-mini:142 yo-castle$ 
(base) YonoMac-mini:142 yo-castle$ 
(base) YonoMac-mini:142 yo-castle$ open c.py 
(base) YonoMac-mini:142 yo-castle$ open input.txt 
(base) YonoMac-mini:142 yo-castle$ aa
bash: aa: command not found
(base) YonoMac-mini:142 yo-castle$ 
(base) YonoMac-mini:142 yo-castle$ 
(base) YonoMac-mini:142 yo-castle$ 
(base) YonoMac-mini:142 yo-castle$ 
(base) YonoMac-mini:142 yo-castle$ 
(base) YonoMac-mini:142 yo-castle$ 
(base) YonoMac-mini:142 yo-castle$ python c.py < input.txt 
Traceback (most recent call last):
  File "c.py", line 12, in <module>
    print(" ".join(answer))
TypeError: sequence item 0: expected str instance, int found
(base) YonoMac-mini:142 yo-castle$ python c.py < input.txt 
3 1 2
(base) YonoMac-mini:142 yo-castle$ python c.py < input.txt 
1 2 3 4 5
(base) YonoMac-mini:142 yo-castle$ python c.py < input.txt 
8 2 4 5 6 7 3 1
(base) YonoMac-mini:142 yo-castle$ cd ..
(base) YonoMac-mini:AtCoder_Problems yo-castle$ cd 154
(base) YonoMac-mini:154 yo-castle$ ll
total 16
-rw-r--r--@ 1 yo-castle  staff  191  4 19 07:23 c.py
-rw-r--r--@ 1 yo-castle  staff   19  4 19 07:24 input.txt
(base) YonoMac-mini:154 yo-castle$ touch d.py
(base) YonoMac-mini:154 yo-castle$ ll
total 16
-rw-r--r--@ 1 yo-castle  staff  191  4 19 07:23 c.py
-rw-r--r--  1 yo-castle  staff    0  4 19 07:39 d.py
-rw-r--r--@ 1 yo-castle  staff   19  4 19 07:24 input.txt
(base) YonoMac-mini:154 yo-castle$ open d.py 
(base) YonoMac-mini:154 yo-castle$ open input.txt 
(base) YonoMac-mini:154 yo-castle$ 
(base) YonoMac-mini:154 yo-castle$ 
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
Traceback (most recent call last):
  File "d.py", line 1, in <module>
    N, K = map(int, input().split())
ValueError: not enough values to unpack (expected 2, got 1)
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
Traceback (most recent call last):
  File "d.py", line 10, in <module>
    print(max(total))
TypeError: 'float' object is not iterable
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
Traceback (most recent call last):
  File "d.py", line 10, in <module>
    print(max(total))
TypeError: 'int' object is not iterable
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
5.5
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
[1.0, 1.5, 1.5, 2.5, 3.0]
5.5
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
[1.0, 1.5, 1.5, 2.5, 3.0]
[4.0, 5.5]
5.5
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
[1.0, 1.5, 1.5, 2.5, 3.0]
[4.0, 5.5, 7.0]
7.0
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
[3.5, 3.5, 3.5, 3.5]
[3.5, 3.5]
3.5
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
[9.0, 7.0, 7.0, 6.5, 8.0, 10.5, 5.5, 7.0, 9.0, 6.0]
Traceback (most recent call last):
  File "d.py", line 9, in <module>
    total += p[i+j]
IndexError: list index out of range
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
[9.0, 7.0, 7.0, 6.5, 8.0, 10.5, 5.5, 7.0, 9.0, 6.0]
[29.5, 28.5, 32.0, 30.5, 31.0, 32.0, 27.5]
32.0
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
Traceback (most recent call last):
  File "d.py", line 10, in <module>
    result.append(total)
NameError: name 'total' is not defined
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
25.5
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
5.5
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
Traceback (most recent call last):
  File "d.py", line 9, in <module>
    sub_total = sub_total - p[i-1] + p[i+K-1]
IndexError: list index out of range
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
[2.5, 4.0, 5.5]
5.5
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
2.5
[2.5, 4.0, 5.5]
5.5
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
4.0
[4.0, 5.5, 7.0]
7.0
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
3.5
[3.5, 3.5, 3.5, 3.5]
3.5
(base) YonoMac-mini:154 yo-castle$ [
bash: [: missing `]'
(base) YonoMac-mini:154 yo-castle$ [
bash: [: missing `]'
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
29.5
[29.5, 28.5, 32.0, 30.5, 31.0, 32.0, 27.5]
32.0
(base) YonoMac-mini:154 yo-castle$ python d.py < input.txt 
32.0
(base) YonoMac-mini:154 yo-castle$

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def find_max_expectation( P, K ):
    # P is a np.array( N, )
    # K is a int
    
    if( len(P)==0 ):
        return np.nan
    
    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
    
    return ans


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

print( find_max_expectation( P, K ) )

Submission status: Runtime Error

Solution code:
import itertools
N,K = list(map(int,input().split()))
p = list(map(int,input().split()))
k = [(1+i)/2 for i in p]
a = list(itertools.accumulate(k))
max = a[2]
for i in range(3,N):
    if max < a[i] - a[i-3]:
        max = a[i] - a[i-3]
print(max)