Buggy python submission (verdict: Runtime Error):
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextFloat64() float64 {
	sc.Scan()
	f, _ := strconv.ParseFloat(sc.Text(), 64)
	return f
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func expectedValue(x float64) float64 {
	s := (x + 1) * (x / 2)
	return s / x
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()
	evs := make([]float64, n)
	for i := 0; i < n; i++ {
		p := nextFloat64()
		evs[i] = expectedValue(p)
	}

	// initialize
	var ev float64
	for i := 0; i < k; i++ {
		ev += evs[i]
	}

	maxEv := ev
	left := 0
	for i := k; i < n; i++ {
		ev = ev - evs[left] + evs[i]
		left++
		if ev > maxEv {
			maxEv = ev
		}
	}
	fmt.Printf("%0.7f\n", maxEv)
}


Fixed submission:
def expected_value(x):
    a = int(x)
    s = (a+1) * (a/2)
    # e = 0
    # for i in range(1, a+1):
    #     e += i / a
    return s / a

n, k = [int(x) for x in input().split()]
evs = list(map(expected_value, input().split())) 

# initialize
left = 0
max_ev = 0
ev = 0
for i in range(k):
    ev += evs[i]

max_ev = ev
for i in range(k, n):
    ev = ev - evs[left] + evs[i]
    left += 1
    if ev > max_ev:
        max_ev = ev
print('{:.7f}'.format(max_ev))

Buggy python submission (verdict: Time Limit Exceeded):
def expected_value(x):
    a = int(x)
    e = 0
    for i in range(1, a+1):
        e += i / a
    return e

n, k = [int(x) for x in input().split()]
evs = list(map(expected_value, input().split())) 

# initialize
left = 0
max_ev = 0
ev = 0
for i in range(k):
    ev += evs[i]

max_ev = ev
for i in range(k, n):
    ev = ev - evs[left] + evs[i]
    left += 1
    if ev > max_ev:
        max_ev = ev
print('{:.7f}'.format(max_ev))

Fixed submission:
def expected_value(x):
    a = int(x)
    s = (a+1) * (a/2)
    # e = 0
    # for i in range(1, a+1):
    #     e += i / a
    return s / a

n, k = [int(x) for x in input().split()]
evs = list(map(expected_value, input().split())) 

# initialize
left = 0
max_ev = 0
ev = 0
for i in range(k):
    ev += evs[i]

max_ev = ev
for i in range(k, n):
    ev = ev - evs[left] + evs[i]
    left += 1
    if ev > max_ev:
        max_ev = ev
print('{:.7f}'.format(max_ev))

Buggy python submission (verdict: Time Limit Exceeded):
def expected_value(x):
    e = 0
    for i in range(1, x+1):
        e += i / x
    return e

n, k = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
evs = [0.0]*n
for i in range(n):
    evs[i] = expected_value(p[i])

# initialize
left = 0
max_ev = 0
ev = 0
for i in range(k):
    ev += evs[i]

max_ev = ev
for i in range(k, n):
    ev = ev - evs[left] + evs[i]
    left += 1
    if ev > max_ev:
        max_ev = ev
print('{:.7f}'.format(max_ev))

Fixed submission:
def expected_value(x):
    a = int(x)
    s = (a+1) * (a/2)
    # e = 0
    # for i in range(1, a+1):
    #     e += i / a
    return s / a

n, k = [int(x) for x in input().split()]
evs = list(map(expected_value, input().split())) 

# initialize
left = 0
max_ev = 0
ev = 0
for i in range(k):
    ev += evs[i]

max_ev = ev
for i in range(k, n):
    ev = ev - evs[left] + evs[i]
    left += 1
    if ev > max_ev:
        max_ev = ev
print('{:.7f}'.format(max_ev))

Buggy python submission (verdict: Time Limit Exceeded):
def expected_value(x):
    e = 0
    for i in range(1, x+1):
        e += i / x
    return e

n, k = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]
evs = list()
for i in p:
    evs.append(expected_value(i))

# initialize
left = 0
max_ev = 0
ev = 0
for i in range(k):
    ev += evs[i]

max_ev = ev
for i in range(k, n):
    ev = ev - evs[left] + evs[i]
    left += 1
    if ev > max_ev:
        max_ev = ev
print('{:.7f}'.format(max_ev))

Fixed submission:
def expected_value(x):
    a = int(x)
    s = (a+1) * (a/2)
    # e = 0
    # for i in range(1, a+1):
    #     e += i / a
    return s / a

n, k = [int(x) for x in input().split()]
evs = list(map(expected_value, input().split())) 

# initialize
left = 0
max_ev = 0
ev = 0
for i in range(k):
    ev += evs[i]

max_ev = ev
for i in range(k, n):
    ev = ev - evs[left] + evs[i]
    left += 1
    if ev > max_ev:
        max_ev = ev
print('{:.7f}'.format(max_ev))