qyliang/CodeNanoFix huggingface dataset:
Buggy code:
ans = "Yes"
N = int(input())
t = []
x = []
y = []
for i in range(N):
  tmp = input().split(" ")
  t.append(int(tmp[0]))
  x.append(int(tmp[1]))
  y.append(int(tmp[2]))

for j in range(N-1):
  dt = t[j+1] - t[j]
  dx = abs(x[j+1] - x[j])
  dy = abs(y[j+1] - y[j])
  if dt >= dx + dy and dt % 2 == (dx + dy) % 2:
    continue
  else:
    ans = "No"
    break

print(ans)

Fixed code:
ans = "Yes"
N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
  tmp = input().split(" ")
  t.append(int(tmp[0]))
  x.append(int(tmp[1]))
  y.append(int(tmp[2]))

for j in range(N):
  dt = t[j+1] - t[j]
  dx = abs(x[j+1] - x[j])
  dy = abs(y[j+1] - y[j])
  if dt >= dx + dy and dt % 2 == (dx + dy) % 2:
    continue
  else:
    ans = "No"
    break

print(ans)
Buggy code:
def func():
    N = int(input())
    data = [list(map(int, input().split())) for i in range(N)]

    now = [0, 0, 0]
    flg = True
    for t, x, y in data:
        dt = t - now[0]
        dx = abs(x-now[1])
        dy = abs(y-now[2])
        
        if dt == dx + dy or (dt - (dx + dy)) % 2 == 0:
            now[0] = t
            now[1] = x
            now[2] = y
        else:
            flg = False
            break
    
    if flg:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    func()


Fixed code:
def func():
    N = int(input())
    data = [list(map(int, input().split())) for i in range(N)]

    now = [0, 0, 0]
    flg = True
    for t, x, y in data:
        dt = t - now[0]
        dx = abs(x-now[1])
        dy = abs(y-now[2])
        
        if dt == dx + dy or ((dt >= (dx + dy))and(dt - (dx + dy)) % 2 == 0):
            now[0] = t
            now[1] = x
            now[2] = y
        
        else:
            flg = False
            break
    
    if flg:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    func()
Buggy code:

r = 1
t = 0
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])


for i in txy:
    t = i[0] - t

    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
            
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
        elif t < i[1] + i[2]:
            print("No")
            break
    
    if r == N and t >= i[1] + i[2]:
        print("Yes")
        break
    else:
        print("No")
    r += 1
    
    
    

Fixed code:

r = 1
t = 0
m = 0
N = int(input())
txy = []

for i in range(N):
    txy.append([int(x) for x in input().split()])


for i in txy:
    t = i[0] - t
    m = abs((i[1] + i[2]) - m)
    
    if i[0] % 2 == 0:
        if (i[1] + i[2]) % 2 != 0:
            print("No")
            break
        elif t < m:
            print("No")
            break
            
    else:
        if (i[1] + i[2]) % 2 != 1:
            print("No")
            break
        elif t < m:
            print("No")
            break
    
   
    if r == N and t >= m:
        print("Yes")
        
    r += 1
Buggy code:
n = int(input())
prev_t = 0
for i in range(n):
    t, x, y=map(int, input().split())
    if (x + y) > (t - prev_t) or (x + y + (t - prev_t)) % 2!=0:
        print("No")
        exit()
    prev_t = t
print("Yes")

Fixed code:
n=int(input())
for i in range(n):
    t,x,y=map(int,input().split())
    if x+y>t or t%2!=(x+y)%2 : 
        print("No")
        exit()
print("Yes")
Buggy code:
import math
N = int(input())

now = 0
p = [0, 0]

for line in (map(int, input().split()) for _ in range(N)):
  t, x, y = line
  d = abs(p[0] - x) + abs(p[1] - y)
  now += d
  if now < t:
    now += math.ceil((t - now)/2)*2
  if now != t:
    print("No")
    break
  *p = x, y
else:
  print("Yes")

Fixed code:
import math
N = int(input())

now = 0
p = [0, 0]

for line in (map(int, input().split()) for _ in range(N)):
  t, x, y = line
  d = abs(p[0] - x) + abs(p[1] - y)
  now += d
  if now < t:
    now += math.ceil((t - now)/2)*2
  if now != t:
    print("No")
    break
  p = x, y
else:
  print("Yes")
Buggy code:
N = int(input())

s_x = 0
s_y = 0
s_t = 0
travel_flag = True

def judge_ok(d_p, d_t):
  if d_p > d_t:
    return False
  if d_p % 2 != d_t % 2:
    return False
  return False

for n in range(N):
  n_t, n_x, n_y = list(map(lambda x:int(x), input().split(" ")))

  if not judge_ok(n_x - s_x + n_y - s_y, n_t - s_t):
    travel_flag = False
  
  s_x = n_x
  s_y = n_y
  s_t = n_t

if travel_flag:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())

s_x = 0
s_y = 0
s_t = 0
travel_flag = True

def judge_ok(d_p, d_t):
  if d_p > d_t:
    return False
  if d_p % 2 != d_t % 2:
    return False
  return True

for n in range(N):
  n_t, n_x, n_y = list(map(lambda x:int(x), input().split(" ")))

  if not judge_ok(abs(n_x - s_x) + abs(n_y - s_y), n_t - s_t):
    travel_flag = False
  
  s_x = n_x
  s_y = n_y
  s_t = n_t

if travel_flag:
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input())
x = y = 0

for _ in range(N):
    print(_)
    t, _x, _y = map(int, input().split())
    dist = abs(_y - y) + abs(_x - x)
    if dist > t or (t - dist) % 2 == 1:
        print('No')
        quit()
print('Yes')


Fixed code:
N = int(input())
x = y = 0

for _ in range(N):
    t, _x, _y = map(int, input().split())
    dist = abs(_y - y) + abs(_x - x)
    if dist > t or (t - dist) % 2 == 1:
        print('No')
        quit()
print('Yes')
Buggy code:
N = int(input())
T, X, Y = ([] for i in range(3))
ans = True
for i in range(N):
  t, x, y = map(int, input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for i in range(N - 1):
  dt = T[i + 1] - T[i]
  dx = X[i + 1] - X[i]
  dy = Y[i + 1] - Y[i]
  if dt >= abs(dx) + abs(dy) and dt % 2 == (abs(dx) + abs(dy)) % 2:
    continue
  else:
    ans = False
    break
if ans:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())
T, X, Y = ([] for i in range(3))
ans = True
T.append(0)
X.append(0)
Y.append(0)
for i in range(N):
  t, x, y = map(int, input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for i in range(N):
  dt = T[i + 1] - T[i]
  dx = X[i + 1] - X[i]
  dy = Y[i + 1] - Y[i]
  if dt >= abs(dx) + abs(dy) and dt % 2 == (abs(dx) + abs(dy)) % 2:
    continue
  else:
    ans = False
    break
if ans:
  print("Yes")
else:
  print("No")
Buggy code:
# -*- coding: utf-8 -*-
N = int(input())
t = []
x = []
y = []
for i in range(N):
    ti, xi, yi = list(map(int, input().split()))
    t.append(ti)
    x.append(xi)
    y.append(yi)

canBePlanned = 'Yes'
xprev = 0
yprev = 0
tprev = 0
for i in range(N):
    xdiff = abs(x[i] - xprev)
    ydiff = abs(y[i] - yprev)
    tdiff = t[i] - tprev
    if (t[i] - (x[i] + y[i])) % 2 != 0 and (tdiff - (xdiff + ydiff)) % 2 != 0:
        canBePlanned = 'No'

print(canBePlanned)


Fixed code:
# -*- coding: utf-8 -*-
N = int(input())
t = []
x = []
y = []
for i in range(N):
    ti, xi, yi = list(map(int, input().split()))
    t.append(ti)
    x.append(xi)
    y.append(yi)

canBePlanned = 'Yes'
xprev = 0
yprev = 0
tprev = 0
for i in range(N):
    xdiff = abs(x[i] - xprev)
    ydiff = abs(y[i] - yprev)
    tdiff = t[i] - tprev
    if (t[i] - (x[i] + y[i])) % 2 != 0 or (tdiff - (xdiff + ydiff)) % 2 != 0 or tdiff < xdiff + ydiff:
        canBePlanned = 'No'
        break
    xprev, yprev, tprev = x[i], y[i], t[i]

print(canBePlanned)
Buggy code:
N = int(input())
flag = 'Yes'
txy = [[0,0,0]]
for i in range(N):
    a = list(map(int,input().split()))
    txy.append(a)
    td = txy[i][0] - txy[i-1][0]
    xd = abs(txy[i][1] - txy[i-1][1])
    yd = abs(txy[i][2] - txy[i-1][2])
    if (td < xd + yd) or ((td-(xd+yd))%2 == 1):
        flag = 'No'
print(flag)

Fixed code:
N = int(input())
flag = 'Yes'
txy = [[0,0,0]]
for i in range(N):
    a = list(map(int,input().split()))
    txy.append(a)
    td = txy[i+1][0] - txy[i][0]
    xd = abs(txy[i+1][1] - txy[i][1])
    yd = abs(txy[i+1][2] - txy[i][2])
    if (td < xd + yd) or ((td-(xd+yd))%2 == 1):
        flag = 'No'
print(flag)
Buggy code:
N=int(input())
i=0

flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  if unk%2!=0:
    flag=1
  beforeTxy=afterTxy
  i=i+1

if flag==0:
  print("Yes")
else:
  print("No")

Fixed code:
N=int(input())
i=0
 
flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  #unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  #unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])
  dt=afterTxy[0]-beforeTxy[0]
  dist=abs(afterTxy[1]-beforeTxy[1])+abs(afterTxy[2]-beforeTxy[2])
  #print(dt,dist)
  if dt < dist or dt%2!=dist%2:
    flag=1
  beforeTxy=afterTxy
  i=i+1
 
if flag==0:
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input().rstrip())
t = [0 for _ in range(N+1)]
x = [0 for _ in range(N+1)]
y = [0 for _ in range(N+1)]

for i in range(1, N+1):
    t[i], x[i], y[i] = [int(s) for s in input().rstrip().split()]

judge = []
for i in range(N):
    diff_t = t[i+1] - t[i]
    diff_x = x[i+1] - x[i]
    if diff_t >= diff_x and (diff_t - diff_x ) % 2 == 0:
        judge.append(True)
    else:
        judge.append(False)

if all(judge):
    print('Yes')
else:
    print('No')

Fixed code:
N = int(input().rstrip())
t = [0 for _ in range(N+1)]
x = [0 for _ in range(N+1)]
y = [0 for _ in range(N+1)]

for i in range(1, N+1):
    t[i], x[i], y[i] = [int(s) for s in input().rstrip().split()]

judge = []
for i in range(N):
    diff_t = t[i+1] - t[i]
    diff_x = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if diff_t >= diff_x and (diff_t - diff_x ) % 2 == 0:
        judge.append(True)
    else:
        judge.append(False)

if all(judge):
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
t_list = [0]
x_list = [0]
y_list = [0]
for i in range(N):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)
result = 'Yes'
for i in range(N):
    if i == 0:
        pass
    else:
        d_t = t_list[i] - t_list[i-1]
        d_x = x_list[i] - x_list[i-1]
        d_y = y_list[i] - y_list[i-1]
        if d_t >= d_x + d_y:
            if (d_t - (d_x + d_y)) % 2 == 0:
                pass
            else:
                result = 'No'
        else:
            result = 'No'
print(result)

Fixed code:
N = int(input())
t_list = [0]
x_list = [0]
y_list = [0]
for i in range(N):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)
result = 'Yes'
for i in range(N + 1):
    if i == 0:
        pass
    else:
        d_t = t_list[i] - t_list[i-1]
        d_x = x_list[i] - x_list[i-1]
        d_y = y_list[i] - y_list[i-1]
        if d_t >= d_x + d_y:
            if (d_t - (d_x + d_y)) % 2 == 0:
                pass
            else:
                result = 'No'
        else:
            result = 'No'
print(result)
Buggy code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]

for txyi, txyip in zip([[0, 0, 0]] + txy[:-1], txy):
    ti, xi, yi = txyi
    tip, xip, yip = txyip
    dift = tip - ti
    difd = abs(xip-xi) + abs(yip-yi)
    if dift < difd:
        print('No')
        exit()
print('Yes')



Fixed code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]

for txyi, txyip in zip([[0, 0, 0]] + txy[:-1], txy):
    ti, xi, yi = txyi
    tip, xip, yip = txyip
    dift = tip - ti
    difd = abs(xip-xi) + abs(yip-yi)
    if difd%2 != dift%2:
        print('No')
        exit()
    if dift < difd:
        print('No')
        exit()
print('Yes')
Buggy code:
n = int(input())
tp, xp, yp = 0, 0, 0
for _ in range(n):
  t, x, y = map(int, input().split())
  td = t - tp
  xd = x - xp
  yd = y - yp
  if td < abs(xd) + abs(yd) or (td - abs(xd) - abs(yd)) % 2 == 1:
    print('No')
    break
    tp = t
    xp = x
    yp = y
    else:
      print('Yes')

Fixed code:
n = int(input())
tp, xp, yp = 0, 0, 0
for _ in range(n):
    t, x, y = map(int, input().split())
    td = t - tp
    xd = x - xp
    yd = y - yp
    if td < abs(xd) + abs(yd) or (td - abs(xd) - abs(yd)) % 2 == 1:
        print('No')
        break
    tp = t
    xp = x
    yp = y
else:
    print('Yes')
Buggy code:
n = input()
n = int(n)

points = []
points.append(("0", "0", "0"))
for i in range(n):
  points.append(input().split())

for i in range(len(points)-1):
  dt = int(points[i+1][0]) - int(points[i][0])
  dx = inat(points[i+1][1]) - int(points[i][1])
  dy = int(points[i+1][2]) - int(points[i][2])
  
  if dt < abs(dx)+abs(dy):
    print("No")
    exit()
  elif (dt - ( abs(dx)+abs(dy) ) ) % 2 == 1:
    print("No")
    exit()

print("Yes")

Fixed code:
n = input()
n = int(n)

points = []
points.append(("0", "0", "0"))
for i in range(n):
  points.append(input().split())

for i in range(len(points)-1):
  dt = int(points[i+1][0]) - int(points[i][0])
  dx = int(points[i+1][1]) - int(points[i][1])
  dy = int(points[i+1][2]) - int(points[i][2])
  
  if dt < abs(dx)+abs(dy):
    print("No")
    exit()
  elif (dt - ( abs(dx)+abs(dy) ) ) % 2 == 1:
    print("No")
    exit()

print("Yes")
Buggy code:
N = int(input())
plan = [list(map(int, input().split())) for i in range(N)]
f = True
for i in range(N-1):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or dist%2 != time%2:
        f = False
        break       
print('Yes' if f else 'No')

Fixed code:
N = int(input())
plan = [[0,0,0]] + [list(map(int, input().split())) for i in range(N)]
f = True
for i in range(N):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or dist%2 != time%2:
        f = False    
print('Yes' if f else 'No')
Buggy code:
N = int(input())
t,x,y = 0,0,0
f = True
for i in range(N):
    ti,xi,yi = map(int, input()split())
    p=ti-t
    d=abs(xi-x)+abs(yi-y)
    if p<d or p%2 != d%2:
        f = False
        break 
    t,x,y = ti,xi,yi
print('Yes' if f else 'No')

Fixed code:
N = int(input())
t,x,y = 0,0,0
f = True
for i in range(N):
    ti,xi,yi = map(int, input().split())
    p=ti-t
    d=abs(xi-x)+abs(yi-y)
    if p<d or p%2 != d%2:
        f = False
        break 
    t,x,y = ti,xi,yi
print('Yes' if f else 'No')
Buggy code:
def solve():
    N = int(input())
    plan = [
        [int(x) for x in input().split()] for _ in range(N)
    ]
    plan = [[0, 0, 0]] + plan

    for i in range(1, N+1):
        t0, x0, y0 = plan[i-1]
        t, x, y = plan[i]
        dx = x - x0
        dy = y = y0
        d = abs(dx) + abs(dy)

        if t - t0 < d:
            return False

        if (t-t0-d)%2 != 0:
            return False

    return True


if solve():
    print("Yes")
else:
    print("No")

Fixed code:
def solve():
    N = int(input())
    plan = [
        [int(x) for x in input().split()] for _ in range(N)
    ]
    plan = [[0, 0, 0]] + plan

    for i in range(1, N+1):
        t0, x0, y0 = plan[i-1]
        t, x, y = plan[i]
        dx = x - x0
        dy = y - y0
        d = abs(dx) + abs(dy)

        if t - t0 < d:
            return False

        if (t-t0-d)%2 != 0:
            return False

    return True


if solve():
    print("Yes")
else:
    print("No")
Buggy code:
def mdist(a, b):
    return abs(a[0]-b[0]) + abs(a[1]-b[1])

n = int(input())
data = [[0, 0, 0]] + [[int(d) for d in input().split(' ')] for _ in range(n)]

for d1, d2 in enumerate(data[:-1], data[1:]):
    dt = d2[0] - d1[0]
    dist = mdist(d1[1:], d2[1:])
    if not ((dt >= dist) and ((dt%2)==(dist%2))):
        print('No')
        return
print('Yes')


Fixed code:
def mdist(a, b):
    return abs(a[0]-b[0]) + abs(a[1]-b[1])

n = int(input())
data = [[0, 0, 0]] + [[int(d) for d in input().split(' ')] for _ in range(n)]

for d1, d2 in zip(data[:-1], data[1:]):
    dt = d2[0] - d1[0]
    dist = mdist(d1[1:], d2[1:])
    if not ((dt >= dist) and ((dt%2)==(dist%2))):
        print('No')
        break
else:
    print('Yes')
Buggy code:
N = int(input())

T = 0
X = 0
Y = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if ((t - T) + abs(x-X) + abs(y-Y))%2 == 1 and (t - T) < abs(x-X) + abs(y-Y):
        print("No")
        break
else:
    print("Yes")

Fixed code:
N = int(input())

T = 0
X = 0
Y = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if ((t - T) + abs(x-X) + abs(y-Y))%2 == 1 or (t - T) < abs(x-X) + abs(y-Y):
        print("No")
        break
else:
    print("Yes")
Buggy code:
n = int(input())
for i in range(n):
  t,x,y = map(int,input().split())
  if (x+y) > t and (x+y)%2==t%2:
    print("No")
    exit()
print("Yes")

Fixed code:
n = int(input())

for i in range(n):
    t, x, y = map(int, input().split())
    if x + y > t or (x + y + t) % 2:
        print("No")
        exit()
print("Yes")
Buggy code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]
L.insert(0, [0, 0, 0])
print(N, L)

for i in range(1, len(L)):
    t = L[i][0] - L[i-1][0]
    x = L[i][1] - L[i-1][1]
    y = L[i][2] - L[i-1][2]
    num = t - abs(x) - abs(y)
    if num < 0 or num % 2:
        print('No')
        sys.exit()
print('Yes')


Fixed code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]
L.insert(0, [0, 0, 0])

for i in range(1, len(L)):
    t = L[i][0] - L[i-1][0]
    x = L[i][1] - L[i-1][1]
    y = L[i][2] - L[i-1][2]
    num = t - abs(x) - abs(y)
    if num < 0 or num % 2:
        print('No')
        sys.exit()
print('Yes')
Buggy code:
N = int(input())
Data = []
for _ in range(N):
    Data.append(list(map(int,input().split())))

ctime = 0
cx = 0
cy = 0
ans = True

for i in range(N):
    nt,nx,ny = Data[i]
    dist = abs(nx-cx)+abs(ny-cy)
    dtime  = nt-ctime 

    print(dist,dtime)

    if dist > dtime or (dtime-dist) % 2 == 1:
        ans = False
        break

    ctime = nt
    cx = nx
    cy = ny

if ans :
    print('Yes')
else:
    print('No')

Fixed code:
N = int(input())
Data = []
for _ in range(N):
    Data.append(list(map(int,input().split())))

ctime = 0
cx = 0
cy = 0
ans = True

for i in range(N):
    nt,nx,ny = Data[i]
    dist = abs(nx-cx)+abs(ny-cy)
    dtime  = nt-ctime 

    if dist > dtime or (dtime-dist) % 2 == 1:
        ans = False
        break

    ctime = nt
    cx = nx
    cy = ny

if ans :
    print('Yes')
else:
    print('No')
Buggy code:
n = int(input())
t = []
x = []
y = []
ok = True #ok

for i in range(0,n):
    tin, xin, yin = (int(i) for i in input().split())
    t.append(tin)
    x.append(xin)
    y.append(yin)

for i in range(1,n):
    TimeGap = t[i]-t[i-1]
    DisGap = x[i]-x[i-1] + y[i]-y[i-1]
    if TimeGap%2 != DisGap%2 or TimeGap < DisGap:
        ok = False
if ok == True:
    print("Yes")
else:
    print("No")


Fixed code:
n = int(input())
t = [0]
x = [0]
y = [0]
ok = True #ok

for i in range(0,n):
    tin, xin, yin = (int(i) for i in input().split())
    t.append(tin)
    x.append(xin)
    y.append(yin)

for i in range(1,n+1):
    TimeGap = t[i]-t[i-1]
    DisGap = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if TimeGap%2 != DisGap%2 or TimeGap < DisGap:
        ok = False
if ok == True:
    print("Yes")
else:
    print("No")
Buggy code:
# coding: utf-8
# Your code here!

n = int(input())

now = [0,0]
time = 0

flag = True

for i in range(n):
    t,x,y = map(int,input().split())
    if t-time >= abs((now[0]-x)*(now[1]-y)) and (t-time)%2==((now[0]-x)*(now[1]-y))%2:
        now = [x,y]
        time = t
    else:
        flag = False
        break
    
if flag:
    print("Yes")
else:
    print("No")

Fixed code:
# coding: utf-8
# Your code here!

n = int(input())

now = [0,0]
time = 0

flag = True

for i in range(n):
    t,x,y = map(int,input().split())
    if t-time >= abs((now[0]-x)+(now[1]-y)) and (t-time)%2==((now[0]-x)+(now[1]-y))%2:
        now = [x,y]
        time = t
    else:
        flag = False
        break
    
if flag:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
points = []
for i in range(n):
    points.append(list(map(int, input().split(" "))))

t_pre, x_pre, y_pre = 0, 0, 0
reachable = True
for point in points:
    t, x, y = map(int, point)
    diff_t = t - t_pre
    p = x + y
    p_pre = x_pre + y_pre
    move = 0
    for _ in range(diff_t):
        move += 1 if p > (p_pre + move) else -1

    if p - p_pre != move:
        reachable = False
        break

    t_pre, x_pre, y_pre = t, x, y


Fixed code:
n = int(input())
points = []
for i in range(n):
    points.append(list(map(int, input().split(" "))))

t_pre, x_pre, y_pre = 0, 0, 0
reachable = True
for point in points:
    t, x, y = map(int, point)
    diff_t = t - t_pre
    p = x + y
    p_pre = x_pre + y_pre
    move = 0
    for _ in range(diff_t):
        move += 1 if p > (p_pre + move) else -1

    if p - p_pre != move:
        reachable = False
        break

    t_pre, x_pre, y_pre = t, x, y

print("Yes" if reachable == True else "No")
Buggy code:
N = int(input())
tmp = [tuple(map(int,input().split())) for i in range(N)]

ct = 0
cx = 0
cy = 0
for t,x,y in tmp:
    dst = abs(cx - x) + abs(cy - y)
    if dst > t-ct or dst%2 != (t-ct)%2:
        print('NO')
        exit()
    ct,cx,cy = t,x,y

print('YES')

Fixed code:
N = int(input())

tmp = [tuple(map(int,input().split())) for i in range(N)]

ct = cx = cy = 0
for t,x,y in tmp:
    dst = abs(cx - x) + abs(cy - y)
    if dst > t-ct or dst%2 != (t-ct)%2:
        print('No')
        exit()
    ct,cx,cy = t,x,y
print('Yes')
Buggy code:
import sys
input()
pt, px, py = 0, 0, 0
for e in sys.stdin:
    ct, cx, cy = map(int, e.split())
    d = (ct - pt) - abs(cx - px) - abs(cy - py)
    if d < 0 or d % 2 == 1:
        print('No')
        break
    pt, px, py = ct, cx, cy
print('Yes')

Fixed code:
import sys
input()
pt, px, py = 0, 0, 0
for e in sys.stdin:
    ct, cx, cy = map(int, e.split())
    d = (ct - pt) - abs(cx - px) - abs(cy - py)
    if d < 0 or d % 2 == 1:
        print('No')
        break
    pt, px, py = ct, cx, cy
else:
    print('Yes')
Buggy code:
import sys
input()
e = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]
for (t0, a0, b0), (t1, a1, b1) in zip(e, e[1:]):
    d = (t1 - t0) - abs(a1 - a0) - abs(b1 - b0)
    if d < 0 or t % 2 == 1:
        print('No')
        exit()
print('Yes')

Fixed code:
import sys
input()
e = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]
for (t0, a0, b0), (t1, a1, b1) in zip(e, e[1:]):
    d = (t1 - t0) - abs(a1 - a0) - abs(b1 - b0)
    if d < 0 or d % 2 == 1:
        print('No')
        exit()
print('Yes')
Buggy code:
def solve():
    N = int(input())
    t_i, x_i, y_i = map(int, input().split())
    for i in range(N-1):
        t_j, x_j, y_j = map(int, input().split())
        dt = t_j - t_i
        dxy = x_i + x_j - y_i - y_j
        if (dt > (t_j - t_i)) | (dt < (t_i - t_j)):
            return "No"
        if ((t_i - t_j) % 2) != (dxy % 2):
            return "No"
    return "Yes"


if __name__ == "__main__":
    print(solve())


Fixed code:
def solve():
    N = int(input())
    t_i, x_i, y_i = 0, 0, 0
    for i in range(N):
        t_j, x_j, y_j = map(int, input().split())
        dt = t_j - t_i
        dxy = x_j - x_i + y_j - y_i
        if (dxy < -dt) | (dxy > dt):
            return "No"
        if ((t_i - t_j) % 2) != (dxy % 2):
            return "No"
        t_i, x_i, y_i = t_j, x_j, y_j
    return "Yes"


if __name__ == "__main__":
    print(solve())