Problem:
 Score : 300 points    Problem Statement AtCoDeer the deer is going on a trip in a two-dimensional plane.
In his plan, he will depart from point (0, 0) at time 0 , then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i .  If AtCoDeer is at point (x, y) at time t , he can be at one of the following points at time t+1 : (x+1,y) , (x-1,y) , (x,y+1) and (x,y-1) .
Note that he cannot stay at his place .
Determine whether he can carry out his plan.      Constraints  1  ≤  N  ≤  10^5  0  ≤  x_i  ≤  10^5  0  ≤  y_i  ≤  10^5  1  ≤  t_i  ≤  10^5  t_i  <  t_{i+1} ( 1  ≤  i  ≤  N-1 )  All input values are integers.         Input Input is given from Standard Input in the following format:  N  t_1  x_1  y_1  t_2  x_2  y_2  :  t_N  x_N  y_N       Output If AtCoDeer can carry out his plan, print Yes ; if he cannot, print No .        Sample Input 1 2
3 1 2
6 1 1      Sample Output 1 Yes  For example, he can travel as follows: (0,0) , (0,1) , (1,1) , (1,2) , (1,1) , (1,0) , then (1,1) .       Sample Input 2 1
2 100 100      Sample Output 2 No  It is impossible to be at (100,100) two seconds after being at (0,0) .       Sample Input 3 2
5 1 1
100 1 1      Sample Output 3 No

Solution (Python):
N = int(input())

memo = [[0, 0, 0]]




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



for i in range(1, N+1):
    diff_s = memo[i][0] - memo[i-1][0]
    
    diff_m = abs(memo[i][1]-memo[i-1][1])+abs(memo[i][2]-memo[i-1][2])
    if diff_m > diff_s:
        print('No')
        exit()
    if diff_m % 2 == 0 and diff_s % 2 == 0:
        pass
    elif diff_m % 2 == 1 and diff_s % 2 == 1:
        pass
    else:
        print('No')
        exit()



print('Yes')

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
pret, prex, prey = 0, 0, 0

for i in range(N):
  t,x,y = map(int,input().split())
  if (t - pret >= abs(x-prex)+abs(y-prey)) and (t-pret)%2 == (abs(x-prex)+abs(y-prey))%2:
    pret,prex,prey = t,x,y    
    continue
  else:
    print("No")
    exit()
print("Yes")

Solution (Python):
N = int(input())
pret = prex = prey = 0
res = True
for _ in range(N):
    t,x,y = map(int,input().split())
    dt,dx,dy = t-pret,x-prex,y-prey
    pret,prex,prey = t,x,y
    r = dt-abs(dx)-abs(dy)
    if r<0 or r%2!=0:res = False
print('Yes' if res else 'No')

Solution (Python):
def hantei(t,x,y):
  if t%2==(x+y)%2 and t>=(abs(x)+abs(y)):
    return True
  else:
    return False
N=int(input())
result=[]
t=0
x=0
y=0
T=0
Y=0
X=0
for i in range(N):
  t,x,y=map(int,input().split())
  result.append(hantei(t-T,x-X,y-Y))
  T=t
  X=x
  Y=y
if False in result:
  print('No')
else:
  print('Yes')

Solution (Python):
n = int(input())
points = [list(map(int, input().split())) for i in range(n)]
points.insert(0, [0, 0, 0])

flg = True

for i in range(n):
    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:
        flg = False
        break
    if dist % 2 != dt % 2:
        flg = False
        break

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

Solution (Python):
import numpy as np
N = int(input())
row = [input().split() for i in range(N)]
f = np.vectorize(int)
t = f(row)
Flag = 0

time = t[0][0]
x = t[0][1]
y = t[0][2]
dis = abs(x) + abs(y)
if dis % 2 == time % 2 and dis <= time:
    for i in range(1,N):
        time = t[i][0] - t[i-1][0]
        x = t[i][1] - t[i-1][1]
        y = t[i][2] - t[i-1][2]
        dis = abs(x) + abs(y)
        if dis % 2 == time % 2 and dis <= time:
            continue
        else:
            Flag = 1
            break
else:
    Flag = 1

if Flag == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
now = [0, 0, 0]
ans = 'Yes'
for i in range(0, N):
	T, X, Y = map(int, input().split())
	nexttime = T - now[0]
	nextX = abs(X - now[1])
	nextY = abs(Y - now[2])
	if nexttime < nextX + nextY:
		ans = 'No'
		break
	if (nexttime-(nextX+nextY)) % 2 == 1:
		ans = 'No'
		break
	now = [T, X, Y]
print(ans)

Solution (Python):
N = int(input())
now_x = 0
now_y = 0
now_t = 0
f = 0
for _ in range(N):
    t,x,y  = map(int,input().split())
    abs_xy = abs(x-now_x)+abs(y-now_y)
    abs_t = abs(t-now_t)
    if abs_xy == abs_t or (abs_t > abs_xy and (abs_t -abs_xy)%2 ==0):
        now_x = x
        now_y = y
        now_t = t
    else:
        f = 1
        break

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

Solution (Python):
N = int(input())

for n in range(N):
  t, x, y = map(int, input().split())
  if t-x-y < 0 or (t-x-y)%2 != 0:
    print('No')
    exit()
print('Yes')

Solution (Python):
n = input()
n = int(n)

points = []
points.append(("0", "0", "0"))
for i in range(n):
  points.append(input().split())

for i in range(len(points)-1):
  dt = int(points[i+1][0]) - int(points[i][0])
  dx = int(points[i+1][1]) - int(points[i][1])
  dy = int(points[i+1][2]) - int(points[i][2])
  
  if dt < abs(dx)+abs(dy):
    print("No")
    exit()
  elif (dt - ( abs(dx)+abs(dy) ) ) % 2 == 1:
    print("No")
    exit()

print("Yes")

Solution (Python):
N = int(input())

tt = 0
xx = 0
yy = 0
f = 0
for i in range(N):
    t, x, y = map(int, input().split())

    dt = t - tt
    dx = x - xx
    dy = y - yy
    dxy = dx + dy

    if dt%2 == 0:
        if dxy <= dt and dxy%2 == 0:
            continue
        else:
            f = 1
            break
    else:
        if dxy <= dt and dxy%2 == 1:
            continue
        else:
            f = 1
            break

if f == 1:
    print('No')
else:
    print('Yes')

Solution (Python):
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")

Solution (Python):
n = int(input())
data = [list(map(int,input().split())) for i in range(n)]

def manhattan(x1,x2,y1,y2):
	return abs(x2-x1) + abs(y2-y1)
x,y = 0,0
can = True
dt = data[0][0]
for i in range(n):
	dist = manhattan(x,data[i][1],y,data[i][2])
	if dist > dt:
		can = False
		break
	elif (dt - dist) % 2 != 0:
		can = False
		break
	if i == n-1:
		break
	x = data[i][1]
	y = data[i][2]
	dt = data[i+1][0] - data[i][0]
if can:
	print("Yes")
else:
	print("No")

Solution (Python):
def traveling():
	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(1, N + 1):
		dt = t[i] - t[i - 1]
		dist = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])
		if dist > dt:
			flag = False
		if dist % 2 != dt % 2:
			flag = False
		
	
	if flag:
		print('Yes')
	else:
		print('No')

traveling()

Solution (Python):
def traveling():
	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(1, N + 1):
		dt = t[i] - t[i - 1]
		dist = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])
		if dist > dt:
			flag = False
		if dist % 2 != dt % 2:
			flag = False
		
	
	if flag:
		print('Yes')
	else:
		print('No')

traveling()

Solution (Python):
N=input()
a=[]
t=True
for _ in range(int(N)):
    a+=[list(map(int,input().split()))]
for i in range(int(N)):
    if a[i][0]%2==0:
        if abs(a[i][1]+a[i][2])<=a[i][0] and (a[i][1]+a[i][2])%2==0:
            continue
        else:
            print('No')
            t=False
            break
    else:
        if abs(a[i][1]+a[i][2]<=a[i][0]) and (a[i][1]+a[i][2])%2==1:
            continue
        else:
            print('No')
            t=False
            break
if t:
    print('Yes')

Solution (Python):
n=int(input())
for i in range(n):
    t,x,y=map(int,input().split())
    if x+y>t or t%2!=(x+y)%2 : 
        print("No")
        exit()
print("Yes")

Solution (Python):


import sys

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())

t.insert(0, 0)
x.insert(0, 0)
y.insert(0, 0)

for j in range(1, len(t)):
    if t[j] % 2 == 0:
        if (x[j] + y[j]) % 2 != 0:
            print("No")
            sys.exit()
    else:
        if (x[j] + y[j]) % 2 == 0:
            print("No")
            sys.exit()
    if ((x[j] - x[j-1]) + (y[j] - y[j-1])) > t[j] - t[j-1]:
        print("No")
        sys.exit()

print("Yes")

Solution (Python):
n = int(input())
t = x = y = 0
for i in range(n):
    next_t, next_x, next_y = map(int, input().split())
    diff = abs(next_x - x) + abs(next_y - y)
    if((diff - (next_t - t) % 2 == 0) or (diff == (next_t - t))):
        t, x, y = next_t, next_x, next_y
    else:
        print("No")
        exit()
print("Yes")

Solution (Python):
import sys
N = int(input())
cor_lis = [0] * N
diff_lis = [0] * N
for n in range(N):
    cor_lis[n] = tuple(map(int, input().split()))
cor_lis = [[0, 0, 0]] + cor_lis
for n in range(N):
    diff_lis[n] = [cor_lis[n + 1][0] - cor_lis[n][0], abs(cor_lis[n + 1][1] - cor_lis[n][1]), abs(cor_lis[n + 1][2] - cor_lis[n][2])]
    if diff_lis[n][0] % (diff_lis[n][1] + diff_lis[n][2]) != 0:
        print('No')
        sys.exit()
print('Yes')

Solution (Python):
import numpy as np

N = int(input())

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

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

if flag == 0:
    print("Yes")

Solution (Python):
t, x, y = 0, 0, 0
N = int(input())
r = "Yes"
for i in range(0, N):
  t2, x2, y2 = map(int, input().split())
  d = abs(x2-x)+abs(y2-y)
  if not(t2-t>=d and d%2==(t2-t)%2):
    r = "No"
    break
print(r)

Solution (Python):
N = int(input())
now_x = 0
now_y = 0
now_time = 0
ans = 1
for i in range(N):
    t, x, y = map(int, input().split())
    distance = abs(now_x - x) + abs(now_y - y)
    time = t - now_time
    sa = time-distance
    if sa >= 0 and sa % 2 == 0:
        now_x, now_y, now_time = x, y, t
        continue
    else:
        ans = 0
        continue

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

Solution (Python):
N = int(input())
C = []
for i in range(N):
    C.append(list(map(int, input().split())))
c_pre = [0, 0, 0]
for c_now in C:
    tr = abs(c_now[0]-c_pre[0])
    length = abs(c_now[1]-c_pre[1])+abs(c_now[2]-c_pre[2])
    if length<=tr and tr%2==length%2:
        c_pre = c_now
        continue
    else:
        print('No')
        break
else:
    print('Yes')

Solution (Python):
n=int(input())
px,py,pt=0,0,0
import sys
for i in range(n):
    t,x,y=map(int,input().split())
    if abs(x-px)+abs(y-py)<=t-pt and (t-pt-abs(x-px)-abs(y-py))%2==0:
        px,py,pt=x,y,t
    else:
        print('No')
        sys.exit()
print('Yes')

Solution (Python):
n=int(input())
txy=[list(map(int,input().split())) for i in range(n)]

now=[0,0,0]
for i in range(n):
    kyori=abs(now[1]-txy[i][1])+abs(now[2]-txy[i][2])
    tsa=txy[i][0]-now[0]

    if kyori>tsa:
        print("No")
        break
    if kyori%2!=tsa%2:
        print("No")
        break
    now=txy[i]
else:
    print("Yes")

Solution (Python):
N = int(input())
t_0, x_0, y_0 = 0, 0, 0

for n in range(N):
  t_1, x_1, y_1 = [int(txyz) for txyz in input().split()]
  d_01 = abs(x_1 - x_0) + abs(y_1 - y_0)
  dt = t_1 - t_0
  if dt < d_01:
    print("No")
    break
  else:
    t_d = dt - d_01
    if t_d % 2 == 0:
      t_0, x_0, y_0 = t_1, x_1, y_1
    else:
      print("No")
      break
else:
  print("Yes")

Solution (Python):
N = int(input())
t_0, x_0, y_0 = 0, 0, 0

for n in range(N):
  t_1, x_1, y_1 = [int(txyz) for txyz in input().split()]
  d_01 = abs(x_1 - x_0) + abs(y_1 - y_0)
  dt = t_1 - t_0
  if dt < d_01:
    print("No")
    break
  else:
    t_d = dt - d_01
    if t_d % 2 == 0:
      t_0, x_0, y_0 = t_1, x_1, y_1
    else:
      print("No")
      break
else:
  print("Yes")

Solution (Python):
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()) 
flag=0
for i in range(n):
    l=abs(x[i]-x[i+1])+abs(y[i]-y[i+1])
    s=t[i+1]-t[i]
    if(l>s or (l-s)%2==1):
        flag=1
if flag==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
coords = []
status = "Yes"
for i in range(N):
    coords.append(list(map(int, input().split())))

x = 0
y = 0
for coord in coords:
  summy = abs(x-coord[1]) + abs(y - coord[2])
  parity = (coord[1] + coord[2]) % 2
  if summy > coord[0] or parity != coord[0] % 2:
    status = "No"
    break
  else:
    pass
  x = coord[1]
  y = coord[2]
print(status)

Solution (Python):
n=int(input())
c=0
for i in range(n):
    ti,xi,yi=map(int,input().split())
    if (xi+yi)%2==ti%2 and ti>=xi+yi:
        c+=1
if n<=c<=n:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
tm_pos = [list(map(int, input().split())) for i in range(N)]
for i in tm_pos:
    if i[0] < i[1] + i[2] or i[0] % 2 != (i[1] + i[2]) % 2:
        print('No')
        exit()
print('Yes')

Solution (Python):
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]
txy.insert(0, [0, 0, 0])
time = 0
d = 0
for i in range(N):
    time = txy[i + 1][0] - txy[i][0]
    d = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    if time >= d and time % 2 == d % 2:
        continue
    else:
        print("No")
        break
else:
    print("Yes")

Solution (Python):

N = int(input())

txy = [[0,0,0]]

for i in range(N):

    new = list(map(int,input().split()))

    txy.append(new)

ans = "Yes"
for i in range(N):

    leng = abs(txy[i+1][1]-txy[i][1]) + abs(txy[i+1][2]-txy[i][2])
    time = txy[i+1][0]-txy[i][0]



    if leng > time or (leng-time)%2 != 0 :
        ans = "No"
        
        break

print (ans)

Solution (Python):
N = int(input())
t0, x0, y0 = [0, 0, 0]
for _ in range(N):
  t, x, y = map(int, input().split())
  d = (t - t0) - (abs(x - x0) + abs(y - y0))
  if d < 0 or d % 2 == 1:
    print('No')
    exit()
  else:
    t0 = t
    x0 = x
    y0 = y
print('Yes')

Solution (Python):
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')

Solution (Python):
from sys import stdin
def main():
    n = int(input())
    for i in range(n):
        t, x, y = map(int, input().split())
        if t<x+y or (t-x-y)%2:
            print("No")
            break
    else: print("Yes")
if __name__=="__main__": main()

Solution (Python):
n = int(input())
x = [input().split() for i in range(n)]

mm = 0
flag = 1

if int(x[0][0]) < int(x[0][1]) + int(x[0][2]):
    flag = 0
else:
    if int(x[0][0])%2 != (int(x[0][1]) + int(x[0][2]))%2:
        flag = 0
    else:
        for i in range(n-1):
            if int(x[i+1][0])-int(x[i][0]) < int(x[i+1][1]) +int(x[i+1][2])-int(x[i][1])-int(x[i][2]):
                flag = 0
                break
            else:
                if (int(x[i+1][0])-int(x[i][0]))%2 != (int(x[i+1][1]) +int(x[i+1][2])-int(x[i][1])-int(x[i][2]))%2:
                    flag = 0
                    break            

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

Solution (Python):
n = int(input())
info = []
for _ in range(n):
    tmp = list(map(int, input().split()))
    info.append(tmp)
diff = [[info[0][0], info[0][1]+info[0][2]]]
for i in range(n-1):
    time_diff = info[i+1][0] - info[i][0]
    dist_diff = abs(info[i+1][1]-info[i][1]) + abs(info[i+1][2]-info[i][2])
    diff.append([time_diff, dist_diff])
    
flg = 0
for i in range(len(diff)):
    if diff[i][0] < diff[i][1] or (diff[i][0]- diff[i][1]) % 2 !=0:
        flg=1
        break
if flg ==0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
arr_old = [0,0,0]
for i in range(n):
    arr = list(map(int,input().split()))
    if arr[0] % 2 != (arr[1]+arr[2]) % 2:
        print("No")
        exit()
    if abs(arr[1]-arr_old[1])+abs(arr[2]-arr_old[2]) > arr[0]-arr_old[0]:
        print("No")
        exit()
    arr_old = arr
print("Yes")

Solution (Python):
N = int(input())
for __ in range(N):
    t, x, y = map(int, input().split())
    if (x + y) > t or (x + y + t) % 2 == 1:
        print("No")
        exit(0)

print("Yes")

Solution (Python):
t, x, y = 0, 0, 0
for i in range(int(input())):
    next_t, next_x, next_y = map(int, input().split())
    diff = abs(x - next_x) + abs(y - next_y)
    if diff > (next_t - t) or (diff - (next_t - t)) % 2 == 1:
        print("No")
        exit(0)
    t, x, y, = next_t, next_x, next_y
print("Yes")

Solution (Python):
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)

Solution (Python):
N = int(input())
Input = []
for i in range(N):
    Input.append(list(map(int,input().split())))

x = 0 
y = 0
t = 0

for i in Input:
    dif_x = abs(x - i[1])
    dif_y = abs(y - i[2])
    dif_t = abs(t - i[0])

    if dif_x + dif_y <= dif_t and (dif_x + dif_y)%2 == dif_t%2:
        x = i[1]
        y = i[2]
        t = i[0]
    else:
        print("No")
        break

else:
    print("Yes")

Solution (Python):
N=int(input())
for i in range(N):
    t,x,y=map(int, input().split())
    j=x+y
    if t<j or (t+j)%2:
        print("No")
        exit()
print("Yes")

Solution (Python):
N=int(input())
T=[list(map(int,input().split())) for i in range(N)]
for i in range(N):
    t=T[i][0]
    j=T[i][1]+T[i][2]
    if t<j or (t+j)%2:
        print("No")
        exit()
print("Yes")

Solution (Python):
n=int(input())

ans='Yes'
dt=0
cur=0
cur_t=0
dist=0
for i in range(n):
	t,x,y=map(int,input().split())
	dist=abs(cur-(x+y))
	cur=x+y
	dt=t-cur_t
	cur_t=t
	
	if dist>dt or dt%2!=(dist)%2:
		ans='No'
		break
print(ans)

Solution (Python):
n=int(input())

ans='Yes'
dt=0
cur=0
cur_t=0
dist=0
for i in range(n):
	t,x,y=map(int,input().split())
	dist=abs(cur-(x+y))
	cur=x+y
	dt=t-cur_t
	cur_t=t
	
	if dist>dt:
		ans='No'
		break
	if dt%2==0 and (dist)%2==0 or dt%2==1 and (dist)%2==1:continue
	else:
		ans='No'
		break
print(ans)

Solution (Python):
import sys
n=int(input())
plan=[[0,0,0]]
for i in range(n):
    plan.append(list(map(int,input().split())))
for i in range(n):
    dt=abs(plan[i][0]-plan[i+1][0])
    dx=abs(plan[i][1]-plan[i+1][1])
    dy=abs(plan[i][2]-plan[i+1][2])
    if dt<dx+dy:
        print('No')
        sys.exit()
    if abs(dx+dy-dt)%2!=0:
        print('No')
        sys.exit()
print('Yes')

Solution (Python):
N,t0,x0,y0,ans=int(input()),0,0,0,0
for _ in range(N):
    t,x,y=map(int,input().split())
    timerest=(t-t0)-(x+y-x0-y0)
    if timerest<0 or timerest%2==1:ans=1
    t0,x0,y0=t,x,y
if ans==0:print("Yes")
else:print("No")

Solution (Python):
n = int(input())
t = 0
res = True
x, y = 0, 0
for i in range(n):
    t2, x2, y2 = map(int, input().split())
    dt = t2 - t
    
    
    

    if abs(x-x2) + abs(y-y2) > dt or (abs(x-x2) + abs(y-y2) - dt) % 2 == 1:
        res = False
    t, x, y = t2, x2, y2
print("Yes" if res else "No")

Solution (Python):
n = int(input())
t_pre = 0
x_pre = 0
y_pre = 0
can = 0
for i in range(n) :
    s = input().split(" ")
    t = int(s[0])
    x = int(s[1])
    y = int(s[2])
    sa = t - t_pre - ((x - x_pre) + (y - y_pre))
    if sa >= 0 and sa % 2 == 0 :
        can = 1
    else :
        can = 0
        break
    t_pre = t
    x_pre = x
    y_pre = y
if bool(can) :
    print("Yes")
else :
    print("No")

Solution (Python):
n = int(input())
t,x,y = [0]*(n+1),[0]*(n+1),[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):
    cnt = (t[i]-t[i-1])-abs(x[i]-x[i-1])-abs(y[i]-y[i-1])
    if cnt>=0 and cnt%2==0:
        pass
    else:
        print("No")
        exit()

print("Yes")

Solution (Python):
N = int(input())
s = [[0,0,0]]*(N+1)
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
for i in range(1,N+1):
  s[i] = input().split()
  t[i] = int(s[i][0])
  x[i] = int(s[i][1])
  y[i] = int(s[i][2])
k = 0
for i in range(N):
  dt = t[i+1]-t[i]
  d = abs(x[i]-x[i+1]) + abs(y[i]-y[i+1])
  if d <= dt and d%2 == dt%2:
    k = k + 1
  else:
    print('No')
    break
if k == N:
  print('Yes')

Solution (Python):
n = int(input())
 
nopass = False
for i in range(n) :
    t, x, y = map(int, input().split())
    if (x+y > t) or ((x+y+t)%2 == 1) :
        nopass = True
        break

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

Solution (Python):
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')

Solution (Python):
N=int(input())
t,x,y=0,0,0
s=0
for i in range(N):
  a,b,c=map(int,input().split())
  p,q=a-t,abs(b-x)+abs(c-y)
  if p<q or p%2!=q%2:
    s=1
    break
  t,x,y=a,b,c
print("No" if s else "Yes")

Solution (Python):
N=int(input())
I=[[0,0,0]]
for i in range(N):
    I.append(list(map(int,input().split())))
    
check=0
for i in range(N):
    time=I[i+1][0]-I[i][0]
    len=abs(I[i+1][1]-I[i][1])+abs(I[i+1][2]-I[i][2])
    if len>time:
        check=1
        break
    if (time-len)%2 != 0:
        check=1
        break

if check==0:
    print("Yes")
else:
    print("No")

Solution (Python):
N=int(input())
t=x=y=0
for i in range(N):
    t_,x_,y_=map(int,input().split())
    k=t_-t-(x_-x+y_-y)
    if k<0 or k%2==1:
        print("No")
        quit()
    t=t_
    x=x_
    y=y_
print("Yes")

Solution (Python):
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")

Solution (Python):
def resolve():

    n = int(input())

    list_t = [0] * 100010
    list_x = [0] * 100010
    list_y = [0] * 100010

    for i in range(n):
        list_t[i], list_x[i], list_y[i] = map(int, input().split())

    for i in range(n):

        if i == 0:
            delta_t = list_t[i]
            delta_xy = list_x[i] + list_y[i]

        else:
            delta_t = list_t[i] - list_t[i-1]
            delta_xy = abs(list_x[i] + list_y[i] - list_x[i-1] - list_y[i-1])

        if delta_t < delta_xy:
            print('No')
            return

        if delta_t % 2 != delta_xy % 2:
            print('No')
            return

    print('Yes')
    
resolve()

Solution (Python):
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")

Solution (Python):
import time

def is_feasible_travel(N, t, x, y):
    t_old, x_old, y_old = t[0], x[0], y[0]
    if N == 1:
        if t_old < (x_old + y_old):
            return False
        if (t_old % 2) == ((x_old + y_old) % 2):
            return True
        else:
            return False

    for ti, xi, yi in zip(t[1:], x[1:], y[1:]):
        t_diff = ti - t_old
        x_diff = abs(xi - x_old)
        y_diff = abs(yi - y_old)

        dist = x_diff + y_diff
        if dist > t_diff:
            return False
        elif dist < t_diff:
            if (dist % 2) != (t_diff % 2):
                return False

        t_old, x_old, y_old = ti, xi, yi
    return True


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())

    
    if is_feasible_travel(N, t, x, y):
        print("Yes")
    else:
        print("No")
    


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
start = [0,0,0]
next_d = []
for i in range(n):
    next_d = list(map(int, input().split()))
    t = start[0]-next_d[0]
    x = start[1]-next_d[1]
    y = start[2]-next_d[2]
    if abs(t)<abs(x)+abs(y) or abs(t)%2 != (abs(x)+abs(y))%2:
        print("No")
        exit()
    start = next_d
print("Yes")

Solution (Python):
n=int(input())
de=[[0,0,0]]
for i in range(n):
  de.append(list(map(int,input().split())))
flag=0
for i in range(n):
  interval=de[i+1][0]-de[i][0]
  distance=abs(de[i+1][1]-de[i][1])+abs(de[i+1][2]-de[i][2])
  if interval<distance:
    flag=1
    break
  elif (interval-distance)%2==0:
    continue
  else:
    flag=1
    break
if flag==1:
  print("No")
else:
  print("Yes")

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  

def get_distance(a,b):
    return abs(a[1]-b[1])+abs(a[2]-b[2])


def solve(N: int, T: "List[int]", X: "List[int]", Y: "List[int]"):

    prev = (0,0,0)
    for cur in zip(T,X,Y): 
        dist = get_distance(prev,cur)
        deltaT = cur[0] - prev[0]
        if dist > deltaT or (dist-deltaT) % 2 == 1:
            print(NO)
            return

        prev = cur

    print(YES)

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    t = [int()] * (N)  
    x = [int()] * (N)  
    y = [int()] * (N)  
    for i in range(N):
        t[i] = int(next(tokens))
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, t, x, y)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = [[0,0,0]]
for i in range(N):
    A.append(list(map(int,input().split())))
for i in range(1,N+1):
    t,x,y = A[i][0],A[i][1],A[i][2]
    pt,px,py = A[i-1][0],A[i-1][1],A[i-1][2]
    
    if (abs(x-px)+abs(y-py)) > t-pt or (abs(x-px)+abs(y-py))%2 != (t-pt)%2:
        print("No")
        exit()
print('Yes')

Solution (Python):
n = int(input())
t = []
x = []
y = []
nowx = 0
nowy = 0
time = 0
for i in range(n):
    T,X,Y = (int(x) for x in input().split())
    t.append(T)
    x.append(X)
    y.append(Y)

for i in range(n):
    distance = abs(nowx - x[i]) + abs(nowy - y[i])
    time = t[i] - time
    
    if (time - distance) % 2 == 0 and time >= distance:
        nowx = x[i]
        nowy = y[i]
        time = t[i]
    else:
        print('No')
        exit()

print('Yes')

Solution (Python):
n = int(input())
p = [[0, 0, 0]]
for i in range(n):
    p.append([int(_) for _ in input().split()])

p.sort()

flag = True
for i in range(n):
    dt = abs(p[i+1][0]-p[i][0])
    dxy = abs(p[i+1][1]-p[i][1])+abs(p[i+1][2]-p[i][2])
    if dt >= dxy and (dt-dxy)%2==0:
        pass
    else:
        flag = False

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

Solution (Python):
import re  
import sys 


def i_input(): return int(input())
def s_input(): return map(int,input().split())
def l_input(): return list(map(int, input().split()))


def main():
    N = i_input()
    T, X, Y = [], [], []
    for _ in range(N):
        t, x, y = s_input()
        T.append(t)
        X.append(x)
        Y.append(y)

    pre_t, pre_x, pre_y = 0, 0, 0
    for i in range(N):
        now_t, now_x, now_y = T[i], X[i], Y[i]
        time = now_t - pre_t
        x_diff = abs(now_x - pre_x)
        y_diff = abs(now_y - pre_y)

        if time >= x_diff + y_diff and\
            (time - x_diff - y_diff) % 2 == 0:
            pre_t, pre_x, pre_y = now_t, now_x, now_y
        else:
            print('No')
            sys.exit()
    
    print('Yes')

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
lst_p = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]


ans = 'Yes'
for i in range(n):
    t = lst_p[i+1][0] - lst_p[i][0]
    x = abs(lst_p[i+1][1] - lst_p[i][1])
    y = abs(lst_p[i+1][2] - lst_p[i][2])
    if t >= x + y and (x+y)%2 == t%2:
        continue
    else:
        ans = 'No'
        break


print(ans)

Solution (Python):
n = int(input())
lst_p = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]


ans = 'Yes'
for i in range(n):
    t = lst_p[i+1][0] - lst_p[i][0]
    x = abs(lst_p[i+1][1] - lst_p[i][1])
    y = abs(lst_p[i+1][2] - lst_p[i][2])
    if t >= x + y and (x+y)%2 == t%2:
        continue
    else:
        ans = 'No'
        break


print(ans)

Solution (Python):
N = int(input())
loc = [[0,0,0]]
while True:
    try:
        loc.append(list(map(int, input().split(" "))))
    except:
        break

def can_travel(p1, p2):
    t = p2[0] - p1[0]
    x = abs(p1[1]-p2[1])
    y = abs(p1[2]-p2[2])
    if (t-x-y)>=0 and (t-x-y)%2 == 0:
        return True
    else:
        return False


for i in range(N):
    ans = can_travel(loc[i], loc[i+1])
    if ans==False:
        print("No")
        exit()

print("Yes")

Solution (Python):
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]

rx = 0
ry = 0
rt = 0
for t, x, y in txy:
  d = abs(x - rx) + abs(y - ry)
  dt = t - rt
  if dt < d or dt % 2 != d % 2:
    print("No")
    exit()

print("Yes")

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if t == x+y:
        continue
    elif t > x+y and (t-(x+y))%2 == 0:
        continue
    else:
        print('No')
        sys.exit()
print('Yes')

Solution (Python):
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
t=0
x=0
y=0
flag=True
for i in range(n):
    tt=l[i][0]-t
    d=abs(l[i][1]-x)+abs(l[i][2]-y)
    if tt<d or tt%2!=d%2:
        flag=False
    t=l[i][0]
    x=l[i][1]
    y=l[i][2]
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())

travel = [[0, 0, 0] for i in range(N+1)]

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


for i in range(N):
    x = abs(travel[i+1][1] - travel[i][1])
    y = abs(travel[i+1][2] - travel[i][2])
    t = travel[i+1][0] - travel[i][0]
    if not( x + y  <= t and (t % 2) == ((x + y) % 2)):
        print("No")
        exit()

print("Yes")

Solution (Python):

def distance(p1,p2):
	return abs(p1[0]-p2[0]) + abs(p1[1]-p2[1])

n = int(input())
anslist = [None for i in range(n)]
point = [0, 0]
t = 0

for i in range(n):
	tn, nx, ny =  [ int(v) for v in input().split() ]
	dt = tn - t
	t = tn
	next_point = [nx, ny]
	
	anslist[i] =  distance(point,next_point) <= dt and (dt - distance(point,next_point)) % 2 == 0
	point = next_point

if all(anslist):
	ans = "Yes"
else:
	ans = "No"

print(ans)