Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int,input().split()))

# １からNまでの値をもつサイコロを振ったときの期待値
def ex(x:int):
    return (x*(x+1)/2)/x

kitaichi = []
kitaichi_goukei = []
for i in range(len(p)):
    kitaichi.append(ex(p[i]))
    if i+1 >= k:
        kitaichi_goukei.append(sum(kitaichi[i+1-k:i+1]))
print (max(kitaichi_goukei))

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
ex = [1/2*(i+1) for i in p]
total = [0]

for i in range(N):
    total.append (total[i] + ex[i])

ans = 0
for i in range(N+1-K):
    tmp = total[i+K] - total[i]
    if ans < tmp:
        ans = tmp

print (ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int,input().split()))

# １からNまでの値をもつサイコロを振ったときの期待値
def ex(x:int):
    return (x*(x+1)/2)/x

# 期待値のリストを作る
kitaichi = []
kitaichi_goukei = []
for i in range(len(p)):
    kitaichi.append(ex(p[i]))
    if i+1 >= k:
        kitaichi_goukei.append(sum(kitaichi[i+1-k:i+1]))
print (max(kitaichi_goukei))

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
ex = [1/2*(i+1) for i in p]
total = [0]

for i in range(N):
    total.append (total[i] + ex[i])

ans = 0
for i in range(N+1-K):
    tmp = total[i+K] - total[i]
    if ans < tmp:
        ans = tmp

print (ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int,input().split()))

# １からNまでの値をもつサイコロを振ったときの期待値
def ex(x:int):
    return (x*(x+1)/2)/x

# 期待値のリストを作る
kitaichi = []
for i in range(len(p)):
    kitaichi.append(ex(p[i]))

# 期待値の最大値のリストを作る
kitaichi_goukei = []
for i in range(len(kitaichi)-k+1):
    kitaichi_goukei.append(sum(kitaichi[i:i+k]))

print (max(kitaichi_goukei))

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
ex = [1/2*(i+1) for i in p]
total = [0]

for i in range(N):
    total.append (total[i] + ex[i])

ans = 0
for i in range(N+1-K):
    tmp = total[i+K] - total[i]
    if ans < tmp:
        ans = tmp

print (ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int,input().split()))

# １からNまでの値をもつサイコロを振ったときの期待値
def ex(x:int):
    return (x*(x+1)/2)/x

wa=0
saidai_p=0
for i in range(len(p)-(k-1)):
    if sum(p[i:i+k]) >= wa:
        wa=sum(p[i:i+k])
        saidai_p=i

kitaichi_goukei=0
for i in range(k):
    kitaichi_goukei+=ex(p[saidai_p+i])

print (kitaichi_goukei)

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
ex = [1/2*(i+1) for i in p]
total = [0]

for i in range(N):
    total.append (total[i] + ex[i])

ans = 0
for i in range(N+1-K):
    tmp = total[i+K] - total[i]
    if ans < tmp:
        ans = tmp

print (ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
p = list(map(int,input().split()))

# １からNまでの値をもつサイコロを振ったときの期待値
def ex(x:int):
    return (x*(x+1)/2)/x

wa=0
saidai_p=0
for i in range(len(p)-(k-1)):
    if sum(p[i:i+k]) >= wa:
        wa=sum(p[i:i+k])
        saidai_p=i

kitaichi_list=[]
for i in range(k):
    kitaichi_list.append(ex(p[saidai_p+i]))

print (sum(kitaichi_list))

Fixed submission:
N,K = map(int,input().split())
p = list(map(int,input().split()))
ex = [1/2*(i+1) for i in p]
total = [0]

for i in range(N):
    total.append (total[i] + ex[i])

ans = 0
for i in range(N+1-K):
    tmp = total[i+K] - total[i]
    if ans < tmp:
        ans = tmp

print (ans)