qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())
t = [[0, 0, 0]]
for i in range(n):
    t.append(list(map(int, input().split())))
for i in range(1, n):
    time = t[i][0] - t[i-1][0]
    move = t[i][1] + t[i][2] - (t[i-1][1] + t[i-1][2])
    if(move > time or move%2 != time%2):
        print("No")
        exit()
print("Yes")

Fixed code:
n = int(input())
t = [[0, 0, 0]]
for i in range(n):
    t.append(list(map(int, input().split())))
for i in range(0, n):
    time = t[i+1][0] - t[i][0]
    move = t[i+1][1] + t[i+1][2] - (t[i][1] + t[i][2])
    if(move > time or move%2 != time%2):
        print("No")
        exit()
print("Yes")
Buggy code:
N = int(input())

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

    # violation case1: distance is more than time
    if x + y > t:
        print("No")
        flag = 0

    # validation case2: t has to be odd if x + y is odd, and vice versa for even number
    if t + x + y % 2 != 0:
        print("No")
        flag = 0

print("Yes") if flag == 1 else print("No")


Fixed code:
N = int(input())

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

    # violation case1: distance is more than time
    if x + y > t:
        flag = 0

    # validation case2: t has to be odd if x + y is odd, and vice versa for even number
    if (t + x + y) % 2 != 0:
        flag = 0

print("Yes") if flag == 1 else print("No")
Buggy code:
N=int(input())
t1,x1,y1=[0,0,0]
for i in range(N-1):
  t2,x2,y2=[int(s) for s in input().split()]
  if t2-t1<abs(x2-x1)+abs(y2-y1) or (t2-t1)%2!=(x2+y2-x1-y1)%2:
    print("No")
    break
  else:
    t1,x1,y1==[t2,x2,y2]
else:
  print("Yes")

Fixed code:
N=int(input())
t1,x1,y1=[0,0,0]
for i in range(N):
  t2,x2,y2=[int(s) for s in input().split()]
  if t2-t1<abs(x2-x1)+abs(y2-y1) or (t2-t1)%2!=(x2+y2-x1-y1)%2:
    print("No")
    break
  else:
    t1,x1,y1==[t2,x2,y2]
else:
  print("Yes")
Buggy code:
N = int(input())
table = [[int(t) for i in input().split()] for n in range(N)]
can = True
for i in range(N):
    if(i != 0):
        dt = table[i][0] - table[i-1][0]
        dist = abs(table[i][1]-table[i-1][1]) +abs(table[i][2]-table[i-1][2])
    else:
        dt = table[i][0]
        dist = abs(table[0][1]) + abs(table[0][2])
    if(dist > dt):
        can = False
        break
    elif((dt-dist)%2 != 0):
        can = False
        break
if(can == True):
    print("Yes")
else:
    print("No")


Fixed code:
N = int(input())
table = [[int(i) for i in input().split()] for n in range(N)]
can = True
for i in range(N):
    if(i != 0):
        dt = table[i][0] - table[i-1][0]
        dist = abs(table[i][1]-table[i-1][1]) +abs(table[i][2]-table[i-1][2])
    else:
        dt = table[i][0]
        dist = abs(table[0][1]) + abs(table[0][2])
    if(dist > dt):
        can = False
        break
    elif((dt-dist)%2 != 0):
        can = False
        break
if(can == True):
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
points = [list(map(int, input().split(" "))) for _ in range(N)]
points.insert(0, [0, 0, 0])

can = True
for i in range(N):
    dt, dist = 0, 0
    dt = 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 dt < dist:
        can = False
    if dist % 2 != dt % 2:
        can = False

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


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

can = True
for i in range(N):
    dt, dist = 0, 0
    dt = 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 dt < dist:
        can = False
    if dist % 2 != dt % 2:
        can = False

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

x = []
y = []
t = []

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

ans = "Yes"
for i in range(N):
    if x[i] + y[i] > t[i]:
        ans = "No"
        break
    if t[i] % 2 == 0 and (x[i] + y[i]) % 2 == 1:
        ans = "No"
        break
    elif t[i] & 2 == 1 and (x[i] + y[i]) % 2 == 0:
        ans = "No"
        break

print(ans)


Fixed code:
N = int(input())

x = []
y = []
t = []

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

ans = "Yes"
for i in range(N):
    if x[i] + y[i] > t[i]:
        ans = "No"
        break
    if t[i] % 2 == 0 and (x[i] + y[i]) % 2 == 1:
        ans = "No"
        break
    elif t[i] % 2 == 1 and (x[i] + y[i]) % 2 == 0:
        ans = "No"
        break

print(ans)
Buggy code:
# -*- coding:utf-8 -*-
 
n = int(input())
t, x, y = [0], [0], [0]
for i in range(n):
  t_i, x_i, y_i = map(int, input().strip().split())
  t.append(t_i)
  x.append(x_i)
  y.append(y_i)
  
can = "YES"
for i in range(n):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if (dt < dist):
    can = "NO"
  if (dist % 2 != dt % 2):
    can = "NO"
print(can)

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

n = int(input())
t, x, y = [0], [0], [0]
for i in range(n):
  t_i, x_i, y_i = map(int, input().strip().split())
  t.append(t_i)
  x.append(x_i)
  y.append(y_i)

  
can = "Yes"
for i in range(n):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if (dt < dist):
    can = "No"
  if(dist % 2 != dt % 2):
    can = "No"
print(can)
Buggy code:
N = int(input())

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

def is_possible(travels):
    current = (0, 0, 0)

    for t, x, y in travels:
        prev_t, prev_x, prev_y = current

        dt = t - prev_t
        dx = x - prev_x
        dy = y - prev_y
        dxy = dx + dy
        if dt < dxy:
            return False
        if dt == dxy:
            continue
        if (dt - dxy) % 2 != 0:
            return False

        current = (t, x, y)

    return True


if is_possible(travels):
    print('YES')
else:
    print('NO')


Fixed code:
N = int(input())

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

def is_possible(travels):
    current = (0, 0, 0)

    for t, x, y in travels:
        prev_t, prev_x, prev_y = current

        dt = t - prev_t
        dx = x - prev_x
        dy = y - prev_y
        dxy = dx + dy
        if dt < dxy:
            return False
        if dt == dxy:
            continue
        if (dt - dxy) % 2 != 0:
            return False

        current = (t, x, y)

    return True


if is_possible(travels):
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
t = []
x = []
y = []

for i in range(N):
    a,b,c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)
i = 0
flag = True
while i < N:
    time = t[i]-t[i-1]
    dis = (x[i]-x[i-1])+(y[i]-y[i-1])
    if time>=dis:
        if (time%2+ dis%2) == 1:
            flag = False
            break
    i += 1

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


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

for i in range(N):
    a,b,c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)
i = 0
flag = True
while i < N:
    time = t[i+1]-t[i]
    dis = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if time<dis:
        flag = False
        break
    elif (time%2 + dis%2) == 1:
            flag = False
            break
    i += 1

if flag == True:
    print("Yes")
else:
    print("No")
Buggy code:
T, X, Y = 0, 0, 0
cnt = 0
for n in range(int(input())):
  t, x, y = map(int,input().split())
  dist = abs(x-X) + abs(y-Y)
  dt = t - T
  cnt += all([dist <= dt, (dist - dt) % 2 == 0])
  T, X, Y = t, x, y
print("YNeos"[n>cnt::2])

Fixed code:
T, X, Y = 0, 0, 0
cnt = 0
for n in range(int(input())):
  t, x, y = map(int,input().split())
  dist = abs(x-X) + abs(y-Y)
  dt = t - T
  cnt += all([dist <= dt, (dist - dt) % 2 == 0])
  T, X, Y = t, x, y
print("YNeos"[n+1!=cnt::2])
Buggy code:
for _ in range(int(input())):
  t, x, y = map(int,input().split())
  if (t+x+y)%2 + (t<x+y):
    s = 0
    break
  s = 1
print("YNeos"[s::2])
    

Fixed code:
for _ in range(int(input())):
  t, x, y = map(int,input().split())
  if (t+x+y)%2 + (t<x+y):
    s = 1
    break
  s = 0
print("YNeos"[s::2])
Buggy code:
N = int(input())
In = [map(int, input().split()) for _ in range(N)]

s = (0, 0)
t = 0
success = True

for move in In:
    before_x, before_y = s
    tn, after_x, after_y = move

    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)
    walk = tn - t

    if walk < dist_xy:
        success *= False

    if walk % 2 == 0 and dist_xy % 2 != 0:
        success *= False
    elif walk % 2 != 0 and dist_xy % 2 == 0:
        success *= False

    s = (after_x, after_y)
    t = tn

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

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

s = (0, 0)
t = 0
success = True

for move in In:
    before_x, before_y = s
    tn, after_x, after_y = move

    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)
    walk = tn - t

    if walk < dist_xy:
        success *= False

    if walk % 2 == 0 and dist_xy % 2 != 0:
        success *= False
    elif walk % 2 != 0 and dist_xy % 2 == 0:
        success *= False

    s = (after_x, after_y)
    t = tn

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

feasible = True
x = 0
y = 0
t = 0

for i in range(n):
    cp_t, cp_x, cp_y = map(int, input().split())
    if not feasible:
        continue

    step = abs(x - cp_x) + abs(y - cp_y)
    dt = cp_t - t
    if (dt - step) % 2 != 0:
        feasible = False
    x = cp_x
    y = cp_y
    t = cp_t

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


Fixed code:
n = int(input())

feasible = True
x = 0
y = 0
t = 0

for i in range(n):
    cp_t, cp_x, cp_y = map(int, input().split())
    if not feasible:
        continue

    step = abs(x - cp_x) + abs(y - cp_y)
    dt = cp_t - t
    if dt < step:
        feasible = False
    if (dt - step) % 2 != 0:
        feasible = False
    x = cp_x
    y = cp_y
    t = cp_t

if feasible:
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
a = 0
for i in range(N):
  a = list(map(int, input().split()))
  print(a[0])
  if a[0] < sum(a) - a[0]:
    print("No")
    exit()
  if (sum(a) - a[0] - a[0])%2 != 0:
    print("No")
    exit()
print("Yes")

Fixed code:
N = int(input())
a = 0
for i in range(N):
  a = list(map(int, input().split()))
  if a[0] < sum(a) - a[0]:
    print("No")
    exit()
  if (sum(a) - a[0] - a[0])%2 != 0:
    print("No")
    exit()
print("Yes")
Buggy code:
N = int(input())
before_t = before_x = before_y = 0
for _ in range(N):
  t, x, y = map(int, input().split())
  distance = abs(x-before_x) + abs(y-before_y)
  diff_t = t-before_t
  if diff_t < distance or diff_t%2 != 0:
    print('No')
    exit()
  before_t = t
  before_x = x
  before_y = y
print('Yes')

Fixed code:
N = int(input())
before_t = before_x = before_y = 0
for _ in range(N):
  t, x, y = map(int, input().split())
  distance = abs(x-before_x) + abs(y-before_y)
  diff_t = t-before_t
  if diff_t < distance or (diff_t-distance)%2 != 0:
    print('No')
    exit()
  before_t = t
  before_x = x
  before_y = y
print('Yes')
Buggy code:
#-*- coding:utf-8 -*-
import math
import sys

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

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

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


Fixed code:
#-*- coding:utf-8 -*-
import math
import sys

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

t.append(0)
x.append(0)
y.append(0)

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

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

t0,x0,y0 = 0,0,0

for i in range(N):
    print(t0,x0,y0," ",t,x,y)
    if t-t0 >= abs(x-x0)+abs(y-y0) and (t-t0)%2 == abs(x-x0+y-y0)%2:
        t0,x0,y0 = t,x,y
        continue
    else:
        print("No")
        sys.exit()

print("Yes")

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

t0,x0,y0 = 0,0,0

for i in range(N):
    t,x,y = TXY[i][0],TXY[i][1],TXY[i][2]
    if t-t0 >= abs(x-x0)+abs(y-y0) and (t-t0)%2 == abs(x-x0+y-y0)%2:
        t0,x0,y0 = t,x,y
        continue
    else:
        print("No")
        sys.exit()

print("Yes")
Buggy code:
n = int(input())
for i in range(n):
  t, x, y = map(int, input().split())
  if t < (x+y) or (t+x+y)==1:
    print("No")
    exit()

print("Yes")

Fixed code:
n = int(input())
for i in range(n):
  t, x, y = map(int, input().split())
  if t < (x+y) or (t+x+y)%2==1:
    print("No")
    exit()

print("Yes")
Buggy code:
t = []

N = input()

for i in range(int(N)):
    t.append(list(map(int, input().split())))
    
t.sort()

co, co_ = [0, 0, 0], [0, 0, 0]
flag = 1

for i in range(len(t)):
    co_[0] = t[i][0] - co[0]
    print(co,co_)
    co_[1] = t[i][1] - co[1]
    print(co,co_)
    co_[2] = t[i][2] - co[2]
    print(co,co_)
    dis = abs(co_[1]) + abs(co_[2])
    print(co,co_,dis)
    if dis % 2 != (t[i][0]-co[0]) % 2:
        flag = 0
        break
    elif dis > co_[0]:
        flag = 0
        break
        
    co = t[i]
    
if flag == 0:
    print('No')
else:
    print('Yes')

Fixed code:
t = []
 
N = input()
 
for i in range(int(N)):
    t.append(list(map(int, input().split())))
    
t.sort()
 
co, co_ = [0, 0, 0], [0, 0, 0]
flag = 1
 
for i in range(len(t)):
    co_[0] = t[i][0] - co[0]
    co_[1] = t[i][1] - co[1]
    co_[2] = t[i][2] - co[2]
    dis = abs(co_[1]) + abs(co_[2])
    if dis % 2 != (t[i][0]-co[0]) % 2:
        flag = 0
        break
    elif dis > co_[0]:
        flag = 0
        break
        
    co = t[i]
    
if flag == 0:
    print('No')
else:
    print('Yes')
Buggy code:
judge = 'Yes'
n = int(input())
txy_l = [0]
for i in range(n):
    txy_l.append(list(map(int,input().split())))

for i in range(n):
    t_dif = txy_l[i+1][0] - txy_l[i][0]
    x_dif = txy_l[i+1][1] - txy_l[i][1]
    y_dif = txy_l[i+1][2] - txy_l[i][2]
    spare_time = t_dif - (abs(x_dif)+abs(y_dif))
    if spare_time < 0 or spare_time%2 != 0:
        judge = 'No'

print(judge)

Fixed code:
judge = 'Yes'
n = int(input())
txy_l = [[0,0,0]]
for _ in range(n):
    txy_l.append(list(map(int,input().split())))

for i in range(n):
    t_dif = txy_l[i+1][0] - txy_l[i][0]
    x_dif = txy_l[i+1][1] - txy_l[i][1]
    y_dif = txy_l[i+1][2] - txy_l[i][2]
    spare_time = t_dif - (abs(x_dif)+abs(y_dif))
    if spare_time < 0 or spare_time%2 != 0:
        judge = 'No'

print(judge)
Buggy code:
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
for i in range(1, N - 1):
  t = D[i][0] - D[i - 1][0]
  d = D[i][1] - D[i - 1][1] + D[i][2] - D[i - 1][2]
  if t < d or t % 2 != d % 2:
    print('No')
    break
print('Yes')

Fixed code:
N = int(input())
D = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
for i in range(1, N + 1):
  t = D[i][0] - D[i - 1][0]
  d = D[i][1] - D[i - 1][1] + D[i][2] - D[i - 1][2]
  if (t < d) or (t % 2 != d % 2):
    print('No')
    break
else:
  print('Yes')
Buggy code:
n = int(input())

tp = 0
xp = 0
yp = 0
flag = [0]*n
for i in range(n):
  t, x, y = map(int,input().split())
  dt = t-tp
  dx = abs(xp-x)
  dy = abs(yp-y)
  if dx+dy==dt:
    flag[i]=1
  elif dt%2==0 and dx%2==0 and dy%2==0:
    flag[i]=1
  elif dt%2==0 and dx%2==1 and dy%2==1:
    flag[i]=1
  elif dt%2==1 and dx%2==0 and dy%2==1:
    flag[i]=1
  elif dt%2==1 and dx%2==1 and dy%2==0:
    flag[i]=1
  tp=t
  xp=x
  yp=y

f=1
for i in range(n):
  f *= flag[i]
  
if f==1:
  print("Yes")
else:
  print("No")

Fixed code:
n = int(input())

tp = 0
xp = 0
yp = 0
flag = [0]*n
for i in range(n):
  t, x, y = map(int,input().split())
  dt = t-tp
  dx = abs(xp-x)
  dy = abs(yp-y)
  if dt==dx+dy:
    flag[i]=1
  elif dt>dx+dy and dt%2==0 and dx%2==0 and dy%2==0:
    flag[i]=1
  elif dt>dx+dy and dt%2==0 and dx%2==1 and dy%2==1:
    flag[i]=1
  elif dt>dx+dy and dt%2==1 and dx%2==0 and dy%2==1:
    flag[i]=1
  elif dt>dx+dy and dt%2==1 and dx%2==1 and dy%2==0:
    flag[i]=1
  tp=t
  xp=x
  yp=y

f=1
for i in range(n):
  f *= flag[i]
  
if f==1:
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input())
TXY = [list(map(int,input().split())) for _ in range(N)]

now = (0,0)
now_t = 0
ok = True
for t,x,y in TXY:
  d = abs(x-now[0]) + abs(y-now[0])
  if d <= (t-now_t) and (t - now_t -d) % 2 == 0:
    now = (x,y)
    now_t = t
    continue
  ok = False
  break
  
if ok:
  print('Yes')
else:
  print('No')


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

now = (0,0)
now_t = 0
ok = True
for t,x,y in TXY:
  d = abs(x-now[0]) + abs(y-now[1])
  if d <= (t-now_t) and ((t - now_t) - d) % 2 == 0:
    now = (x,y)
    now_t = t
    continue
  ok = False
  break
  
if ok:
  print('Yes')
else:
  print('No')
Buggy code:
n=int(input())

from numpy import array

i=0
o=array([0,0,0])
while i<n:
   c=list(map(int,input().split()))
   z=array(c)
   w=z-o
   a,b=map(int,[w[0],abs(w[1])+abs(w[2])])

   if a<b:
       print("No")
        break

   else:
       if (a+b)%2==0:
           o=z
           i=i+1
       else:
           print("No")
           break
else:
    print("Yes")


Fixed code:
n=int(input())

from numpy import array

i=0
o=array([0,0,0])
while i<n:
   c=list(map(int,input().split()))
   z=array(c)
   w=z-o
   a,b=map(int,[w[0],abs(w[1])+abs(w[2])])

   if a<b:
       print("No")
       break

   else:
       if (a+b)%2==0:
           o=z
           i=i+1
       else:
           print("No")
           break
else:
    print("Yes")
Buggy code:
N = int(input())
for i in range(N):
    cord_list.append(list(map(int, input().split())))

cord_list = [[0, 0, 0]]
flag = 0

for j in range(N):
    a = cord_list[j+1][0] - cord_list[j][0]
    b = abs(cord_list[j+1][1] - cord_list[j][1])
    c = abs(cord_list[j+1][2] - cord_list[j][2])
    if ((a - (b + c))%2 ==0) & ((b+c) <= a):
        pass
    else:
        print("No")
        flag += 1
        break
        
if flag == 0:
    print("Yes")

Fixed code:
N = int(input())
cord_list = [[0, 0, 0]]
flag = 0
for i in range(N):
    cord_list.append(list(map(int, input().split())))
    
for j in range(N):
    a = cord_list[j+1][0] - cord_list[j][0]
    b = cord_list[j+1][1] - cord_list[j][1]
    c = cord_list[j+1][2] - cord_list[j][2]
    if ((a - (abs(b) + abs(c)))%2 ==0) & ((abs(b) + abs(c)) <= a):
        pass
    else:
        print("No")
        flag += 1
        break
        
if flag == 0:
    print("Yes")
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())
  dt = t - T
  dist = abs(x - X) + abs(y - Y)
  if dist <= dt and t%2 == (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())
  dt = t - T
  dist = abs(x - X) + abs(y - Y)
  if dist <= dt and t%2 == (x+y)%2:
    count += 1
  T, X, Y = t, x, y
print('Yes' if count == N else 'No')
Buggy code:
n = int(input())
flg = True
t, x, y = 0, 0, 0
for i in range(n):
    nt, nx, ny = map(int, input().split()) 
    dist = abs(x - nx) + abs(y - ny)
    dt = nt - t
    if dist > dt or (dist - dt) % 2 == 1:
        print("NO")
        flg = False
        break
    t, x, y = nt, nx, ny
if flg == True:
    print("YES")

Fixed code:
n = int(input())
flg = True
t, x, y = 0, 0, 0
for i in range(n):
    nt, nx, ny = map(int, input().split()) 
    dist = abs(x - nx) + abs(y - ny)
    dt = nt - t
    if dist > dt or (dist - dt) % 2 == 1:
        print("No")
        flg = False
        break
    t, x, y = nt, nx, ny
if flg == True:
    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) >(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 t < x + y or (x+y+t) % 2:
		print("No")
		exit()

print("Yes")
Buggy code:
n = int(input())
a = 0
b = 0
c = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if (t%2 != ((x-b) + (y-c))%2):
        if (t - a) < ((x - b) + (y - c)):
            print("No")
            exit()
    else:
        print("No")
        exit()
    a,b,c = t,x,y       
print("Yes")


Fixed code:
n = int(input())
a = 0
b = 0
c = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if (t - a) >= (abs(x - b) + abs(y - c)):
        if ((t - a)%2 != (abs(x-b) + abs(y-c))%2):
            print("No")
            exit()
    else:
        print("No")
        exit()
    a,b,c = t,x,y       
print("Yes")
Buggy code:
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
for i in txy:
    if i[0] % 2 != (i[1] + i[2]) % 2:
        print("No")
        exit()
print("Yes")

Fixed code:
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
for i in txy:
    if i[1] + i[2] > i[0] or i[0] % 2 != (i[1] + i[2]) % 2:
        print("No")
        exit()
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 != 0:
    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 != 0:
    print("No")
    exit()
print("Yes")
Buggy code:
n = int(input())
for _ in range(n):
  t, dx, dy = list(map(int, input().split()))
  if( (dx + dy) > dt ):
    print("No")
    exit()
  if((dx + dy) % 2 != dt % 2):
    print("No")
    exit()
print("Yes")


Fixed code:
n = int(input())
for _ in range(n):
  dt, dx, dy = list(map(int, input().split()))
  if( (dx + dy) > dt ):
    print("No")
    exit()
  if((dx + dy) % 2 != dt % 2):
    print("No")
    exit()
print("Yes")
Buggy code:
n = int(input())
t = [0] * n
x = [0] * n
y = [0] * n
ans = 'Yes'
for i in range(n):
  t[i], x[i], y[i] = map(int, input().split())

for i in range(n-1):
  t_temp = t[i+1] - t[i]
  x_temp = abs(x[i+1] - x[i])
  y_temp = abs(y[i+1] - y[i])
  d = x_temp + y_temp
  if d in range(t_temp, -1, -2):
    continue
  else:
    ans = 'No'
print(ans)

Fixed code:
n = int(input())
t = [0] * n
x = [0] * n
y = [0] * n
ans = 'Yes'
for i in range(n):
  t[i], x[i], y[i] = map(int, input().split())

d = abs(x[0]) + abs(y[0])
if d not in range(t[0], -1, -2):
  ans = 'No'
  
for i in range(n-1):
  t_temp = t[i+1] - t[i]
  x_temp = abs(x[i+1] - x[i])
  y_temp = abs(y[i+1] - y[i])
  d = x_temp + y_temp
  if d in range(t_temp, -1, -2):
    continue
  else:
    ans = 'No'
print(ans)
Buggy code:
_,*p=map(int,open(0).read().split());print(('Yes','No')[sum(1 for t,x,y in zip(*[iter(p)]*3)if t<x+y|t%2!=(x+y)%2)>0])

Fixed code:
_,*p=map(int,open(0).read().split());print(('Yes','No')[sum(1 for t,x,y in zip(*[iter(p)]*3)if t<x+y or t%2!=(x+y)%2)>0])
Buggy code:
#!/usr/bin/env python3
# coding=utf-8

import sys

n = int(sys.stdin.readline().strip())

txy = [(0,0,0)]+[tuple(map(int, l.strip().split(" "))) for l in sys.stdin.readlines()]
check_txy = [abs(_x - _xp) + abs(_y -_ yp) <= _t - _tp and (_t + _x + _y) % 2 == 0 for (_t, _x, _y), (_tp, _xp, _yp) in zip(txy[1:], txy)]
if all(check_txy):
    print("Yes")
else:
    print("No")


Fixed code:
#!/usr/bin/env python3
# coding=utf-8

import sys

n = int(sys.stdin.readline().strip())

txy = [(0,0,0)]+[tuple(map(int, l.strip().split(" "))) for l in sys.stdin.readlines()]
check_txy = [abs(_x - _xp) + abs(_y - _yp) <= _t - _tp and (_t + _x + _y) % 2 == 0 for (_t, _x, _y), (_tp, _xp, _yp) in zip(txy[1:], txy)]
if all(check_txy):
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())

ans = True
for i in range(n):
    t,x,y = map(int,input().split())
    if (x+y)%2 != t%2:
        ans = False

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

Fixed code:
n = int(input())
ans = True
for i in range(n):
    t,x,y = map(int,input().split())
    if (x+y)%2 != t%2:
        ans = False
    if x+y>t:
        ans = False

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