Buggy python submission (verdict: Runtime Error):
def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    l = list(itertools.accumulate(A))
    
    if A[0] == 1 and len(A) == 1:
        return 1
    
    ans = 0
    for i in range(M, N):
        ans = max(ans, l[i] - l[i-M])
    
    ans = (ans+M) / 2
    
    return ans

print(solve())

Fixed submission:
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # スコアの累積和
    l = list(itertools.accumulate(A))

    score = sum(A[:M])
    for i in range(1, N-M):
        score = max(score, l[i+M] - l[i])
        
    ans = (M + score) / 2

    return ans

print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    ans = 0
    for i in range(N-M+1):
        ans = max(ans, sum(A[i:M+i]))
    ans = (ans+M) / 2
    
    return ans

print(solve())


Fixed submission:
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # スコアの累積和
    l = list(itertools.accumulate(A))

    score = sum(A[:M])
    for i in range(1, N-M):
        score = max(score, l[i+M] - l[i])
        
    ans = (M + score) / 2

    return ans

print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    a = [(i/2 + 0.5) for i in A]
    ans = 0
    for i in range(N-M+1):
        ans = max(ans, sum(a[i:M+i]))

    return ans

print(solve())


Fixed submission:
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # スコアの累積和
    l = list(itertools.accumulate(A))

    score = sum(A[:M])
    for i in range(1, N-M):
        score = max(score, l[i+M] - l[i])
        
    ans = (M + score) / 2

    return ans

print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    maxi = 0
    ans = 0
    l = []
    for i in range(N-M+1):
        s = sum(A[i:M+i])        
        if maxi < s:
            maxi = s
            l = A[i:M+i]

    r = [(i/2 + 0.5) for i in l]
    return sum(r)

print(solve())



Fixed submission:
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # スコアの累積和
    l = list(itertools.accumulate(A))

    score = sum(A[:M])
    for i in range(1, N-M):
        score = max(score, l[i+M] - l[i])
        
    ans = (M + score) / 2

    return ans

print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    
    base = [i for i in range(1, 1001)]
    l = list(itertools.accumulate(base))
    r = [l[i] / (i+1) for i in range(1000)]


    maxi = 0
    ans = 0
    for i in range(N-M+1):
        s = sum(A[i:M+i])
        if maxi < s:
            ans = 0
            maxi = s
            for a in A[i:M+i]:
                ans += r[a-1]

    return ans

print(solve())

Fixed submission:
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # スコアの累積和
    l = list(itertools.accumulate(A))

    score = sum(A[:M])
    for i in range(1, N-M):
        score = max(score, l[i+M] - l[i])
        
    ans = (M + score) / 2

    return ans

print(solve())

Buggy python submission (verdict: Time Limit Exceeded):
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    
    base = [i for i in range(1, 1001)]
    l = list(itertools.accumulate(base))
    r = []
    for i in range(0, len(l)):
        r.append(l[i] / (i+1))

    memo = 0
    maxi = 0
    for i in range(N-M+1):
        if maxi < sum(A[i:M+i]):
            maxi = sum(A[i:M+i])
            memo = i

    ans = 0
    for i in A[memo:M+memo]:
        ans += r[i-1]

    return ans

print(solve())


Fixed submission:
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # スコアの累積和
    l = list(itertools.accumulate(A))

    score = sum(A[:M])
    for i in range(1, N-M):
        score = max(score, l[i+M] - l[i])
        
    ans = (M + score) / 2

    return ans

print(solve())

Buggy python submission (verdict: Runtime Error):
def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    
    base = [i for i in range(1, 1001)]
    l = list(itertools.accumulate(base))
    r = []
    for i in range(0, len(l)):
        r.append(l[i] / (i+1))

    memo = 0
    maxi = 0
    for i in range(N-M+1):
        if maxi < sum(A[i:M+i]):
            maxi = sum(A[i:M+i])
            memo = i

    ans = 0
    for i in A[memo:M+memo]:
        ans += r[i-1]

    return ans

print(solve())

Fixed submission:
import itertools

def solve():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    # スコアの累積和
    l = list(itertools.accumulate(A))

    score = sum(A[:M])
    for i in range(1, N-M):
        score = max(score, l[i+M] - l[i])
        
    ans = (M + score) / 2

    return ans

print(solve())