qyliang/CodeNanoFix huggingface dataset:
Buggy code:
N = int(input())
list = [[int(i) for i in input().split()] for i in range(N)]
list.insert(0, [0, 0, 0])

if N == 1:
    timeInterval = list[1][0] - list[0][0]
    distance = abs(list[1][1]+list[1][2]-list[0][1]-list[0][2])
    if timeInterval < distance:
        print("No")
    elif (timeInterval - distance)%2 == 0:
        print("Yes")
    else:
        print("No")
else:
    for i in range(N):
        timeInterval = list[i+1][0] - list[i][0]
        distance = abs(list[i+1][1]+list[i+1][2]-list[i][1]-list[i][2])
        if timeInterval < distance:
            print("No")
        elif (timeInterval - distance)%2 == 0 and i == N-1:
            print("Yes")
        else:
            print("No")

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

if N == 1:
    timeInterval = list[1][0] - list[0][0]
    distance = abs(list[1][1]+list[1][2]-list[0][1]-list[0][2])
    if timeInterval < distance:
        print("No")
    elif (timeInterval - distance)%2 == 0:
        print("Yes")
    else:
        print("No")
else:
    for i in range(N):
        timeInterval = list[i+1][0] - list[i][0]
        distance = abs(list[i+1][1]+list[i+1][2]-list[i][1]-list[i][2])
        if timeInterval < distance:
            print("No")
            break
        elif (timeInterval - distance)%2 == 0:
            if i == N-1:
                print("Yes")
        else:
            print("No")
            break
Buggy code:
N = int(input())
grid = [list(map(int, input().split())) for _ in range(N)]

t = [0] + [col[0] for col in grid]
xs = [0] + [col[1] for col in grid]
ys = [0] + [col[2] for col in grid]

res = 'Yes'
for i in range(N):
    interval = t[i+1] - t[i]
    x_dist = xs[i+1] - xs[i]
    y_dist = ys[i+1] - ys[i]
    if x_dist > interval or y_dist > interval:
        res = 'No'
        break

print(res)

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

t = [0] + [col[0] for col in grid]
xs = [0] + [col[1] for col in grid]
ys = [0] + [col[2] for col in grid]

res = 'Yes'
for i in range(N):
    interval = t[i+1] - t[i]
    x_dist = xs[i+1] - xs[i]
    y_dist = ys[i+1] - ys[i]
    dist = x_dist + y_dist
    if dist == 0 and interval % 2 == 1:
        res = 'No'
        break
    if dist > interval or dist % 2 != interval % 2:
        res = 'No'
        break

print(res)
Buggy code:
n = int(input())
me = [0,0]
arr = []

for i in range(n):
    arr += [list(map(int,input().split()))]

for t in arr:
    for _ in range(t[0]):
        if me[0] < t[1]:
            me[0] += 1
        elif me[0] > t[1]:
            me[0] -= 1
        elif me[1] < t[2]:
            me[1] += 1
        elif me[1] > t[2]:
            me[1] -= 1
        else:
            me[0] += 1
    if me != t[1:]:
        break
if me == arr[-1][1:]:
    print("Yes")
else:
    print("No")

Fixed code:
n = int(input())
me = [0,0]
arr = []
tmp = 0
flg = True
for i in range(n):
    arr += [list(map(int,input().split()))]

for t in arr:
    for _ in range(t[0]-tmp):
        if me[0] < t[1]:
            me[0] += 1
        elif me[0] > t[1]:
            me[0] -= 1
        elif me[1] < t[2]:
            me[1] += 1
        elif me[1] > t[2]:
            me[1] -= 1
        else:
            me[0] += 1
        tmp = t[0]
    if me != t[1:]:
        flg = False
        break
if flg:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())

prev_t, prev_x, prev_y = 0, 0, 0
for _ in range(n):
    t, x, y = map(int, input().split())
    print('#1', t, x, y)
    if (abs(x - prev_x) + abs(y - prev_y) <= t - prev_t and
        (abs(x - prev_x) + abs(y - prev_y)) % 2 == (t - prev_t) % 2):
        prev_t, prev_x, prev_y = t, x, y
        print(t, x, y)
        continue
    else:
        print('No')
        break
else:
    print('Yes')

Fixed code:
n = int(input())

prev_t, prev_x, prev_y = 0, 0, 0
for _ in range(n):
    t, x, y = map(int, input().split())
    if (abs(x - prev_x) + abs(y - prev_y) <= t - prev_t and
        (abs(x - prev_x) + abs(y - prev_y)) % 2 == (t - prev_t) % 2):
        prev_t, prev_x, prev_y = t, x, y
        continue
    else:
        print('No')
        break
else:
    print('Yes')
Buggy code:
n = int(input())
lst = [list(map(int, input().split())) for _ in range(n)]

ans = 'No'

for line in lst:
    t, x, y = line
    if t < x + y:
        break
    if t % 2 == 0 and x + y % 2 != 0:
        break
    if t % 2 != 0 and x + y % 2 == 0:
        break

    ans = 'Yes'

print(ans)

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

ans = 'Yes'

for line in lst:
    t, x, y = line
    c1 = t < x + y
    c2 = t % 2 == 0 and (x + y) % 2 != 0
    c3 = t % 2 != 0 and (x + y) % 2 == 0
    
    if c1 or c2 or c3:
        ans = 'No'
        break

print(ans)
Buggy code:
def check():
    N = int(input())
    t1,x1,y1 = [0,0,0]
    
    for _ in range(N):
        t2,x2,y2 = [int(i) for i in input().split(' ')]
        x_sub = abs(x1-x2)
        y_sub = abs(y1-y2)
        t_sub = t2 - t1
        t = t_sub - x_sub - y_sub
        if t < 0:
            return 'no'
        else:
            if t % 2 == 0:
                t1 = t2
                x1 = x2
                y1 = y2
            else:
                return 'no'
    return 'yes'

print(check())

Fixed code:
def check():
    N = int(input())
    t1,x1,y1 = [0,0,0]
    
    for _ in range(N):
        t2,x2,y2 = [int(i) for i in input().split(' ')]
        x_sub = abs(x1-x2)
        y_sub = abs(y1-y2)
        t_sub = t2 - t1
        t = t_sub - x_sub - y_sub
        if t < 0:
            return 'No'
        else:
            if t % 2 == 0:
                t1 = t2
                x1 = x2
                y1 = y2
            else:
                return 'No'
    return 'Yes'
print(check())
Buggy code:
n=int(input())
t=[0]*n+1
x=[0]*n+1
y=[0]*n+1
t[0],x[0],y[0]=0,0,0
for i in range(1,n+1):
  t[i],x[i],y[i]=map(int, input().split())
d='Yes'
for i in range(n):
  a=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])-t[i+1]+t[i]
  if a<0 or a%2==1:
    d='No'
    break
print(d)

Fixed code:
n=int(input())
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
t[0],x[0],y[0]=0,0,0
for i in range(1,n+1):
  t[i],x[i],y[i]=map(int, input().split())
d='Yes'
for i in range(n):
  a=t[i+1]-t[i]-abs(x[i+1]-x[i])-abs(y[i+1]-y[i])
  if a<0 or a%2==1:
    d='No'
    break
print(d)
Buggy code:
    n = int(input())
    pos = [list(map(int, input().split())) for _ in range(n)]
     
    def func(n, pos):
        c_t, c_x, c_y = 0, 0, 0
     
        for i in pos:
            d_t = i[0] - c_t
            z = abs(i[1] - c_x) + abs(i[2] - c_y)
     
            if z > d_t or (d_t - z) % 2 != 0:
                return "No"
            else:
                c_t, c_x, c_y = 0, 0, 0
     
        return "Yes"
     
     
    print(func(n, pos))

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

def func(n, pos):
    c_t, c_x, c_y = 0, 0, 0

    for i in pos:
        d_t = i[0] - c_t
        z = abs(i[1] - c_x) + abs(i[2] - c_y)

        if z > d_t or (d_t - z) % 2 != 0:
            return "No"
        else:
            c_t, c_x, c_y = i[0], i[1], i[2]

    return "Yes"


print(func(n, pos))
Buggy code:
import sys

N = int(input())
arr = [list(map(int,input().split())) for i in range(N)]

for i in range(len(arr)-1):
    if arr[i+1][0]-arr[i][0] < abs(arr[i+1][1]-arr[i][1])+abs(arr[i+1][2]-arr[i][2]) or (arr[i+1][0]-arr[i][0])%2 != (abs(arr[i+1][1]-arr[i][1])+abs(arr[i+1][2]-arr[i][2]))%2:
        print("No")
        exit()

print("Yes")

Fixed code:
import sys

N = int(input())
arr = [list(map(int,input().split())) for i in range(N)]

for i in range(len(arr)):
    if arr[i][0] < arr[i][1]+arr[i][2] or arr[i][0]%2 != (arr[i][1]+arr[i][2])%2:
        print("No")
        exit()

for i in range(len(arr)-1):
    if arr[i+1][0]-arr[i][0] < abs(arr[i+1][1]-arr[i][1])+abs(arr[i+1][2]-arr[i][2]):
        print("No")
        exit()

print("Yes")
Buggy code:
import sys
lis =list()
lis.append([0, 0, 0])
for e in sys.stdin:
  lis.append(list(map(int, input().split())))
for i in range(len(lis) - 1):
  d_t = lis[i + 1][0] - lis[i][0]
  man_dis = abs(lis[i + 1][1] - lis[i][1]) + abs(lis[i + 1][2] - lis[i][2])
  if d_t < man_dis or d_t % 2 - man_dis % 2 != 0:
    print("No")
    sys.exit()
print("Yes")

Fixed code:
import sys
lis =list()
lis.append([0, 0, 0])
sys.stdin.readline()
for e in sys.stdin:
  lis.append(list(map(int, e.split())))
for i in range(len(lis) - 1):
  d_t = lis[i + 1][0] - lis[i][0]
  man_dis = abs(lis[i + 1][1] - lis[i][1]) + abs(lis[i + 1][2] - lis[i][2])
  if d_t < man_dis or d_t % 2 - man_dis % 2 != 0:
    print("No")
    sys.exit()
print("Yes")
Buggy code:
n = int(input())
t,x,y =(0, 0, 0)
for _ in range(n):
    nt, nx, ny =map(int,input().split())
    dis=abs(nx-x)+abs(ny-y)
    tim = nt - t
    print(dis,tim)
    if tim >= dis and (tim - dis) % 2 ==0:
        t,x,y=nt, nx, ny
    else:
        print('No')
        break
else:
    print('Yes')

Fixed code:
n = int(input())
t,x,y =(0, 0, 0)
for _ in range(n):
    nt, nx, ny =map(int,input().split())
    dis=abs(nx-x)+abs(ny-y)
    tim = nt - t
    if tim >= dis and (tim - dis) % 2 ==0:
        t,x,y=nt, nx, ny
    else:
        print('No')
        break
else:
    print('Yes')
Buggy code:
n = int(input())
 
for i in range(n):
    t, x, y = map(int, input().split())
    if t < x + y or (x + y + t) % 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 t < x + y or (x + y + t) % 2 != 0:
        print('No')
        exit()
print('Yes')
Buggy code:
if __name__ == '__main__':
    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())
    flag=True
    if (t[0] - max(x[0], -x[0]) - max(y[0], -y[0])) %2 != 0 or t[0] < max(x[0], -x[0]) + max(y[0], -y[0]):
        print('No')
        flag = False
    
    for i in range(N-1):
        delta_t = t[i+1] - t[i]
        delta_x = x[i+1] - x[i]
        if delta_x < 0:
            delta_x = -delta_x
        delta_y = y[i+1] - y[i]
        if delta_y < 0:
            delta_y = -delta_y
        delta = delta_x + delta_y
        if (delta_t - delta) % 2 == 0 and delta_t >= delta:
            continue
        else:
            print('No')
            flag = False
            break
    if flag:
        print('Yes')

Fixed code:
if __name__ == '__main__':
    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())
    flag=True
    # check first step
    if (t[0] - max(x[0], -x[0]) - max(y[0], -y[0])) %2 != 0 or t[0] < max(x[0], -x[0]) + max(y[0], -y[0]):
        print('No')
        flag = False
    
    for i in range(N-1):
        delta_t = t[i+1] - t[i]
        delta_x = x[i+1] - x[i]
        if delta_x < 0:
            delta_x = -delta_x
        delta_y = y[i+1] - y[i]
        if delta_y < 0:
            delta_y = -delta_y
        delta = delta_x + delta_y
        if (delta_t - delta) % 2 == 0 and delta_t >= delta:
            continue
        else:
            if flag:
                print('No')
                flag = False
            break
    if flag:
        print('Yes')
Buggy code:
n = int(input())
trv = []
for i in range(n):
    t,x,n = map(int,input().split())
    a = [t,x,n]
    trv.append(a)

flag = 1
for i in range(1,len(trv)):
    time = trv[i][0]-trv[i-1][0]
    dist = abs(trv[i][1]-trv[i-1][1]) + abs(trv[i][2]-trv[i-1][2])
    if time <= dist:
        flag = 0
        break
    elif time >= dist and (time-dist) % 2 == 0:
        None
    else:
        flag = 0
        break
        
if flag == 0:
    print('No')
else:
    print('Yes')

Fixed code:
n = int(input())
trv = [[0,0,0]]
for i in range(n):
    t,x,y = map(int,input().split())
    a = [t,x,y]
    trv.append(a)

flag = 1

for i in range(1,len(trv)):
    time = trv[i][0]-trv[i-1][0]
    dist = abs(trv[i][1]-trv[i-1][1]) + abs(trv[i][2]-trv[i-1][2])
    if time < dist:
        flag = 0
    elif time >= dist and (time-dist) % 2 == 0:
        None
    else:
        flag = 0
        break
        
if flag == 0:
    print('No')
else:
    print('Yes')
Buggy code:
n = int(input())
t=[0]
x=[0]
y=[0]
for i in range(n):
    _t, _x, _y = map(int, input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

flag = 0
for i in range(1,n+1):
    dt = t[i] - t[i-1]
    dx = x[i] - x[i-1]
    dy = y[i] - y[i-1]
    dist = abs(dx) + abs(dy)
    if dist > dt:
        flag = flag +1
    elif dist % 2 != 0 and dt % 2 != 0:
        flag = flag +1
else:
    print("Yes" if flag ==0 else "No")

Fixed code:
n = int(input())
t=[0]
x=[0]
y=[0]
for i in range(n):
    _t, _x, _y = map(int, input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

flag = 0
for i in range(1,n+1):
    dt = t[i] - t[i-1]
    dx = x[i] - x[i-1]
    dy = y[i] - y[i-1]
    dist = abs(dx) + abs(dy)
    if dist > dt:
        flag = flag +1
    elif dist % 2 != dt % 2:
        flag = flag +1
else:
    print("Yes" if flag ==0 else "No")
Buggy code:
n = int(input())
txy = [list(map(int,input().split())) for _ in range(n)]
for i in range(n-1):
  t = txy[i+1][0] - txy[i][0]
  x = abs(txy[i+1][1] - txy[i][1])
  y = abs(txy[i+1][2] - txy[i][2])
  if t < x+y:
    print('No')
    exit()
  elif t == x+y:
    pass
  else:
    if ((t%2 == 0) and ((x+y)%2 == 0)) or ((t%2 != 0)and((x+y)%2 != 0)):
      pass
    else:
      print('No')
      exit()
print('Yes')

Fixed code:
n = int(input())
txy = [list(map(int,input().split())) for _ in range(n)]
txy.insert(0,[0,0,0])
for i in range(n):
  t = txy[i+1][0] - txy[i][0]
  x = abs(txy[i+1][1] - txy[i][1])
  y = abs(txy[i+1][2] - txy[i][2])
  if t < x+y:
    print('No')
    exit()
  elif t == x+y:
    pass
  else:
    if ((t%2 == 0) and ((x+y)%2 == 0)) or ((t%2 != 0)and((x+y)%2 != 0)):
      pass
    else:
      print('No')
      exit()
print('Yes')
Buggy code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])==1:
    if lst[j][2]==lst[j+1][2]:
      pass
    else:
      print('No')
      sys.exit()
  if abs(lst[j][2]-lst[j+1][2])==1:
    if lst[j][1]==lst[j+1][1]:
      pass
    else:
      print('No')
      sys.exit()    
  else:
    print('No')
    sys.exit()
print('Yes')


Fixed code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
if (abs(lst[0][1])+abs(lst[0][2]))%2==lst[0][0]%2:
  if abs(lst[0][1])+abs(lst[0][2])<=lst[0][0]:
    pass
  else:
    print('No')
    sys.exit()
else:
  print('No')
  sys.exit()

for j in range(n-1):
  if (abs(lst[j][1]-lst[j+1][1])+abs(lst[j][2]-lst[j+1][2]))%2==(lst[j+1][0]-lst[j][0])%2:
    if abs(lst[j][1]-lst[j+1][1])+abs(lst[j][2]-lst[j+1][2])<=(lst[j+1][0]-lst[j][0]):
      pass
    else:
      print('No')
      sys.exit()
  else:
    print('No')
    sys.exit()
print('Yes')
Buggy code:
N = int(input())

cnt = 0
ans = "No"
for _ in range(N):
  t, x, y = map(int,input().split())
  if((t+x+y)%2 == 1 or t < x+y):
    cnt += 1
if(cnt == N):
  ans = "Yes"
print(ans)

Fixed code:
N = int(input())

ans = "Yes"
for _ in range(N):
  t, x, y = map(int,input().split())
  if((t+x+y)%2 == 1 or t < x+y):
    ans = "No"
    break
print(ans)
Buggy code:
N = int(input())
ans = "Yes"
for i in range(N):
  t, x, y = map(int,input().split())
  if(t < x+y and (t+x+y)%2 == 1):
    ans = "No"
    break
print(ans)

Fixed code:
N = int(input())
ans = "Yes"
for i in range(N):
  t, x, y = map(int,input().split())
  if(t < x+y or (t+x+y)%2 == 1):
    ans = "No"
    break
print(ans)
Buggy code:
N = int(input())
T = list()
for index in range(N):
	T.append((int(i) for i in input().split()))

pt, px, py = (0, 0, 0)
for t, x, y in T:
	d = ((x - px) + (y - py)) - (pt - t)
	if d >= 0 and d % 2 == 0:
		pt, px, py = (t, x, y)
	else:
		print("No")
		exit(0)

print("Yes")

Fixed code:
N = int(input())
T = list()
for index in range(N):
	T.append((int(i) for i in input().split()))

pt, px, py = (0, 0, 0)
for t, x, y in T:
	d = (t - pt) - (abs(x - px) + abs(y - py))
	if d >= 0 and d % 2 == 0:
		pt, px, py = (t, x, y)
	else:
		print("No")
		exit(0)

print("Yes")
Buggy code:
import sys
n = int(input())
txy = []
for i in range(n):
  txy.append(list(map(int, input().split())))
pt = 0
py = 0
px = 0
for t, x, y in txy:
  dt = t - pt
  dx = x - px
  dy = y - py
  ax = abs(dx) % 2
  ay = abs(dy) % 2
  a = ax + ay % 2
  if abs(dx) + abs(dy) > dt or a != dt % 2:
    print("No")
    sys.exit()
print("Yes")

Fixed code:
import sys
n = int(input())
txy = []
for i in range(n):
  txy.append(list(map(int, input().split())))
pt = 0
py = 0
px = 0
for t, x, y in txy:
  dt = t - pt
  dx = x - px
  dy = y - py
  ax = abs(dx) % 2
  ay = abs(dy) % 2
  a = (ax + ay) % 2
  if abs(dx) + abs(dy) > dt or a != dt % 2:
    print("No")
    sys.exit()
print("Yes")
Buggy code:
n=int(input())
t=0
x=0
y=0
for i in range(n):
  g,h,j=map(int,input().split())
  if (g-t)%2==(abs(h-x)+abs(j-y)%2:
               print("Yes")
  else:
               print("No")
               

Fixed code:
n=int(input())
t=0
x=0
y=0
for i in range(n):
  g,h,j=map(int,input().split())
  if (g-t)%2==(abs(h-x)+abs(j-y))%2 and (abs(h-x)+abs(j-y))<=(g-t):
    t=g
    x=h
    y=j
  else:
    print("No")
    exit()

print("Yes")
Buggy code:
n = int(input())
flag = True
for _ in range(N):
    t, x, y = map(int, input().split())
    if (t < x + y) or (x + y + t) % 2==1:
        flag = False


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


Fixed code:
n = int(input())
flag = True
for _ in range(n):
    t, x, y = map(int, input().split())
    if (t < x + y) or (x + y + t) % 2==1:
        flag = False


if flag:
    print("Yes")
else:
    print("No")
Buggy code:
n = int(input())
ti,xi,yi = [0],[0],[0]
ans = 'NO'

for ni in range(n):
 t,x,y = [int(x) for x in input().split()]
 ti.append(t)
 xi.append(x)
 yi.append(y)

for i in range(n):
  dt = ti[i+1] - ti[i]
  dx = xi[i+1] - xi[i]
  dy = yi[i+1] - yi[i]

  if dt < abs(dx)+abs(dy):
    break

  odev1 = (xi[i]+yi[i])%2
  odev2 = (xi[i+1]+yi[i+1])%2

  if dt%2 == 0:
    if odev1 != odev2:
      break
  else:
    if odev1 == odev2:
      break
  if i == n-1:
    ans = 'YES'

print(ans)

Fixed code:
n = int(input())
ti,xi,yi = [0],[0],[0]
ans = 'No'

for ni in range(n):
 t,x,y = [int(x) for x in input().split()]
 ti.append(t)
 xi.append(x)
 yi.append(y)

for i in range(n):
  dt = ti[i+1] - ti[i]
  dx = xi[i+1] - xi[i]
  dy = yi[i+1] - yi[i]

  if dt < abs(dx)+abs(dy):
    break

  odev1 = (xi[i]+yi[i])%2
  odev2 = (xi[i+1]+yi[i+1])%2

  if dt%2 == 0:
    if odev1 != odev2:
      break
  else:
    if odev1 == odev2:
      break
  if i == n-1:
    ans = 'Yes'

print(ans)
Buggy code:
N=int(input())
t=[[int(x) for x in input().split()] for i in range(0,N)]

def func(N,t):
    if (t[0][0]-(t[0][1]+t[0][2]))%2==1 or t[0][0]-(t[0][1]+t[0][2])<0 : return "No"
    
    for i in range(1,N+1):
        if ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))%2==1 or ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))<0 : return "No"
    
    return "Yes"
    
print(func(N,t))

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

def func(N,t):
    if (t[0][0]-(t[0][1]+t[0][2]))%2==1 or t[0][0]-(t[0][1]+t[0][2])<0 : return "No"
    
    for i in range(1,N):
        if ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))%2==1 or ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))<0 : return "No"
    
    return "Yes"
    
print(func(N,t))
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())
    if ((x+y)%2) != (t%2):
        print('No')
        exit()
    if t < x+y:
        print('No')
        exit()
print('Yes')


Fixed code:
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
for i in range(N):
    t, x, y = map(int, input().split())
    if ((x+y)%2) != (t%2):
        print('No')
        exit()
    if t < x+y:
        print('No')
        exit()
print('Yes')
Buggy code:
import collections


def solve(N, ts, ps):
    for i in range(N-1):
        dt = ts[i+1] - ts[i]
        d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)

        if d > dt or dt % 2 != d % 2:
            return "No"
    return "Yes"


N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = []
ps = []
for i in range(N):
    t, x, y = list(map(int, input().split()))
    ts.append(t)
    ps.append(point(x, y))

print(solve(N, ts, ps))

Fixed code:
import collections


def solve(N, ts, ps):
    for i in range(N):
        dt = ts[i+1] - ts[i]
        d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)

        if d > dt or dt % 2 != d % 2:
            return "No"
    return "Yes"


N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = [0]
ps = [point(0, 0)]
for i in range(N):
    t, x, y = list(map(int, input().split()))
    ts.append(t)
    ps.append(point(x, y))

print(solve(N, ts, ps))
Buggy code:
n = int(input())
curx, cury = 0, 0
ans = 'Yes'
prev_t = 0
for _ in range(n):
   t, x, y = map(int, input().split())
   d = abs(x - curx) + abs(y - cury)
   if d > (t - prev_t) or (t - prev_t) % 2 != d % 2:
      ans = 'No'
      break
   prev_t = t

print(ans)


Fixed code:
n = int(input())
curt, curx, cury = 0, 0, 0
ans = 'Yes'
for _ in range(n):
   t, x, y = map(int, input().split())
   d = abs(x - curx) + abs(y - cury)
   if d > (t - curt) or (t - curt) % 2 != d % 2:
      ans = 'No'
      break
   curt, curx, cury = t, x, y

print(ans)
Buggy code:
N=int(input())
des=[list(map(int,input().split())) for _ in range(N)]
des.insert(0,[0,0,0])
for i in range(N):
    time=des[i+1][0]-des[i][0]
    d_x=abs(des[i+1][1]-des[i][1])
    d_y=abs(des[i+1][2]-des[i][2])
    if (time-(d_x+d_y))%2!=0 and time>=(d_x+d_y)
        print("No")
        exit()
print("Yes")

Fixed code:
N=int(input())
des=[list(map(int,input().split())) for _ in range(N)]
des.insert(0,[0,0,0])
for i in range(N):
    time=des[i+1][0]-des[i][0]
    d_x=abs(des[i+1][1]-des[i][1])
    d_y=abs(des[i+1][2]-des[i][2])
    if (time-(d_x+d_y))%2!=0 or time<(d_x+d_y):
        print("No")
        exit()
print("Yes")
Buggy code:
import math
import sys

n = int(input())


for i in range(n):
	t,x,y = map(int, input().split())
	d = abs(x)+abs(y)

	if d > t or (d - t) % 2 != 0:
		print('No')

print('Yes')


Fixed code:
import math
import sys

n = int(input())

for i in range(n):
	t,x,y = map(int, input().split())
	d = abs(x)+abs(y)

	if d > t or (d - t) % 2 != 0:
		print('No')
		exit()

print('Yes')
Buggy code:
N = int(input())
x = []
y = []
t = []
distance = []
x.append(0)
y.append(0)
t.append(0)

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

dis = 0
flag = True
for i in range(1,N+1):
    time = t[i] - t[i-1]
    dis = abs(x[i] -x[i-1])+abs(y[i] - y[i-1])
    print(time)
    print(dis)
    if time != dis :
        if time < dis:
            #print("time<dis")
            flag = False
        elif time - dis > 0 and (time-dis) %2 == 1:
            #print("time%2")
            flag = False

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

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

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

dis = 0
flag = True
for i in range(1,N+1):
    time = t[i] - t[i-1]
    dis = abs(x[i] -x[i-1])+abs(y[i] - y[i-1])
    #print(time)
    #print(dis)
    if time != dis :
        if time < dis:
            #print("time<dis")
            flag = False
        elif time - dis > 0 and (time-dis) %2 == 1:
            #print("time%2")
            flag = False

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