Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def main():
    n,k = map(int, input().split())
    l = list(map(mean, input().split()))
    out = 0

    for i in range(len(l)-(k-1)):
        s = sum(l[i:i+k])

        if out < s:
            out = s

    print(out)

def mean(x):
    x = int(x)
    return x * (x+1) / (2 * x)

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

def main():
    n,k = map(int, input().split())
    l = list(map(mean, input().split()))
    out = sum(l[:k])
    result = out

    for i in range(1, len(l)-(k-1)):
        result = result - l[i-1] + l[i+k-1]

        if out < result:
            out = result

    print(out)

def mean(x):
    x = int(x)
    return x * (x+1) / (2 * x)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def main():
    n,k = map(int, input().split())
    l = list(map(int, input().split()))
    out = 0
    out_i = 0

    for i in range(len(l)-(k-1)):
        s = sum(l[i:i+k])

        if out < s:
            out = s
            out_i = i

    r = sum(map(mean, l[out_i:out_i+k]))
    print(r)

def mean(x):
    x = x
    return x * (x+1) / (2 * x)

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

def main():
    n,k = map(int, input().split())
    l = list(map(mean, input().split()))
    out = sum(l[:k])
    result = out

    for i in range(1, len(l)-(k-1)):
        result = result - l[i-1] + l[i+k-1]

        if out < result:
            out = result

    print(out)

def mean(x):
    x = int(x)
    return x * (x+1) / (2 * x)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def main():
    n,k = map(int, input().split())
    l = list(map(int, input().split()))
    out = 0
    out_i = 0

    for i in range(len(l)-(k-1)):
        result = 0
        s = sum(l[i:i+k])

        if out < s:
            out = s
            out_i = i

    r = sum(map(mean, l[out_i:out_i+k]))
    print(r)

def mean(x):
    x = x
    return sum(range(x+1))/x

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

def main():
    n,k = map(int, input().split())
    l = list(map(mean, input().split()))
    out = sum(l[:k])
    result = out

    for i in range(1, len(l)-(k-1)):
        result = result - l[i-1] + l[i+k-1]

        if out < result:
            out = result

    print(out)

def mean(x):
    x = int(x)
    return x * (x+1) / (2 * x)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

def main():
    n,k = map(int, input().split())
    l = list(map(int, input().split()))
    out = 0

    for i in range(len(l)-(k-1)):
        result = 0
        for j in range(k):
            result += sum(range(l[i+j]+1))/l[i+j]

        if out < result:
            out = result

    print(out)

if __name__ == "__main__":
    main()


Fixed submission:
# -*- coding: utf-8 -*-

def main():
    n,k = map(int, input().split())
    l = list(map(mean, input().split()))
    out = sum(l[:k])
    result = out

    for i in range(1, len(l)-(k-1)):
        result = result - l[i-1] + l[i+k-1]

        if out < result:
            out = result

    print(out)

def mean(x):
    x = int(x)
    return x * (x+1) / (2 * x)

if __name__ == "__main__":
    main()