qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
t_x_y = [0]*N
for n in range(N):
    t_x_y[n] = [int(x) for x in input().split()]
    
can_flag = 1
for t, x, y in t_x_y: 
    if (t%2 == (x+y)%2) & (x+y)<=t:
        continue
    else:
        can_flag=0
        break

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

Fixed code:
N = int(input())
t_x_y = [0]*N
for n in range(N):
    t_x_y[n] = [int(x) for x in input().split()]
    
can_flag = 1
for t, x, y in t_x_y: 
    if (t%2 == (x+y)%2) & ((x+y)<=t):
        continue
    else:
        can_flag=0
        break

if can_flag:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
travel_plan = list(tuple(map(int, input().split())))
travel_plan = [(0, 0, 0)] + travel_plan
for i in range(n+1):
    t1, x1, y1 = travel_plan[i][0] + travel_plan[i][1] + travel_plan[i][2]
    t2, x2, y2 = travel_plan[i+1][0] + travel_plan[i+1][1] + travel_plan[i+1][2]
    x = abs(x1 - x2)
    y = abs(y1 - y2)
    t = t2 - t1
    if x + y < t or (x + y + t) % 2:
        print("No")
        exit()
print("Yes")

Fixed code:
n = int(input())
travel_plan = [tuple(map(int, input().split())) for i in range(n)]
travel_plan = [(0, 0, 0)] + travel_plan

for i in range(n):
    t1 = travel_plan[i][0]
    x1 = travel_plan[i][1]
    y1 = travel_plan[i][2]
    t2 = travel_plan[i+1][0]
    x2 = travel_plan[i+1][1]
    y2 = travel_plan[i+1][2]
    x = abs(x1 - x2)
    y = abs(y1 - y2)
    t = t2 - t1
    if x + y > t or (x + y) % 2 != t % 2:
        print("No")
        exit()
print("Yes")
Buggy code:
n = int(input())
travel_plan = [tuple(map(int, input().split())) for i in range(n)]
travel_plan = [(0, 0, 0)] + travel_plan

for i in range(n+1):
    t1 = travel_plan[i][0]
    x1 = travel_plan[i][1]
    y1 = travel_plan[i][2]
    t2 = travel_plan[i+1][0]
    x2 = travel_plan[i+1][1]
    y2 = travel_plan[i+1][2]
    x = abs(x1 - x2)
    y = abs(y1 - y2)
    t = t2 - t1
    if x + y < t or (x + y + t) % 2:
        print("No")
        exit()
print("Yes")

Fixed code:
n = int(input())
travel_plan = []
for i in range(n):
    travel_plan.append(tuple(map(int, input().split())))
travel_plan = [(0, 0, 0)] + travel_plan

for i in range(n):
    t1 = travel_plan[i][0]
    x1 = travel_plan[i][1]
    y1 = travel_plan[i][2]
    t2 = travel_plan[i+1][0]
    x2 = travel_plan[i+1][1]
    y2 = travel_plan[i+1][2]
    x = abs(x1 - x2)
    y = abs(y1 - y2)
    t = t2 - t1
    if x + y > t or (x + y) % 2 != t % 2:
        print("No")
        exit()
print("Yes")
Buggy code:
N = int(input())
t_bef = 0
x_bef = 0
y_bef = 0

flag = False
for i in range(N):
    t, x, y = map(int, input().split())
    t_diff = t - t_bef
    dist = abs(x - x_bef) + abs(y - y_bef)
    print(dist)
    if (t_diff - dist)%2 != 0 or dist > t_diff:
        flag = True
    else:
        t_bef = t
        x_bef = x
        y_bef = y

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

Fixed code:
N = int(input())
t_bef = 0
x_bef = 0
y_bef = 0

flag = False
for i in range(N):
    t, x, y = map(int, input().split())
    t_diff = t - t_bef
    dist = abs(x - x_bef) + abs(y - y_bef)
    if (t_diff - dist)%2 != 0 or dist > t_diff:
        flag = True
    else:
        t_bef = t
        x_bef = x
        y_bef = y

if flag:
    print("No")
else:
    print("Yes")
Buggy code:
# ABC_086_C_Traveling
N = int(input())
txy = [map(int, input().split()) for _ in range(N)]
t, x, y = [list(i) for i in zip(*txy)]
t.insert(0, 0)
x.insert(0, 0)
y.insert(0, 0)
can = True
distX = [0]*(N)
distY = [0]*(N)
dist = [0]*(N)
time = [0]*(N)

# distance
for i in range(N):
	distX[i] = abs(x[i]-x[i+1])
	distY[i] = abs(y[i]-y[i+1])
	dist[i] = distX[i]+distY[i]
	time[i] = t[i+1]-t[i]
	if dist[i] > time[i]:
		can = False
		break

# parity
for i in range(N):
	if (dist[i]-time[i]) % 2 == 1:
		can = False
		break

if can == True:
	print("YES")
else:
	print("NO")


Fixed code:
# ABC_086_C_Traveling
N = int(input())
txy = [map(int, input().split()) for _ in range(N)]
t, x, y = [list(i) for i in zip(*txy)]
t.insert(0, 0)
x.insert(0, 0)
y.insert(0, 0)
can = True
distX = [0]*(N)
distY = [0]*(N)
dist = [0]*(N)
time = [0]*(N)

# distance
for i in range(N):
	distX[i] = abs(x[i]-x[i+1])
	distY[i] = abs(y[i]-y[i+1])
	dist[i] = distX[i]+distY[i]
	time[i] = t[i+1]-t[i]
	if dist[i] > time[i]:
		can = False
		break

# parity
for i in range(N):
	if (dist[i]-time[i]) % 2 == 1:
		can = False
		break

if can == True:
	print("Yes")
else:
	print("No")
Buggy code:
import sys
N = int(input())
T = []
for _ in range(N):
	T.append(list(map(int,input().split())))

#--------------------------------------------
now = [0,0]
now_time = 0
for i in range(N):
  left_time = T[i][0] - now_time
  target = [T[i][1],T[i][2]]
  distance = abs(T[i][1]-now[0]) + abs(T[i][2]-now[1])
  if distance <= left_time and distance % 2 == left_time % 2:
    now_time = T[i][0]
    now = target
    
  else:
    print("NO")
    sys.exit()

print("YES")


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

#--------------------------------------------
now = [0,0]
now_time = 0
for i in range(N):
  left_time = T[i][0] - now_time
  target = [T[i][1],T[i][2]]
  distance = abs(T[i][1]-now[0]) + abs(T[i][2]-now[1])
  if distance <= left_time and distance % 2 == left_time % 2:
    now_time = T[i][0]
    now = target
    
  else:
    print("No")
    sys.exit()

print("Yes")
Buggy code:
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]

now = [0, 0]
for p in txy:
    d = p[1] - now[0] + p[2] - now[1]
    if p[0] % 2 == d % 2:
        continue
    else:
        print("No")
        exit()

print("Yes")


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

now = [0, 0]
for p in txy:
    d = abs(p[1] - now[0]) + abs(p[2] - now[1])
    if p[0] % 2 == d % 2 and p[0] >= d:
        continue
    else:
        print("No")
        exit()

print("Yes")
Buggy code:
N=int(input())
a=[list(map(int,input().split())) for _ in range(N)]
dp=[[0,0] for _ in range(N)]
for i in range(N):
  t=a[i][0]-dp[i-1][1]
  x=a[i][1]
  y=a[i][2]
  if t>=x+y and t%2==(x+y+dp[i-1][1])%2 and dp[i-1][0]==1:
    dp[i][0]=1
    dp[i][1]=a[i][0]
if dp[N-1][0]==1:print("Yes")
else:print("No")

Fixed code:
N=int(input())
a=[list(map(int,input().split())) for _ in range(N)]
dp=[[0,0] for _ in range(N+1)]
dp[0][0]=1
f=True
for i in range(1,N+1):
  t=a[i-1][0]-dp[i-1][1]
  x=a[i-1][1]
  y=a[i-1][2]
  if t>=x+y-dp[i-1][0] and t%2==(x+y+dp[i-1][1])%2:
    dp[i][0]=x+y
    dp[i][1]=a[i-1][0]
  else:
    f=False
    break
if f:print("Yes")
else:print("No")
Buggy code:
N = int(input())
points = [tuple(map(int, input().split())) for i in range(N)]
points = [(0,0,0)] + points
for idx in range(1,N):
  time_diff = points[idx][0] - points[idx-1][0]
  x_diff = abs(points[idx][1] - points[idx-1][1])
  y_diff = abs(points[idx][2] - points[idx-1][2])
  
  if time_diff < x_diff + y_diff or (time_diff - x_diff - y_diff) % 2 == 1:
    print('No')
    break
    
print('Yes')

Fixed code:
N = int(input())
points = [tuple(map(int, input().split())) for i in range(N)]
points = [(0,0,0)] + points
for idx in range(1,N + 1):
  time_diff = points[idx][0] - points[idx-1][0]
  x_diff = abs(points[idx][1] - points[idx-1][1])
  y_diff = abs(points[idx][2] - points[idx-1][2])
  
  if (time_diff < x_diff + y_diff) or (time_diff - x_diff - y_diff) % 2 == 1:
    print('No')
    exit()
    
print('Yes')
Buggy code:
n = int(input())
_ = [list(map(int, input().split())) for _ in range(n)]

dt = [0] * n
dx = [0] * n
dy = [0] * n

for i in range(n):
    dt[i] = _[i + 1][0] - _[i][0]
    dx[i] = _[i + 1][1] - _[i][1]
    dy[i] = _[i + 1][2] - _[i][2]

ans = "Yes"

for i in range(n):
    man_d = abs(dx[i]) + abs(dy[i])
    if not (dt[i] >= man_d and (dt [i]- man_d) % 2 == 0):
        ans = "No"

print(ans)

Fixed code:
n = int(input())
_ = [list(map(int, input().split())) for _ in range(n)]
_.insert(0, [0, 0, 0])

dt = [_[i + 1][0] - _[i][0] for i in range(n)]
dx = [_[i + 1][1] - _[i][1] for i in range(n)]
dy = [_[i + 1][2] - _[i][2] for i in range(n)]

ans = "Yes"

for i in range(n):
    man_d = abs(dx[i]) + abs(dy[i])
    if not (dt[i] >= man_d and (dt [i]- man_d) % 2 == 0):
        ans = "No"

print(ans)
Buggy code:
N = int(input())

T = 0
X = Y = 0
Flag = 'Even'

for n in range(N):
    Ti,Xi,Yi = [int(x) for x in input().split()]
    if abs(Xi-X) + abs(Yi-Y) > (Ti-T):
        print('NO')
        break
    else:
        if Flag == 'Even':
            if (Ti-T) % 2 == 0:#Even and Even = Even
                if (Xi + Yi) % 2 == 0:
                    X = Xi
                    Y = Yi
                    T = Ti
                    continue
                else:
                    print('NO')
                    break
            else:#Even and Odd = Odd
                if (Xi + Yi) % 2 == 0:
                    print('NO')
                    break
                else:
                    X = Xi
                    Y = Yi
                    T = Ti
                    Flag = 'Odd'
                    continue
        else:#Odd
            if (Ti - T) % 2 == 0: #Odd and Even = Odd
                if(Xi + Yi)% 2 == 0:
                    print('No')
                    break
                else:
                    X = Xi
                    Y = Yi
                    T = Ti
                    continue
            else: #Odd and Odd = Even
                if(Xi + Yi) % 2 == 0:
                    X = Xi
                    Y = Yi
                    T = Ti
                    Flag = 'Even'
                    continue
                else:
                    print('NO')
                    break
else:
    print('YES')

Fixed code:
N = int(input())

T = 0
X = Y = 0
Flag = 'Even'

for n in range(N):
    Ti,Xi,Yi = [int(x) for x in input().split()]
    if abs(Xi-X) + abs(Yi-Y) > (Ti-T):
        print('No')
        break
    else:
        if Flag == 'Even':
            if (Ti-T) % 2 == 0:#Even and Even = Even
                if (Xi + Yi) % 2 == 0:
                    X = Xi
                    Y = Yi
                    T = Ti
                    continue
                else:
                    print('No')
                    break
            else:#Even and Odd = Odd
                if (Xi + Yi) % 2 == 0:
                    print('No')
                    break
                else:
                    X = Xi
                    Y = Yi
                    T = Ti
                    Flag = 'Odd'
                    continue
        else:#Odd
            if (Ti - T) % 2 == 0: #Odd and Even = Odd
                if(Xi + Yi)% 2 == 0:
                    print('No')
                    break
                else:
                    X = Xi
                    Y = Yi
                    T = Ti
                    continue
            else: #Odd and Odd = Even
                if(Xi + Yi) % 2 == 0:
                    X = Xi
                    Y = Yi
                    T = Ti
                    Flag = 'Even'
                    continue
                else:
                    print('No')
                    break
else:
    print('Yes')
Buggy code:
n = int(input())
d = [list(map(int, input().split())) for i in range(n)]

t, x, y = 0, 0, 0

flag = True
for ti, xi, yi in d:
  if ti > x + y:
    if (ti - t) % 2 != (abs(xi - x) + abs(yi - y)) % 2:
    	flag = False
    	break
    t = ti
    x = xi
    y = yi
    
  else:
    flag = False
    break
    
print("Yes" if flag else "No")

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

t, x, y = 0, 0, 0

flag = True
for ti, xi, yi in d:
  if ti >= xi + yi:
    if (ti - t) % 2 != (abs(xi - x) + abs(yi - y)) % 2:
    	flag = False
    	break
    t = ti
    x = xi
    y = yi
    
  else:
    flag = False
    break
    
print("Yes" if flag else "No")
Buggy code:
n = int(input())
x = 0
y = 0
t = 0
a = 0
def trav(a,b,c,d,e,f):
    if abs(a-b) + abs(c-d) <= e - f and ((a-b) % 2 + (c-d) % 2)%2 == (e-f) % 2:
        return 0
    else:
        return 1
for i in range(n):
    tn,xn,yn = map(int,input().split())
    if trav(xn,x,yn,y,tn,t) == 0:
        a = 0
        x = xn
        y = yn
        t = tn
    else:
        a = 1
if a == 0:
    print("Yes")
else:
    print("No")

Fixed code:
n = int(input())
x = 0
y = 0
t = 0
a = 0
def trav(a,b,c,d,e,f):
    if abs(a-b) + abs(c-d) <= e - f and ((a-b) % 2 + (c-d) % 2)%2 == (e-f) % 2:
        return 0
    else:
        return 1
for i in range(n):
    tn,xn,yn = map(int,input().split())
    if trav(xn,x,yn,y,tn,t) == 0:
        x = xn
        y = yn
        t = tn
    else:
        a = 1
if a == 0:
    print("Yes")
else:
    print("No")
Buggy code:
N=int(input())

t_before=0
x_before=0
y_before=0
import sys

for i in range (N):
    t, x, y =map(int,input().split())
    t_diff=t-t_before
    distance=abs(x-x_before)+abs(y-y_before)
    if (t_diff-distance)%2!=0:
        print("No")
        sys.exit()

print ("Yes")

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

for i in range (N):
    t, x, y =map(int,input().split())
    t_diff=t-t_before
    distance=abs(x-x_before)+abs(y-y_before)
    if (t_diff-distance)%2!=0 or distance>t_diff:
        print("No")
        sys.exit()
    else:
        t_before=t
        x_before=x
        y_before=y
    
        

print ("Yes")
Buggy code:
n = int(input())
nums = [[0,0,0]]
ans = False

for v in range(n):
    t, x, y = map(int,input().split())
    nums.append([t,x,y])

# print(nums)
# print(nums[1][1])

for x in range(n+1):
    p = nums[x+1][0] - nums[x][0]
    px = nums[x+1][1] - nums[x][1]
    py = nums[x+1][2] - nums[x][2]
    ps = px + py
    # print(p,px,py,ps)

    for w in range(p+1):
        pp = w
        mp = p - pp
        # print(pp,mp)
        if pp-mp==ps:
            ans = True

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

Fixed code:
n = int(input())
nums = [[0,0,0]]
ans = []

for v in range(n):
    t, x, y = map(int,input().split())
    nums.append([t,x,y])

# print(nums)
# print(nums[1][1])

for x in range(n):
    p = nums[x+1][0] - nums[x][0]
    px = nums[x+1][1] - nums[x][1]
    py = nums[x+1][2] - nums[x][2]
    ps = px + py
    # print(p,px,py,ps)

    for w in range(p+1):
        pp = w
        mp = p - pp
        # print(pp,mp)
        if pp-mp==ps:
            ans.append(1)
        else:
            ans.append(0)

    
sum = 0 
for num in ans:
    sum = sum + num


if sum==n:
    print('Yes')
else:
    print('No')
Buggy code:
N, *T = map(int, open(0).read().split())
d_t, d_x, d_y = 0, 0, 0
for t, x, y in zip(T[::3], T[1::3], T[2::3]):
    dist = abs(d_x - x) + abs(d_y - y)
    if (t - d_t - dist) % 2:
        print("No")
        break
    d_t, d_x, d_y = t, x, y
else:
    print("Yes")


Fixed code:
N, *T = map(int, open(0).read().split())
d_t, d_x, d_y = 0, 0, 0
for t, x, y in zip(T[::3], T[1::3], T[2::3]):
    dist = abs(d_x - x) + abs(d_y - y)
    if t - d_t - dist < 0 or (t - d_t - dist) % 2:
        print("No")
        break
    d_t, d_x, d_y = t, x, y
else:
    print("Yes")
Buggy code:
N = int(input())

t0, x0, y0 = 0, 0, 0
for _ in range(N):
    t, x, y = map(int, input().split())
    dt = t - t0
    dx = x - x0
    dy = y - y0
    dxy = abs(dx) + abs(dy)  #; print(dt, dx, dy, dxy) 
    isEvenOdd = (dt%2 == 0 and dxy%2 == 0) or (dt%2 != 0 and dxy%2 != 0)
    if isEvenOdd and dxy <= dt :
        t0, x0, y0 = t, x, y
    else:
        print('NO')
        break
else:
    print('YES')

Fixed code:
N = int(input())

t0, x0, y0 = 0, 0, 0
for _ in range(N):
    t, x, y = map(int, input().split())
    dt = t - t0
    dx = x - x0
    dy = y - y0
    dxy = abs(dx) + abs(dy)  #; print(dt, dx, dy, dxy) 
    isEvenOdd = (dt%2 == 0 and dxy%2 == 0) or (dt%2 != 0 and dxy%2 != 0)
    if isEvenOdd and dxy <= dt :
        t0, x0, y0 = t, x, y
    else:
        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 or (x + y + t) % 2:
        print("Yes")
        exit()
print("No")

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:
N = int(input())

pos_x=0
pos_y=0
t_now=0
flg = True
for i in range(N):
    t,x,y = map(int,input().split())
    t_del = t-t_now
    res = (t_del-abs(pos_x-x)-abs(pos_y-y))
    if (res>=0) & (res%2==0):
        t_now = t
        x_pos = x
        y_pos=y
        pass
    else:
        flg = False
        break

if flg == True:
    print('Yes')
else:
    print('No')

Fixed code:
N = int(input())

pos_x=0
pos_y=0
t_now=0
flg = True
for i in range(N):
    t,x,y = map(int,input().split())
    t_del = t-t_now
    res = (t_del-abs(pos_x-x)-abs(pos_y-y))
    if (res>=0) & (res%2==0):
        t_now = t
        pos_x = x
        pos_y=y
        pass
    else:
        flg = False
        break

if flg == True:
    print('Yes')
else:
    print('No')
Buggy code:
n = int(input())
rn = []
for i in range(n):
    rn.append(list(map(int, input().split())))

for i in range(n - 1):
    t = rn[i + 1][0] - rn[i][0]
    distx = rn[i + 1][1] - rn[i][1]
    disty = rn[i + 1][2] - rn[i][2]
    k = abs(distx) + abs(disty)
    if (t > k) and ((t + k) % 2 == 0):
        continue
    else:
        print('No')
        exit()
print('Yes')


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

for i in range(n):
    t = rn[i + 1][0] - rn[i][0]
    distx = rn[i + 1][1] - rn[i][1]
    disty = rn[i + 1][2] - rn[i][2]
    k = abs(distx) + abs(disty)
    if (t >= k) and ((t + k) % 2 == 0):
        continue
    else:
        print('No')
        exit()
print('Yes')
Buggy code:
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
 t_new, x_new, y_new = map(int, input().split())
 l = abs(x_new - x) + abs(y_new - y)
 dt = t_new - t
 if (l <= dt and abs(l - dt) % 2 == 0):
  x = x_new
  y = y_new
  t = t_new
 else:
  print('No')
  exit()
print('YES')

Fixed code:
n = int(input())
x = 0
y = 0
t = 0
for i in range(n):
 t_new, x_new, y_new = map(int, input().split())
 l = abs(x_new - x) + abs(y_new - y)
 dt = t_new - t
 if (l <= dt) and (l % 2 == dt % 2 ):
  x = x_new
  y = y_new
  t = t_new
 else:
  #print(t, x, y) 
  print('No')
  exit()
print('Yes')
Buggy code:
n = int(input()strip())
p = [ list(map(int, input().split())) for i in range(n) ]
p.insert(0, [0,0,0])
ans = True

for i in range(n):
    time = p[i+1][0] - p[i][0]
    dist = abs(sum(p[i+1][1:]) - sum(p[i][1:]))

    if time % 2 != dist % 2 or dist > time:
        ans = False
        break

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

Fixed code:
n = int(input().strip())
p = [ list(map(int, input().split())) for i in range(n) ]
p.insert(0, [0,0,0])
ans = True

for i in range(n):
    time = p[i+1][0] - p[i][0]
    dist = abs(sum(p[i+1][1:]) - sum(p[i][1:]))

    if time % 2 != dist % 2 or dist > time:
        ans = False
        break

if ans: print("Yes")
else: print("No")
Buggy code:
n = int(input())
t=[0]
x = [0]
y = [0]

for i in range(n):
    a,b,c = list(map(int,input().split()))
    t.append(a)
    x.append(b)
    y.append(c)

flag = True
for i in range(1,n+1):

    if (t[i]-t[i-1])%2 != (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2 or (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))>=t[i]-t[i-1]:
        flag = False


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

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

for i in range(n):
    a,b,c = list(map(int,input().split()))
    t.append(a)
    x.append(b)
    y.append(c)

flag = True
for i in range(1,n+1):

    if (t[i]-t[i-1])%2 != (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2 or (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))>t[i]-t[i-1]:
        flag = False


if flag:
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
cnt = 0
sum = 0
flag = 0
T = X = Y = 0 
for i in range(N):
        cnt = x[i][0] - T
        sum = abs(x[i][1]- X) + abs(x[i][2]- Y)
        T = x[i][0]
        X = x[i][1]
        Y = x[i][2]
    if cnt < sum or cnt % 2 != sum % 2:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")


Fixed code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
cnt = 0
sum = 0
flag = 0
T = X = Y = 0
for i in range(N):
    cnt = x[i][0] - T
    sum = abs(x[i][1]- X) + abs(x[i][2]- Y)
    T = x[i][0]
    X = x[i][1]
    Y = x[i][2]
    if cnt < sum or cnt % 2 != sum % 2:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
t_old, x_old, y_old = 0

for i in range(N):
  t, x, y = map(int, input().split())
  dt = t - t_old
  dx = x - x_old
  dy = y - y_old
  t_old = t
  x_old = x
  y_old = y
  if abs(dx) + abs(dy) =< dt and (dt - (abs(dx) + abs(dy))) % 2 == 0:
    if i == N - 1:
      print('Yes')
  else:
    print('No')
    break
    

Fixed code:
N = int(input())
t_old, x_old, y_old = 0, 0, 0

for i in range(N):
  t, x, y = map(int, input().split())
  dt = t - t_old
  dx = x - x_old
  dy = y - y_old
  t_old = t
  x_old = x
  y_old = y
  if abs(dx) + abs(dy) <= dt and (dt - (abs(dx) + abs(dy))) % 2 == 0:
    if i == N - 1:
      print('Yes')
    pass
  else:
    print('No')
    break
Buggy code:
N = int(input())
t, x, y = [], [], []

for i in range(N) :
    _t, _x, _y = map(int, input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

cur_x, cur_y = 0, 0
cur_t = 0
flg_impossible = "YES"

for i in range(N) :
    dloc = (x[i] - cur_x) + (y[i] - cur_y)
    dt = t[i] - cur_t
    
    if ((dloc % 2 == 0 and dt % 2 == 0) or (dloc % 2 != 0 and dt % 2 != 0)) and dloc <= dt :
        cur_x, cur_y, cur_t = x[i], y[i], t[i]
    else :
        flg_impossible = "NO"
        
print(flg_impossible)

Fixed code:
N = int(input())
t, x, y = [], [], []

for i in range(N) :
    _t, _x, _y = map(int, input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

cur_x, cur_y = 0, 0
cur_t = 0
flg_impossible = "Yes"

for i in range(N) :
    dloc = (x[i] - cur_x) + (y[i] - cur_y)
    dt = t[i] - cur_t
    
    if ((dloc % 2 == 0 and dt % 2 == 0) or (dloc % 2 != 0 and dt % 2 != 0)) and dloc <= dt :
        cur_x, cur_y, cur_t = x[i], y[i], t[i]
    else :
        flg_impossible = "No"
        
print(flg_impossible)
Buggy code:
n=int(input())
arr=[[0,0,0]+[list(map(int,input().split())) for _ in range(n)]]
for i in range(n):
  t1,x1,y2=arr[i]
  t2,x2,y2=arr[i+1]
  if abs(x1-x2)+abs(y1-y2)>t1+t2:
    print('No')
    exit()
  if (abs(x1-x2)+abs(y1-y2))%2!=(t1+t2)%2:
    print('No')
    exit()
print('Yes')

Fixed code:
n=int(input())
arr=[[0,0,0]]+[list(map(int,input().split())) for _ in range(n)]
for i in range(n):
  t1,x1,y1=arr[i]
  t2,x2,y2=arr[i+1]
  if abs(x1-x2)+abs(y1-y2)>t2-t1:
    print('No')
    exit()
  if (abs(x1-x2)+abs(y1-y2))%2!=(t2-t1)%2:
    print('No')
    exit()
print('Yes')
Buggy code:
n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
ans = 'Yes'
t_diff = 0
x_diff = 0
y_diff = 0
for i in p:
  t_diff = i[0] - t_diff
  x_diff = abs(i[1] - x_diff)
  y_diff = abs(i[2] - y_diff)
  if t_diff > x_diff + y_diff:
    if (t_diff - x_diff - y_diff)%2 != 0:
      ans = 'No'
      break
  else:
    ans = 'No'
    break
print(ans)

Fixed code:
n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
ans = 'Yes'
t_diff = 0
x_diff = 0
y_diff = 0
for i in p:
  t_diff = i[0] - t_diff
  x_diff = abs(i[1] - x_diff)
  y_diff = abs(i[2] - y_diff)
  if t_diff >= x_diff + y_diff:
    if (t_diff - x_diff - y_diff)%2 != 0:
      ans = 'No'
      break
  else:
    ans = 'No'
    break
print(ans)
Buggy code:
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
if n==1:
  print("Yes")
  exit()
for i in range(n-1):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")
    
      
  


Fixed code:
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
  A.append([a,b,c])
if n==1:
  print("Yes")
  exit()
for i in range(n-1):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")