Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
T = list(map(int, input().split()))
V = list(map(int, input().split()))
T = [0, 0] + T + [0]
V = [0] + V + [0]
accT = np.cumsum(T)
INF = 10 ** 9

t2_max = accT[-1] * 2
speeds = np.ones(t2_max + 1) * INF
for t0, t1, v in zip(accT[:-1], accT[1:], V):
    sptmp = np.ones(t2_max + 1) * v
    for t2 in range(0, t0 * 2):
        sptmp[t2] += t0 - t2 * 0.5
    for t2 in range(t1 * 2, t2_max + 1):
        sptmp[t2] += t2 * 0.5 - t1
    speeds = np.minimum(speeds, sptmp)

ans = sum(speeds) / 2

print(ans)

Fixed submission:
import numpy as np
N = int(input())
T = list(map(int, input().split()))
V = list(map(int, input().split()))
T = [0, 0] + T + [0]
V = [0] + V + [0]
accT = np.cumsum(T)
INF = 10 ** 9

t2_max = accT[-1] * 2
speeds = np.ones(t2_max + 1) * INF
for t0, t1, v in zip(accT[:-1], accT[1:], V):
    sptmp = np.ones(t2_max + 1) * v
    sptmp[:t0 * 2] += np.arange(t0, 0, -0.5)
    sptmp[t1 * 2:] += np.arange(0, accT[-1] - t1 + 0.5, 0.5)
    speeds = np.minimum(speeds, sptmp)

ans = sum(speeds) / 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
N = int(input())
T = list(map(int, input().split()))
V = list(map(int, input().split()))
T = [0, 0] + T + [0]
V = [0] + V + [0]
accT = list(accumulate(T))
INF = 10 ** 9

t2_max = accT[-1] * 2
speeds = [INF] * (t2_max + 1)
for t0, t1, v in zip(accT[:-1], accT[1:], V):
    for t2 in range(0, t0 * 2):
        speeds[t2] = min(speeds[t2], (t0 - t2 * 0.5) + v)
    for t2 in range(t0 * 2, t1 * 2):
        speeds[t2] = min(speeds[t2], v)
    for t2 in range(t1 * 2, t2_max + 1):
        speeds[t2] = min(speeds[t2], (t2 * 0.5 - t1) + v)

ans = sum(speeds) / 2

print(ans)

Fixed submission:
import numpy as np
N = int(input())
T = list(map(int, input().split()))
V = list(map(int, input().split()))
T = [0, 0] + T + [0]
V = [0] + V + [0]
accT = np.cumsum(T)
INF = 10 ** 9

t2_max = accT[-1] * 2
speeds = np.ones(t2_max + 1) * INF
for t0, t1, v in zip(accT[:-1], accT[1:], V):
    sptmp = np.ones(t2_max + 1) * v
    sptmp[:t0 * 2] += np.arange(t0, 0, -0.5)
    sptmp[t1 * 2:] += np.arange(0, accT[-1] - t1 + 0.5, 0.5)
    speeds = np.minimum(speeds, sptmp)

ans = sum(speeds) / 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate
N = int(input())
T = list(map(int, input().split()))
V = list(map(int, input().split()))
T = [0, 0] + T + [0]
V = [0] + V + [0]
accT = list(accumulate(T))
INF = 10 ** 9

def speed(t, t0, t1, v):
    if t < t0:
        return (t0 - t) + v
    elif t > t1:
        return (t - t1) + v
    return v

ans = 0
sp_pre = 0
for t2 in range(0, accT[-1] * 2 + 1):
    t = t2 * 0.5
    sp = INF
    for t0, t1, v in zip(accT[:-1], accT[1:], V):
        sp = min(sp, speed(t, t0, t1, v))
    ans += 0.25 * (sp + sp_pre)
    sp_pre = sp

print(ans)

Fixed submission:
import numpy as np
N = int(input())
T = list(map(int, input().split()))
V = list(map(int, input().split()))
T = [0, 0] + T + [0]
V = [0] + V + [0]
accT = np.cumsum(T)
INF = 10 ** 9

t2_max = accT[-1] * 2
speeds = np.ones(t2_max + 1) * INF
for t0, t1, v in zip(accT[:-1], accT[1:], V):
    sptmp = np.ones(t2_max + 1) * v
    sptmp[:t0 * 2] += np.arange(t0, 0, -0.5)
    sptmp[t1 * 2:] += np.arange(0, accT[-1] - t1 + 0.5, 0.5)
    speeds = np.minimum(speeds, sptmp)

ans = sum(speeds) / 2

print(ans)