Problem p03457 (python)

Fixed submission:
N = int(input())
s = [[0,0,0]]*(N+1)
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
for i in range(1,N+1):
  s[i] = input().split()
  t[i] = int(s[i][0])
  x[i] = int(s[i][1])
  y[i] = int(s[i][2])
k = 0
for i in range(N):
  dt = t[i+1]-t[i]
  d = abs(x[i]-x[i+1]) + abs(y[i]-y[i+1])
  if d <= dt and d%2 == dt%2:
    k = k + 1
  else:
    print('No')
    break
if k == N:
  print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [[0,0,0]]*(N+1)
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
for i in range(1,N+1):
  s[i] = input().split()
  t[i] = int(s[i][0])
  x[i] = int(s[i][1])
  y[i] = int(s[i][2])
k = 0
for i in range(N):
  T = t[i+1]-t[i]
  p = 0
  if T%2 == 0:
    for u in range((T/2)+1):
      for l in range(-2*u,2*u+1):
        if x[i]+l == x[i+1] and y[i]+2*u - max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        elif x[i]+l == x[i+1] and y[i]-2*u + max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        else:
          p = p + 1
      if (x[i]+w == x[i+1] and y[i]+2*u - max(w,-w) == y[i+1]) or (x[i]+w == x[i+1] and y[i]-2*u + max(w,-w) == y[i+1]):
        break
    if p == ((T/2)+1)(T+1):
      print('No')
      break
  
  else:
    for u in range(int((T+1)/2)):
      for l in range(-2*u-1,2*u+2):
        if x[i]+l == x[i+1] and y[i]+2*u+1 - max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        elif x[i]+l == x[i+1] and y[i]-2*u-1 + max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        else:
          w = 10000000000
          p = p + 1
      if (x[i]+w == x[i+1] and y[i]+2*u+1 - max(w,-w) == y[i+1]) or (x[i]+w == x[i+1] and y[i]-2*u-1 + max(w,-w) == y[i+1]):
        break
    if p == ((T**2)+(3*T)+2)/2:
      print('No')
      break
    
if k == N:
  print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
s = [[0,0,0]]*(N+1)
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
for i in range(1,N+1):
  s[i] = input().split()
  t[i] = int(s[i][0])
  x[i] = int(s[i][1])
  y[i] = int(s[i][2])
k = 0
for i in range(N):
  T = t[i+1]-t[i]
  p = 0
  if T%2 == 0:
    for u in range((T/2)+1):
      for l in range(-2*u,2*u+1):
        if x[i]+l == x[i+1] and y[i]+2*u - max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        elif x[i]+l == x[i+1] and y[i]-2*u + max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        else:
          p = p + 1
      if (x[i]+w == x[i+1] and y[i]+2*u - max(w,-w) == y[i+1]) or (x[i]+w == x[i+1] and y[i]-2*u + max(w,-w) == y[i+1]):
        break
    if p == ((T/2)+1)(T+1):
      print('No')
      break
  
  else:
    for u in range(int((T+1)/2)):
      for l in range(-2*u-1,2*u+2):
        if x[i]+l == x[i+1] and y[i]+2*u+1 - max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        elif x[i]+l == x[i+1] and y[i]-2*u-1 + max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        else:
          w = float('inf')
          p = p + 1
      if (x[i]+w == x[i+1] and y[i]+2*u+1 - max(w,-w) == y[i+1]) or (x[i]+w == x[i+1] and y[i]-2*u-1 + max(w,-w) == y[i+1]):
        break
    if p == ((T**2)+(3*T)+2)/2:
      print('No')
      break
    
if k == N:
  print('Yes')