Buggy python submission (verdict: Runtime Error):
#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])

Fixed submission:
N,K=map(int,input().split())
list_pn=list(map(int,input().split()))
# 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])

Buggy python submission (verdict: Runtime Error):
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])

Fixed submission:
N,K=map(int,input().split())
list_pn=list(map(int,input().split()))
# 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])

Buggy python submission (verdict: Runtime Error):
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])

Fixed submission:
N,K=map(int,input().split())
list_pn=list(map(int,input().split()))
# 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])

Buggy python submission (verdict: Runtime Error):
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])

Fixed submission:
N,K=map(int,input().split())
list_pn=list(map(int,input().split()))
# 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])