Buggy python submission (verdict: Time Limit Exceeded):
from itertools import chain
 
double = lambda c: int(c)*2
 
N = int(input())
T = tuple(map(double,input().split()))
V = tuple(map(double,input().split()))
 
dp = [0]
 
for t,v_max,vf_max in zip(T,V,chain(V[1:],(0,))):
  ndp = [None]*(min(vf_max,v_max)+1)
  
  for vf in range(len(ndp)):
    vi_min = max(0,vf-t)
    vi_max = min(v_max,vf+t)
    vf2 = vf*vf
    vt = vf+t
    def it():
      for vi,d in enumerate(dp[vi_min:vi_max+1], start=vi_min):
        vp = (vt+vi)/2
        yield d + 2*vp*vp-vf2-vi*vi - 2*max(0,vp-v_max)**2
    ndp[vf] = max(it(), default=-float('inf'))
  
  dp = ndp
 
print(dp[0]/8)

Fixed submission:
from itertools import chain
 
double = lambda c: int(c)*2
 
N = int(input())
T = tuple(map(double,input().split()))
V = tuple(map(double,input().split()))
 
dp = [0]
 
for t,v_max,vf_max in zip(T,V,chain(V[1:],(0,))):

  ndp = [None]*(min(vf_max,v_max)+1)
  
  for vf in range(len(ndp)):
    vi = min(len(dp)-1,vf+t)
    while vi >= 0 and dp[vi] is None:
      vi -= 1

    if vi < max(0,vf-t):
      ndp[vf] = None
    else:
      vp = (vf+t+vi)/2
      ndp[vf] = dp[vi] + 2*vp*vp-vf*vf-vi*vi - 2*max(0,vp-v_max)**2
  dp = ndp
 
print(dp[0]/8)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import chain
from collections import defaultdict
 
N = int(input())
T = tuple(map(int,input().split()))
V = tuple(map(int,input().split()))
 
dp = {0:0}
 
for t,v_max in zip(T,V):
 
  ndp = dict()
  
  def it():
    for vf in range(2*v_max+1):
      vf /= 2
      def it():
        for vi,d in dp.items():
          if abs(vf-vi) > t or vi > v_max:
            continue
          vp = (t+vi+vf)/2
          yield d + (2*vp*vp-vf*vf-vi*vi)/2 - max(0,vp-v_max)**2
      yield (vf,max(it(),default=-float('inf')))
  
  dp = dict(it())
 
print(dp[0])

Fixed submission:
from itertools import chain
 
double = lambda c: int(c)*2
 
N = int(input())
T = tuple(map(double,input().split()))
V = tuple(map(double,input().split()))
 
dp = [0]
 
for t,v_max,vf_max in zip(T,V,chain(V[1:],(0,))):

  ndp = [None]*(min(vf_max,v_max)+1)
  
  for vf in range(len(ndp)):
    vi = min(len(dp)-1,vf+t)
    while vi >= 0 and dp[vi] is None:
      vi -= 1

    if vi < max(0,vf-t):
      ndp[vf] = None
    else:
      vp = (vf+t+vi)/2
      ndp[vf] = dp[vi] + 2*vp*vp-vf*vf-vi*vi - 2*max(0,vp-v_max)**2
  dp = ndp
 
print(dp[0]/8)

Buggy python submission (verdict: Runtime Error):
from itertools import chain
 
double = lambda c: int(c)*2
 
N = int(input())
T = tuple(map(double,input().split()))
V = tuple(map(double,input().split()))
 
dp = [0]
 
for t,v_max,vf_max in zip(T,V,chain(V[1:],(0,))):
  ndp = [0]*(min(vf_max,v_max)+1)
  
  for vf in range(len(ndp)):
    vi_min = max(0,vf-t)
    vi_max = min(v_max,vf+t)
    def it():
      for vi,d in enumerate(dp[vi_min:vi_max+1], start=vi_min):
        vp = (t+vi+vf)/2
        yield d + 2*vp*vp-vf*vf-vi*vi - 2*(max(0,vp-v_max))**2
    ndp[vf] = max(it())
  
  dp = ndp
 
print(dp[0]/8)

Fixed submission:
from itertools import chain
 
double = lambda c: int(c)*2
 
N = int(input())
T = tuple(map(double,input().split()))
V = tuple(map(double,input().split()))
 
dp = [0]
 
for t,v_max,vf_max in zip(T,V,chain(V[1:],(0,))):

  ndp = [None]*(min(vf_max,v_max)+1)
  
  for vf in range(len(ndp)):
    vi = min(len(dp)-1,vf+t)
    while vi >= 0 and dp[vi] is None:
      vi -= 1

    if vi < max(0,vf-t):
      ndp[vf] = None
    else:
      vp = (vf+t+vi)/2
      ndp[vf] = dp[vi] + 2*vp*vp-vf*vf-vi*vi - 2*max(0,vp-v_max)**2
  dp = ndp
 
print(dp[0]/8)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import chain
from collections import defaultdict

N = int(input())
T = tuple(map(int,input().split()))
V = tuple(map(int,input().split()))

dp = {0:0}

for t,v_max in zip(T,V):

  ndp = defaultdict(int)

  for vf in range(2*v_max+1):
    vf /= 2
    for vi,d in dp.items():
      if abs(vf-vi) > t or vi > v_max:
        continue
      vp = (t+vi+vf)/2
      d += (2*vp*vp-vf*vf-vi*vi)/2
      if vp > v_max:
        d -= (vp-v_max)**2
      ndp[vf] = max(ndp[vf],d)
  
  dp = ndp

print(dp[0])

Fixed submission:
from itertools import chain
 
double = lambda c: int(c)*2
 
N = int(input())
T = tuple(map(double,input().split()))
V = tuple(map(double,input().split()))
 
dp = [0]
 
for t,v_max,vf_max in zip(T,V,chain(V[1:],(0,))):

  ndp = [None]*(min(vf_max,v_max)+1)
  
  for vf in range(len(ndp)):
    vi = min(len(dp)-1,vf+t)
    while vi >= 0 and dp[vi] is None:
      vi -= 1

    if vi < max(0,vf-t):
      ndp[vf] = None
    else:
      vp = (vf+t+vi)/2
      ndp[vf] = dp[vi] + 2*vp*vp-vf*vf-vi*vi - 2*max(0,vp-v_max)**2
  dp = ndp
 
print(dp[0]/8)