Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    max_t = 0
    for i in range(N-K+1):

        if max_t < sum(P[i:i+K]):
            max_t = sum(P[i:i+K])

    print((max_t + K) / 2)

main()

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    tmp_max = sum(P[:K])
    tmp = sum(P[:K])
    for i in range(N-K):
        tmp += P[i+K]
        tmp -= P[i]

        if tmp > tmp_max:
            tmp_max = tmp

    print((tmp_max + K) / 2)

main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    _, K = map(int, input().split())
    P = list(map(int, input().split()))

    max_average = 0
    point = 0
    for i in range(len(P)-K+1):

        if max_average < sum(P[i:i+K]):
            max_average = sum(P[i:i+K])
            point = i

    count = 0
    for p in range(point, point+K):
        count += sum(range(1, P[p]+1)) / P[p]

    print(count)

main()

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    tmp_max = sum(P[:K])
    tmp = sum(P[:K])
    for i in range(N-K):
        tmp += P[i+K]
        tmp -= P[i]

        if tmp > tmp_max:
            tmp_max = tmp

    print((tmp_max + K) / 2)

main()

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

    max_average = 0
    point = 0
    for i in range(len(P)-K+1):

        if max_average < sum(P[i:i+K]):
            max_average = sum(P[i:i+K])
            point = i

    count = 0
    for p in range(point, point+K):
        count += sum(range(1, P[p]+1)) / P[p]

    print(count)

main()

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    tmp_max = sum(P[:K])
    tmp = sum(P[:K])
    for i in range(N-K):
        tmp += P[i+K]
        tmp -= P[i]

        if tmp > tmp_max:
            tmp_max = tmp

    print((tmp_max + K) / 2)

main()

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

max_average = 0
point = 0
for i in range(len(P)-K+1):

    if max_average < sum(P[i:i+K]):
        max_average = sum(P[i:i+K])
        point = i

count = 0
for p in range(point, point+K):
    count += sum(range(1, P[p]+1)) / P[p]

print(count)

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    tmp_max = sum(P[:K])
    tmp = sum(P[:K])
    for i in range(N-K):
        tmp += P[i+K]
        tmp -= P[i]

        if tmp > tmp_max:
            tmp_max = tmp

    print((tmp_max + K) / 2)

main()

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

max_average = 0
point = 0
for i in range(len(P)-K+1):
    check = 0
    for j in range(K):
        check += P[i+j]

    if check > max_average:
        max_average = check
        point = i
        
count = 0
for p in range(point, point+K):
    count += sum(range(1, P[p]+1)) / P[p]

print(count)

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    P = list(map(int, input().split()))

    tmp_max = sum(P[:K])
    tmp = sum(P[:K])
    for i in range(N-K):
        tmp += P[i+K]
        tmp -= P[i]

        if tmp > tmp_max:
            tmp_max = tmp

    print((tmp_max + K) / 2)

main()