Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

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

# 期待値は(1+P)/2 https://rikeilabo.com/sum-formula-of-numerical-sequence
# 累積和を求めておく．隣接するK個の和はS_{j+K} - S_j
# 期待値の前計算→累積和の計算→隣接するK項の和の計算 (１乗オーダー)
E_list = []
for dice in dices:
    E_list.append((1 + dice) * 0.5)

S_list = []  # i番目までのサイコロの期待値の累積和
for i in range(len(dices)):
    # S_list.append(sum(E_list[:i + 1]))  # アホ
    S_list.append(E_list[0] if i == 0 else S_list[i - 1] + E_list[i])

print(max(list(S_list[j + K] - S_list[j] for j in range(len(dices) - K))))

Fixed submission:
N, K = map(int, input().split())

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

# 期待値は(1+P)/2 https://rikeilabo.com/sum-formula-of-numerical-sequence
# 累積和を求めておく．隣接するK個の和はS_{j+K} - S_j
# 期待値の前計算→累積和の計算→隣接するK項の和の計算 (１乗オーダー)
E_list = []
for dice in dices:
    E_list.append((1 + dice) * 0.5)

S_list = []  # i番目までのサイコロの期待値の累積和
for i in range(len(dices)):
    # S_list.append(sum(E_list[:i + 1]))  # アホ
    S_list.append(E_list[0] if i == 0 else S_list[i - 1] + E_list[i])

print(max(list(S_list[j + K] - S_list[j] for j in range(len(dices) - K))) if len(dices) != K else S_list[-1])

Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())

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

# 期待値は(1+P)/2 https://rikeilabo.com/sum-formula-of-numerical-sequence
# 累積和を求めておく．隣接するK個の和はS_{j+K} - S_j
# 期待値の前計算→累積和の計算→隣接するK項の和の計算 (１乗オーダー)
E_list = []
for dice in dices:
    E_list.append((1 + dice) * 0.5)

S_list = []  # i番目までのサイコロの期待値の累積和
for i in range(len(dices)):
    S_list.append(sum(E_list[:i + 1]))

print(max(list(S_list[j + K] - S_list[j] for j in range(len(dices) - K))))

Fixed submission:
N, K = map(int, input().split())

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

# 期待値は(1+P)/2 https://rikeilabo.com/sum-formula-of-numerical-sequence
# 累積和を求めておく．隣接するK個の和はS_{j+K} - S_j
# 期待値の前計算→累積和の計算→隣接するK項の和の計算 (１乗オーダー)
E_list = []
for dice in dices:
    E_list.append((1 + dice) * 0.5)

S_list = []  # i番目までのサイコロの期待値の累積和
for i in range(len(dices)):
    # S_list.append(sum(E_list[:i + 1]))  # アホ
    S_list.append(E_list[0] if i == 0 else S_list[i - 1] + E_list[i])

print(max(list(S_list[j + K] - S_list[j] for j in range(len(dices) - K))) if len(dices) != K else S_list[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())


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

ans_index = 0
max_sum = 0
for i in range(len(dices) - K + 1):
    # summation = 0
    # for j in range(K):
    #     summation += dices[i + j]
    summation = sum(dices[i:i + K])
    if max_sum < summation:
        max_sum = summation
        ans_index = i

ans = 0
for dice in dices[ans_index:ans_index + K]:
    ans += sum(list(range(1, dice + 1))) / dice
print(ans)

Fixed submission:
N, K = map(int, input().split())

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

# 期待値は(1+P)/2 https://rikeilabo.com/sum-formula-of-numerical-sequence
# 累積和を求めておく．隣接するK個の和はS_{j+K} - S_j
# 期待値の前計算→累積和の計算→隣接するK項の和の計算 (１乗オーダー)
E_list = []
for dice in dices:
    E_list.append((1 + dice) * 0.5)

S_list = []  # i番目までのサイコロの期待値の累積和
for i in range(len(dices)):
    # S_list.append(sum(E_list[:i + 1]))  # アホ
    S_list.append(E_list[0] if i == 0 else S_list[i - 1] + E_list[i])

print(max(list(S_list[j + K] - S_list[j] for j in range(len(dices) - K))) if len(dices) != K else S_list[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
dices = list(map(int, input().split()))

ans_index = 0
max_sum = 0
for i in range(len(dices) - K + 1):
    summation = 0
    for j in range(K):
        summation += dices[i + j]
    if max_sum < summation:
        max_sum = summation
        ans_index = i

ans = 0
for dice in dices[ans_index:ans_index + K]:
    ans += sum(list(range(1, dice + 1))) / dice
print(ans)

Fixed submission:
N, K = map(int, input().split())

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

# 期待値は(1+P)/2 https://rikeilabo.com/sum-formula-of-numerical-sequence
# 累積和を求めておく．隣接するK個の和はS_{j+K} - S_j
# 期待値の前計算→累積和の計算→隣接するK項の和の計算 (１乗オーダー)
E_list = []
for dice in dices:
    E_list.append((1 + dice) * 0.5)

S_list = []  # i番目までのサイコロの期待値の累積和
for i in range(len(dices)):
    # S_list.append(sum(E_list[:i + 1]))  # アホ
    S_list.append(E_list[0] if i == 0 else S_list[i - 1] + E_list[i])

print(max(list(S_list[j + K] - S_list[j] for j in range(len(dices) - K))) if len(dices) != K else S_list[-1])