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):
def judge(t, x1, y1, x2, y2):
    if abs(x2 - x1) + abs(y2 - y1) > t:
        return False
    else:
        t -= abs(x2 - x1) + abs(y2 - y1)
        if 0 == t % 2:
            return True
        else:
            return False


n = int(input())
ans = "Yes"
now_x, now_y = 0, 0
t0 = 0
for _ in range(n):
    t, x, y = map(int, input().split())
    if judge(t-t0, now_x, now_y, x, y):
        now_x, now_y = x, y
        t0 = t
    else:
        ans = "No"
        break
print(ans)

Solution (Python):
N = int(input())
loc = [list(map(int, input().split())) for i in range(N)]
t = 0
x = 0
y = 0
i = 0
def check(X,Y):
    k=0
    global x,y,t,i
    
    d = (loc[i][0] - t) - (abs(loc[i][1] - X) + abs(loc[i][2] - Y))
    if d %2 ==0 and d >= 0: 
        t = loc[i][0]
        x = loc[i][1]
        y = loc[i][2]
        
        k =1 
        i += 1
         
    if k ==0:
        t = -1  

while(i < N and t!= -1):
    check(x,y)
    

if t == -1:
    print('No')

else:
    print('Yes')

Solution (Python):

N=int(input())
L=[]
L.append([0,0,0])
Flg=True
cnt=0
for i in range(1,N+1):
    t,x,y=map(int,input().split())
    L.append([t,x,y])
    if (t-L[i-1][0]-(abs(L[i-1][1]-x)+abs(L[i-1][2]-y)))%2==0 and t-L[i-1][0]>=(abs(L[i-1][1]-x)+abs(L[i-1][2]-y)):
        cnt+=1
        
if cnt==N:
    print('Yes')
else:
    print('No')

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

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

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

def ch(t1,t2,x1,x2,y1,y2):
    dt=t2-t1
    dx=abs(x2-x1)
    dy=abs(y2-y1)
    if dt<dx+dy:
        return False
    if dt%2 != (dx+dy)%2:
        return False
    return True


t1=0
t2=0
x1=0
x2=0
y1=0
y2=0

f=1
for i in range(N):
    t2,x2,y2=map(int,input().split())
    if ch(t1,t2,x1,x2,y1,y2)==False:
        f=0
    t1=t2
    x1=x2
    y1=y2
    
if f==1:
    print("Yes")
else:
    print("No")

Solution (Python):
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)
flag=True
for i in range(1,N+1):
    distance=abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    dt=t[i]-t[i-1]
    if distance>dt:
        flag=False
        break
    elif t[i]%2==0:
        if (x[i]+y[i])%2!=0:
            flag=False
    elif t[i]%2==1:
        if (x[i]+y[i])%2!=1:
            flag=False
if flag==True:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
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")
        sys.exit()
        
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())
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())
nt=0
nx=0
ny=0
for i in range(N):
    t,x,y=map(int,input().split())
    d=t-nt
    dxy=abs(x-nx)+abs(y-ny)
    if(d<dxy or d%2!=dxy%2):
        print("No")
        exit()
    else:
        nt=t
        nx=x
        ny=y
print("Yes")

Solution (Python):
N = int(input())
yes = True
for _ in range(N):
  t, x, y = map(int, input().split())
  margin = t - (x + y)
  if not(margin >= 0 and margin % 2 == 0):
    yes = False
if yes:
  print("Yes")
else:
  print("No")

Solution (Python):
N=(int)(input())
t_=0
x_=0
y_=0
for i in range(N):
    st,sx,sy = input().split()
    t=(int)(st)
    x=(int)(sx)
    y=(int)(sy)
    dt = t-t_
    dx = x-x_
    dy = y-y_
    if dx+dy>dt or (dx+dy)%2!=dt%2:
        print("No")
        exit(0)
    
print("Yes")

Solution (Python):

import sys

def incrementCheck(t, x, y):
    t=abs(t)
    x=abs(x)
    y=abs(y)
    
    for i in range(t,-1,-2):
        if y == -1*x + i:
            return True
    
    return False


n = int(input().strip())
nums = [ list(map(int, input().rstrip().split())) for _ in range(n)]

for i,current in enumerate(nums):
    if i == 0:
        increment=current
    else:
        increment=[nums[i][0]-nums[i-1][0],
                   nums[i][1]-nums[i-1][1],
                   nums[i][2]-nums[i-1][2]]

    if incrementCheck(increment[0],increment[1],increment[2]):
        continue
    else:
        print("No")
        sys.exit()
        
print("Yes")

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

Solution (Python):
def main():
    N = int(input())
    plan = [[0, 0, 0]]
    for _ in range(N):
        plan.append(list(map(int, input().split(" "))))
    answer = True
    for i in range(N):
        distance = abs(plan[i + 1][1] - plan[i][1]) + abs(plan[i + 1][2] - plan[i][2])
        dt = plan[i + 1][0] - plan[i][0]
        if distance > dt or (dt - distance) % 2:
            answer = False
            break
    print("Yes" if answer else "No")


if __name__ == '__main__':
    main()

Solution (Python):
def solve():
    N = int(input())
    A = [[0,0,0]]
    for _ in range(N):
        a = list(map(int, input().split()))
        A.append(a)

    ans = 'Yes'

    for i in range(N):
        t1, x1, y1 = A[i]
        t2, x2, y2 = A[i+1]

        time = t2 - t1
        x = abs(x2 - x1)
        y = abs(y2 - y1)

        if time < x+y or (time+x+y) % 2 != 0:
            ans = 'No'

    return ans

print(solve())

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


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

judge = 'No'


l.insert(0,[0,0,0])
for i in range(n):
    
    dt = l[i+1][0]-l[i][0]
    n_j = dt%2
    xy = (l[i+1][1]+l[i+1][2])-(l[i][1]+l[i][2])
    if n_j==xy%2 and dt>=abs(xy):
        judge = 'Yes'
    else:
        judge ='No'
        break

print(judge)

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

for i in range(n):
    time=t[i+1]-t[i]
    dx=abs(x[i+1]-x[i])
    dy=abs(y[i+1]-y[i])

    if time<dx+dy or (time+dx+dy)%2!=0:
        print('No')
        exit()
print('Yes')

Solution (Python):
N = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(N):
    a, b, c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)

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

print('Yes')

Solution (Python):
N = int(input())
s = 0
k = 0
l = 0
count = 0
for i in range(N):
  t, x, y = map(int, input().split())
  if t-s >= abs(x - k) + abs(y - l) and (t - s - (abs(x - k) + abs(y - l))) % 2 == 0:
    s = t
    k = x
    l = y
  else:
    count += 1
if count > 0:
  print('No')
else:
  print('Yes')

Solution (Python):
n = int(input())
l = [[0, 0, 0]]
for _ in range(n):
    l.append(list(map(int, input().split())))
flag = 1

def move(time, x, y):
    for t_x in range(time+1):
            for ue in range(t_x+1):
                if (2*ue-t_x)==x:
                    for migi in range(time-t_x+1):
                        if (2*migi-time+t_x)==y:
                            return 1
    return 0

for i in range(n):
    time = l[i+1][0] - l[i][0]
    x = l[i+1][1] - l[i][1]
    y = l[i+1][2] - l[i][2]
    if not move(time, x, y):
        flag = 0
        break

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

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())
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):
def f_l1d(x0, y0, x1, y1):
    return abs(x0-x1)+abs(y0-y1)

n = int(input())
t0, x0, y0 = 0, 0, 0
r = 'Yes'
for i in range(n):
    t1, x1, y1 = map(int, input().split())
    l1d = f_l1d(x0, y0, x1, y1)
    t = t1-t0
    if l1d<=t and (l1d-t)%2==0:
        t0, x0, y0 = t1, x1, y1
    else:
        r = 'No'
print(r)

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

clear_flag=0
for i in range(N):
  txy=list(map(int,input().split()))
  if txy[0]>=(txy[1]+txy[2]) and (txy[0]+txy[1]+txy[2])%2==0:
    clear_flag+=1
  else:
    break
    
if clear_flag==N:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
t, x, y = [0] * (N + 1), [0] * (N + 1), [0] * (N + 1)
t[0], x[0], y[0] = 0, 0, 0

ans = "Yes"
for i in range(1, N + 1):
    t[i], x[i], y[i] = map(int, input().split())
    distance_xy = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1])
    distance_t = abs(t[i] - t[i - 1])
    
    
    if (distance_t >= distance_xy) & (distance_t % 2 == distance_xy % 2):
        pass
    else:
        ans = "No"

print(ans)

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

ans = 'Yes'

pre_t = 0
pre_x = 0
pre_y = 0
for n in range(N):
  t,x,y = map(int, input().split())
  
  

  
  dif_t = t - pre_t
  dif_x = abs(x - pre_x)
  dif_y = abs(y - pre_y)
  if dif_t < (dif_x + dif_y):
    ans = 'No'
    break    
  
  
  if t%2 != (x+y)%2:
    ans = 'No'
    break


print(ans)

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:
        print("No")
        exit()
print("Yes")

Solution (Python):
N = int(input())
[t, x, y] = [[0],[0],[0]]
for i in range(N):
  input_line = list(map(int, input().split()))
  t.append(input_line[0])
  x.append(input_line[1])
  y.append(input_line[2])

can = True
for i in range(0, N):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if dt < dist:
    can = False
  if dt%2 != dist%2:
    can = False
  
if can == True:
  print("Yes")
else:
  print("No")

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

count = 0
t, x, y = 0, 0, 0
for i in range(n):
    ti, xi, yi = l[i][0], l[i][1], l[i][2]
    dl = abs(x - xi) + abs(y - yi)
    dt = ti - t
    if dt % dl == 0:
        count += 1
        t, x, y = ti, xi, yi
        continue
    else:
        break

if count == n:
    print('Yes')
else:
    print('No')

Solution (Python):

N = int(input())
list = [0 for i in range(0,N+1)]
list[0] = (0,0,0)
for i in range(0,N) :
    a, b, c = map(int, input().split())
    list[i+1] = (a,b,c)

can = True

for i in range(1,N+1):
    time = list[i][0] - list[i-1][0]
    dist = abs(list[i][1] - list[i-1][1]) + abs(list[i][2] - list[i-1][2])
    if dist > time :
        can = False
        break
    elif time%2 != dist%2 :
        can = False
        break
    else :
        continue        

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

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

t = 0
x = 0
y = 0
flag = True
for _ in range(N):
    tn, xn, yn = map(int, input().split())
    dt = tn - t
    l1 = abs(xn - x) + abs(yn - y)
    if (l1 <= dt) and (tn % 2 == (xn + yn) % 2):
        continue
    else:
        flag = False
        break

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

Solution (Python):
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[i] + y[i] > t[i]:
        print("No")
        exit()
    elif (x[i]+y[i])%2 != t[i]%2:
        print("No")
        exit()        
    if i > 0:
        a = abs(x[i]+y[i]-x[i-1]-y[i-1])%2
        b = (t[i]-t[i-1])%2
        if a != b:
            print("No")
            exit()
else:
    print("Yes")

Solution (Python):
N = int(input())
ans = True
k,x,y = 0,0,0
for i in range(N):
    t,p,q = map(int,input().split())
    d = abs(x-p)+abs(y-q)
    if d>(t-k):ans = False
    if ((t-k)-d)%2==1:ans = False
    k,x,y = t,p,q
print("Yes" if ans else "No")

Solution (Python):
def main(plan):
    
    p0 = [0,0,0]
    
    if not CanReach(p0, plan[0]):
        return False
    
    for i in range(1,len(plan)):
        if not CanReach(plan[i-1], plan[i]):
            return False
    return True


def CanReach(p1, p2):
    
    t = p2[0] - p1[0]
    
    t_min = abs(p1[1] - p2[1]) + abs(p1[2] - p2[2])
    
    if t_min <= t and (t-t_min) % 2 == 0:
        return True
    return False


n = int(input())
plan = list(list(map(int,input().split())) for _ in range(n))
print("Yes" if main(plan) else "No")

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

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

for i in range(n):
    a,b,c=map(int,input().split())
    t.append(a)
    x.append(b)
    y.append(c)
for i in range(n):
    if x[i]+y[i]>t[i] or (x[i]+y[i])%2!=t[i]%2:
        print("No")
        exit()

print("Yes")

Solution (Python):
N=int(input())
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 or t%2!=(x+y)%2:
    print("No")
    exit()
  T,X,Y=t,x,y
print("Yes")

Solution (Python):
N=int(input())
cnt=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:cnt+=1
  T,X,Y=t,x,y
print("Yes" if cnt==N else "No")

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

last_t, last_x, last_y = 0, 0, 0
for _ in range(n):
    t, x, y = map(int, input().split())
    remaining_time = t - last_t
    distance = abs(x - last_x) + abs(y - last_y)
    if remaining_time < distance or (remaining_time - distance) % 2:
        print('No')
        exit()
    last_t, last_x, last_y = t, x, y

print('Yes')

Solution (Python):
N = int(input())
t, x, y = 0, 0, 0

for _ in range(N):
    ti, xi, yi = map(int, input().split())
    dt, dx, dy = ti - t, abs(xi - x), abs(yi - y)
    t, x, y = ti, xi, yi
    
    
    if ((dt - (dx + dy)) % 2 != 0) or (dx + dy > dt):
        print('No')
        exit()

print('Yes')

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N
for i in range(N):
    t[i],x[i],y[i] = [int(i) for i in input().split()]
t.insert(0,0)
x.insert(0,0)
y.insert(0,0)
for i in range(1,N+1):
    dt = t[i]-t[i-1]
    dx = abs(x[i]-x[i-1])
    dy = abs(y[i]- y[i-1])
    dl = dx + dy
    if dl > dt:
        print("No")
        exit()
    else :
        if (dt % 2) != (dl % 2):
            print("No")
            exit()
print("Yes")

Solution (Python):
N = int(input())
TXY = []
flag = True
for i in range(N):
	txy = list(map(int,input().split()))
	if not (txy[0] % 2 == (txy[1] + txy[2]) % 2 and txy[0] >= (txy[1] + txy[2])):
		flag = False
if flag == True:
	print("Yes")
else:
	print("No")

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())
    
f = 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:
        f = False
    if dist%2 != dt%2:
        f = False

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

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())
    
f = 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:
        f = False
    if dist%2 != dt%2:
        f = False

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

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

t_now = 0
x_now = 0
y_now = 0

for _ in range(n):
    t,x,y = map(int,input().split())
    dist = x+y - (x_now + y_now)
    time = t - t_now
    if dist<=time and (time-dist)%2 == 0:
        t_now,x_now,y_now = t,x,y
        continue
    else:
        print('No')
        break
else:
    print('Yes')

Solution (Python):

n = int(input())
p = []
for _ in range(n):
    p.append(list(map(int,input().split())))


t = 0
gx = 0
gy = 0
x = 0
y = 0
can = True
for i in range(n):
    gt = p[i][0]
    gx = p[i][1]
    gy = p[i][2]
    flag = False
    while True:
        if gx>x:
            x+=1
            t+=1
        elif gx<x:
            x-=1
            t+=1
        else:
            if gy>y:
                y+=1
                t+=1
            elif gy<y:
                y-=1
                t+=1
            else:
                if t>gt:
                    break
                elif t==gt:
                    flag = True
                    break
                else:
                    x+=1
                    t+=1
    if flag==False:
        can = False
        break

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

Solution (Python):
n = int(input())
t = [0] * n
x = [0] * n
y = [0] * n
breaker = 0
for i in range(n):
    t[i], x[i], y[i] = map(int, input().split())
for i in range(n):
    if i == 0:
        if x[i]+y[i] <= t[i] and (x[i]+y[i]+t[i])%2 == 0:
            pass
        else:
            breaker = 1
            break
    else:
        if x[i]+y[i] <= t[i] and (x[i]+y[i]+t[i])%2 == 0 and x[i]-x[i-1]+y[i]-y[i-1] <= t[i]-t[i-1]:
            pass
        else:
            breaker = 1
            break
if breaker == 0:
    print("Yes")
else:
    print("No")

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

Solution (Python):


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

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

posi=[]
for _ in range(n):
  posi.append(list(map(int,input().split())))

x=0
y=0
t=0
for item in posi:
  temp=abs(x-item[1])+abs(y-item[2])
  
  if item[0]-t<temp:
    
    print("No")
    exit()
  flag=(item[0]-t-temp)%2
  
  if flag==0:
    
    t=item[0]
    x=item[1]
    y=item[2]
  else:
    print("No")
    exit()
print("Yes")

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

TXY = [[0,0,0]]
for n in range(N):
  TXY.append([int(i) for i in input().split()])

ans = "Yes"
for i in range(N):
  sec = TXY[i+1][0] - TXY[i][0]
  length = abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2])

  if sec < length or (sec >= length and (length - sec)%2 == 1):
    ans = "No"
    break

print(ans)

Solution (Python):
n = int(input())
pt = 0
px, py = 0, 0
f = True
for i in range(n):
    t, x, y = map(int, input().split())
    dis = abs(px-x) + abs(py-y)
    dt = t - pt
    
    if dt >= dis and abs(dis - dt) % 2 == 0:
        pass
    else:
        f = False
    pt, px, py = t, x, y
print("Yes" if f else "No")

Solution (Python):
n = int(input())
tp = 0
xp = 0
yp = 0
for i in range(n):
  t,x,y = map(int, input().split())
  if abs(x-xp) + abs(y-yp) > t - tp:
    print('No')
    exit()
  if (abs(x-xp) + abs(y-yp)) % 2 != (t-tp) % 2:
    print('No')
    exit()
  tp = t
  xp = x
  yp = y
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())
for i in range(n):
    t,x,y = map(int,input().split())
    if x+y <= t and (x+y-t) % 2 == 0: pass
    else: 
        print("No")
        break
    if i == n-1: print("Yes")

Solution (Python):
n = int(input())
t1 = x1 = y1 = 0
flag = 0
for i in range(n):
    t2, x2, y2 = map(int,input().split())
    if t2-t1 >= abs(x2-x1)+abs(y2-y1) and (t2-t1)%2 == (abs(x2-x1)+abs(y2-y1))%2:
        pass
    else:
        flag = 1
    t1, x1, y1 = t2, x2, y2
if flag == 1:
    print('No')
else:
    print('Yes')

Solution (Python):
def dis(x_1, y_1, x_2, y_2):
    return ((x_1-x_2)**2 + (y_1-y_2)**2)**(1/2)

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(n):
    if t[i] % 2 !=  (x[i] + y[i]) % 2:
        print("No")
        exit(0)
    if i != 0:
        if dis(x[i-1], y[i-1], x[i], y[i]) > t[i] - t[i-1]:
            print("No")
            exit(0)
    else:
        if x[i] + y[i] > t[i]:
            print("No")
            exit(0)

print("Yes")

Solution (Python):
N = int(input())
t = []
x = []
y = []
x.append(0)
y.append(0)
t.append(0)
for i in range(N):
    a = list(map(int,input().split()))
    t.append(a[0])
    x.append(a[1])
    y.append(a[2])

flag = True
for i in range(1,N+1):
    a = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])
    T = t[i] - t[i-1]
    if T < a:
        flag = False
        break
    b = T -a
    if b % 2 == 0:
        continue
    else:
        flag = False
        break

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

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

for i in range(n):
  if l[i][0] % 2 != (l[i][1]+l[i][2]) % 2:
    print("No")
    exit()
  if l[i][0] < l[i][1]+l[i][2]:
    print("No")
    exit()
  if i > 0 :
    if abs(l[i][0]-l[i-1][0]) < abs(l[i][1]-l[i-1][1])+abs(l[i][2]-l[i-1][2]):
      print("No")
      exit()
print("Yes")

Solution (Python):
N = int(input())
x = [[0,0,0]]
for i in range(N):
    num = [int(i) for i in input().split()]
    x.append(num)

count = 0    
for i in range(1,len(x)):
    dist = 0
    dist = dist + x[i][1]-x[i-1][1] + x[i][2]-x[i-1][2]
    
    if dist == 0:
        (x[i][0]-x[i-1][0])%2==0
        count += 1
        continue
        
    if dist <= x[i][0]-x[i-1][0]:
        if (x[i][0]-x[i-1][0])-dist==0:
            count += 1
            continue

        if ((x[i][0]-x[i-1][0])-dist)%2==0:
            count += 1

if count == (len(x)-1):
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
x = [[0,0,0]]
for i in range(N):
    num = [int(i) for i in input().split()]
    x.append(num)

count = 0    
for i in range(1,len(x)):
    dist = 0
    dist = dist + x[i][1]-x[i-1][1] + x[i][2]-x[i-1][2]
    
    if dist == 0:
        (x[i][0]-x[i-1][0])%2==0
        count += 1
        continue
        
    if dist <= x[i][0]-x[i-1][0]:
        if (x[i][0]-x[i-1][0])-dist==0:
            count += 1
            continue

        if ((x[i][0]-x[i-1][0])-dist)%2==0:
            count += 1

if count == (len(x)-1):
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
 
flg = True
t_ = 0
x_ = 0
y_ = 0

for i in range(n):
  t, x, y = map(int, input().split())
  t_ = abs(t - t_)
  x_ = abs(x - x_)
  y_ = abs(y - y_)
  
  if t_ - x_ - y_ < 0:
    print('No')
    flg = False
    break
  elif (t_ - x_ - y_) % 2 != 0:
    print('No')
    flg = False
    break
  t_ = t
  x_ = x
  y_ = y
 
if flg:
  print('Yes')

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

txy=[]
Current_t,Current_x,Current_y=0,0,0
for i in range(N):
    txy=TXY[i]
    t,x,y=txy[0],txy[1],txy[-1]
    sa_t=t-Current_t
    sa_x=x-Current_x
    sa_y=y-Current_y

    if sa_t<sa_x+sa_y or sa_t%2!=(sa_x+sa_y)%2:
        print('No')
        exit()  
        
    Current_t=t
    Current_x=x
    Current_y=y

print('Yes')

Solution (Python):
import sys
import numpy as np

read = sys.stdin.read


def main():
    N, *txy = map(int, read().split())
    t = np.array([0] + txy[::3], np.int64)
    x = np.array([0] + txy[1::3], np.int64)
    y = np.array([0] + txy[2::3], np.int64)
    time = t[1:] - t[:-1]
    length = np.abs(y[1:] - y[:-1]) + np.abs(x[1:] - x[:-1])
    if np.any((time < length) | (time % 2 != length % 2)):
        print('No')
    else:
        print('Yes')


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
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 and (dt -dx-dy)%2 ==0:
    continue
  else:
    print('No')
    break
else:
  print('Yes')

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

a = 0
b = 0
time = 0
manhattan = lambda x,y : abs(x[0] - y[0]) + abs(x[1] - y[1])
enable = 'Yes'
for i in range(n):
    t,x,y = map(int, input().split())
    cost = manhattan((a,b), (x,y))
    c = t - time - cost
    if c < 0 or c % 2:
        enable = 'No'
    time = t
    a = x
    b = y

print(enable)

Solution (Python):
N = int(input())
T, X, Y = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    dt = abs(T-t)
    dist = abs(X-x) + abs(Y-y)
    if dt < dist or dist % 2 != dt % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
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) <= abs(T-t) and t%2==(x+y)%2:
        count += 1
    T,X,Y = t,x,y
print("Yes" if count==n else "No")

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

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

is_able=True
pre_t = 0
pre_x = 0
pre_y = 0
for i in range(len(T)):
  if (T[i][0] % 2) != (T[i][1]+T[i][2])%2:
    is_able=False
    break
  if T[i][0]-pre_t < (T[i][1]-pre_x + T[i][2]-pre_y):
    is_able=False
    break
  pre_t=T[i][0]
  pre_x=T[i][1]
  pre_y=T[i][2]
if is_able:
  print('Yes')
else:
  print('No')

Solution (Python):
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) <= abs(T-t) and t%2==(x+y)%2:
        count += 1
    T,X,Y = t,x,y
print("Yes" if count==n else "No")

Solution (Python):
N = int(input())
now = (0,0,0)
for i in range(N):
    bx,by,bt = now
    t,x,y = map(int,input().split())
    if abs(x-bx)+abs(y-by) <= t-bt and (abs(x-bx)+abs(y-by))%2 == (t-bt)%2:
        now = (x,y,t)
        continue
    else:
        print("No")
        break
else:
    print("Yes")

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


def resolve():
    N = int(_input())
    t, x, y = 0, 0, 0
    for _ in range(N):
        next_t, next_x, next_y = map(int, _input().split())
        diff_xy = abs(x - next_x) + abs(y - next_y)
        diff_t = next_t - t
        if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):
            print('No')
            exit(0)
    print('Yes')


if __name__ == '__main__':
    resolve()

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


def resolve():
    N = int(_input())
    T = [list(map(int, _input().split())) for _ in range(N)]
    t, x, y = 0, 0, 0
    for next_t, next_x, next_y in T:
        diff_xy = abs(x - next_x) + abs(y - next_y)
        diff_t = next_t - t
        if diff_xy > diff_t or (diff_xy % 2 != diff_t % 2):
            print('No')
            exit(0)
    print('Yes')


if __name__ == '__main__':
    resolve()

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

t, x, y = 0, 0, 0
for _ in range(n):
  _t, _x, _y = map(int, input().rstrip().split())
  dxy = abs(_x - x) + abs(_y - y)
  dt = _t - t
  
  if dxy == dt:
    pass
  elif dxy > dt:
    print('No')
    exit()
  else:
    if (dxy % 2 == 0) and (dt % 2 == 0):
      pass
    elif ((dxy - 1) % 2 == 0) and ((dt - 1) % 2 == 0):
      pass
    else:
      print('No')
      exit()
  
  x = _x
  y = _y
  t = _t
      
print('Yes')

Solution (Python):
def solve(n, TXY):
    pt, px, py = 0, 0, 0
    for t, x, y in TXY:
        dt = t - pt
        dl = abs(x - px) + abs(y - py)
        if not (dl <= dt and (dt - dl) % 2 == 0):
            
            return 'No'
        pt, px, py = t, x, y
    return 'Yes'

_n = int(input())
_TXY = [list(map(int, input().split())) for _ in range(_n)]
print(solve(_n, _TXY))

Solution (Python):
import sys
n = int(input())
tourList = {}

nowX = 0
nowY = 0
nowTime = 0
for i in range(n):
  t,x,y = map(int,input().split())  
  moveX = abs(x - nowX)
  moveY = abs(y - nowY)
  moveTime = moveX+moveY
  reachTime = moveTime + nowTime
  if reachTime > t or (t-reachTime) % 2 != 0:
    print('No')
    sys.exit()
  nowTime = t
  nowX = x
  nowY = y
print('Yes')

Solution (Python):
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) <=abs(T-t) and t%2==(x+y)%2:
        count +=1
    T,X,Y = t,x,y
print("Yes" if count==n else "No")

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

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

x0 = 0
y0 = 0
t0 = 0
res = "Yes"
for t, x, y in pairs:
    dx = x - x0
    dy = y - y0
    dt = t - t0

    
    tmp = dt - (abs(dx) + abs(dy))
    if tmp < 0 or tmp % 2 != 0:
        res = "No"
        break
    x0 = x
    y0 = y
    t0 = t

print(res)

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

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

x0 = 0
y0 = 0
t0 = 0
res = "Yes"
for t, x, y in pairs:
    dx = x - x0
    dy = y - y0
    dt = t - t0

    if abs(dx) + abs(dy) != dt:
        tmp = dt - (abs(dx) + abs(dy))
        if tmp <= 0 or tmp % 2 != 0:
            res = "No"
            break
    x0 = x
    y0 = y
    t0 = t

print(res)

Solution (Python):
N = int(input())
nowx = 0
nowy = 0
nowt = 0

result = 'Yes'
for i in range(N):
  [t, x, y] = list(map(int,input().split(' ')))
  if (t - nowt) >= abs(x - nowx) + abs(y - nowy) and ((t - nowt) - (x - nowx) - (y - nowy)) % 2 == 0:
    nowx = x
    nowy = y
    nowt = t
    continue
  else:
    result = 'No'
    break
    
print(result)

Solution (Python):
n=int(input())
data=[list(map(int,input().split())) for _ in range(n)]
x_past=0
y_past=0
t_past=0
for t,x,y in data:
  if abs(x-x_past)+abs(y-y_past)>t-t_past:
    print("No")
    exit()
  if (abs(x-x_past)+abs(y-y_past))%2!=(t-t_past)%2:
    print("No")
    exit()
  x_past=x
  y_past=y
  t_past=t
print("Yes")

Solution (Python):


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

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

Solution (Python):
N = int(input())
a = 0
b = 0
c = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    l = t - c
    m = abs((a + b) - (x + y))
    if l >= m and (l - m) % 2 == 0:
        a = x
        b = y
        c = t
    else:
        print("No")
        exit()
print("Yes")