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

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N, K = MI()
    p = LI()
    max_ans = 0
    max_i = 0
    ans = 0

    for i in range(0, N-K+1):
        sum_i = sum(p[i:i+K])
        #sum_i = p[i]
        #print("i",i)
        #for j in range(i+1,i+K):
        #    sum_i += p[j]
        #print("sum",sum_i)
        if max_ans <= sum_i:
            max_ans = sum_i
            max_i = i
    #print("max",max_i) 
    for j in range(max_i,max_i+K):
        #print("max_i",j)  
        ans += sum(range(1, p[j] + 1))/p[j]
    
    print(ans)




if __name__ == "__main__":
	main()

Fixed submission:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N, K = MI()
    p = LI()

    sum_i = sum(p[0:K])
    max_ans = sum_i
    max_i = 0
    ans = 0
    for i in range(1, N-K+1):
        sum_i = sum_i - p[i-1] + p[K+i-1]
        #print(i,p[i-1],p[K+i-1])
        #print(sum_i)
        #for j in range(i+1,i+K):
        #    sum_i += p[j]
        #print("sum",sum_i)
        if max_ans <= sum_i:
            max_ans = sum_i
            max_i = i
    #print("max",max_i) 
    for j in range(max_i,max_i+K):
        #print("max_i",j)  
        ans += sum(range(1, p[j] + 1))/p[j]
    
    print(ans)




if __name__ == "__main__":
	main()

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

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N, K = MI()
    p = LI()
    max_ans = 0
    max_i = 0
    ans = 0

    for i in range(0, N-K+1):
        sum_i = p[i]
        #print("i",i)
        for j in range(i+1,i+K):
            sum_i += p[j]
        #print("sum",sum_i)
        if max_ans <= sum_i:
            max_ans = sum_i
            max_i = i
    #print("max",max_i) 
    for j in range(max_i,max_i+K):
        #print("max_i",j)  
        ans += sum(range(1, p[j] + 1))/p[j]
    
    print(ans)




if __name__ == "__main__":
	main()

Fixed submission:
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N, K = MI()
    p = LI()

    sum_i = sum(p[0:K])
    max_ans = sum_i
    max_i = 0
    ans = 0
    for i in range(1, N-K+1):
        sum_i = sum_i - p[i-1] + p[K+i-1]
        #print(i,p[i-1],p[K+i-1])
        #print(sum_i)
        #for j in range(i+1,i+K):
        #    sum_i += p[j]
        #print("sum",sum_i)
        if max_ans <= sum_i:
            max_ans = sum_i
            max_i = i
    #print("max",max_i) 
    for j in range(max_i,max_i+K):
        #print("max_i",j)  
        ans += sum(range(1, p[j] + 1))/p[j]
    
    print(ans)




if __name__ == "__main__":
	main()