Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
pi = list(map(int, input().split()))
index = []
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    index.append(x)
max_index = index.index(max(index))
EX_max = 0
for i in range(max_index, max_index+K):
  EX_max += 1+(pi[i]-1)*0.5
print(EX_max)

Fixed submission:
N, K = map(int, input().split())
pi = list(map(int,input().split()))
def EV(x):
    return 1+(x-1)*0.5
for i in range(N):
    pi[i] = EV(pi[i])

ruisekiwa = sum(pi[0:K])
max_EV = ruisekiwa

for i in range(N-K):
    ruisekiwa = ruisekiwa + pi[i+K]-pi[i]
    if ruisekiwa > max_EV:
        max_EV = ruisekiwa
print(max_EV)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K = map(int, input().split())
pi = np.array(list(map(int, input().split())))
index = []
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    index.append(x)
max_index = index.index(max(index))
array_max = (np.array(pi[max_index:max_index+K])-1) *0.5 + 1
print(array_max.sum())

Fixed submission:
N, K = map(int, input().split())
pi = list(map(int,input().split()))
def EV(x):
    return 1+(x-1)*0.5
for i in range(N):
    pi[i] = EV(pi[i])

ruisekiwa = sum(pi[0:K])
max_EV = ruisekiwa

for i in range(N-K):
    ruisekiwa = ruisekiwa + pi[i+K]-pi[i]
    if ruisekiwa > max_EV:
        max_EV = ruisekiwa
print(max_EV)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def Expected_Value(x):
    EV = 0
    for i in range(1,x+1):
        EV += i/x
    return EV
N, K = map(int, input().split())
pi = np.array(list(map(int, input().split())))
ma = 0
for i in range(N-K+1):
    x = sum(pi[i:i+K])
    if x > ma:
        ma = x
        max_index = i
array_max = (np.array(pi[max_index:max_index+K])-1) *0.5 + 1
print(array_max.sum())

Fixed submission:
N, K = map(int, input().split())
pi = list(map(int,input().split()))
def EV(x):
    return 1+(x-1)*0.5
for i in range(N):
    pi[i] = EV(pi[i])

ruisekiwa = sum(pi[0:K])
max_EV = ruisekiwa

for i in range(N-K):
    ruisekiwa = ruisekiwa + pi[i+K]-pi[i]
    if ruisekiwa > max_EV:
        max_EV = ruisekiwa
print(max_EV)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N, K = map(int, input().split())
pi = list(map(int, input().split()))
K_sum = []
for i in range(N-K+1):
    K_sum.append(sum(pi[i:i+K])) 
index = K_sum.index(max(K_sum))
array_max = (np.array(pi[index:index+K])-1) *0.5 + 1
print(array_max.sum())

Fixed submission:
N, K = map(int, input().split())
pi = list(map(int,input().split()))
def EV(x):
    return 1+(x-1)*0.5
for i in range(N):
    pi[i] = EV(pi[i])

ruisekiwa = sum(pi[0:K])
max_EV = ruisekiwa

for i in range(N-K):
    ruisekiwa = ruisekiwa + pi[i+K]-pi[i]
    if ruisekiwa > max_EV:
        max_EV = ruisekiwa
print(max_EV)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
pi = list(map(int, input().split()))
K_sum = []
for i in range(N-K+1):
    K_sum.append(sum(pi[i:i+K])) 
index = K_sum.index(max(K_sum))

def Expected_Value(x):
    EV = 0
    for i in range(1,x+1):
        EV += i/x
    return EV

EV_Dice = 0
for i in range(index,index+K):
    EV_Dice += Expected_Value(pi[i])
print(EV_Dice)

Fixed submission:
N, K = map(int, input().split())
pi = list(map(int,input().split()))
def EV(x):
    return 1+(x-1)*0.5
for i in range(N):
    pi[i] = EV(pi[i])

ruisekiwa = sum(pi[0:K])
max_EV = ruisekiwa

for i in range(N-K):
    ruisekiwa = ruisekiwa + pi[i+K]-pi[i]
    if ruisekiwa > max_EV:
        max_EV = ruisekiwa
print(max_EV)