qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
t0 = 0
x0 = 0
y0 = 0
ans = True

for i in range(N):
    x,y,z = map(input().split())
    #t = int(next[0])
    #x = int(next[1])
    #y = int(next[2])
    time = t - t0
    range = abs(x - x0) + abs(y - y0)

    if 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

    t0 = t
    y0 = y
    x0 = x



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


Fixed code:
N = int(input())
t0 = 0
x0 = 0
y0 = 0
ans = True

for i in range(N):
    next = input().split()
    t = int(next[0])
    x = int(next[1])
    y = int(next[2])
    time = t - t0
    range = abs(x - x0) + abs(y - y0)

    if 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

    t0 = t
    y0 = y
    x0 = x



if ans == True:
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())
array_t = []
array_x = []
array_y = []
for i in range(N):
    t,x,y = map(int, input().split(" "))
    array_t.append(t)
    array_x.append(x)
    array_y.append(y)
flag = True
for i in range(N):
    if i ==0:
        added = abs(array_x[0])+abs(array_y[0])
        gap = array_t[0] - added
    else:
        added = abs(array_x[i]-array_x[i-1])+abs(array_x[i]+array_y[i-1])
        gap = array_t[i]-array_t[i-1] - added
    if gap>=0 and gap%2 == 0:
        continue
    else:
        print('NO')
        flag = False
        break
if flag:
    print('YES')


Fixed code:
N = int(input())
array_t = []
array_x = []
array_y = []
for i in range(N):
    t,x,y = map(int, input().split(" "))
    array_t.append(t)
    array_x.append(x)
    array_y.append(y)
flag = True
for i in range(N):
    if i ==0:
        added = abs(array_x[0])+abs(array_y[0])
        gap = array_t[0] - added
    else:
        added = abs(array_x[i]-array_x[i-1])+abs(array_y[i]-array_y[i-1])
        gap = array_t[i]-array_t[i-1] - added
    if gap>=0 and gap%2 == 0:
        continue
    else:
        print('No')
        flag = False
        break
if flag:
    print('Yes')
Buggy code:
N = int(input())

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

for i in range(N-1):
    move = x[i+1]-x[i] + y[i+1]-y[i]
    time = t[i+1]-t[i]
    if time%2 ^ move%2 == 1 or time < move:
        print("No")
        exit()

print("Yes")


Fixed code:
N = int(input())

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

for i in range(N):
    move = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    time = t[i+1]-t[i]
    if time%2 ^ move%2 == 1 or time < move:
        print("No")
        exit()

print("Yes")
Buggy code:
N = int(input())
tpr, xpr, ypr = 0, 0, 0
count = 0
for i in range(N):
    t, x, y = map(int, input().split())
    d = abs(x-xpr) + abs(y-ypr)
    n = ((t-tpr) - d) / 2
    if n >= 0:
        count += 1
    tpr, xpr, ypr = t, x, y
if count == N:
    print("Yes")
else:
    print("No") 

Fixed code:
N = int(input())
tpr, xpr, ypr = 0, 0, 0
count = 0
for i in range(N):
    t, x, y = map(int, input().split())
    d = abs(x-xpr) + abs(y-ypr)
    n = ((t-tpr) - d) / 2
    if n >= 0 and n % 1 == 0:
        count += 1
    tpr, xpr, ypr = t, x, y
if count == N:
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
T = [0]
coo = [(0, 0)]
for i in range(N):
    t, x, y = map(int, input().split())
    T.append(t)
    coo.append((x, y))

for i in range(N):
    dxdy = coo[i+1][0] - coo[i][0] + coo[i+1][1] - coo[i][1]
    rt = T[i+1] - T[i] % 2
    rdxdy = dxdy % 2
    if dxdy <= T[i+1] - T[i] and rt == rdxdy:
        pass
    else:
        print('No')
        exit()
print('Yes')

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

for i in range(N):
    dxdy = coo[i+1][0] - coo[i][0] + coo[i+1][1] - coo[i][1]
    rt = (T[i+1] - T[i]) % 2
    rdxdy = dxdy % 2
    if dxdy <= T[i+1] - T[i] and rt == rdxdy:
        pass
    else:
        print('No')
        exit()
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())
  
def traveling(t,x,y):
  time_i=0
  x_i=0
  y_i=0
  for i,time in enumerate(t):
    time_i=time-time_i
    x_i=x[i]-x_i
    y_i=y[i]-y_i
    z=x[i]+y[i]
    if (time_i-z)%2==0:
      return "Yes"
    else:
      return "No"
    time_i=time
    x_i=x[i]
    y_i=y[i]
    
print("{}".format(traveling(t,x,y)))

Fixed 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())
  
def traveling(t,x,y):
  time_i=0
  x_i=0
  y_i=0
  for i,time in enumerate(t):
    time_i=time-time_i
    x_i=x[i]-x_i
    y_i=y[i]-y_i
    z=x_i+y_i
    if (time_i-z)%2!=0 or z>time_i:
      return "No"
    time_i=time
    x_i=x[i]
    y_i=y[i]
  return "Yes"
    
print("{}".format(traveling(t,x,y)))
Buggy code:

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

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

flag = True
for j in range(1,N):
    c = abs(x[j]-x[j-1])+abs(y[j]-y[j-1])
    tm = t[j]-t[j-1]
    if tm-c < 0 or (tm-c) % 2 != 0:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

Fixed code:

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

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

flag = True
for j in range(1,N+1):
    c = abs(x[j]-x[j-1])+abs(y[j]-y[j-1])
    tm = t[j]-t[j-1]
    if tm-c < 0 or (tm-c) % 2 != 0:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
T,X,Y = 0,0,0

ans = "Yes"
for _ in range(N):
    t,x,y = map(int,input().split())
    t_need = abs(x - X) + abs(y - Y)
    if t - T < t_need:
        ans = "no"
        break
    if t - T > t_need:
        if ((t - T) - t_need) % 2 == 1:
            ans = "no"
            break
    T,X,Y = t,x,y

print(ans)

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

ans = "Yes"
for _ in range(N):
    t,x,y = map(int,input().split())
    t_need = abs(x - X) + abs(y - Y)
    if t - T < t_need:
        ans = "No"
        break
    if t - T > t_need:
        if ((t - T) - t_need) % 2 == 1:
            ans = "No"
            break
    T,X,Y = t,x,y

print(ans)
Buggy code:
N=int(input()) 
pre_t=0
pre_x=0
pre_y=0
for i in range(N):
    now_t,now_x,now_y=list(map(int,input().split()))
    d=abs(pre_x-now_x)+abs(pre_y-now_y)
    t=pre_t-now_t
    if d<=t and t%2==d%2:
        flg=1
    else:
        flg=0
        break
if flg==1:
    print('Yes')
else:
    print('No')

Fixed code:
N = int(input()) 
pre_t = 0
pre_x = 0
pre_y = 0

for i in range(N):
    now_t,now_x,now_y = list(map(int,input().split()))
    d = abs(now_x - pre_x) + abs(now_y - pre_y)
    t = now_t - pre_t
    if d <= t and t % 2 == d % 2:
        flg = 1
    else:
        flg = 0
        break

if flg == 1:
    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:
        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:
n = int(input())
a = [input().split() for l in range(n)]
b = 0
t = [0]
x = [0]
y = [0]
for i in range(n):
    t.append(a[i][0])
    x.append(a[i][1])
    y.append(a[i][2])


for p in range(1,n+1):
    o = int(t[i])-int(t[i-1])
    p = int(x[i])-int(x[i-1])
    q = int(y[i])-int(y[i-1])
    if o >= p+q and (o - (p+q))%2 == 0:
        b += 1

if b == n:
    print('Yes')
else:

Fixed code:
n = int(input())
a = [input().split() for l in range(n)]
b = 0
t = [0]
x = [0]
y = [0]
for i in range(n):
    t.append(a[i][0])
    x.append(a[i][1])
    y.append(a[i][2])

for k in range(n):
    o = int(t[k+1])-int(t[k])
    p = int(x[k+1])-int(x[k])
    q = int(y[k+1])-int(y[k])
    if (o >= p+q) and ((o - (p+q))%2 == 0):
        b += 1
    else:
        b = b

if b == n:
    print('Yes')
else:
    print('No')
Buggy code:
n=int(input())
l=[[] for i in range(n+1)]
l[0]=[0,0,0]
for i in range(1,n+1):
    l[i]=list(map(int,input().split()))
for i in range(n):
    flag=False
    t=l[i+1][0]-l[i][0]
    x=l[i+1][1]-l[i][1]
    y=l[i+1][2]-l[i][2]
    for a in range(t):
        for b in range(t-a):
            c=a-x
            d=b-y
            if a+b+c+d==t:
                flag=True
                break
        if flag: break
    if not flag:
        print("No")
        break
if flag: print("Yes")

Fixed code:
n=int(input())
l=[[] for i in range(n+1)]
l[0]=[0,0,0]
for i in range(1,n+1):
    l[i]=list(map(int,input().split()))
for i in range(n):
    flag=False
    t=l[i+1][0]-l[i][0]
    x=l[i+1][1]-l[i][1]
    y=l[i+1][2]-l[i][2]
    for a in range(t+1):
        for b in range(t+1-a):
            c=a-x
            d=b-y
            if a+b+c+d==t:
                flag=True
                break
        if flag: break
    if not flag:
        print("No")
        break
if flag: print("Yes")
Buggy code:
N = int(input())

t, x, y = [0]*(N+1), [0]*(N+1), [0]*(N+1)
t[0] = x[0] = y[0] = 0
result = "YES"

def is_even(num):
    return num % 2 == 0

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

for i in range(1, N+1):
    time = t[i] - t[i-1]
    xlen = x[i] - x[i-1]
    ylen = y[i] - y[i-1]
    distance = abs(xlen)+abs(ylen)
    if is_even(time) == is_even(distance) and distance <= time:
        continue
    result = "NO"
    break

print(result)


Fixed code:
N = int(input())

t, x, y = [0]*(N+1), [0]*(N+1), [0]*(N+1)
t[0] = 0
x[0] = 0
y[0] = 0
result = "Yes"

def is_even(num):
    return num % 2 == 0

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

for i in range(1, N+1):
    time = t[i] - t[i-1]
    xlen = abs(x[i] - x[i-1])
    ylen = abs(y[i] - y[i-1])
    distance = xlen+ylen
    if is_even(time) == is_even(distance) and distance <= time:
        continue
    result = "No"
    break
    
print(result)
Buggy code:
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

def f(x1,y1,x2,y2,t):
    l = abs(x1-x2)+abs(y1-y2)
    if l <= t:
        if l%2 == t%2:
            return True
    return False

if __name__ == "__main__":
    n = I()
    t = [0]
    x = [0]
    y = [0]
    for i in range(n):
        a,b,c = I2()
        t.append(a)
        x.append(b)
        y.append(c)
    for i in range(n):
        print(x[i],y[i],x[i+1],y[i+1],t[i+1]-t[i])
        if not f(x[i],y[i],x[i+1],y[i+1],t[i+1]-t[i]):
            print("No")
            exit()
    print("Yes")

Fixed code:
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

def f(x1,y1,x2,y2,t):
    l = abs(x1-x2)+abs(y1-y2)
    if l <= t:
        if l%2 == t%2:
            return True
    return False

if __name__ == "__main__":
    n = I()
    t = [0]
    x = [0]
    y = [0]
    for i in range(n):
        a,b,c = I2()
        t.append(a)
        x.append(b)
        y.append(c)
    for i in range(n):
        #print(x[i],y[i],x[i+1],y[i+1],t[i+1]-t[i])
        if not f(x[i],y[i],x[i+1],y[i+1],t[i+1]-t[i]):
            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 :
    	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 (x+y+t)%2 :
    	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("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:
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(N):
  t[i+1], x[i+1], y[i+1] = map(int, input().split())
is_able = 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 < dist:
    is_able = False
  if dt % 2 != dist % 2:
    is_able = False
  
if is_able:
  print("YES")
else:
  print("NO")

Fixed code:
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(N):
  t[i+1], x[i+1], y[i+1] = map(int, input().split())
is_able = 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 < dist:
    is_able = False
  if dt % 2 != dist % 2:
    is_able = False
  
if is_able:
  print("Yes")
else:
  print("No")
Buggy code:
N = int(input())
status = [list(map(int, input().split())) for i in range(N)]
dt = []
dist = []
flag = []

for i in range(N - 1):
    dt.append(status[i + 1][0] - status[i][0])
    dist.append(abs(status[i + 1][1] - status[i][1]) + abs(status[i + 1][2] - status[i][2]))
    if (dt[i] % 2 == 0 and dist[i] % 2 == 0) \
        or (dt[i] % 2 == 1 and dist[i] % 2 == 1):
        flag.append(True)
    else:
        flag.append(False)

if all(flag):
    print('Yes')
else:
    print('No')


Fixed code:
N = int(input())
status = [list(map(int, input().split())) for i in range(N)]
dt = []
dist = []
flag = []
status.insert(0, [0, 0, 0])
for i in range(N):
    dt.append(status[i + 1][0] - status[i][0])
    dist.append(abs(status[i + 1][1] - status[i][1]) + abs(status[i + 1][2] - status[i][2]))
    if ((dt[i] % 2 == 0 and dist[i] % 2 == 0) \
        or (dt[i] % 2 == 1 and dist[i] % 2 == 1)) \
        and (dist[i] <= dt[i]):
        flag.append(True)
    else:
        flag.append(False)

if all(flag):
    print('Yes')
else:
    print('No')
Buggy code:
n = int(input())
lists = [[0,0,0]]
for i in range(n):
  a = list(map(int,input().split()))
  lists.append(a)

diffs = []  
for i in range(1,n+1,1):
  diff = [ x - y for (x,y) in zip(lists[i], lists[i-1])]
  diffs.append(diff) 
  
for diff in diffs:
  if diff[0] < abs(diff[1]) + abs(diff[2]):
    print('No')
    exit()
  elif diff[0] % 2 != (abs(diff[1]) + abs(diff[2])) % 2:
    print('No')
    exit()
print('yes') 

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

diffs = []  
for i in range(1,n+1,1):
  diff = [ x - y for (x,y) in zip(lists[i], lists[i-1])]
  diffs.append(diff) 
  
for diff in diffs:
  if diff[0] < abs(diff[1]) + abs(diff[2]):
    print('No')
    exit()
  elif diff[0] % 2 != (abs(diff[1]) + abs(diff[2])) % 2:
    print('No')
    exit()
print('Yes')
Buggy code:
N=int(input())
oldn,oldx,oldy=0,0,0
#print(x,y)
no=0
for i in range(N):
  nxy=input().split()
  n,x,y=int(nxy[0]),int(nxy[1]),int(nxy[2])
#  print(n,x,y)
  ndiff = n - oldn
  distance = abs(x - oldx) + abs(y - oldy)
#  print(ndiff,distance)
  oldn,oldx,oldy=n,x,y
  if distance > ndiff:
    print("No")
    no=1
    break
  print((ndiff-distance)%2)
  if (ndiff-distance)%2==0:
    continue
  else:
    no=1
    print("No")
    break
if no==0:
  print("Yes")

Fixed code:
N=int(input())
oldn,oldx,oldy=0,0,0
#print(x,y)
no=0
for i in range(N):
  nxy=input().split()
  n,x,y=int(nxy[0]),int(nxy[1]),int(nxy[2])
#  print(n,x,y)
  ndiff = n - oldn
  distance = abs(x - oldx) + abs(y - oldy)
#  print(ndiff,distance)
  oldn,oldx,oldy=n,x,y
  if distance > ndiff:
    print("No")
    no=1
    break
#  print((ndiff-distance)%2)
  if (ndiff-distance)%2==0:
    continue
  else:
    no=1
    print("No")
    break
if no==0:
  print("Yes")
Buggy code:
import sys

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] = map(int, input().split())

for i in range(N-1):
    time = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if (time - dist) >= 0 and (time - dist) % 2 == 0:
        pass
    else:
        print("No")
        sys.exit()


Fixed code:
import sys

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(1, N+1):
    t[i], x[i], y[i] = map(int, input().split())

for i in range(N):
    time = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if (time - dist) >= 0 and (time - dist) % 2 == 0:
        pass
    else:
        print("No")
        sys.exit()
print("Yes")
Buggy code:
import sys
N = int(input().strip())
grid = []
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
t = [0]
x = [0]
y = [0]
for lists in grid:
  t.append(lists[0])
  x.append(lists[1])
  y.append(lists[2])
i = 0
while i < N-1:
  d = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
  dt = t[i+1]-t[i]
  if dt >= d and (dt-d)%2==0:
    i += 1
  else:
    print('No')
    sys.exit()
print('Yes')

Fixed code:
import sys
N = int(input().strip())
grid = []
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
t = [0]
x = [0]
y = [0]
for lists in grid:
  t.append(lists[0])
  x.append(lists[1])
  y.append(lists[2])
i = 0
while i < N:
  d = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
  dt = t[i+1]-t[i]
  if dt >= d and (dt-d)%2==0:
    i += 1
  else:
    print('No')
    sys.exit()
print('Yes')
Buggy code:
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):
    if t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        print('No')
        exit()
    elif t[i] % 2 != (x[i] + y[i]) % 2:
        print('No')
        exit()
print('Yes')

Fixed code:
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):
    if t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        print('No')
        exit()
    elif t[i] % 2 != (x[i] + y[i]) % 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) % 2 != 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())
t = []
p = [0, 0, 0]
while(n):
    a, b, c = input().split(' ')
    t.append([int(a), int(b), int(c)])
    n-=1
for i in t:
    while(p[0] < i[0]):
        p[0]+=1
        if i[1] > p[1]:
            p[1]+=1
        elif i[2] > p[2]:
            p[2]+=1
        elif i[1] < p[1]:
            p[1]-=1
        elif i[2] < p[2]:
            p[2]-=1
        else:
            p[1]-=1
        print(p)
    if p != i:
        print('No')
        exit()
print('Yes')

Fixed code:
n = int(input())
t = []
p = [0, 0, 0]
while(n):
    a, b, c = input().split(' ')
    t.append([int(a), int(b), int(c)])
    n-=1
for i in t:
    while(p[0] < i[0]):
        p[0]+=1
        if i[1] > p[1]:
            p[1]+=1
        elif i[2] > p[2]:
            p[2]+=1
        elif i[1] < p[1]:
            p[1]-=1
        elif i[2] < p[2]:
            p[2]-=1
        else:
            p[1]-=1
    if p != i:
        print('No')
        exit()
print('Yes')
Buggy code:
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N

cx, cy, ct = 0, 0, 0
for i in range(N):
  t[i], x[i], y[i] = map(int, input().split())
  dx, dy, dt = abs(x[i]-cx), abs(y[i]-cy), abs(t[i]-ct)
  if dt < dx+dy:
    print("No")
    exit()
  if (dt-dx-dy) % 2 == 1:
    print("No")

print("Yes")

Fixed code:
# from math import abs

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

cx, cy, ct = 0, 0, 0
for i in range(N):
  t[i], x[i], y[i] = map(int, input().split())
  dx, dy, dt = abs(x[i]-cx), abs(y[i]-cy), abs(t[i]-ct)
  if dt < dx+dy:
    print("No")
    exit()
  if (dt-dx-dy) % 2 == 1:
    print("No")
    exit()

print("Yes")
Buggy code:
# ABC86 C - Traveling
N = int(input())
ans = "Yes"
t, x, y = 0, 0, 0
for i in range(N):
    ti, xi, yi = map(int, input().split())
    dt, dx, dy = ti - t, abs(xi - x), abs(yi - y)
    if (dx + dy - dt) % 2 == 0:
        t, x, y = ti, xi, yi
    else:
        ans = "No"
        break
print(ans)

Fixed code:
# ABC86 C - Traveling
N = int(input())
ans = "Yes"
t, x, y = 0, 0, 0
for i in range(N):
    ti, xi, yi = map(int, input().split())
    dt, dx, dy = ti - t, abs(xi - x), abs(yi - y)
    if dt >= dx + dy and (dt - (dx + dy)) % 2 == 0:
        t, x, y = ti, xi, yi
    else:
        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 + t) % 2 == 1:
        print("No")
        exit()
print("Yes")
Buggy code:
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
flag = 0
for i in range(1,N):
    dx = dist(X[i][1:],X[i-1][1:])
    dt = X[i][0]-X[i-1][0]
    if dt>=dx and (dt-dx)%2==0:
        continue
    else:
        flag = 1
        break
if flag==0:
    print("Yes")
else:
    print("No")

Fixed code:
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
X.insert(0,[0,0,0])
flag = 0
for i in range(1,N+1):
    dx = dist(X[i][1:],X[i-1][1:])
    dt = X[i][0]-X[i-1][0]
    if dt>=dx and (dt-dx)%2==0:
        continue
    else:
        flag = 1
        break
if flag==0:
    print("Yes")
else:
    print("No")
Buggy code:
N = int(input())
input_lis = [list(map(int,input().split())) for _ in range(N)]

can = True

for n in range(len(input_lis)):
    dis = 0
    t = 0
    if n == 0:
        dis = abs(input_lis[n][1]) + abs(input_lis[n][2])
        t = abs(input_lis[n][0])
    else:
        dis = abs(input_lis[n][1] - input_lis[n-1][1]) + abs(input_lis[n][2] - input_lis[n-1][2])
        t = abs(input_lis[n][0]) - abs(input_lis[n-1][0])
    
    if dis == t:
        continue
    if dis < t and ((t - dis) % 2) == 0:
        continue
    can = False
    break

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


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

can = True

for n in range(len(input_lis)):
    dis = 0
    t = 0
    if n == 0:
        dis = abs(input_lis[n][1]) + abs(input_lis[n][2])
        t = abs(input_lis[n][0])
    else:
        dis = abs(input_lis[n][1] - input_lis[n-1][1]) + abs(input_lis[n][2] - input_lis[n-1][2])
        t = abs(input_lis[n][0]) - abs(input_lis[n-1][0])
    
    if dis == t:
        continue
    if dis < t and ((t - dis) % 2) == 0:
        continue
    can = False
    break

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