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())
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=True
for i in range(N):
    t=T[i+1]-T[i]
    x=abs(X[i+1]-X[i])
    y=abs(Y[i+1]-Y[i])
    z=x+y
    if t>=z and (t-z)%2==0:
        flag=True
    else:
        flag=False
        break
print("Yes") if flag 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())
ans = "Yes"
for _ in range(n):
    t, x, y = map(int, input().split())
    if ((t % 2) != ((x+y) % 2)) | (t < x+y):
        ans = "No"
print(ans)

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


judge = True

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]) :
        if (T[i] - T[i-1] - (abs(X[i] - X[i-1]) + abs(Y[i] - Y[i-1]))) % 2 == 0 :
            
            continue
    judge = False
    break

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

Solution (Python):
n = int(input())
position = [[0]*3 for _ in range(n)]
ans = 'Yes'
for i in range(n):
    t, x, y = map(int, input().split())
    if ans != "No":
        if x + y > t:
            ans = "No"
        else:
            if t % 2 == (x+y) % 2:
                ans = "Yes"
            else:
                ans = "No"
print(ans)

Solution (Python):
N = int(input())
TXY = [map(int,input().split()) for _ in range(N)]
ans = "Yes"
for t,x,y in TXY:
    if (x+y)%2 != t%2:
        ans = "No"
        break
    if x+y > t:
        ans = "No"
        break
print(ans)

Solution (Python):

N = int(input())
T = [[0 for i in range(3)] for i in range(N+1)]
for i in range(1,N+1):
  input_lines = input().split()
  T[i][0] = int(input_lines[0])
  T[i][1] = int(input_lines[1])
  T[i][2] = int(input_lines[2])
T[0][0] = 0
T[0][1] = 0
T[0][2] = 0

for i in range(1,N+1):
  t = T[i][0] - T[i-1][0]
  d = abs(T[i][1] - T[i-1][1]) + abs(T[i][2] - T[i-1][2])
  if (t-d)%2 ==1:
    print("No")
    break
  if t < d:
    print("No")
    break
  if i == N:
    print("Yes")

Solution (Python):



n = int(input())
t, x, y = zip(*((map(int, input().split()) for _ in range(n))))
t = [z for z in t]
x = [z for z in x]
y = [z for z in y]
t.insert(0, 0)  
x.insert(0, 0)
y.insert(0, 0)

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

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

Solution (Python):
def solve():
    N = int(input())
    cx = 0
    cy = 0
    ct = 0
    for i in range(N):
        ti,xi,yi = map(int,input().split())
        t = ti - ct
        x = abs(xi - cx)
        y = abs(yi - cy)
        if x + y > t:
            return 'No'
        if (x + y - t) % 2 != 0:
            return 'No'
        cx = xi
        cy = yi
        ct = ti
    return 'Yes'

print(solve())

Solution (Python):
n = int(input())
tn=0
xn=0
yn=0
f=0
for i in range(n):
    t, x, y = map(int, input().split())
    dt=t-tn
    dx=abs(x-xn)
    dy=abs(y-yn)
    dxy= dx + dy
    if dt < dxy:
        f=1
    else:
        if dt%2==0 and dxy%2!=0:
            f=1
        elif dt%2!=0 and dxy%2==0:
            f=1
if f==1:
    print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())
a = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
ans = "Yes"
for i in range(n) :
  diff = sum(a[i+1]) - sum(a[i])
  if(diff % 2 == 1 or diff - 2*(a[i+1][0] - a[i][0]) > 0) : ans = "No" 
print(ans)

Solution (Python):
n=int(input())
t0=x0=y0=0
f=0
for i in range(n):
  t,x,y=map(int,input().split())
  t1=t-t0
  x1=abs(x-x0)
  y1=abs(y-y0)
  if t1<x1+y1 or t1%2!=(x1+y1)%2:
    f=1
  t0=t
  x0=x
  y0=y
if f==1:
  print('No')
else:
  print('Yes')

Solution (Python):
n = int(input())
x0 = [[0,0,0]]
for i in range(n):
    x0 += [list(map(int,input().split()))]
flag = 1
for i in range(1,n+1):
    x1 = x0[i-1]
    x2 = x0[i]
    dt = x2[0]-x1[0]
    dx = abs(x2[1]-x1[1])
    dy = abs(x2[2]-x1[2])
    if dx+dy-dt>0:
        flag=0
        break
    else:
        if (dt-dx-dy)%2==1:
            flag = 0
            break
if flag:
    print('Yes')
else:
    print('No')

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

prex = 0
prey = 0
pret = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    dt = t-pret
    mindis = abs(x-prex)+abs(y-prey)
    if dt >=mindis and (dt-mindis)%2==0:
        o = 1
    else:
        flag = False
    pret = t
    prex = x
    prey = y
if flag:
    print("Yes")
else:
    print("No")

Solution (Python):
def solve(string):

    n, *txy = map(int, string.split())
    checks = [
        abs(x) + abs(y) <= t and (t + x + y) % 2 == 0
        for t, x, y in zip(txy[::3], txy[1::3], txy[2::3])
    ]
    return "Yes" if all(checks) else "No"


if __name__ == '__main__':
    n = int(input())
    print(solve('{}\n'.format(n) + '\n'.join([input() for _ in range(n)])))

Solution (Python):
import numpy as np
N = int(input())
travels = np.array([input().split() for _ in range(N)], dtype=int)
travels = np.insert(travels, 0, [0, 0, 0], axis=0)
travels = travels[travels[:,0].argsort(), :]
able = True
for i in range(0, N):
    dist = travels[i+1,:] - travels[i,:]
    x_dist = abs(dist[1])
    y_dist = abs(dist[2])
    time_dist = dist[0]
    x = travels[i+1,1]
    y = travels[i+1,2]
    time = travels[i+1,0]
    if x_dist+y_dist>time_dist:
        able = False
        break
    elif (x+y)%2==0 and time%2!=0:
        able = False
        break
    elif (x+y)%2!=0 and time%2==0:
        able = False
        break
if able:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
    ti, xi, yi = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)

def judge():
    for i in range(N):
        dt = t[i + 1] - t[i]
        diff = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
        if diff > dt or (dt - diff) % 2 != 0:
            return False
    return True

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

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())
Ti = [list(map(int, input().split())) for _ in range(N)]

last_x = 0
last_y = 0
last_t = 0
for t in Ti:
    dt = t[0] - last_t
    dx = abs(t[1] - last_x)
    dy = abs(t[2] - last_y)
    d = dx + dy
    if dt < d or dt % 2 != d % 2:
        print("No")
        exit()

    last_t = t[0]
    last_x = t[1]
    last_y = t[2]

print("Yes")

Solution (Python):

n = int(input())


here = list( map(int, input().split()) )
can = here[0] >= (here[1]+here[2])

for i in range(n-1):

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

    t = next[0] - here[0]

    d = abs( next[1] + next[2] - (here[1]+ here[2] ) )

    cond = t >= d and t % 2 == d % 2
    if not cond:
        can = False
        break

    here = next

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

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

for i in range(1,N+1):
  t,x,y = map(int,input().split())
  cond1 = t >= (x + y)
  cond2 = (t % 2 == 0 and (x + y) % 2 == 0) or (t % 2 == 1 and (x + y) % 2 == 1)
  if not cond1 or not cond2:
    print("No")
    break
  
  if i == N:
    print('Yes')

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

f=True
for i in range(int(n)):
    m = plan[i+1][0] - plan[i][0] - abs(plan[i+1][1] - plan[i][1]) - abs(plan[i+1][2] - plan[i][2]) 
    if m < 0 or m%2!=0:
        print("No")
        f=False
        break


if f:
    print("Yes")

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

for i in range(0, N):
  dist = (abs(X[i] - X[i+1]) + abs(Y[i] - Y[i+1]))
  if T[i+1] - T[i] >= dist and (T[i+1] - T[i] - dist)%2==0:
    continue
  else:
    print('No')
    break
else:
  print('Yes')

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

ts, xs, ys = [], [], []
for _ in range(N):
    t, x, y = map(int, input().split())
    xs.append(x)
    ys.append(y)
    ts.append(t)

dt = ts[0]
dist = abs(xs[0]) + abs(ys[0])

if dist > dt:
    print("No")
    exit()
if (dt % 2) != (dist % 2):
    print("No")
    exit()

for t in range(N-1):
    dt = ts[t+1] - ts[t]
    dist = abs(xs[t+1]-xs[t]) + abs(ys[t+1]-ys[t])

    if dist > dt:
        print("No")
        exit()

    if (dt % 2) != (dist % 2):
        print("No")
        exit()

print("Yes")

Solution (Python):

def travelable(t, x, y):
    min_step = x + y
    if t < min_step:
        return False
    return (t - min_step) % 2 == 0

ans = None
N = int(input())
for _ in range(N):
    t_x_y = list(map(int, input().split()))
    if not travelable(t_x_y[0], t_x_y[1], t_x_y[2]):
        ans = "No"
        break
if ans is None:
    ans = "Yes"
print(ans)

Solution (Python):
def solve(T_X_Y):
    curr_t = 0
    curr_x = 0
    curr_y = 0
    for t_x_y in T_X_Y:
        t = t_x_y[0]
        x = t_x_y[1]
        y = t_x_y[2]
        if not travelable(curr_t, curr_x, curr_y, t, x, y):
            return "No"
    return "Yes"


def travelable(curr_t, curr_x, curr_y, t, x, y):
    dist_x = abs(x - curr_x)
    dist_y = abs(y - curr_y)
    min_step = dist_x + dist_y
    if t - curr_t < min_step:
        return False
    return (t - curr_t - min_step) % 2 == 0


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

print(solve(T_X_Y))

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

now_t , now_x , now_y = 0, 0, 0
flag = 1
for _ in range(n):
    next_t , next_x, next_y = map(int,input().split())
    diff_t = next_t - now_t
    diff_x = next_x - now_x
    diff_y = next_y - now_y
    diff = diff_t - (diff_x+diff_y)
    if diff >= 0:
        if diff%2 == 0:
            pass
        else:
            flag= 0
    else:
        flag = 0
    
    now_t , now_x , now_y = next_t , next_x, next_y

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

Solution (Python):
N = int(input())
T = []
X = []
Y = []

for i in range(N):
  t,x,y = map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
  
judge = 1 
nx,ny = 0,0
for i in range(N):
  if(i == 0):
    t = T[i]
  else:
    t = T[i] - T[i-1]
    
  distance = abs(X[i]-nx) + abs(Y[i]-ny)
  time = 1*distance
  if(t < time):
    judge = 0
    break
  if((t - time)%2 != 0): 
    judge = 0
    break
  nx,ny = X[i],Y[i]
  
if(judge == 1):
  print('Yes')
else:
  print('No')

Solution (Python):


"""
Created on 2019/3/21
Solved on 2019/3/
@author: shinjisu
"""






def getInt(): return int(input())

def getIntList(): return [int(x) for x in input().split()]


def zeros(n): return [0]*n


def getIntLines(n): return [int(input()) for i in range(n)]
"""
def getIntLines(n):
    data = zeros(n)
    for i in range(n):
        data[i] = getInt()
    return data
"""

def zeros2(n, m): return [zeros(m) for i in range(n)] 

def getIntMat(n, m):  
    
    mat = zeros2(n, m)
    for i in range(n):
        mat[i] = getIntList()
    return mat

ALPHABET = [chr(i+ord('a')) for i in range(26)]
DIGIT = [chr(i+ord('0')) for i in range(10)]
N1097 = 10**9 + 7
INF = 10**18

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                print(cmt, ':  ', end='')
            print(x)
        return x


def prob():
    d = Debug()
    d.off()
    N = getInt()
    d.dmp(N)
    prevT, prevX, prevY = 0, 0, 0
    for i in range(N):
        T, X, Y = getIntList()
        d.dmp((T, X, Y), 'T, X, Y')
        dt, dx, dy = T-prevT, abs(X-prevX), abs(Y-prevY)
        d.dmp((dt, dx, dy), 'dt, dx, dy')
        if dt < dx+dy:
            return 'No'
        if (dt-dx-dy) % 2 == 1:
            return 'No'
        prevT, prevX, prevY = T, X, Y
    return 'Yes'


ans = prob()
if ans is None:
    pass
elif type(ans) == tuple and ans[0] == 1:  
    for elm in ans[1]:
        print(elm)
else:
    print(ans)

Solution (Python):
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]
ct = 0
p = [0, 0]
failed = False
for i in range(N):
    t, x, y = txy[i]
    dx, dy = abs(p[0]-x), abs(p[1]-y)
    dt = t - ct
    if dt < dx+dy:
        failed = True
        break
    elif dt % 2 and (dx+dy) % 2 == 0:
        failed = True
        break
    elif dt % 2 == 0 and (dx+dy) % 2:
        failed = True
        break
    ct = t
    p = [x, y]

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

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

point_a, point_b = 0, 0
for i in range(N):
    if TXY[i+1][0] - TXY[i][0] < abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2]):
        point_a += 1

for i in range(N):
    if point_a == 0 and ((TXY[i+1][0] - TXY[i][0]) % 2 != (abs(TXY[i+1][1] - TXY[i][1]) + abs(TXY[i+1][2] - TXY[i][2])) %2) :
        point_b += 1

if point_a == 0 and point_b == 0:
    print('Yes')
else:
    print('No')

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

Solution (Python):
import sys
N = int(input())
t, x, y = [], [], []
p_x, p_y = 0, 0
for i in range(N):
    t_t, x_t, y_t = map(int, input().split())
    t.append(t_t)
    x.append(x_t)
    y.append(y_t)
for i in range(N):
    if int(t[i]) < int(x[i]) + int(y[i]) or t[i] % 2 != (x[i] + y[i]) % 2:
        print("No")
        sys.exit()
print("Yes")

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

Solution (Python):
def judge(t,x,y,t0,x0,y0):
  minT=abs(x-x0)+abs(y-y0)
  return (t-t0-minT)>=0 and (t-t0-minT)%2==0
n=int(input())
lst=[tuple(int(i) for i in input().split()) for i in range(n)]
t0=0;x0=0;y0=0
num=0;bool=False
while num<=n-1:
  t,x,y=lst[num]
  if judge(t,x,y,t0,x0,y0):
    t0=t;x0=x;y0=y
    num+=1
    bool=True
  else:
    bool=False
    break
if bool:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
t0 = 0
x0 = 0
y0 = 0
for i in range(0, N):
    t1, x1, y1 = map(int, input().split())
    id = (t1-t0)-abs(x1-x0)-abs(y1-y0)
    if id<0 or id%2==1:
        print("No")
        break
    elif i==N-1:
        print("Yes")
    t0 = t1
    x0 = x1
    y0 = y1

Solution (Python):
def judge(t,x,y,t0,x0,y0):
  minT=abs(x-x0)+abs(y-y0)
  if (t-t0-minT)>=0 and (t-t0-minT)%2==0:
    return True
  else:
    return False
n=int(input())
lst=[tuple(int(i) for i in input().split()) for i in range(n)]
t0=0;x0=0;y0=0
for i in range(n):
  t,x,y=lst[i]
  if judge(t,x,y,t0,x0,y0):
    t0=t;x0=x;y0=y
    ans=True
  else:
    ans=False
    break
if ans:
  print('Yes')
else:
  print('No')

Solution (Python):
n = int(input())
tn,xn,yn = 0,0,0
for _ in range(n):
  to,xo,yo = tn,xn,yn
  tn,xn,yn = map(int,input().split())
  if tn-to >= abs(xn-xo)+abs(yn-yo) and (tn-to)%2 == (abs(xn-xo)+abs(yn-yo))%2:
    continue
  else:
    print("No")
    break
else:
  print("Yes")

Solution (Python):
from sys import stdin

input = stdin.readline
lines = stdin.readlines

N = int(input())

txy = [[int(i) for i in line.split()] for line in lines()]


def main():
    pt = 0
    px = 0
    py = 0

    flg = False

    for t, x, y in txy:
        dt = t - pt - abs(x - px) - abs(y - py)
        
        if dt < 0 or dt % 2 == 1:
            break

        pt = t
        px = x
        py = y
    else:
        
        flg = True

    print("Yes" if flg else "No")
    return


main()

Solution (Python):
from sys import stdin

input = stdin.readline
lines = stdin.readlines

N = int(input())

txy = ((map(int, line.split())) for line in lines())


def main():
    pt = 0
    px = 0
    py = 0

    flg = False

    for t, x, y in txy:
        dt = t - pt - abs(x - px) - abs(y - py)
        
        if dt < 0 or dt % 2 == 1:
            break

        pt = t
        px = x
        py = y
    else:
        
        flg = True

    print("Yes" if flg else "No")
    return


main()

Solution (Python):
from sys import stdin

input = stdin.readline

N = int(input())

txy = [[int(j) for j in input().split()] for i in range(N)]


def main():
    pt = 0
    px = 0
    py = 0

    flg = False

    for t, x, y in txy:
        dt = t - pt - abs(x - px) - abs(y - py)
        
        if dt < 0 or dt % 2 == 1:
            break

        pt = t
        px = x
        py = y
    else:
        
        flg = True

    print("Yes" if flg else "No")
    return


main()

Solution (Python):
from sys import stdin

input = stdin.readline

N = int(input())

txy = [[int(j) for j in input().split()] for i in range(N)]


def main():
    pt = 0
    px = 0
    py = 0

    flg = False

    for t, x, y in txy:
        d = abs(x - px) + abs(y - py)
        dt = t - pt
        
        
        if d <= dt and d % 2 == dt % 2:
            pt = t
            px = x
            py = y
        
        
        else:
            break
    else:
        
        flg = True

    print("Yes" if flg else "No")
    return


main()

Solution (Python):
from sys import stdin

input = stdin.readline

N = int(input())

txy = [[int(j) for j in input().split()] for i in range(N)]


def main():
    pt = 0
    px = 0
    py = 0

    flg = False

    for t, x, y in txy:
        d = abs(x - px) + abs(y - py)
        dt = t - pt
        
        if d <= dt:
            
            if d % 2 != dt % 2:
                break
            else:
                pt = t
                px = x
                py = y
        
        else:
            break
    else:
        
        flg = True

    print("Yes" if flg else "No")
    return


main()

Solution (Python):
from sys import stdin

input = stdin.readline

N = int(input())

txy = [[int(j) for j in input().split()] for i in range(N)]


def main():
    pt = 0
    px = 0
    py = 0

    flg = False

    for t, x, y in txy:
        
        if abs(x - px) + abs(y - py) <= t - pt:
            
            if (abs(x - px) + abs(y - py)) % 2 != (t - pt) % 2:
                break
            else:
                pt = t
                px = x
                py = y
        
        else:
            break
    else:
        
        flg = True

    print("Yes" if flg else "No")
    return


main()

Solution (Python):
def check_rote(a, b, t, x, y):
    cost_min = abs(a - x) + abs(b - y)
    if cost_min <= t and (t - cost_min) % 2 == 0:
        return True
    else:
        return False

n = int(input())
rotes = []

for i in range(n):
    rotes.append(tuple((int(x) for x in input().split())))

copy_t = 0
copy_a = 0
copy_b = 0

for i in rotes:
    t, a, b = i
    if not check_rote(a, b, t - copy_t, copy_a, copy_b):
        print("No")
        break
    copy_t = t
    copy_a = a
    copy_b = b
else:
    print("Yes")

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

Solution (Python):
def traveling(N: int, plan: list)->bool:
    ct, cx, cy = 0, 0, 0
    for nt, nx, ny in plan:
        if nt-ct < abs(nx-cx) + abs(ny-cy):
            return False
        if (nt-ct) % 2 != (abs(nx-cx) + abs(ny-cy)) % 2:
            return False
    return True


if __name__ == "__main__":
    N = int(input())
    plan = [tuple(int(s) for s in input().split()) for _ in range(N)]
    yes = traveling(N, plan)
    print('Yes' if yes else 'No')

Solution (Python):
N = int(input())
l = [[int(x) for x in input().split()] for _ in range(N)]
l.insert(0, [0, 0, 0])
judge = True
 
for i in range(N):
    if (l[i+1][0]-l[i][0]) < ((l[i+1][1]-l[i][1])+(l[i+1][2]-l[i][2])):
        judge = False
        break
    
    if (l[i+1][0]-l[i][0]) % 2 != ((l[i+1][1]-l[i][1])+(l[i+1][2]-l[i][2])) % 2:
        judge = False
        break
    
if judge == True:
    print("Yes")
else:
    print("No")

Solution (Python):
answer = "Yes"
N = int(input())
points = [[int(i) for i in input().split()] for i in range(N)]

for t, x, y in points:
    mdist = abs(x) + abs(y)
    if (mdist - t)%2 != 0 or t < mdist:
        answer = "No"
        break

print(answer)

Solution (Python):
last = [0,0,0]
N = int(input())
flag = True
for i in range(N):
    now = list(map(int, input().split()))
    judge = (now[0]-last[0]) - (abs(now[1]-last[1])+abs(now[2]-last[2]))
    if not (judge >= 0 and judge % 2 == 0):
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')

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

ct = 0
cx = 0
cy = 0

result = "Yes"
for e_ in e:
    t = e_[0]
    x = e_[1]
    y = e_[2]

    dt = t - ct
    dxy = abs(cx - x) + abs(cy - y)
    if dxy > dt or (dt - dxy)%2 == 1:
        result = "No"
        break

    ct = t
    cx = x
    cy = y

print(result)

Solution (Python):
n=int(input())
now=(0,0,0)
result=True
for i in range(n):
    t,a,b=[int(i) for i in input().split()]
    time=t-now[0]
    x=abs(a-now[1])
    y=abs(b-now[2])
    if (x+y-time)%2!=0 or (x+y)>time:
        result=False
    else:
        now=(t,a,b)
if result:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys
sys.setrecursionlimit(10**6)
def input(): return sys.stdin.readline()
def read(): return int(input())
def reads(): return [int(i) for i in input().split()]

def f(dt, dx, dy):
	if dt == dx + dy:
		return True
	elif dt < dx + dy:
		return False
	else:
		return f(dt-2, dx, dy)

N = read()
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] = reads()

ans = True
for i in range(N):
	dt = t[i+1] - t[i]
	dx = abs(x[i+1] - x[i])
	dy = abs(y[i+1] - y[i])
	ans = ans and f(dt, dx, dy)

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

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

for i in range(N):
    t2,x2,y2 = map(int,input().split())
    if abs(x+y-x2-y2) > t2-t:
        break
    elif abs(x+y-x2-y2) == t2-t:
        t,x,y=t2,x2,y2
    elif abs(x+y-x2-y2) < t2-t:
        if abs(x+y-x2-y2)%2 != (t2-t)%2:
            break
        else:
            t,x,y=t2,x2,y2
    if i+1 == N:
        flag = 1
        break
            
if flag == 1:
    print('Yes')
else:
    print('No')

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

t, x, y = 0, 0, 0
flg = True
for _ in range(n):
    tn, xn, yn = map(int, input().split())
    dt, dx, dy = abs(tn-t), abs(xn-x), abs(yn-y)

    if not (dx + dy <= dt and (dx + dy) % 2 == dt % 2):
        flg = False

    t, x, y = tn, xn, yn

print("Yes") if flg else print("No")

Solution (Python):
n = int(input())
txy = [[0,0,0]]
for i in range(n):
    txy.append([int(j) for j in input().split()])
for i in range(1,n+1):
    t = txy[i][0]-txy[i-1][0]
    x = abs(txy[i][1]-txy[i-1][1])
    y = abs(txy[i][2]-txy[i-1][2])
    if t%2 == (x+y)%2 and t >= x+y:
        continue
    else:
        print('No')
        exit()
print('Yes')

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

pre_t=0
pre_x=0
pre_y=0
for i in range(n):
    t, x, y=map(int, input().split())
    delta_t=t-pre_t
    delta_x=abs(x-pre_x)
    delta_y=abs(y-pre_y)
    if delta_t<delta_x+delta_y:
        print("No")
        exit()
    elif (delta_x+delta_y+delta_t)%2==1:
        print("No")
        exit()
    pre_t=t
    pre_x=x
    pre_y=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):
    a,b,c = map(int,input().split())
    if abs(b)+abs(c)>a or (a+b+c)%2==1:
        print("No")
        exit()
print("Yes")

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

ans = True

for i in range(len(l)):
    time = l[i][0]
    x = l[i][1]
    y = l[i][2]
    dist = x + y
    if not ((dist <= time) & ((time - dist) % 2 == 0)):
        ans = False
print("Yes") if ans else print("No")

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

Solution (Python):

import copy
n = int(input())
preX = [0,0,0]
ans = True
for i in range(n):
    curX = list(map(int, input().split()))
    dt = curX[0] - preX[0]
    dx = abs(curX[1] - preX[1])
    dy = abs(curX[2] - preX[2])
    if dt < dx + dy  or (dt % 2) != ((dx + dy) % 2):
        ans = False
    preX = copy.copy(curX)
if ans:
    print('Yes')
else:
    print('No')

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

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    ans = 'Yes'
    t0, x0, y0 = 0, 0, 0
    for _ in range(N):
        t, x, y = map(int, input().split())
        move = abs(x - x0) + abs(y - y0)
        time = t - t0
        if time >= move and (time - move) % 2 == 0:
            t0, x0, y0 = t, x, y
        else:
            ans = 'No'
            break
    print(ans)


if __name__ == '__main__':
    main()

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

Solution (Python):
def main():
    N = int(input())
    pt, px, py = 0, 0, 0
    for _ in range(N):
        t, x, y = map(int, input().split())
        tmp = t - pt - (abs(x-px) + abs(y-py))
        if tmp < 0 or tmp % 2 == 1:
            print("No")
            return
        pt, px, py = t, x, y
    print("Yes")


if __name__ == "__main__":
    main()

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

for i in range(1,len(t)):
    dt = abs(t[i][0]-t[i-1][0])
    dx = abs(t[i][1]-t[i-1][1])
    dy = abs(t[i][2]-t[i-1][2])
    if not dx+dy<=dt or not (dx+dy)%2==dt%2:
        print('No')
        exit()
print('Yes')

Solution (Python):
N = int(input())
L = [list(map(int, input().split())) for _ in range(N)]
t1 = x1 = y1 = 0
for t2, x2, y2 in L:
    t = t2 - t1
    x = abs(x2 - x1)
    y = abs(y2 - y1)
    if x + y > t:
        print("No")
        break
    if (t - (x + y)) % 2 != 0:
        print("No")
        break
    t1 = t2
    x1 = x2
    y1 = y2
else:
    print("Yes")

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

h,j,k = 0,0,0

for i in range(n):
    t = abs(h - a[i][0])
    dx = abs(j - a[i][1])
    dy = abs(k - a[i][2])
    if t >= dx + dy:
        if t % 2 != (dx + dy) % 2:
            print("No")
            sys.exit()
    else:
        print("No")
        sys.exit()
    h = a[i][0]
    j = a[i][1]
    k = a[i][2]
print("Yes")

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
d = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]

for i in range(n):
    if (d[i][1] + d[i][2]) > d[i][0] or (d[i][1] + d[i][2] + d[i][0]) % 2 == 1:
        print("No")
        exit()

print("Yes")

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

Solution (Python):
n = int(input())
ans = "Yes"
for _ 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)

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

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

Solution (Python):
def traveling(n, m):
    t = range(1, n+1)
    for i in t:
        tdif = m[i][0] - m[i-1][0]
        xydif = abs(m[i][1] - m[i-1][1]) + abs(m[i][2] - m[i-1][2])
        if tdif < xydif:
            return 'No'
        else:
            if tdif%2 != xydif%2:
                return 'No'
    return 'Yes'
N = int(input())
deer = [[0,0,0]] + [list(map(int, input().split())) for i in range(N)]
print(traveling(N, deer))

Solution (Python):
import sys
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
data = [[int(i) for i in l] for l in data]
data.insert(0, [0, 0, 0])
for i, l in enumerate(data):
    if i == 0:
        continue
    distance = abs(l[1]-data[i-1][1])+abs(l[2]-data[i-1][2])
    step_diff = l[0]-data[i-1][0]
    if step_diff%2 == distance%2 and distance <= step_diff:
        continue
    else:
        print('No')
        sys.exit()
print('Yes')