Buggy python submission (verdict: Runtime Error):
def K(n):
    return 0.5 * (n + 1)

def d():
    n, k = list(map(int, input().split()))
    p = list(map(int, input().split()))

    pionta = None
    ire = [None for i in range(k)]
    for i in range(0, n):
        if k < i + 1:
            pionta = i // k
        if pionta is None:
            ire[i] = p[i]
        else:
            if ire[pionta] < p[i]:
                ire[pionta] = p[i]
    m = 0
    for i in ire:
        m += K(i)
    return m
print(d())

Fixed submission:
def K(n):
    return 0.5 * (n + 1)

def d():
    n, k = list(map(int, input().split()))
    p = list(map(int, input().split()))

    pionta = None
    ire = [None for i in range(k)]
    d = {}
    d[0] = 0

    ss = 0
    for i in range(0, n):
        if k < i + 1:
            pionta = i % k
        if pionta is None:
            ire[i] = p[i]
        else:
            ss += p[i] - ire[pionta]
            d[ss] = i
            ire[pionta] = p[i]


    max_s = max(d.keys())
    i = d[max_s]
    m = 0
    for i2 in range(i-k+1, i+1):
        m += K(p[i2])
    return m
print(d())

Buggy python submission (verdict: Time Limit Exceeded):
def K(n):
    return 0.5 * (n + 1)

def d():
    n, k = input().split()
    n = int(n)
    k = int(k)
    p = input().split()

    m = 0
    for i in range(0, len(p)-k+1):
        a = 0
        for i2 in range(k):
            a += int(p[i+i2])
        if m < a:
            m = a
            I = i
    m2 = 0
    for i in range(k):
        m2 += K(int(p[I + i]))
    return m2
print(d())

Fixed submission:
def K(n):
    return 0.5 * (n + 1)

def d():
    n, k = list(map(int, input().split()))
    p = list(map(int, input().split()))

    pionta = None
    ire = [None for i in range(k)]
    d = {}
    d[0] = 0

    ss = 0
    for i in range(0, n):
        if k < i + 1:
            pionta = i % k
        if pionta is None:
            ire[i] = p[i]
        else:
            ss += p[i] - ire[pionta]
            d[ss] = i
            ire[pionta] = p[i]


    max_s = max(d.keys())
    i = d[max_s]
    m = 0
    for i2 in range(i-k+1, i+1):
        m += K(p[i2])
    return m
print(d())

Buggy python submission (verdict: Time Limit Exceeded):
def K(n):
    s = 0
    for i in range(1, n+1):
        s += i
    return s / i

def d():
    n, k = input().split()
    n = int(n)
    k = int(k)
    p = input().split()

    m = 0
    for i in range(0, len(p)-k+1):
        a = 0
        for i2 in range(k):
            a += int(p[i+i2])
        if m < a:
            m = a
            I = i
    m2 = 0
    for i in range(k):
        m2 += K(int(p[I + i]))
    return m2
print(d())

Fixed submission:
def K(n):
    return 0.5 * (n + 1)

def d():
    n, k = list(map(int, input().split()))
    p = list(map(int, input().split()))

    pionta = None
    ire = [None for i in range(k)]
    d = {}
    d[0] = 0

    ss = 0
    for i in range(0, n):
        if k < i + 1:
            pionta = i % k
        if pionta is None:
            ire[i] = p[i]
        else:
            ss += p[i] - ire[pionta]
            d[ss] = i
            ire[pionta] = p[i]


    max_s = max(d.keys())
    i = d[max_s]
    m = 0
    for i2 in range(i-k+1, i+1):
        m += K(p[i2])
    return m
print(d())

Buggy python submission (verdict: Time Limit Exceeded):
def K(n):
    s = 0
    for i in range(1, n+1):
        s += i
    return s / i

def d():
    n, k = input().split()
    n = int(n)
    k = int(k)
    p = input().split()
    p2 = [K(int(o)) for o in p]

    m = 0
    for i in range(0, len(p2)-k+1):
        a = 0
        for i2 in range(k):
            a += p2[i+i2]
        if m < a:
            m = a
    return m
print(d())

Fixed submission:
def K(n):
    return 0.5 * (n + 1)

def d():
    n, k = list(map(int, input().split()))
    p = list(map(int, input().split()))

    pionta = None
    ire = [None for i in range(k)]
    d = {}
    d[0] = 0

    ss = 0
    for i in range(0, n):
        if k < i + 1:
            pionta = i % k
        if pionta is None:
            ire[i] = p[i]
        else:
            ss += p[i] - ire[pionta]
            d[ss] = i
            ire[pionta] = p[i]


    max_s = max(d.keys())
    i = d[max_s]
    m = 0
    for i2 in range(i-k+1, i+1):
        m += K(p[i2])
    return m
print(d())