qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
t=x=y=[0 for i in range(N+1)]
for i in range(N):
    t[i + 1], x[i + 1], y[i + 1] = map(int, input().split())
flag = 1
for i in range(N):
    dl = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    dt = t[i + 1] - t[i]
    if dl > dt or (dl - dt) % 2 == 1:
        flag = 0
        break
if flag == 1:
    print("Yes")
else:
    print("No")


Fixed code:
N = int(input())
t = [0 for i in range(N + 1)]
x = [0 for i in range(N + 1)]
y = [0 for i in range(N + 1)]
for i in range(N):
    t[i + 1], x[i + 1], y[i + 1] = map(int, input().split())
flag = 1
for i in range(N):
    dl = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    dt = t[i + 1] - t[i]
    if dl > dt or (dl - dt) % 2 == 1:
        flag = 0
        break
if flag == 1:
    print("Yes")
else:
    print("No")
Buggy code:
n=int(input())
t0=0
x0=0
y0=0
for i in range(n):
  t,x,y=[int(i) for i in input().split()]
  if (t-t0-(abs(x-x0)+abs(y-y0)))%2 == 1 or t-t0<(abs(x-x0)+abs(y-y0)):
    print('No')
    break
  t0,x0,y0=t,x,
else:
  print('Yes')
  

Fixed code:
n=int(input())
t0=0
x0=0
y0=0
for i in range(n):
  t,x,y=[int(i) for i in input().split()]
  if (t-t0-(abs(x-x0)+abs(y-y0)))%2 == 1 or t-t0<(abs(x-x0)+abs(y-y0)):
    print('No')
    break
  t0,x0,y0=t,x,y
else:
  print('Yes')
Buggy code:
import numpy as np
n=int(input())
x=[list(map(int, input().split())) for _ in range(n)]

now=0
nplace=[0,0]
noflag=False
for y in x:
    dis=sum(map(abs, (np.array(y[1:]) - np.array(nplace))))
    if not (dis>0 & (dis-y[0])%2==0):
        noflag=True
    now=y[0]
    nplace=y[1:]
print('Yes') if noflag==False else print('No')

Fixed code:
import numpy as np
n=int(input())
x=[list(map(int, input().split())) for _ in range(n)]

now=0
nplace=[0,0]
noflag=False
for y in x:
    dis=sum(map(abs, (np.array(y[1:]) - np.array(nplace))))
    # print(dis)
    if not ((dis<=(y[0]-now)) & ((y[0]-now-dis)%2==0)):
        noflag=True

    now=y[0]
    nplace=y[1:]
print('Yes') if noflag==False else print('No')
Buggy code:
# coding: utf-8

import sys

N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
	txy = [int(x) for x in input().split()]
	t.append(txy[0])
	x.append(txy[1])
	y.append(txy[2])

for i in range(N - 1):
	d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
	print(d)
	dt = t[i + 1] - t[i]
	if dt < d or (dt - d) % 2 == 1:
		print("No")
		sys.exit()
	
print("Yes")

Fixed code:
# coding: utf-8

import sys

N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
	txy = [int(x) for x in input().split()]
	t.append(txy[0])
	x.append(txy[1])
	y.append(txy[2])

for i in range(N):
	d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
	dt = t[i + 1] - t[i]
	if dt < d or dt % 2 != d % 2:
		print("No")
		sys.exit()
	
print("Yes")
Buggy code:
N = int(input())
TXY = [list(map(int, input().split())) for _ in range(N)]
TXY.insert(0,[0,0,0])

point_a, point_b = 0, 0
for i in range(N):
    if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
        point += 1

for i in range(N):
    if point_a == 0 and (TXY[i+1][0] - TXY[i][0] % 2 != abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]) %2) :
        point_b += 1

if point_a == 0 and point_b == 0:
    print('Yes')
else:
    print('No')

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

point_a, point_b = 0, 0
for i in range(N):
    if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
        point_a += 1

for i in range(N):
    if point_a == 0 and ((TXY[i+1][0] - TXY[i][0]) % 2 != (abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2])) %2) :
        point_b += 1

if point_a == 0 and point_b == 0:
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
txy = [[0, 0, 0]]
for i in range(N):
  txy.append(list(map(int, input().split())))

for i in range(N):
  dt = txy[i+1][0] - txy[i][0]
  dx = txy[i+1][1] - txy[i][1]
  dy = txy[i+1][2] - txy[i][2]
  print(dt, dx, dy, dt - (dx + dy))
  
  if dt < abs(dx + dy):
    print('No')
    break
  else:
    if (dt - (dx + dy)) % 2 != 0:
      print('No')
      break
else:
  print('Yes')

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

for i in range(N):
  dt = txy[i+1][0] - txy[i][0]
  dx = txy[i+1][1] - txy[i][1]
  dy = txy[i+1][2] - txy[i][2]
  
  if dt < abs(dx + dy):
    print('No')
    break
  else:
    if (dt - (dx + dy)) % 2 != 0:
      print('No')
      break
else:
  print('Yes')
Buggy code:
N = int(input())

tprev = 0
xprev = 0
yprev = 0

result = 'YES'

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

    xlen = abs(x - xprev)
    ylen = abs(y - yprev)
    
    time = t - tprev

    length = xlen + ylen

    if time%2 == length%2 and time >= length:
        tprev = t
        xprev = x
        yprev = y

    else:
        result = 'NO'
        break
print(result)


Fixed code:
N = int(input())

tprev = 0
xprev = 0
yprev = 0

result = 'Yes'

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

    xlen = abs(x - xprev)
    ylen = abs(y - yprev)
    
    time = t - tprev

    length = xlen + ylen

    if time%2 == length%2 and time >= length:
        tprev = t
        xprev = x
        yprev = y

    else:
        result = 'No'
        break
print(result)
Buggy code:
n = int(input())
t_state = 0
x_state = 0
y_state = 0
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(x - x_state) + abs(y - y_state)
    if  t - t_state < d or (t-t_state)%2 != d%2
        print("No")
        exit()
    t_state = t
    x_state = x
    y_state = y
print("Yes")

Fixed code:
n = int(input())
t_state, x_state, y_state = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    d = abs(x - x_state) + abs(y - y_state)
    td = t - t_state
    if  td < d or td%2 != d%2:
        print("No")
        exit()
    t_state, x_state, y_state = t, x, y
print("Yes")
Buggy code:
N = int(input())
plan = []

for j in range(0,N):
    t,x,y = map(int,input().split())
    plan.append(t,x,y)

if (plan[0] < plan[1] + plan[2]) or ((plan[0] % 2) != ((plan[1] + plan[2]) % 2)):
    print("No")
    exit()

for i in range(0,N-1):
    time_dis = plan[i*3 +3] - plan[i*3]
    x_dis = abs(plan[i*3+1] - plan[i*3+1 +3])
    y_dis = abs(plan[i*3+2] - plan[i*3+2 +3])
    
    if (time_dis < x_dis + y_dis) or ((time_dis % 2) != ((x_dis + y_dis) % 2)):
        print("No")
        exit()
        
print("Yes")


Fixed code:
N = int(input())
plan = []

for j in range(0,N):
    t,x,y = map(int,input().split())
    plan.append(t)
    plan.append(x)
    plan.append(y)

if (plan[0] < plan[1] + plan[2]) or ((plan[0] % 2) != ((plan[1] + plan[2]) % 2)):
    print("No")
    exit()

for i in range(0,N-1):
    time_dis = plan[i*3 +3] - plan[i*3]
    x_dis = abs(plan[i*3+1] - plan[i*3+1 +3])
    y_dis = abs(plan[i*3+2] - plan[i*3+2 +3])
    
    if (time_dis < x_dis + y_dis) or ((time_dis % 2) != ((x_dis + y_dis) % 2)):
        print("No")
        exit()
        
print("Yes")
Buggy code:
n = int(input())
posdata = [list(map(int,input().split())) for i in range(n)]
nowpos = [0,0,0]

for i in range(n):
    diff = posdata[i][1] - nowpos[1] + posdata[i][2] - nowpos[2]
    l_parity = diff % 2
    t_parity = posdata[i][0] % 2
    
    if diff > (posdata[i][0] - posdata[i - 1][0]) and l_parity == t_parity:
        i = i
    else:
        print("No")
        exit()
        
print("Yes")

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

for i in range(n):
    diff = posdata[i][1] - nowpos[1] + posdata[i][2] - nowpos[2]
    l_parity = diff % 2
    t_parity = (posdata[i][0] - nowpos[0]) % 2
    
    if (posdata[i][0] - nowpos[0]) >= diff and l_parity == t_parity:
        nowpos = posdata[i]
    else:
        print("No")
        exit()
print("Yes")
Buggy code:
n = int(inupt())
s = [0, 0, 0]

for i in range(n):
  l = list(map(int, input().split()))
  diff_t = l[0] - s[0]
  diff_x = abs(s[1] - l[1])
  diff_y = abs(s[2] - l[2])
  s = [l[0], l[1], l[2]]
  if diff_x + diff_y > diff_t or (diff_t - diff_x - diff_y) % 2 != 0:
    print('No')
    break
else:
  print('Yes')

Fixed code:
n = int(input())
s = [0, 0, 0]
ans = 'Yes'
for i in range(n):
  l = list(map(int, input().split()))
  diff_t = l[0] - s[0]
  diff_x = abs(s[1] - l[1])
  diff_y = abs(s[2] - l[2])
  s = [l[0], l[1], l[2]]
  if diff_x + diff_y > diff_t or (diff_t - diff_x - diff_y) % 2 != 0:
    ans = 'No'
print(ans)
Buggy code:
n = int(input())
a,b,c=0,0,0
for i in range(n):
    t,x,y = map(int, input().split())
    sa = t-a
    if sa<abs(x-b)+abs(y-c):
        print("No")
        exit()
    else:
        tw = sa-abs(x-b)-abs(y-c)
        if tw%2!=0:
            print("No")
            exit()
    a,b,c=x,y,z
print("Yes")


Fixed code:
n = int(input())
a,b,c=0,0,0
for i in range(n):
    t,x,y = map(int, input().split())
    sa = t-a
    if sa<abs(x-b)+abs(y-c):
        print("No")
        exit()
    else:
        tw = sa-abs(x-b)-abs(y-c)
        if tw%2!=0:
            print("No")
            exit()
    a,b,c=t,x,y
print("Yes")
Buggy code:
before = 0, 0, 0
for _ in range(int(input())):
    tt, tx, ty = map(int, input().split())
    bt, bx, by = before
    distance = abs(tx - bx) + abs(ty - by)
    t = tt - bt
    if tt <= distance or t % 2 != distance % 2:
        break
    before = tt, tx, ty
else:
    print('Yes')
    exit()
print('No')


Fixed code:
before = 0, 0, 0
for _ in range(int(input())):
    tt, tx, ty = map(int, input().split())
    bt, bx, by = before
    distance = abs(tx - bx) + abs(ty - by)
    t = tt - bt
    if t < distance or t % 2 != distance % 2:
        break
    before = tt, tx, ty
else:
    print('Yes')
    exit()
print('No')
Buggy code:
n=int(input())
t0,x0,y0=0,0,0
ans=True
for i in range(n):
    t,x,y = map(int, input().split())
    if (abs(x-x0)+ abs(y-y0)-(t-t0)) %2 !=0:
        ans=False
    else:
        t0,x0,y0=t,x,y
if ans:
    print('Yes')
else:
    print('No')


Fixed code:
n=int(input())
t0,x0,y0=0,0,0
ans=True
for i in range(n):
    t,x,y = map(int, input().split())
    if (abs(x-x0)+ abs(y-y0)-(t-t0)) %2 !=0 or abs(x-x0)+abs(y-y0)>(t-t0):
        ans=False
    else:
        t0,x0,y0=t,x,y
if ans:
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]
result = True

for i in range(N - 1):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    
    if(dist > dt): result = False
    if(dist % 2 != dt % 2): result = False

print(("No", "Yes")[result])

Fixed code:
N = int(input())
txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
result = True

for i in range(N):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    
    if(dist > dt): result = False
    if(dist % 2 != dt % 2): result = False

print(("No", "Yes")[result])
Buggy code:
_ = int(input())
bef_time = 0
bef_x = 0
bef_y = 0
ans = True

for i in range(_):
    next = input().split()
    next_time = int(next[0])
    next_x = int(next[1])
    next_y = int(next[2])
    time = next_time - bef_time
    range = abs(next_x - bef_x) + abs(next_y - bef_y)

    if (next_time - bef_time) < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



if ans == True:
    print('YES')
else:
    print('NO')

Fixed code:
_ = int(input())
bef_time = 0
bef_x = 0
bef_y = 0
ans = True

for i in range(_):
    next = input().split()
    next_time = int(next[0])
    next_x = int(next[1])
    next_y = int(next[2])
    time = next_time - bef_time
    range = abs(next_x - bef_x) + abs(next_y - bef_y)

    if (next_time - bef_time) < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



if ans == True:
    print('Yes')
else:
    print('No')
Buggy code:
n = int(input())
b = 1
tn,xn,yn = map(int,input().split())
for _ in range(n-1):
  to,xo,yo = tn,xn,yn
  tn,xn,yn = map(int,input().split())
  if tn-to >= abs(xn-xo)+abs(yn-yo) and (tn-to)%2 == (abs(xn-xo)+abs(yn-yo))%2:
    continue
  else:
    print("No")
    break
else:
  print("Yes")

Fixed code:
n = int(input())
tn,xn,yn = 0,0,0
for _ in range(n):
  to,xo,yo = tn,xn,yn
  tn,xn,yn = map(int,input().split())
  if tn-to >= abs(xn-xo)+abs(yn-yo) and (tn-to)%2 == (abs(xn-xo)+abs(yn-yo))%2:
    continue
  else:
    print("No")
    break
else:
  print("Yes")
Buggy code:

N = int(input())
Z=[]
for i in range(N):
	t, x, y = map(int, input().split())
	if t % 2 == 0:
		if x + y <= t and (x + y) % 2 == 0:
			Z.append(1)
		else:
			Z.append(0)
	else:
		if x + y <= t and (x + y) % 2 == 1:
			Z.append(1)
		else:
			Z.append(0)
	i += 1

if Z.index(0) >= 1:
	print('No')
else:
	print('Yes')

Fixed code:

N = int(input())
Z=[]
for i in range(N):
	t, x, y = map(int, input().split())
	if t % 2 == 0:
		if x + y <= t and (x + y) % 2 == 0:
			Z.append(1)
		else:
			Z.append(0)
	else:
		if x + y <= t and (x + y) % 2 == 1:
			Z.append(1)
		else:
			Z.append(0)
	i += 1
if Z.count(0) >=1:
	print('No')
else:
	print('Yes')
Buggy code:
N=int(input())
t=[]
x=[]
y=[]
flag=False
for i in range(N):
  t1,x1,y1=[int(i) for i in input().split()]
  t.append(t1)
  x.append(x1)
  y.append(y1)
for i in range(N):
  if(i>0):
    t[i]=t[i]-t[i-1]
    x[i]=x[i]-x[i-1]
    y[i]=y[i]-y[i-1]

for i in range(N):
  if((x[i]+y[i])%2==t[i] or abs(x[i])+abs(y[i])<=t[i]):
    flag=True
  else:
    flag=False
    break
if(flag):
  print("Yes")
else:
  print("No")

Fixed code:
N=int(input())
t=[]
x=[]
y=[]
flag=False
for i in range(N):
  t1,x1,y1=[int(i) for i in input().split()]
  t.append(t1)
  x.append(x1)
  y.append(y1)
for i in range(N):
  if(i>0):
    t[i]=t[i]-t[i-1]
    x[i]=x[i]-x[i-1]
    y[i]=y[i]-y[i-1]

for i in range(N):
  if((x[i]+y[i])%2==t[i]%2 and abs(x[i])+abs(y[i])<=t[i]):
    flag=True
  else:
    flag=False
    break

if(flag):
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input())
for i 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 i in range(N):
    t,x,y=map(int,input().split())
    if x+y>t or (t+x+y)%2 != 0:
        print("No")
        exit()
print("Yes")
Buggy code:
N=int(input())
Ki=[list(map(int,input().split())) for i in range(N)]
f=False
for i in range(Ki):
  t,x,y=i
  s=x+y
  if (t%2==0 and s%2==1) or (t%2==1 and s%2==0) or t<s:
    f=True
    break
if f:
  print('No')
else:
  print('Yes')
  


Fixed code:
N=int(input())
Ki=[list(map(int,input().split())) for i in range(N)]
f=False
for i in Ki:
  t,x,y=i
  s=x+y
  if (t%2==0 and s%2!=0) or (t%2!=0 and s%2==0) or t<s:
    f=True
    break
if f:
  print('No')
else:
  print('Yes')
Buggy code:
N = int(input())
[t, x, y] = [[],[],[]]
for i in range(N):
  input_line = list(map(int, input().split()))
  t.append(input_line[0])
  x.append(input_line[1])
  y.append(input_line[2])

can = True
for i in range(0, N-1):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if dt < dist:
    can = False
  if dt%2 != dist%2:
    can = False
  
if can == True:
  print("Yes")
else:
  print("No")

Fixed code:
N = int(input())
[t, x, y] = [[0],[0],[0]]
for i in range(N):
  input_line = list(map(int, input().split()))
  t.append(input_line[0])
  x.append(input_line[1])
  y.append(input_line[2])

can = True
for i in range(0, N):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if dt < dist:
    can = False
  if dt%2 != dist%2:
    can = False
  
if can == True:
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input())
txy = [[0,0,0]]
for i in range(N):
    txy.append([int(x) for x in input().split()])
flg = 0

for j in range(1, N + 1):
    dt = txy[j][0] - txy[j - 1][0]
    dx = txy[j][1] - txy[j - 1][1]
    dy = txy[j][2] - txy[j - 1][2]
    d = dt - abs(dx) - abs(dy)

    if d < 0 or d % 2 != 0:
        print("NO")
        flg = 1
        break

if flg == 0:
    print("YES")

Fixed code:
N = int(input())
txy = [[0,0,0]]
for i in range(N):
    txy.append([int(x) for x in input().split()])
flg = 0

for j in range(1, N + 1):
    dt = txy[j][0] - txy[j - 1][0]
    dx = txy[j][1] - txy[j - 1][1]
    dy = txy[j][2] - txy[j - 1][2]
    d = dt - abs(dx) - abs(dy)

    if d < 0 or d % 2 != 0:
        print("No")
        flg = 1
        break

if flg == 0:
    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('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)%2 != t%2:
        print("No")
        exit()

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

l = [[0, 0, 0]]
l.extend(L)

flag = True
for c in range(1, len(L)):
    dt = l[c][0] - l[c-1][0]
    dist = abs(l[c][1] - l[c-1][1]) + abs(l[c][2] - l[c-1][2])

    if dist > dt or dist % 2 != dt % 2:
        flag = False

print("YES" if flag else "NO")


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

l = [[0, 0, 0]]
l.extend(L)

flag = True
for c in range(1, len(l)):
    dt = l[c][0] - l[c-1][0]
    dist = abs(l[c][1] - l[c-1][1]) + abs(l[c][2] - l[c-1][2])

    if dist > dt or (dist % 2) != (dt % 2):
        flag = False

print("Yes" if flag else "No")
Buggy code:
n = int(input())
t1 = 0
x1 = 0
y1 = 0
boolean = True

for _ in range(n):
    t, x, y = [int(_) for _ in input().split()]
    if boolean:
        temp1 = x
        temp2 = t
        x = abs(x - x1) + abs(y - y1)
        t -= t1
        x1 = temp
        y1 = y
        t1 = temp2
        if x > t or (x + t) % 2 == 1:
            boolean = False
if boolean:
    print('Yes')
else:
    print('No')

Fixed code:
n = int(input())
t1 = 0
x1 = 0
y1 = 0
boolean = True

for __ in range(n):
    t, x, y = [int(_) for _ in input().split()]
    if boolean:
        temp1 = x
        temp2 = t
        x = abs(x - x1) + abs(y - y1)
        t -= t1
        x1 = temp1
        y1 = y
        t1 = temp2
        if x > t or (x + t) % 2 == 1:
            boolean = False
if boolean:
    print('Yes')
else:
    print('No')
Buggy code:
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('NO')
        exit()
    elif (x2-x1 + y2-y1)%2 == (t2-t1)%2:
        t1=t2
        x1=x2
        y1=y2
        continue
    else:
        print('No')
        exit()

print('Yes')


Fixed code:
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('No')
        exit()
    elif ((t2-t1)-(x2-x1 + y2-y1) ) % 2 == 0:
        t1=t2
        x1=x2
        y1=y2
    else:
        print('No')
        exit()

print('Yes')
Buggy code:
N = int(input())
T = [None] * N
X = [None] * N
Y = [None] * N

for i in range(N):
    T[i], X[i], Y[i] = map(int, input().split())

def is_reachable(t, x, y):
    if t >= (x + y):
        if (t - x - y) % 2 == 0:
            return True
    return False

ans = 'Yes'

if is_reachable(T[0], X[0], Y[0]):
    for i in range(N-1):
        t, x, y = T[i+1], X[i+1], Y[i+1]
        t, x, y = t - T[i], x - X[i], y - Y[i]
        if not is_reachable(t, x, y):
            ans = 'No'
            break
print(ans)

Fixed code:
N = int(input())
T = [None] * N
X = [None] * N
Y = [None] * N

for i in range(N):
    T[i], X[i], Y[i] = map(int, input().split())

def is_reachable(t, x, y):
    x, y = abs(x), abs(y)
    if t >= (x + y):
        if (t - x - y) % 2 == 0:
            return True
    return False

ans = 'No'
if is_reachable(T[0], X[0], Y[0]):
    ans = 'Yes'
    for i in range(N-1):
        t, x, y = T[i+1], X[i+1], Y[i+1]
        t, x, y = t - T[i], x - X[i], y - Y[i]
        if not is_reachable(t, x, y):
            ans = 'No'
            break
print(ans)
Buggy code:
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
t, x, y = 0, 0, 0
flag = True
for nt, nx, ny in txy:
    dt = nt - t
    dx = nx - x
    dy = ny - y
    if (dt < dx + dy) or ((dx + dy) % 2 != dt % 2):
        flag = False
        break
    else:
        t = nx
        x = nx
        y = ny
if flag:
    print('YES')
else:
    print('NO')

Fixed code:
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
t, x, y = 0, 0, 0
flag = True
for nt, nx, ny in txy:
    dt = nt - t
    dx = nx - x
    dy = ny - y
    if (dt < dx + dy) or ((dx + dy) % 2 != dt % 2):
        flag = False
        break
    t = nt
    x = nx
    y = ny
if flag:
    print('Yes')
else:
    print('No')
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 == 1:
        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:
# -*- coding: utf-8 -*-

import numpy
import scipy
#import sys


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

for i, p in enumerate(P):
    if i == 0:
        t_p, x_p, y_p = 0, 0, 0
    else:
        t_p, x_p, y_p = P[i-1][0], P[i-1][1], P[i-1][2]
    t, x, y = p
    dt = t - t_p
    dx = x - x_p
    dy = y - y_p
    dist = abs(dx) + abs(dy)

    if dist > dt:
        print("No")
        exit()

    if dist%2 != dt%2:
        print("No")
        exit()

print("Yes")



Fixed code:
# -*- coding: utf-8 -*-

import numpy
import scipy
#import sys


N = int(input())
P = []
for n in range(N):
    P.append(list(map(int, input().split())))

for i, p in enumerate(P):
    if i == 0:
        t_p, x_p, y_p = 0, 0, 0
    else:
        t_p, x_p, y_p = P[i-1][0], P[i-1][1], P[i-1][2]
    t, x, y = p
    dt = t - t_p
    dx = x - x_p
    dy = y - y_p
    dist = abs(dx) + abs(dy)

    if dist > dt:
        print("No")
        exit()

    if dist%2 != dt%2:
        print("No")
        exit()

print("Yes")
Buggy code:
n = int(input())
s_list = [list(map(int, input().split())) for j in range(n)]
ans = "Yes"
for s in s_list:
    if s[0] < s[1] + s[2]:
        print("1:",s[0] < s[1] + s[2])
        ans = "No"
        break
    elif s[0] % 2 == 0 and (s[1] + s[2]) % 2 == 1:
        print("2", s[0] % 2 == 0 and (s[1] + s[2]) % 2 == 1)
        ans = "No"
        break
    elif s[0] % 2 == 1 and (s[1] + s[2]) % 2 == 0:
        print("3", s[0] % 2 == 1 and (s[1] + s[2]) % 2 == 0)
        ans = "No"
        break
print(ans)


Fixed code:
n = int(input())
s_list = [list(map(int, input().split())) for i in range(n)]
ans = "Yes"
for s in s_list:
    if s[0] < s[1] + s[2]:
        ans = "No"
        break
    elif s[0] % 2 == 0 and (s[1] + s[2]) % 2 == 1:
        ans = "No"
        break
    elif s[0] % 2 == 1 and (s[1] + s[2]) % 2 == 0:
        ans = "No"
        break
print(ans)
Buggy code:
Row = int(input())
List = []
for i in range (Row):
  List.append(list(map(int, input().split())))
x = 0
y = 0
flag = True
for i in range(Row):
  reqT = List[i][1]-x+List[i][2]-y
  chck= reqT - T
  if chck < 0 or chck % 2 == 1:
    flag = False
    break
  x = List[i][1]
  y = List[i][2]
if flag:
  print("Yes")
else:
  print("No")

Fixed code:
Row = int(input())
List = []
for i in range (Row):
  List.append(list(map(int, input().split())))
x = 0
y = 0
T = 0
flag = True
for i in range(Row):
  reqT = abs(List[i][1]-x)+abs(List[i][2]-y)
  chck= List[i][0] - T - reqT
  if chck < 0 or chck % 2 == 1:
    flag = False
    break
  x = List[i][1]
  y = List[i][2]
  T = List[i][0]
if flag:
  print("Yes")
else:
  print("No")