qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
T = []
XY = []


def f(x1, y1, x2, y2):
    return abs(x1 - x2) + abs(y1 - y2)


print('No')
exit()

cx, cy = 0, 0
ct = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    d = f(cx, cy, x, y)
    if d > t - ct:
        print('No')
        exit()
    if (t - ct - d) % 2 != 0:
        print('No')
        exit()
print('Yes')


Fixed code:
N = int(input())
T = []
XY = []


def f(x1, y1, x2, y2):
    return abs(x1 - x2) + abs(y1 - y2)


cx, cy = 0, 0
ct = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    d = f(cx, cy, x, y)
    # print(f'{ct=}, {t=}, {d=}')
    if d > t - ct:
        print('No')
        exit()
    if (t - ct - d) % 2 != 0:
        print('No')
        exit()
    cx, cy = x, y
    ct = t
print('Yes')
Buggy code:
N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=x+y-p-q
  e=t-r
  if a<=e:
    if (e-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p=x
  q=y
  r=t
print(flag)N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=x+y-p-q
  e=t-r
  if a<=e:
    if (e-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p=x
  q=y
  r=t
print(flag)

Fixed code:
N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=abs(x-p)+abs(y-q)
  e=t-r
  if a<=e:
    if (e-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p,q,r=x,y,t
print(flag)
Buggy code:
N = int(input())
flag = True
for i in range(N):

    t,x,y = map(int, input().split(" "))

    if x+y>t or t%2 !=(x+y)%2:
        flag=False
        break

print("Yes" if flag else "no")

Fixed code:

N = int(input())
flag = True
for i in range(N):

    t,x,y = map(int, input().split())

    if x+y>t or t%2 !=(x+y)%2:
        flag=False
        break

print("Yes" if flag else "No")
Buggy code:
n = int(input())

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

can = True
for i in range(len(points)-1):
    move_n = points[i+1][0] - points[i][0]
    dist = abs(points[i+1][1] - points[i][1]) + abs(points[i+1][2] - points[i][2])
    if move_n < dist or dist % 2 != move_n % 2:
        can = False 
        break

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

Fixed code:
n = int(input())
points = []
points.append([0, 0, 0])
for i in range(n):
    points.append([i for i in map(int, input().split())])
# print(points)
can = True
for i in range(len(points)-1):
    move_n = points[i+1][0] - points[i][0]
    dist = abs(points[i+1][1] - points[i][1]) + abs(points[i+1][2] - points[i][2])
    if move_n < dist or dist % 2 != move_n % 2:
        can = False 
        break

if can:
    print('Yes')
else:
    print('No')
Buggy code:
import sys

def main():
    def iterate_position():
        yield list(map(int, sys.stdin.readline().rstrip().split()))

    N = int(sys.stdin.readline().rstrip())
    now_position = [0, 0, 0]
    for x in range(N):
        try:
            next_position = next(iterate_position())
            dt = next_position[0] - now_position[0]
            dx = next_position[1] - now_position[1]
            dy = next_position[2] - now_position[2]
            if dt < abs(dx) + abs(dy):
                print("No")
                sys.exit()
            check = dt - (dx + dy)
            if check % 2 == 1:
                print("No")
                sys.exit()
            now_position = next_position
        except StopIteration:
            print("No")
    else:
        print("No")

if __name__ == '__main__':
    main()

Fixed code:
import sys
import math

def main():
    def iterate_position():
        yield list(map(int, sys.stdin.readline().rstrip().split()))

    N = int(sys.stdin.readline().rstrip())
    now_position = [0, 0, 0]
    for x in range(N):
        try:
            next_position = next(iterate_position())
            dt = next_position[0] - now_position[0]
            dx = next_position[1] - now_position[1]
            dy = next_position[2] - now_position[2]
            if dt < abs(dx) + abs(dy):
                print("No")
                sys.exit()
            check = dt - (dx + dy)
            if check % 2 == 1:
                print("No")
                sys.exit()
            now_position = next_position
        except StopIteration:
            print("No")
    else:
        print("Yes")

if __name__ == '__main__':
    main()
Buggy code:
jN = int(input())

M = []
for _ in range(N):
  t, x, y = map(int, input().split())
  M.append([t, x, y])

current = [0, 0, 0]
can = True
for m in M:
  dt = m[0] - current[0]
  dist = abs(m[1] - current[1]) + abs(m[2] - current[2])
  if (dist > dt):
    can = False
    break
  else:
    if (dist % 2 != dt % 2):
      can = False
      break
  current = m

result = "Yes" if (can == True) else "No"
print(result)

Fixed code:
N = int(input())

M = []
for _ in range(N):
  t, x, y = map(int, input().split())
  M.append([t, x, y])

current = [0, 0, 0]
can = True
for m in M:
  dt = m[0] - current[0]
  dist = abs(m[1] - current[1]) + abs(m[2] - current[2])
  if (dist > dt):
    can = False
    break
  else:
    if (dist % 2 != dt % 2):
      can = False
      break
  current = m

result = "Yes" if (can == True) else "No"
print(result)
Buggy code:
# coding: utf-8
N = int(input())
T = [[0 for i in range(3)] for i in range(N+1)]
for i in range(1,N+1):
  input_lines = input().split()
  T[i][0] = int(input_lines[0])
  T[i][1] = int(input_lines[1])
  T[i][2] = int(input_lines[2])
T[0][0] = 0
T[0][1] = 0
T[0][2] = 0

for i in range(1,N+1):
  t = T[i][0] - T[i-1][0]
  d = abs(T[i][1] - T[i-1][1]) + abs(T[i][2] - T[i-1][2])
  if (t-d)%2 !=0:
    print("No")
    break
  if i == N:
    print("Yes")
    

Fixed code:
# coding: utf-8
N = int(input())
T = [[0 for i in range(3)] for i in range(N+1)]
for i in range(1,N+1):
  input_lines = input().split()
  T[i][0] = int(input_lines[0])
  T[i][1] = int(input_lines[1])
  T[i][2] = int(input_lines[2])
T[0][0] = 0
T[0][1] = 0
T[0][2] = 0

for i in range(1,N+1):
  t = T[i][0] - T[i-1][0]
  d = abs(T[i][1] - T[i-1][1]) + abs(T[i][2] - T[i-1][2])
  if (t-d)%2 ==1:
    print("No")
    break
  if t < d:
    print("No")
    break
  if i == N:
    print("Yes")
Buggy code:
N = int(input())
flg = True
now,posx,posy=0,0,0
while flg==True:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = n
    posx = x
    posy = y
if flg:
  print('Yes')

Fixed code:
N = int(input())
flg = True
cnt,now,posx,posy=0,0,0,0
while cnt < N and flg:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = t
    posx = x
    posy = y
    cnt += 1
if flg:
  print('Yes')
Buggy code:
n=int(input())
T,X,Y=0,0,0

a='Yes'
for i in range(n):
    t,x,y=map(int,input().split())
    if abs(s-X)+abs(y-Y)>t-T or t%2!=(x+y)%2:
        a='No'
        break
    T,X,Y=t,x,y
print(a)


Fixed code:
n=int(input())
T,X,Y=0,0,0

a='Yes'
for i in range(n):
    t,x,y=map(int,input().split())
    if abs(x-X)+abs(y-Y)>t-T or t%2!=(x+y)%2:
        a='No'
        break
    T,X,Y=t,x,y
print('{}'.format(a))
Buggy code:
n=int(input())
T,X,Y=0,0,0

for i in range(n):
    t,x,y=map(int,input().split())
    if abs(s-X)+abs(y-Y)>t-T or t%2!=(x+y)%2:
        print('No')
        break
    T,X,Y=t,x,y
print('Yes')

Fixed code:
n=int(input())
T,X,Y=0,0,0

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

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

Fixed code:
N = int(input())
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    if abs(x-X)+abs(y-Y) <= t-T and t % 2 == (x+y) % 2:
        count += 1
    T, X, Y = t, x, y
if count==N:
    print('Yes')
else:
    print('No')
Buggy code:
#coding:utf-8
t = 0
n = int(input())
x, y = 0, 0
for _ in range(n):
    t_i, x_i, y_i = map(int, input().split(' '))
    t_d = t_i - t
    x_d = abs(x_i - x)
    y_d = abs(y_i - y)
    
    t, x, y = t_i, x_i, y_i
    if x_d + y_d <= t_d and (x_d + y_d) % 2 == t_d % 2:
        continue
    else:
        break
else:
    print('Yes')

Fixed code:
#coding:utf-8
t = 0
n = int(input())
x, y = 0, 0
for _ in range(n):
    t_i, x_i, y_i = map(int, input().split(' '))
    t_d = t_i - t
    x_d = abs(x_i - x)
    y_d = abs(y_i - y)
    
    t, x, y = t_i, x_i, y_i
    if x_d + y_d <= t_d and (x_d + y_d) % 2 == t_d % 2:
        continue
    else:
        print('No')
        break
else:
    print('Yes')
Buggy code:
for i in range(int(input())):
 t,x,y=map(int,input().split())
 if i:
  l=abs(x-p)+abs(y-q)
  if(l-t-s)%2or l>t-s:print("No");break
 s,p,q=t,x,y
else:print("Yes")

Fixed code:
s=p=q=0
for i in range(int(input())):
 t,x,y=map(int,input().split())
 l=abs(x-p)+abs(y-q)
 if(l-t-s)%2or l>t-s:print("No");break
 s,p,q=t,x,y
else:print("Yes")
Buggy code:
can_reach = True
for i in range(N):
  next_T, next_X, next_Y = map(int, input().split())
  
  z = next_T - T - abs(X - next_X) - abs(Y - next_Y)
  if z >= 0 and z % 2 == 0:
    T, X, Y = next_T, next_X, next_Y
  else:
    can_reach = False
    break
    
if can_reach:
  print('Yes')
else:
  print('No')

Fixed code:
N = int(input())
T, X, Y = 0, 0, 0

can_reach = True
for i in range(N):
  next_T, next_X, next_Y = map(int, input().split())
  
  z = next_T - T - abs(X - next_X) - abs(Y - next_Y)
  if z >= 0 and z % 2 == 0:
    T, X, Y = next_T, next_X, next_Y
  else:
    can_reach = False
    break
    
if can_reach:
  print('Yes')
else:
  print('No')
Buggy code:
n=int(input())
nx=0
ny=0
nt=0
for i in range(n):
  t,x,y=map(int,input().split())
  k=abs(x-nx)+abs(y-ny)
  if k>nt-t:
    print("No")
    exit()
  elif k%2 != (nt-t)%2:
    print("No")
    exit()
  nt,nx,ny=t,x,y
print("Yes")

Fixed code:
n=int(input())
nx=0
ny=0
nt=0
for i in range(n):
  t,x,y=map(int,input().split())
  k=abs(x-nx)+abs(y-ny)
  if k>t-nt:
    print("No")
    exit()
  elif k%2 != (t-nt)%2:
    print("No")
    exit()
  nt,nx,ny=t,x,y
print("Yes")
Buggy code:
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
for n in range(N):
    t[n], x[n], y[n] = map(int, input().split())

ans = "Yes"
for n in range(N-1):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt > dist) or (dt % 2 != dist % 2):
        ans = "No"

print(ans)

Fixed code:
N = int(input())
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
t[0] = 0
x[0] = 0
y[0] = 0
for n in range(N):
  n = n+1
  t[n], x[n], y[n] = map(int, input().split())

ans = "Yes"
for n in range(N):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt < dist) or ((dt - dist) % 2 == 1):
        ans = "No"

print(ans)
Buggy code:
n = int(input())
A = []
A.append([0, 0, 0])
for i in range(n):
    A.append([int(i) for i in input().split()])
ans = 'Yes'

for i in range(n - 1):
    dist = abs(A[i][1] - A[i + 1][1]) + abs(A[i][2] - A[i + 1][2])
    if (A[i + 1][0] - dist) % 2 == 1:
        ans = 'No'
        break
    
print(ans)

Fixed code:
n = int(input())
A = []
A.append([0, 0, 0])
for i in range(n):
    A.append([int(i) for i in input().split()])
ans = 'Yes'

for i in range(n):
    dist = abs(A[i][1] - A[i + 1][1]) + abs(A[i][2] - A[i + 1][2])
    if (A[i + 1][0] - A[i][0])  < dist:
        ans = 'No'
        break
    if ((A[i + 1][0] - A[i][0]) - dist) % 2 == 1:
        ans = 'No'
        break
    
print(ans)
Buggy code:
N = int(input())
T = []
X = []
Y = []
T[0] = X[0] = Y[0] = 0
for i in range(N):
    t,x,y = map(int,input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

flag = True
for i in range(N):
    time = T[i+1]-T[i]
    dist = abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i])
    if time < dist or (dist%2!=time%2):
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')


Fixed code:
N = int(input())
T = [0]
X = [0]
Y = [0]
for i in range(N):
    t,x,y = map(int,input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

flag = True
for i in range(N):
    time = T[i+1]-T[i]
    dist = abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i])
    if time < dist or (dist%2!=time%2):
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')
Buggy code:
n = int(input())
ans = "Yes"
now_x = 0
now_y = 0
now_t = 0

for i in range(n):
  x,y,t = map(int,input().split())
  
  if abs(now_x-x)+abs(now_y-y) < (t-now_t):
    ans = "No"
    break
    
  if (abs(now_x-x)+abs(now_y-y)-(t-now_t))%2 == 1:
    ans = "No"
    break
    
  now_x = x
  now_y = y
  now_t = t
    
print(ans)

Fixed code:
n = int(input())
ans = "Yes"
now_x = 0
now_y = 0
now_t = 0

for i in range(n):
  t,x,y = map(int,input().split())
  
  if abs(now_x-x)+abs(now_y-y) > (t-now_t):
    ans = "No"
    break
    
  if (abs(now_x-x)+abs(now_y-y)-(t-now_t))%2 == 1:
    ans = "No"
    break
    
  now_x = x
  now_y = y
  now_t = t
    
print(ans)
Buggy code:
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = ((x - self.now_x) + (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if (distance - duration) % 2 == 0:
            return False

        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')


Fixed code:
# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = ((x - self.now_x) + (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if distance % 2 != duration % 2:
            return False

        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')
Buggy code:
N = int(input())
T,X,Y = [0],[0],[0]
a = 1
for n in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

for m in range(N):
    dt = T[m+1]-T[m]
    ds = abs(X[m+1]-X[m]) + abs(Y[m+1]-Y[m])
    if dt < ds:
        a = 0
    if dt%2 != ds%2:
        a = 0

if a:
    print("YES")
else:
    print("NO")

Fixed code:
N = int(input())
T,X,Y = [0],[0],[0]
a = 1
for n in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

for m in range(N):
    dt = T[m+1]-T[m]
    ds = abs(X[m+1]-X[m]) + abs(Y[m+1]-Y[m])
    if dt < ds:
        a = 0
    if dt%2 != ds%2:
        a = 0

if a:
    print("Yes")
else:
    print("No")
Buggy code:
num = int( input())
check = 0
step_b = 0
x_b = 0
y_b = 0
for i in range(num):
    step ,x ,y = map(int,input().split())
    if ((x-x_b)+(y-y_b) - (step-step_b)  > 0) or (((x-x_b)+(y-y_b) - (step - step_b))%2 == 1 ) :
        check = 1
        break
    print(((x-x_b)+(y-y_b) - (step - step_b)))
    x_b = x
    y_b = y
    step_b = step
if check == 0:
    print('Yes')
else:
    print('No')

Fixed code:
#C - Traveling
num = int( input())
check = 0
step_b = 0
x_b = 0
y_b = 0
for i in range(num):
    step ,x ,y = map(int,input().split())
    if ((x-x_b)+(y-y_b) - (step-step_b)  > 0) or (((x-x_b)+(y-y_b) - (step - step_b))%2 == 1) :
        check = 1
        break
    x_b = x
    y_b = y
    step_b = step
if check == 0:
    print('Yes')
else:
    print('No')
Buggy code:
n=int(input())
tt,xx,yy=0,0,0
ans=0
for i in range(n):
  t,x,y=map(int,input().split())
  if (x-xx+y-yy)%2>0:
    ans=1
  if x-xx+y-yy>t-tt:
    ans=1
  tt,xx,yy=t,x,y
print("YNeos"[ans::2])

Fixed code:
n=int(input())
tt,xx,yy=0,0,0
ans=0
for i in range(n):
  t,x,y=map(int,input().split())
  if (x-xx+y-yy)%2!=(t-tt)%2:
    ans=1
  if x-xx+y-yy>t-tt:
    ans=1
  tt,xx,yy=t,x,y
print("YNeos"[ans::2])
Buggy code:
N = int(input())
pre_x = 0
pre_y = 0
for i in range(N):
    t,x,y = map(int, input().split())
    if (t%2)+(x+y)%2 == 1 or x+y > t or abs(pre_x-x) > 1 or abs(pre_y-y) > 1:
        print("No")
        exit()
    pre_x = x
    pre_y = y
print("Yes")

Fixed code:
N = int(input())
pre_t = 0
pre_x = 0
pre_y = 0
for i in range(N):
    t,x,y = map(int, input().split())
    if (t%2)+(x+y)%2 == 1 or x+y > t or abs(pre_x-x)+abs(pre_y-y) > (t-pre_t):
        print("No")
        exit()
    pre_t = t
    pre_x = x
    pre_y = y
print("Yes")
Buggy code:
manhattan = lambda x,y: abs(x[0] - y[0]) + abs(x[1] - y[1])

def solve():
    n = int(input())
    table = [[0, 0, 0]] + list(map(int, input().rstrip("\n").split()) for i in range(n))

    for i in range(1, len(table)):
        t = (table[i][0] - table[i - 1][0] - manhattan(table[i - 1][1:], table[i][1:]))
        if t < 0 or t % 2 != 0:
            return "No"
    return "Yes"

print(solve())


Fixed code:
manhattan = lambda x,y: abs(x[0] - y[0]) + abs(x[1] - y[1])

def solve():
    n = int(input())
    table = [[0, 0, 0]] + [list(map(int, input().rstrip("\n").split())) for i in range(n)]

    for i in range(1, len(table)):
        t = (table[i][0] - table[i - 1][0] - manhattan(table[i - 1][1:], table[i][1:]))
        if t < 0 or t % 2 != 0:
            return "No"
    return "Yes"

print(solve())
Buggy code:
N = int(input())
All = [list(map(int, input().split())) for _ in range(N)]
pre_x = 0
pre_y = 0
pre_t = 0

can = True
for n in range(N):
    can2 = False
    T = All[n][0] - pre_t
    d = abs(All[n][1] - All[n][2])
    if d <= T and T % 2 ==  d % 2:
        can2 = True

    if can2 == False:
        can = False
        break

    pre_t = All[n][0]
    pre_x = All[n][1]
    pre_y = All[n][2]

if can == True:
    print("Yes")
else:
    print("No")

Fixed code:
N = int(input())
All = [list(map(int, input().split())) for _ in range(N)]
pre_x = 0
pre_y = 0
pre_t = 0

can = True
for n in range(N):
    can2 = False
    T = All[n][0] - pre_t
    d = abs(All[n][1] - pre_x) + abs(All[n][2] - pre_y)
    # print(T, d)
    if d <= T and T % 2 ==  d % 2:
        can2 = True

    if can2 == False:
        can = False
        break

    pre_t = All[n][0]
    pre_x = All[n][1]
    pre_y = All[n][2]

if can == True:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(iput())
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")

Fixed code:
n = int(input())
for _ 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:
def main():
    N = int(input())
    l = [[int(s) for s in input().split()] for n in range(N)]
    can = True
    now = [0, 0, 0]
    for i in range(N):
        pos = l[i]
        d = abs(pos[1] - now[1]) + abs(pos[2] - now[2])
        t = pos[0] - now[0]
        if d % 2 != t % 2 or d > t:
            can = False
        now = pos
    if can:
        print('YES')
    else:
        print('NO')


if __name__ == '__main__':
    main()


Fixed code:
def main():
    N = int(input())
    l = [[int(s) for s in input().split()] for n in range(N)]
    can = True
    now = [0, 0, 0]
    for i in range(N):
        pos = l[i]
        d = abs(pos[1] - now[1]) + abs(pos[2] - now[2])
        t = pos[0] - now[0]
        if d % 2 != t % 2 or d > t:
            can = False
        now = pos
    if can:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
Buggy code:
n = int(input())
st, sx, sy = list(map(int, input().split()))

is_reach = True

for i in range(0, n):
    gt, gx, gy = list(map(int, input().split()))
    t = gt - sy
    dist = abs(gx - sx) + abs(gy - sy)

    if not(t >= dist and (t - dist) % 2 == 0):
        is_reach = False
        break


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


Fixed code:
n = int(input())
st, sx, sy = 0, 0, 0

is_reach = True

for i in range(0, n):
    gt, gx, gy = list(map(int, input().split()))
    t = gt - sy
    dist = abs(gx - sx) + abs(gy - sy)

    if not(t >= dist and (t - dist) % 2 == 0):
        is_reach = False
        break


if is_reach:
    print("Yes")
else:
    print("No")
Buggy code:
N=int(input())

t_,x_,y_=(0,0,0)

ans = 'Yes'
for n in range(N):
    t,x,y = list(map(int,input().split()))
    T = t-t_
    manhattan_dist = abs(x-x_)+abs(y-y_)
    print(T,manhattan_dist)
    if T >= manhattan_dist and manhattan_dist%2 == T%2:
        pass
    else:
        ans='No'
        
    t_,x_,y_ = t,x,y

print(ans)

Fixed code:
N=int(input())

t_,x_,y_=(0,0,0)

ans = 'Yes'
for n in range(N):
    t,x,y = list(map(int,input().split()))
    T = t-t_
    manhattan_dist = abs(x-x_)+abs(y-y_)
#     print(T,manhattan_dist)
    if T >= manhattan_dist and manhattan_dist%2 == T%2:
        pass
    else:
        ans='No'
        
    t_,x_,y_ = t,x,y

print(ans)
Buggy code:
n = int(input())
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(n):
    t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
    if t[i+1] - t[i] < abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) or (t[i] % 2 == (abs(x[i]) + abs(y[i])) % 2):
        print('No')
        exit()
print('Yes')


Fixed code:
n = int(input())
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(n):
    t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
    if t[i+1] - t[i] < abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) or (t[i+1] % 2 != (abs(x[i+1]) + abs(y[i+1])) % 2):
        print('No')
        exit()
print('Yes')
Buggy code:
N = int(input())
t_before = 0
x_before = 0
y_before = 0

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

def judge(t_plus, x_diff, y_diff):
    distance = abs(x_diff) + abs(y_diff)
    if (t_plus % 2) != (distance % 2):
        return False
    if distance > t_plus:
        return False 
    return True

for i in range(0,N):
    t, x, y = travel_list[i]
    result = judge(t_plus=t-t_before, x_diff=x-x_before, y_diff=y-y_before)
    if result:
        t_before = t
        x_before = x
        y_before = y
    if not result:
        print("No")
        break
else:
    print("YES")



Fixed code:
N = int(input())
t_before = 0
x_before = 0
y_before = 0

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

def judge(t_plus, x_diff, y_diff):
    distance = abs(x_diff) + abs(y_diff)
    if (t_plus % 2) != (distance % 2):
        return False
    if distance > t_plus:
        return False 
    return True

is_found = False

for i in range(N):
    t, x, y = travel_list[i]
    result = judge(t_plus=t-t_before, x_diff=x-x_before, y_diff=y-y_before)
    if result:
        t_before = t
        x_before = x
        y_before = y
    else:
        break
else:
    is_found = True
if is_found:
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
T,X,Y =0,0,0
count = 0
for i in range(N):
    t,x,y = map(int,input().split())
    if abs(t-T) >= abs((x+y)-(X+Y)): count+=1
T,X,Y=t,x,y        
print('Yes' if count==N else 'No' )        



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