Buggy python submission (verdict: Time Limit Exceeded):
def main():
    """"ここに今までのコード"""
    N, K = map(int, input().split())
    dice_list = list(map(int, input().split()))
    expected_values = [sum(range(1, i + 1)) / i for i in dice_list]
    acc = [0 for i in range(N+1)]
    for i in range(1, N+1):
        n = dice_list[i-1]
        acc[i] = acc[i-1] + sum(range(1, n + 1)) / n 
    
    max_sum = -1

    for i in range(N - K + 1):
        s = acc[i + K] - acc[i]
        if s > max_sum:
            max_sum = s
    
    print(max_sum)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    """"ここに今までのコード"""
    N, K = map(int, input().split())
    dice_list = list(map(int, input().split()))
    max, s = 0, 0

    for i in range(K):
        s += (dice_list[i] + 1) / 2
    
    max = s

    for i in range(N-K):
        s -= (dice_list[i] + 1) / 2
        s += (dice_list[i+K] + 1) / 2
        if s > max:
            max = s
    
    print(max)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    """"ここに今までのコード"""
    N, K = map(int, input().split())
    dice_list = list(map(int, input().split()))
    expected_values = [sum(range(1, i + 1)) / i for i in dice_list]
    acc = [0 for i in range(N+1)]
    for i in range(1, N+1):
        acc[i] = acc[i-1] + expected_values[i-1]
    
    max_sum = -1

    for i in range(N - K + 1):
        s = acc[i + K] - acc[i]
        if s > max_sum:
            max_sum = s
    
    print(max_sum)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    """"ここに今までのコード"""
    N, K = map(int, input().split())
    dice_list = list(map(int, input().split()))
    max, s = 0, 0

    for i in range(K):
        s += (dice_list[i] + 1) / 2
    
    max = s

    for i in range(N-K):
        s -= (dice_list[i] + 1) / 2
        s += (dice_list[i+K] + 1) / 2
        if s > max:
            max = s
    
    print(max)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    """"ここに今までのコード"""
    N, K = map(int, input().split())
    dice_list = list(map(int, input().split()))
    expected_values = [sum(range(1, i + 1)) / i for i in dice_list]
    max_sum = -1

    for i in range(N - K + 1):
        s = sum([n for n in expected_values[i:i+K]])
        if s > max_sum:
            max_sum = s
    
    print(max_sum)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    """"ここに今までのコード"""
    N, K = map(int, input().split())
    dice_list = list(map(int, input().split()))
    max, s = 0, 0

    for i in range(K):
        s += (dice_list[i] + 1) / 2
    
    max = s

    for i in range(N-K):
        s -= (dice_list[i] + 1) / 2
        s += (dice_list[i+K] + 1) / 2
        if s > max:
            max = s
    
    print(max)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    """"ここに今までのコード"""
    N, K = map(int, input().split())
    dice_list = list(map(int, input().split()))
    expected_values = [sum(range(1, i + 1)) / i for i in dice_list]
    max_sum = -1

    for i in range(N - K + 1):
        s = sum([n for n in expected_values[i:i+K]])
        if s > max_sum:
            max_sum = s
    
    print(max_sum)

if __name__ == '__main__':
    main()

Fixed submission:
def main():
    """"ここに今までのコード"""
    N, K = map(int, input().split())
    dice_list = list(map(int, input().split()))
    max, s = 0, 0

    for i in range(K):
        s += (dice_list[i] + 1) / 2
    
    max = s

    for i in range(N-K):
        s -= (dice_list[i] + 1) / 2
        s += (dice_list[i+K] + 1) / 2
        if s > max:
            max = s
    
    print(max)


if __name__ == '__main__':
    main()