qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys

def main():
    N = int(input())
    t = [0] * N
    x = [0] * N
    y = [0] * N
    for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())
    
    flag = True
    for i in range(N-1):
        dt = t[i+1] - t[i]
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
        if dt % 2 != dist % 2:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()

Fixed code:
import sys

def main():
    N = int(input())
    t = [0] * (N+1)
    x = [0] * (N+1)
    y = [0] * (N+1)
    for i in range(1, N+1):
        t[i], x[i], y[i] = map(int, input().split())
    
    flag = True
    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 % 2 != dist % 2 or dt < dist:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()
Buggy code:
N=int(input())
tl=[]
xl=[]
yl=[]
al=[]
bl=[]
cl=[]
dl=[]

for i in range(N):
 t,x,y=map(int,input().split())
 tl.append(t)
 xl.append(x)
 yl.append(y)
 al.append((x+y)%2)
 bl.append(t%2)
 print(x)
for i in range(N):
 c=abs((xl[i]+yl[i])-(xl[i-1]+yl[i-1]))
 d=tl[i]-tl[i-1]
 cl.append(c)
 dl.append(d)

if al==bl and (xl+yl)<=tl and cl<=dl:
 print("Yes")
else :
  print("No")

Fixed code:
N=int(input())
tl=[]
xl=[]
yl=[]
al=[]
bl=[]
cl=[]
dl=[]

for i in range(N):
 t,x,y=map(int,input().split())
 tl.append(t)
 xl.append(x)
 yl.append(y)
 al.append((x+y)%2)
 bl.append(t%2)

for i in range(N):
 c=abs((xl[i]+yl[i])-(xl[i-1]+yl[i-1]))
 d=abs(tl[i]-tl[i-1])
 cl.append(c)
 dl.append(d)

count=0
for i in range(N):
 if al[i]==bl[i] and (xl[i]+yl[i])<=tl[i] and cl[i]<=dl[i]:
  count+=1
if count==N:
  print("Yes")
else :
  print("No")
Buggy code:
N = int(input())
txy = []
for i in range(N):
    txy.append(list(map(int,input().split())))
ans = "YES"
t = 0
x = 0
y = 0
for i in range(N):
    deft = txy[i][0] - t
    defx = abs(txy[i][1] - x)
    defy = abs(txy[i][2] - y)
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    if (defx + defy) > deft:
        ans = "NO"
        break
    elif (deft - defx - defy)%2 != 0:
        ans = "NO"
        break
print(ans)

Fixed code:
N = int(input())
txy = []
for i in range(N):
    txy.append(list(map(int,input().split())))
ans = "Yes"
t = 0
x = 0
y = 0
for i in range(N):
    deft = txy[i][0] - t
    defx = abs(txy[i][1] - x)
    defy = abs(txy[i][2] - y)
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    if (defx + defy) > deft:
        ans = "No"
        break
    elif (deft - defx - defy)%2 != 0:
        ans = "No"
        break
print(ans)
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())
p = [[0, 0, 0]]

for i in range(0, n):
    t, x, y = [int(i) for i in input().split(" ")]
    p.append([t, x, y])

f = True

for i in range(0, n):
    d = (p[i + 1][0] - p[i][0]) - (abs(p[i][1] - p[i + 1][1]) + abs(p[i][2] - p[i + 1][2]))
    print(d)
    if  d <= 0:
        f = False
        break
    else:
        if d % 2 == 1:
            f = False
            break

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

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

for i in range(0, n):
    t, x, y = [int(i) for i in input().split(" ")]
    p.append([t, x, y])

f = True

for i in range(0, n):
    l = abs(p[i][1] - p[i + 1][1]) + abs(p[i][2] - p[i + 1][2])
    dt = p[i + 1][0] - p[i][0]
    if l == 0 and dt == 1:
        f = False
        break
    if dt < l:
        f = False
        break
    else:
        if (dt - l) % 2 == 1:
            f = False
            break

if f:
    print("Yes")
else:
    print("No")
Buggy code:
n=int(input())
t=[0 for i in range(n)]
x=[0 for i in range(n)]
y=[0 for i in range(n)]
for i in range(n):
    t[i],x[i],y[i]=list(map(int,input().split(" ")))
x.insert(0,0)
y.insert(0,0)
for i in range(n-1):
    abx=abs(x[i]-x[i+1])
    aby=abs(y[i]-y[i+1])
    if abx+aby>t[i] or (abs(x[i+1])+abs(y[i+1]))%2!=t[i]%2:
        print("NO")
        exit(0)
print("YES")

Fixed code:
n=int(input())
t=[0 for i in range(n)]
x=[0 for i in range(n)]
y=[0 for i in range(n)]
for i in range(n):
    t[i],x[i],y[i]=list(map(int,input().split(" ")))
t.insert(0,0)
x.insert(0,0)
y.insert(0,0)
for i in range(n):
    abx=abs(x[i]-x[i+1])
    aby=abs(y[i]-y[i+1])
    if abx+aby>t[i+1]-t[i] or (abs(x[i+1])+abs(y[i+1]))%2!=t[i+1]%2:
        print("No")
        exit(0)
print("Yes")
Buggy code:
def odd_even(a, b):
    if a % 2 == b % 2:
        return True
    else:
        return False

n = int(input())
T, X, Y = [0], [0], [0]
for _ 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(1,n+1):
    t_dif = T[i] - T[i-1]
    x_dif = abs(X[i]-X[i-1])
    y_dif = abs(Y[i]-Y[i-1])
    if t_dif <= (x_dif + y_dif) and odd_even(t_dif, x_dif+y_dif):
        pass
    else:
        ans = 'No'
        break

print(ans)

Fixed code:
def odd_even(a, b):
    if a % 2 == b % 2:
        return True
    else:
        return False

n = int(input())
T, X, Y = [0], [0], [0]
for _ 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(1,n+1):
    t_dif = T[i] - T[i-1]
    x_dif = abs(X[i]-X[i-1])
    y_dif = abs(Y[i]-Y[i-1])
    if t_dif >= (x_dif + y_dif) and odd_even(t_dif, x_dif+y_dif):
        pass
    else:
        ans = 'No'
        break

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

#print(li)

for i in range(n-1) :
  cr=li[i]
  nx=li[i+1]
  dist=abs(nx[1]-cr[1])+abs(nx[2]-cr[2])
  dt=nx[0]-cr[0]
  if dt<dist :
    print("No")
    exit()
  if (dt%2) != (dist%2) :
    print("No")
    exit()
print("Yes")

Fixed code:
n=int(input())

li=[list(map(int,input().split())) for i in range(n)]
li.insert(0,[0,0,0])
#print(li)

for i in range(n) :
  cr=li[i]
  nx=li[i+1]
  dist=abs(nx[1]-cr[1])+abs(nx[2]-cr[2])
  dt=nx[0]-cr[0]
  if dt<dist :
    print("No")
    exit()
  if (dt%2) != (dist%2) :
    print("No")
    exit()
print("Yes")
Buggy code:
n = int(input())
previous_t = 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    print(t)
    print(x)
    print(y)
    if x + y > t:
        print("No")
        break
    if (x + y) % 2 != t % 2:
        print("No")
        break
    if previous_t > 0 and (abs(x - previous_x) + abs(y - previous_y) > (t - previous_t)):
        print("No")
        break
    previous_t = t
    previous_x = x
    previous_y = y
else:
    print("Yes")


Fixed code:
n = int(input())
previous_t = 0
for i in range(n):
    t, x, y = list(map(int, input().split()))
    if x + y > t:
        print("No")
        break
    if (x + y) % 2 != t % 2:
        print("No")
        break
    if previous_t > 0 and (abs(x - previous_x) + abs(y - previous_y) > (t - previous_t)):
        print("No")
        break
    previous_t = t
    previous_x = x
    previous_y = y
else:
    print("Yes")
Buggy code:
n = int(input())
past_x = 0
past_y = 0
for _ in range(n):
    t, x, y = tuple(map(int, input().split(" ")))
    diff = abs(past_x - x) + abs(past_y - y)
    if (t - diff) % 2 == 0:
        continue
    else:
        print("No")
        exit(0)

print("Yes")

Fixed code:
n = int(input())
past_x = 0
past_y = 0
past_t = 0
for _ in range(n):
    t, x, y = tuple(map(int, input().split(" ")))
    diff = abs(past_x - x) + abs(past_y - y)
    if (t - past_t) >= diff and ((t - past_t) - diff) % 2 == 0:
        past_t, past_x, past_y = t, x, y
        continue
    else:
        print("No")
        exit(0)

print("Yes")
Buggy code:
t = [0]
x = [0]
y = [0]
N = int(input())
for i in range(1,N+1):
  ti,xi,yi = map(int,input(),split())
  t.append(ti)
  x.append(xi)
  y.append(yi)
  
flg = True
 
for i in range(0,N):
  if t[i+1]-t[i] <　x[i+1]-x[i] + y[i+1]-y[i]:
    flg = False
  else (t[i+1]-t[i])%2 - (x[i+1]-x[i] + y[i+1]-y[i])%2==0:
    flg = False
if (flg):
  print('Yes')
else:
  print('No')

Fixed code:
t = [0]
x = [0]
y = [0]
n = int(input())
for i in range(n):
  ti, xi, yi = map(int,input().split())
  t.append(ti)
  x.append(xi)
  y.append(yi)
  
flg = True 
for i in range(1,n+1):
  if (t[i]-t[i-1]) < (x[i]-x[i-1]+y[i]-y[i-1]):
    flg = False
  elif ((t[i]-t[i-1])%2) != ((x[i]-x[i-1]+y[i]-y[i-1])%2):
    flg = False
if(flg):
  print("Yes")
else:
  print("No")
Buggy code:
t = [0]
x = [0]
y = [0]
N = int(input())
for i in range(N):
  ti,xi,yi = map(int,input(),split())
  t.append(ti)
  x.append(xi)
  y.append(yi)
  
flg = True
 
for i in range(1,N+1):
  if t[i]-t[i-1] <　x[i]-x[i-1] + y[i]-y[i-1]:
    flg = False
  elif (t[i]-t[i-1])%2 != (x[i]-x[i-1]+y[i]-y[i-1])%2:
    flg = False
if(flg):
  print("Yes")
else:
  print("No")


Fixed code:
t = [0]
x = [0]
y = [0]
n = int(input())
for i in range(n):
    ti, xi, yi = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
    
flg=True
for i in range(1, n+1):
    if((x[i]-x[i-1])+(y[i]-y[i-1])>(t[i]-t[i-1])):
        flg=False
    elif(((x[i]-x[i-1])+(y[i]-y[i-1]))%2!=(t[i]-t[i-1])%2):
        flg=False
if(flg):
    print("Yes")
else:
    print("No")
Buggy code:
num_list=int(input())
a=[1,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and d != 0 and (dt-d)%2==0:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break

Fixed code:
num_list=int(input())
a=[0,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and dt%2==d%2:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break
Buggy code:
N = int(input())
point = [0, 0]
t_list = []
ans = "Yes"
t = list(map(int, input().split()))
dis = abs(point[0]-t[1])+abs(point[1]-t[2])
t_list.append(t)
if t[0] < dis:
    ans = "No"
point = [t[1], t[2]]
for i in range(N-1):
    t = list(map(int, input().split()))
    dis = abs(point[0]-t[1])+abs(point[1]-t[2])
    if t_list[-1][0]-t[0] < dis:
        ans = "No"
    point = [t[1], t[2]]
    t_list.append(t)
print(ans)

Fixed code:
N = int(input())
point = [0, 0]
t_list = []
ans = "Yes"
t = list(map(int, input().split()))
dis = abs(point[0]-t[1])+abs(point[1]-t[2])
t_list.append(t)
if t[0] < dis or t[0]%2!=dis%2:
    ans = "No"
point = [t[1], t[2]]
for i in range(N-1):
    t = list(map(int, input().split()))
    dis = abs(point[0]-t[1])+abs(point[1]-t[2])
    if t[0]-t_list[-1][0] < dis or (t[0]-t_list[-1][0])%2!=dis%2:
        ans = "No"
    point = [t[1], t[2]]
    t_list.append(t)
print(ans)
Buggy code:
N=int(input())
ans=[]
for i in range(N):
 t,x,y=map(int, input().split())
 if t<x+y:
  ans+='No'
 elif (t%2==0 and (x+y)%2==1):
  ans.append('No')
 elif (t%2==1 and (x+y)%2==0):
  ans.append('No')
 else:
  ans.append('Yes')
if 'No' in ans:
 print('No')
else:
 print('Yes')

Fixed code:
N=int(input())
ans=[]
for i in range(N):
 t,x,y=map(int, input().split())
 if t<x+y:
  ans.append('No')
 elif (t%2==0 and (x+y)%2==1):
  ans.append('No')
 elif (t%2==1 and (x+y)%2==0):
  ans.append('No')
 else:
  ans.append('Yes')
if 'No' in ans:
 print('No')
else:
 print('Yes')
Buggy code:
N = int(input())
flag = 1
t1 = 0
x1 = 0
x2 = 0
for i in range(N):
  t2, x2, y2 = map(int, input().split())
  dt = t2-t1
  dx = abs(x2-x1)
  dy = abs(y2-y1)
  if dt<(dx+dy) or dt %2 != (dx+dy) % 2:
    flag = 0
    break
  t1 = t2
  x1 = x2
  y1 = y2
print("Yes" if flag else "No")

Fixed code:
N = int(input())
flag = 1
t1 = 0
x1 = 0
y1 = 0
for i in range(N):
  t2, x2, y2 = map(int, input().split())
  dt = t2-t1
  dx = abs(x2-x1)
  dy = abs(y2-y1)
  if dt<(dx+dy) or dt %2 != (dx+dy) % 2:
    flag = 0
    break
  t1 = t2
  x1 = x2
  y1 = y2
print("Yes" if flag else "No")
Buggy code:
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n
    x = [0]*n
    y = [0]*n
    for i in range(n):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Fixed code:
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*(n+1)
    x = [0]*(n+1)
    y = [0]*(n+1)
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()
Buggy code:
N = int(input())
P = [list(map(int,input().split())) for i in range(N)]
flag = False
for tmp in P:
  t,x,y = tmp
  sum_ = x + y
  if (t % 2 == 0 and sum_ % 2 != 0) or (t % 2 != 0 and sum_ % 2 == 0):
    flag = True
    break
if flag:
  print('No')
else:
  print('Yes')

Fixed code:
N = int(input())
P = [list(map(int,input().split())) for i in range(N)]
flag = False
for tmp in P:
  t,x,y = tmp
  sum_ = x + y
  if (t % 2 == 0 and sum_ % 2 != 0) or (t % 2 != 0 and sum_ % 2 == 0) or t < sum_:
    flag = True
    break
if flag:
  print('No')
else:
  print('Yes')
Buggy code:
N = int(input())
txy = [tuple() for _ in range(N)]
for i in range(N - 1):
    now = txy[i]
    next = txy[i + 1]
    root = abs(next[1] - now[1]) + abs(next[2] - now[2])
    time = next[0] - now[0]
    if time < root:
        print("No")
        break
    else:
        if time == root:
            pass
        else:
            if (time - root) % 2 != 0:
                print("No")
                break
else:
    print("Yes")


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


for i in range(N):
    now = txy[i]
    next = txy[i + 1]
    root = abs(next[1] - now[1]) + abs(next[2] - now[2])
    time = next[0] - now[0]
    if time < root:
        print("No")
        break
    else:
        if time == root:
            pass
        else:
            if (time - root) % 2 != 0:
                print("No")
                break
else:
    if N == 1:
        root = txy[1][1] + txy[1][2]
        time = txy[1][0]
        if time < root:
            print("No")
        else:
            if (time - root) % 2 == 0:
                print("Yes")
            else:
                print("No")
    else:
        print("Yes")
Buggy code:
N = input()
T, X, Y = 0, 0, 0
for i in range(N):
  t, x, y = map(int, input().split())
  if t % 2 == (x+y) % 2 and abs(x-X)+abs(y-Y) <= t-T:
    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
  
print('Yes' if count == N else 'No')
Buggy code:
for i in range(int(input())):
	t,x,y=map(int,input().split())
	if(t+x+y)%2+(t<x+y):
      print("No")
      exit()
print("Yes")

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

n = int(input())
before_t, before_x, before_y = 0, 0, 0
for i in range(n):
	txy_strs = input().split()
	t, x, y = tuple(map(int, txy_strs))
	
	movable = t - before_t
	min_move = abs(x - before_x) + abs(y - before_y)

	remaining = movable - min_move
	if 0 <= remaining and remaining % 2 == 0:
		before_t, before_min = t, min_move
	else:
		print("No")
		sys.exit()
print("Yes")

Fixed code:
import sys

n = int(input())
before_t, before_x, before_y = 0, 0, 0
for i in range(n):
	txy_strs = input().split()
	t, x, y = tuple(map(int, txy_strs))
	
	movable = t - before_t
	min_move = abs(x - before_x) + abs(y - before_y)

	remaining = movable - min_move
	if 0 <= remaining and remaining % 2 == 0:
		before_t, before_x, before_y = t, x, y
	else:
		print("No")
		sys.exit()
print("Yes")
Buggy code:
# Relative rela
import sys

n = int(input())
txy_list = [[int(n) for n in input().split()] for i in range(n)]

before_x, before_y = 0, 0
for t, x, y in txy_list:
	rela_x, rela_y = x - before_x, y - before_y
	remaining = t - abs(rela_x) + abs(rela_y)
	if 0 <= remaining and remaining % 2 == 0:
		before_x, before_y = x, y
	else:
		print("No")
		sys.exit()

print("Yes")

Fixed code:
# Relative rela
import sys

n = int(input())
txy_list = [[int(n) for n in input().split()] for i in range(n)]
times_list = [txy_list[0][0]] + [txy_list[i+1][0] - txy_list[i][0] for i in range(n-1)]

before_x, before_y = 0, 0
for i, txy in enumerate(txy_list):
	t, x, y = txy
	rela_x, rela_y = x - before_x, y - before_y
	remaining = times_list[i] - (abs(rela_x) + abs(rela_y))
	if 0 <= remaining and remaining % 2 == 0:
		before_x, before_y = x, y
	else:
		print("No")
		sys.exit()
print("Yes")
Buggy code:
n = int(input())

x_now, y_now, t_now = 0, 0, 0

for i in range(n):
    t, x, y = map(int, input().split())
    if ((t -t_now) - abs(x-x_now) - abs(y-y_now)) % 2 == 0 :
        x_now,y_now,t_now = x,y,t
    else:
        print('No')
        exit()

print('Yes')


Fixed code:
n = int(input())

x_now, y_now, t_now = 0, 0, 0

for i in range(n):
    t, x, y = map(int, input().split())
    distance = (t -t_now) - abs(x-x_now) - abs(y-y_now)
    if distance >= 0 and distance % 2 == 0:
        x_now,y_now,t_now = x,y,t
    else:
        print('No')
        exit()

print('Yes')
Buggy code:
nums = int(input())
tmp = list()
for num in range(nums):
    tmp.append([int(_) for _ in str(input()).split(" ")])

for num, case in enumerate(tmp):
    t, x, y = case
    if t < abs(x) + abs(y):
        print("No")
        break
    else:
        if ((abs(x) + abs(y)) % 2) and (t % 2):
            if num == len(tmp):
                print("Yes")
        elif ((abs(x) + abs(y)) % 2 == 0) and (t % 2 == 0):
            if num == len(tmp):
                print("Yes")
        else:
            print("No")
            break


Fixed code:
nums = int(input())
tmp = list()
for num in range(nums):
    tmp.append([int(_) for _ in str(input()).split(" ")])

for num, case in enumerate(tmp):
    t, x, y = case
    if t < abs(x) + abs(y):
        print("No")
        break
    else:
        if ((abs(x) + abs(y)) % 2) and (t % 2):
            if num +1 == len(tmp):
                print("Yes")
        elif ((abs(x) + abs(y)) % 2 == 0) and (t % 2 == 0):
            if num +1 == len(tmp):
                print("Yes")
        else:
            print("No")
            break
Buggy code:
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]

X=Y=T=0
ok = True
for t,x,y in txy:
    if abs(X-x)+abs(Y-y) <= t-T:
        if (t-T)%2 == 0:
            if (abs(X-x)+abs(Y-y))%2!=0:
                ok = False
                break
        else:
            if (abs(X-x)+abs(Y-y))%2==0:
                ok = False
                break
    else:
        ok = False
        break
    T,X,Y = t,x,y
print("Yes" if ok else "NO")

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

T=X=Y=0
ok = True
for t,x,y in txy:
  if abs(X-x)+abs(Y-y) <= t-T:
    if (t-T)%2 == 0:
      if (abs(X-x)+abs(Y-y))%2!=0:
        ok = False
        break
    else:
      if (abs(X-x)+abs(Y-y))%2==0:
        ok = False
        break
  else:
    ok = False
    break
  T,X,Y = t,x,y
print("Yes" if ok else "No")
Buggy code:
n = int(input())
T = [0];X = [0];Y = [0]
for i in range(n):
    t, x, y = [int(i) for i in input().split()]
    T.append(t);X.append(x);Y.append(y)

for i in range(1, n+1):
    t_diff = T[i] - T[i-1]
    pos_diff = abs(X[i] + Y[i] - X[i-1] - Y[i-1])
    if (pos_diff - t_diff) % 2 != 0:
        break
else:
    print("Yes")
    exit()
print("No")


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

for i in range(1, n+1):
    t_diff = T[i] - T[i-1]
    pos_diff = abs(X[i] - X[i-1]) + abs(Y[i] - Y[i-1])
    a = t_diff - pos_diff
    if a % 2 != 0 or a < 0:
        break
else:
    print("Yes")
    exit()
print("No")
Buggy code:
import sys
N = int(input())
txy2 = [list(map(int,input().split())) for _ in range(N)]
txy = [[0,0,0]]
for i in range(N):
    txy.append(txy2[i])
for i in range(N):
    if abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2]) > txy[i+1][0]-txy[i][0]:
        print("No")
        sys.exit()
print("Yes")

Fixed code:
import sys
N = int(input())
txy2 = [list(map(int,input().split())) for _ in range(N)]
txy = [[0,0,0]]
for i in range(N):
    txy.append(txy2[i])
for i in range(N):
    if abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2]) > txy[i+1][0]-txy[i][0]:
        print("No")
        sys.exit()
    elif ((txy[i+1][0]-txy[i][0]) - (abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])))%2 != 0:
        print("No")
        sys.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())
k = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if t < x + y or t % 2 == (x + y) %2:
        print('No')
        break
    if i == n-1:
        print('Yes')

Fixed code:
n = int(input())
k = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if t < x + y or t % 2 != (x + y) %2:
        print('No')
        break
    if i == n-1:
        print('Yes')
Buggy code:

N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N

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

hantei="Yes"

for i in range(N):
    if i==0:
        if t[i]-x[i]-y[i]>=0 and t[i]%2==(x[i]+y[i])%2:
            continue
        else:
            break
    else:
        if t[i]-t[i-1]-x[i]-y[i]>=0 and (t[i]-t[i-1])%2==(x[i]-x[i-1]+y[i]-y[i-1])%2:
            continue
        
        else:
            break
    
print(hantei)


Fixed code:

N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N

hantei="Yes"


for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())
    if t[i]-x[i]-y[i]>=0 and t[i]%2==(x[i]+y[i])%2:
        continue
    else:
        hantei="No"
        break

print(hantei)
Buggy code:
n = int(input())
info = [list(map(int, input().split())) for i in range(n)]
info = sorted(info)

t = 0
x = 0
y = 0
for t1, x1, y1 in info:
    diff = abs(x - x1) + abs(y - y1)
    diff_t = abs(t - t1)
    if diff_t >= diff and diff % 2 == diff % 2:
        continue
    else:
        print("No")
        exit()
print("Yes")

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

t = 0
x = 0
y = 0
for t1, x1, y1 in info:
    diff = abs(x - x1) + abs(y - y1)
    diff_t = abs(t - t1)
    if diff_t >= diff and diff % 2 == diff_t % 2:
        continue
    else:
        print("No")
        exit()
print("Yes")
Buggy code:
n=int(input())
l=[]
for i in range(n):
  l.append(list(map(int,input().split())))
l1=[0,0,0]
b=True
for i in l:
  if abs(l[i][1]-l1[1])+abs(l1[2]-l[i][2])>l[i][0]-l1[0]:
    b=False
    break
  elif (abs(l[i][1]-l1[1])+abs(l1[2]-l[i][2]))%2!=(l[i][0]-l1[0])%2:
    b=False
    break
  else:
    l1=l[i]
if b:
  print("Yes")
else:
  print("No")

Fixed code:
n=int(input())
l=[]
for i in range(n):
  l.append(list(map(int,input().split())))
l1=[0,0,0]
b=True
for i in range(n):
  if abs(l[i][1]-l1[1])+abs(l1[2]-l[i][2])>l[i][0]-l1[0]:
    b=False
    break
  elif (abs(l[i][1]-l1[1])+abs(l1[2]-l[i][2]))%2!=(l[i][0]-l1[0])%2:
    b=False
    break
  else:
    l1=l[i]
if b:
  print("Yes")
else:
  print("No")