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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
  n,k=MI()
  p=LI()
  ans1 =0
  for i in range(n -k +1):
    ans2 = sum(p[i:i+k])
    if ans2 > ans1:
      ans1 = ans2
      ans_list = p[i:i+k]
  ans = sum(map(lambda i:i/2+0.5,ans_list))
  print(ans)


if __name__ == "__main__":
	main()

  

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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
	n,k=MI()
	p=LI()

	for i in range(n):
		p[i]=p[i]/2+0.5
	#print(p)

	ans=sum(p[:k])
	now=sum(p[:k])

	for i in range(n-k):
		now=now-p[i]+p[i+k]
		ans=max(ans,now)
	print(ans)















if __name__ == "__main__":
	main()

Buggy python submission (verdict: Runtime Error):
import sys
#input = sys.stdin.buffer.readline


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
	n,k=MI()
	p=LI()

	for i in range(N -K +1):
  	ans2 = sum(p[i:i+K])
  	if ans2 > ans1:
    	ans1 = ans2
    	ans_list = p[i:i+K]
    ans = sum(map(lambda i:i/2+0.5,ans_list))
	print(ans)


if __name__ == "__main__":
	main()

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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
	n,k=MI()
	p=LI()

	for i in range(n):
		p[i]=p[i]/2+0.5
	#print(p)

	ans=sum(p[:k])
	now=sum(p[:k])

	for i in range(n-k):
		now=now-p[i]+p[i+k]
		ans=max(ans,now)
	print(ans)















if __name__ == "__main__":
	main()

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
for i in range(n):
  p[i]=p[i]/2+0.5
  ans=sum(p[:k])
  now=sum(p[:k])
for i in range(n-k):
  now=now-p[i]+p[i+k]
  ans=max(ans,now)
print(ans)
 
 
 
 
 
 
 
 
 
 

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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
	n,k=MI()
	p=LI()

	for i in range(n):
		p[i]=p[i]/2+0.5
	#print(p)

	ans=sum(p[:k])
	now=sum(p[:k])

	for i in range(n-k):
		now=now-p[i]+p[i+k]
		ans=max(ans,now)
	print(ans)















if __name__ == "__main__":
	main()

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = list(map(int,input().split()))
ans1 = 0
for i in range(N -K +1):
  ans2 = sum(A[i:i+K])
  if ans2 > ans1:
    ans1 = ans2
    ans_list = A[i:i+K]
#print(ans_list)

ans = sum(map(lambda i:i/2+0.5,ans_list))


print(ans)
  

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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
	n,k=MI()
	p=LI()

	for i in range(n):
		p[i]=p[i]/2+0.5
	#print(p)

	ans=sum(p[:k])
	now=sum(p[:k])

	for i in range(n-k):
		now=now-p[i]+p[i+k]
		ans=max(ans,now)
	print(ans)















if __name__ == "__main__":
	main()

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
A = list(map(int,input().split()))
ans1 = 0
for i in range(N -K +1):
  ans2 = sum(A[i:i+K])
  if ans2 > ans1:
    ans1 = ans2
    ans_list = list(A[i:i+K])
#print(ans_list)
answer = 0
for i in ans_list:
  result = sum(range(1,i+1))/i
  #print(result)
  answer += result

print(answer)
  

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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

#import numpy as np

def main():
	n,k=MI()
	p=LI()

	for i in range(n):
		p[i]=p[i]/2+0.5
	#print(p)

	ans=sum(p[:k])
	now=sum(p[:k])

	for i in range(n-k):
		now=now-p[i]+p[i+k]
		ans=max(ans,now)
	print(ans)















if __name__ == "__main__":
	main()