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())
txy=[]
txy.append([0,0,0])
for _ in range(n):
    txy.append(list(map(int,input().split())))
ans = 'Yes'
for i in range(1,len(txy)):
    t_=txy[i][0]-txy[i-1][0]
    d_=abs(txy[i][1]-txy[i-1][1])+abs(txy[i][2]-txy[i-1][2])
    if t_ >= d_ and (t_ - d_) % 2 == 0:
        pass
    else:
        ans='No'
        break
print(ans)

Solution (Python):
N = int(input())
point = [0, 0]
t_list = []
ans = "Yes"
t = list(map(int, input().split()))
dis = abs(point[0]-t[1])+abs(point[1]-t[2])
t_list.append(t)
if t[0] < dis or t[0]%2!=dis%2:
    ans = "No"
point = [t[1], t[2]]
for i in range(N-1):
    t = list(map(int, input().split()))
    dis = abs(point[0]-t[1])+abs(point[1]-t[2])
    if t[0]-t_list[-1][0] < dis or (t[0]-t_list[-1][0])%2!=dis%2:
        ans = "No"
    point = [t[1], t[2]]
    t_list.append(t)
print(ans)

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())
s = [[0, 0, 0]]
for i in range(n):
    s.append(list(input().split()))

for i in range(1, len(s)):
    dt = int(s[i][0])-int(s[i-1][0])
    dx = abs(int(s[i][1])-int(s[i-1][1]))
    dy = abs(int(s[i][2])-int(s[i-1][2]))

    if dx+dy > dt:
        print("No")
        exit()
    elif (dx+dy) % 2 != dt % 2:
        print("No")
        exit()

print("Yes")

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

ans = True
cx = 0
cy = 0
ct = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    d = abs(cx - x) + abs(cy - y)
    dt = t - (ct + d)
    if dt % 2 == 0 and dt >= 0:
        cx = x
        cy = y
        ct = t
    else:
        ans = False
        break

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

Solution (Python):
import sys
n = int(input())
li = [[0,0,0]]
for _ in range(n):
    li.append(list(map(int,input().split())))

for i,l in enumerate(li):
    if i == 0:
        continue
    bef = li[i-1]
    diff = l[1]+l[2]-bef[1]-bef[2]
    if diff <= l[0]-bef[0] and  (diff - (l[0]-bef[0]))%2 == 0:
        continue
    else:
        print('No')
        sys.exit()
else:
    print('Yes')

Solution (Python):
import sys
import numpy as np

I = np.array(sys.stdin.read().split(), dtype=np.int64)
t, x, y = np.concatenate((np.array([[0, 0, 0]]), I[1:].reshape(-1, 3)), axis=0).T

def main():
    dt = t[1:] - t[:-1]
    dd = np.absolute(x[1:] - x[:-1]) + np.absolute(y[1:] - y[:-1])
    ans = 'Yes' if np.all((dt >= dd) & (dt & 1 == dd & 1)) else 'No'
    print(ans) 

if __name__ ==  '__main__':
    main()

Solution (Python):
import sys
import numpy as np

n = int(sys.stdin.readline().rstrip())
txy = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(n, 3)
t, x, y = np.concatenate((np.array([[0, 0, 0]]), txy), axis=0).T

def main():
    dt = t[1:] - t[:-1]
    dd = np.absolute(x[1:] - x[:-1]) + np.absolute(y[1:] - y[:-1])
    ans = 'Yes' if np.all((dt >= dd) & (dt & 1 == dd & 1)) else 'No'
    print(ans) 

if __name__ ==  '__main__':
    main()

Solution (Python):

def can_travel(N):

	last_t, last_x, last_y = 0, 0, 0
	
	for i in range(N):
		t, x, y = map(int, input().split())
		distnace = abs(x - last_x) + abs(y - last_y)
		time = t - last_t
		
		if distnace > time:
			return False
		elif (time - distnace) % 2 == 1:
			return False
	
	return  True
		

N = int(input())

if can_travel(N):
	print('Yes')
else:
	print('No')

Solution (Python):
import sys
import itertools
sys.setrecursionlimit(10000)
def resolve():
    N = int(input())
    TXY = [list(map(int, input().split(" "))) for i in range(N)]
    current = [0, 0, 0]
    for txy in TXY:
        tdiff = txy[0] - current[0]
        xdiff = abs(txy[1] - current[1])
        ydiff = abs(txy[2] - current[2])
        if tdiff < (xdiff + ydiff) or (tdiff % 2) != ((xdiff+ydiff) % 2):
            print("No")
            return
        current[0], current[1], current[2] = txy[0], txy[1], txy[2]
    print("Yes")
    


if '__main__' == __name__:
    resolve()

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

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

for _ in range(N):
    a, b, c = list(map(int, input().split()))
    t.append(a)
    x.append(b)
    y.append(c)



for index in range(1, N + 1):
    distance = (x[index] - x[index - 1]) + (y[index] - y[index - 1])
    duration = t[index] - t[index - 1]
    if duration < distance or duration % 2 != distance % 2:
        print("No")
        break
else:
    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) <= 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())
txy = [list(map(int,input().split()))for _ in range(n)]
ok = True
time = 0
nx = 0
ny = 0
for i in range(n):
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    dist = abs(x-nx)+abs(y-ny)
    if not(t - time >= dist and (t- time )%2 == dist%2):
        ok = False
        break
    time=t
    nx = x
    ny = y
if ok: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())
flg = 1
for i in range(N):
    if i == 0:
        deltax = x[i]
        deltay = y[i]
        deltat = t[i]
    else:
        deltax = abs(x[i] - x[i-1])
        deltay = abs(y[i] - y[i-1])
        deltat = t[i] - t[i-1]
    trip_len = deltax + deltay
    if (((deltat - trip_len)%2) != 0) or (deltat < trip_len) :
        flg = 0
if flg == 1:
    print('Yes')
else:
    print('No')

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

for i in range(N):
    timelimit = scedule[i+1][0] - scedule[i][0]
    x_distance = abs(scedule[i+1][1] - scedule[i][1])
    y_distance = abs(scedule[i+1][2] - scedule[i][2])

    if timelimit < (x_distance + y_distance):
        print("No")
        exit()
    if timelimit % (x_distance + y_distance) != 0:
        print("No")
        exit()

print("Yes")

Solution (Python):
n = int(input())
pos = []
for i in range(n):
  b = list(input().split( ))
  pos.append(b)
tp, xp, yp = 0, 0, 0
rflag = True
for p in pos:
  t, x, y = map(int, p)
  tint = t - tp
  xd = x - xp
  yd = y - yp
  tp, xp, yp = t, x, y
  pd = abs(xd) + abs(yd)
  if ((tint >= pd) & ((tint % 2) == (pd % 2))):
    continue
  else:
    rflag = False
    break
  
if rflag == True:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
pos = []
for i in range(n):
  b = list(input().split( ))
  pos.append(b)
tp, xp, yp = 0, 0, 0
rflag = True
for p in pos:
  t = int(p[0])
  x = int(p[1])
  y = int(p[2])
  tint = t - tp
  xd = x - xp
  yd = y - yp
  pd = abs(xd) + abs(yd)
  if ((tint >= pd) & ((tint % 2) == (pd % 2))):
    continue
  else:
    rflag = False
    break
  
if rflag == True:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
t0 = x0 = y0 = 0
for _ in range(n):
  t, x, y = map(int, input().split())
  dt, dx, dy = t - t0, x - x0, y - y0
  dist = abs(dx) + abs(dy)
  if dist > dt or dist % 2 != dt % 2 :
    print('No')
    exit()
  t0, x0, y0 = t, x, y
print('Yes')

Solution (Python):
N = int(input())
a = 0
b = 0
c = 0
for i in range(N):
    t,x,y = [int(x) for x in input().split()]
    kyori = abs(a-x)+abs(b-y)
    if t-c-kyori >= 0 and (t-c-kyori) % 2 == 0:
        a = x
        b = y
        c = t
        continue
    print("No")
    exit()
print("Yes")

Solution (Python):
import sys
def dif(two_lists):
    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]


n = int(input())

txy = [[0, 0, 0]] + [[int(s) for s in line.split()] for line in sys.stdin]
dtxy = list(map(dif, zip(txy, txy[1:])))

for i in range(n):
    dt, dx, dy = dtxy[i]
    if  dx + dy > dt or (dt - dx - dy) % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
def dif(two_lists):
    return [abs(two_lists[1][i] - two_lists[0][i]) for i in range(3)]


n = int(input())

txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(n)]
dtxy = list(map(dif, zip(txy, txy[1:])))

for i in range(n):
    dt, dx, dy = dtxy[i]
    if  dx + dy > dt or (dt - dx - dy) % 2:
        print("No")
        exit()
print("Yes")

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

t_arr = [0]*(n+1)
x_arr = [0]*(n+1)
y_arr = [0]*(n+1)

for i in range(n+1):
    
    if i == 0:continue
    pos = input().split()
    t_arr[i] = int(pos[0])
    x_arr[i] = int(pos[1])
    y_arr[i] = int(pos[2])

is_possible = True

for i in range(n):
    
    t = t_arr[i+1] - t_arr[i];
    
    
    x = abs(x_arr[i] - x_arr[i+1])
    y = abs(y_arr[i] - y_arr[i+1])
    d = x + y
    
    if d <= t and t%2 == d%2:
        continue
    else:
        is_possible = False
        break
    
print("Yes" if is_possible else "No")

Solution (Python):






def readInts():
  return list(map(int,input().split()))
mod = 10**9 + 7
def main():
    n = int(input())
    T = []
    X = []
    Y = []
    for i in range(n):
        t,x,y = readInts()
        T.append(t)
        X.append(x)
        Y.append(y)
    cx,cy,ct = 0,0,0
    for i in range(n):
        dist_place = abs(X[i] - cx) + abs(Y[i] - cy)
        dist_time = abs(T[i] - ct)
        if dist_time >= dist_place and (dist_time - dist_place) % 2 == 0:
            cx = X[i]
            cy = Y[i]
            ct = T[i]

            pass
        else:
            print('No')
            exit()
    print('Yes')



if __name__ == '__main__':
  main()

Solution (Python):
n=int(input())
t0=0
x0=0
y0=0
ok=True
for i in range(n):
  t1,x1,y1=map(int,input().split())
  c=t1-t0-x1+x0-y1+y0
  if c<0 or c%2==1:
    ok=False
    break
print('Yes' if ok else 'No')

Solution (Python):
N = int(input())
now = [0,0]
tnow = 0
ans = 'Yes'
for i in range(N):
    t,x,y = map(int,input().split())
    dis = abs(x-now[0]) + abs(y-now[1])
    if t-tnow >= dis and (t-tnow)%2 == dis%2:
        tnow = t
        now = [x,y]
    else:
        ans = 'No'
        break
print(ans)

Solution (Python):
def distance(point1, point2):
    return abs(point1[0] - point2[0]) + abs(point1[1] - point2[1])
def solve(t1, t2, point1, point2):
    t = abs(t2 - t1)
    d = distance(point1, point2)
    if d==t:
        return True
    elif d<t and t%2==d%2:
        return True
    return False

n = int(input())
t = [0]*(n+1)
xy = [[0,0]]*(n+1)
for i in range(1,n+1):
    t[i], *xy[i] = list(map(int, input().split()))
ans = True
for i in range(1, n+1):
    if not solve(t[i-1], t[i], xy[i-1], xy[i]):
        ans = False

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

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

a = "Yes"

for i in range(N):
    if i == 0:
        dt = t[0]
        dist = abs(x[0]) + abs(y[0])
    else:
        dt = t[i]-t[i-1]
        dist = abs(x[i]-x[i-1]) + abs(y[i]-y[i-1])
    if dist > dt or (dist+dt) % 2 == 1:
        a = "No"
print(a)

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

Solution (Python):
import sys

def main():
    def input():
      return sys.stdin.readline().rstrip()
    
    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(N):
        dt = t[i+1] - t[i]
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
        if dt % 2 != dist % 2 or dt < dist:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()

Solution (Python):
import sys

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

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
t = 0
x = 0
y = 0
for _ in range(N):
    nt, nx, ny = map(int, input().split())
    dt = nt - t
    dx = nx - x
    dy = ny - y
    if dt >= dx + dy and dt % 2 == (dx+dy) % 2:
        continue
    else:
        print('No')
        break
else:
    print('Yes')

Solution (Python):






def main():
    N = int(input())
    t, x, y = [None] * N, [None] * N, [None] * N
    for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())

    for i in range(N):
        if i == 0:
            root = abs(x[i]) + abs(y[i])
            if root > t[i] or (t[i] - root) % 2 > 0:
                return "No"

            continue

        root = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])
        if root > t[i] - t[i-1] or (t[i] - t[i-1] - root) % 2 > 0:
            return "No"

    return "Yes"


print(main())

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

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

t = 0
x = 0
y = 0
for i in range(N):
    
    ido = abs(x-TXY[i][1])+abs(y-TXY[i][2])

    
    if ido > TXY[i][0]-t:
        break

    
    if ido % 2 != (TXY[i][0]-t) % 2:
        break

    t = TXY[i][0]
    x = TXY[i][1]
    y = TXY[i][2]

else:
    print('Yes')
    exit(0)
print('No')

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

t, x, y = [0], [0], [0]

for i in range(n):
    ti, xi, yi, = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
    
is_can = True
for i in range(len(t) - 1):
    dt = t[i + 1] - t[i]
    dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    if dt < dist:
        is_can = False
        break
    if(dt % 2 != dist % 2):
        is_can = False
        break
if is_can:
    print('Yes')
else:
    print('No')

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

flag = True
for t in IN:
    if t[0] < t[1] + t[2]:
        flag = False
        break
    if t[0] % 2:
        if (t[1]+t[2]) % 2 == 0:
            flag = False
            break
    else:
        if (t[1]+t[2]) % 2:
            flag = False
            break

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

Solution (Python):

import sys
try:
    from typing import List
except ImportError:
    pass


YES = "Yes"  
NO = "No"  


def solve(N: int, t: "List[int]", x: "List[int]", y: "List[int]"):
    pti = 0
    pxi = 0
    pyi = 0
    for ti, xi, yi in zip(t, x, y):
        dt = ti - pti
        dx = xi - pxi
        dy = yi - pyi
        if abs(dx) + abs(dy) > dt or (dx + dy + dt) % 2 != 0:
            print(NO)
            return
        pti = ti
        pxi = xi
        pyi = yi
    print(YES)


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())
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())
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):
import sys
import numpy as np

def judge(bef, aft):
    t, a, b = map(int, np.abs(aft-bef))
    if a+b <= t and (a+b)%2 == t%2:
        return True
    return False
    
def main():
    input = sys.stdin.readline
    n = int(input())
    bef = np.array([0, 0, 0])
    flag = True
    for i in range(n):
        aft = np.array([int(x) for x in input().split()])
        if judge(bef, aft):
            continue
        flag = False
    if flag:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    D = [list(map(int, input().split())) for _ in range(N)]
    T = 0
    X = 0
    Y = 0
    for d in D:
        t, x, y = d
        ans = "Yes"
        dxy = abs(X-x) + abs(Y-y)
        dt = t-T
        if dxy > dt or dxy % 2 != dt % 2: 
            
            ans = "No"
            break
    print(ans)

Solution (Python):

n = int(input())

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

for i in range(1, n + 1):
    dis = abs(data[i][1] - data[i - 1][1]) + abs(data[i][2] - data[i- 1][2])
    dif = data[i][0] - data[i - 1][0]
    if (dif % 2 != dis % 2 or dis > dif):
        print("No")
        exit() 

print("Yes")

Solution (Python):
def solve():
    N = int(input())
    t_i, x_i, y_i = 0, 0, 0
    for i in range(N):
        t_j, x_j, y_j = map(int, input().split())
        dt = t_j - t_i
        dxy = x_j - x_i + y_j - y_i
        if (dxy < -dt) | (dxy > dt):
            return "No"
        if ((t_i - t_j) % 2) != (dxy % 2):
            return "No"
        t_i, x_i, y_i = t_j, x_j, y_j
    return "Yes"
print(solve())

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

t = [0] * N
x = [0] * N
y = [0] * N

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

judg = 0    

for i in range(N):
    if x[i]+y[i]<=t[i]:
        if t[i]%2==0 and (x[i]+y[i])%2==0:
            judg += 1
        elif t[i]%2!=0 and (x[i]+y[i])%2!=0:
            judg += 1

if judg == N:
    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)%2 != t%2:
        print("No")
        exit()
print("Yes")

Solution (Python):

import sys

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


if arr[0][0] < arr[0][1] + arr[0][2]:
    print("No")
    exit()

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

print("Yes")

Solution (Python):
import sys

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

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

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

print("Yes")

Solution (Python):
n = int(input())
t_x_y_list = [list(map(int, input().split())) for _ in range(n)]
pt = 0
px = 0
py = 0
for t, x, y in t_x_y_list:
    if t - pt < abs(px - x) + abs(py - y):
        print("No")
        exit()
    if (t - pt) % 2 != (abs(px - x) + abs(py - y)) % 2:
        print("No")
        exit()
    pt = t
    px = x
    py = y
print("Yes")

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

for i in range(N):
    t = abs(S[i][0] - S[i + 1][0])
    d = abs(S[i][1] - S[i + 1][1]) + abs(S[i][2] - S[i + 1][2])
    if t < d:
        print("No")
        exit()
    if t % 2 != d % 2:
        print("No")
        exit()

print("Yes")

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

for i in range(N):
    t = abs(S[i][0] - S[i + 1][0])
    d = abs(S[i][1] - S[i + 1][1]) + abs(S[i][2] - S[i + 1][2])
    if t < d:
        print("No")
        exit()
    if t % 2 != d % 2:
        print("No")
        exit()

print("Yes")

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    txy = [list(map(int, input().split())) for _ in range(n)]

    time = 0
    pos = [0, 0]
    for i in range(n):
        dist = abs(txy[i][1] - pos[0]) + abs(txy[i][2]-pos[1])
        t = txy[i][0] - time
        if dist > t:
            print('No')
            exit()
        elif (t - dist) % 2 == 1:
            print('No')
            exit()
        pos = [txy[i][1], txy[i][2]]
        time = txy[i][0]

    print('Yes')

Solution (Python):
n = int(input())
nt,nx,ny = 0,0,0
 
for i in range(n):
    t,x,y = map(int,input().split())
    if (abs(nx-x)+abs(ny-y)) > t-nt:
        print("No")
        exit()
    else:
        t2 = t-nt-abs(nx-x)
        if abs(ny-y)%2 == 0 and t2%2 == 0:
            nt,nx,ny = t,x,y
        elif abs(ny-y)%2 == 1 and t2%2 == 1:
            nt,nx,ny = t,x,y
        else:
            print("No")
            exit()
 
print("Yes")

Solution (Python):
def solve():
    N = int(input())
    t_i, x_i, y_i = 0, 0, 0
    for i in range(N):
        t_j, x_j, y_j = map(int, input().split())
        dt = t_j - t_i
        dxy = x_j - x_i + y_j - y_i
        if (dxy < -dt) | (dxy > dt):
            return "No"
        if ((t_i - t_j) % 2) != (dxy % 2):
            return "No"
        t_i, x_i, y_i = t_j, x_j, y_j
    return "Yes"


if __name__ == "__main__":
    print(solve())

Solution (Python):
n = int(input())
list_A = [ list(map(int,input().split(" "))) for i in range(n)]
list_A.insert(0, [0, 0, 0])
ans = "Yes"
for i in range(1, n+1):
    l = list_A[i]
    k = list_A[i-1]
    distance = abs(l[1]-k[1]) + abs(l[2]-k[2])
    if distance > l[0] - k[0]:
        ans = "No"
        break
    else:
        if (distance - (l[0]-k[0])) % 2 == 1:
            ans = "No"

print(ans)

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)


ans = True
move=(x[0]+y[0])
time = t[0] - 0
if move > time:ans = False
if (time - move)%2 ==1:ans = False

for i in range(1,n):
    move =x[i] + y[i] - x[i-1] - y[i-1]
    time =t[i] - t[i-1]
    if move > time:ans = False
    if (time - move)%2 ==1:ans = False

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

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

for i in range(N):
  a,b,c = map(int, input().split())
  tmp = abs(a-t) - abs(b-x) - abs(c-y) 
  if tmp >= 0 and tmp % 2 == 0:
    t,x,y = a,b,c
  else:
    print('No')
    exit()
print('Yes')

Solution (Python):
n=int(input())
nt,nx,ny=0,0,0

for i in range(n):
    t,x,y=map(int,input().split())
    if (abs(nx-x)+abs(ny-y)) > t-nt:
        print("No")
        exit()
    else:
        t2=t-nt-abs(nx-x)
        if abs(ny-y)%2==0 and t2%2==0:
            nt,nx,ny=t,x,y
        elif abs(ny-y)%2==1 and t2%2==1:
            nt,nx,ny=t,x,y
        else:
            print("No")
            exit()

print("Yes")

Solution (Python):
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
T, X, Y = 0, 0, 0
result = "Yes"
for t, x, y in txy:
    d =  (x-X) + (y-Y)
    if t<d or (t-d)%2==1:
        result = "No"
        break
print(result)

Solution (Python):
n = int(input())
txy = [list(map(int,input().split())) for _ in range(n)]
txy.insert(0,[0,0,0])
for i in range(n):
  t = txy[i+1][0] - txy[i][0]
  x = abs(txy[i+1][1] - txy[i][1])
  y = abs(txy[i+1][2] - txy[i][2])
  if t < x+y:
    print('No')
    exit()
  elif t == x+y:
    pass
  else:
    if ((t%2 == 0) and ((x+y)%2 == 0)) or ((t%2 != 0)and((x+y)%2 != 0)):
      pass
    else:
      print('No')
      exit()
print('Yes')

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

fault=0
for el in txy:
    t, x, y = el
    
    if t % 2 == 0 and (x+y) % 2 == 0 or\
        t % 2 == 1 and (x+y) % 2 == 1:
        pass
    else:
        fault = 1
if fault == 1:

    print('No')
else:
    txy.insert(0, (0,0,0))
    for i in range(N):
        time = txy[i+1][0] - txy[i][0]
        distance = abs(txy[i+1][1]- txy[i][1]) +\
            abs(txy[i+1][2] - txy[i][2])
        
        if time >= distance:
            pass
        else:
            fault=1
    if fault == 1:
        print('No')
    else:
        print('Yes')

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

flagCount = 0

for i in range(n):
    if t[i] < x[i] + y[i]:
        flagCount += 1
    if t[i]%2 != (x[i]+y[i])%2:
        flagCount += 1

if flagCount == 0:
    print('Yes')
else :
    print('No')

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

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

for i in range(N):
    if i == 0:
        dt = txy[0][0]
        dxy = txy[0][1] + txy[0][2]
    else:
        dt = txy[i][0] - txy[i-1][0]
        dxy = abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2])
    if dxy > dt:
        print("No")
        break
    else:
        if (dxy - dt) % 2 == 1:
            print("No")
            break
        else:
            continue
else:
    print("Yes")

Solution (Python):
n = int(input())
flg = True
x,y = 0,0
for i in range(n):
  a,b,c = map(int,input().split())
  if (a < abs(b) + abs(c) - (x+y)) or (a % 2 != (abs(b) + abs(c)) % 2):
    flg = False
    break
  else:
    x = b
    y = c

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

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

t, x, y = 0, 0, 0

flag = True
for ti, xi, yi in d:
  if ti >= xi + yi:
    if (ti - t) % 2 != (abs(xi - x) + abs(yi - y)) % 2:
    	flag = False
    	break
    t = ti
    x = xi
    y = yi
    
  else:
    flag = False
    break
    
print("Yes" if flag else "No")

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

t = 0
x = 0
y = 0
flag = True

for i in range(N):
    t_next = P[i][0] - t
    d_next = abs(P[i][1] - x) + abs(P[i][2] - y)
    
    
    if (t_next - d_next)%2 == 1 or t_next < d_next:
        flag = False
        break
    t = P[i][0]
    x = P[i][1]
    y = P[i][2]

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

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

for i in range(n):
    T,X,Y = lst[i+1][0]-lst[i][0],abs(lst[i][1]-lst[i+1][1]),abs(lst[i][2]-lst[i+1][2])
    if X+Y>T or (X+Y-T)%2!=0:
        print("No")
        exit()

print("Yes")

Solution (Python):
t=0
x=0
y=0
n=int(input())
for i in range(n):
    ti,xi,yi=map(int,input().split())
    t=ti-t
    x=xi-x
    y=yi-y
    if t%2!=(abs(x+y))%2:
        print('No')
        exit()
    elif t<abs(x)+abs(y):
        print('No')
        exit()
print('Yes')

Solution (Python):
N=int(input())
tl=[]
xl=[]
yl=[]
al=[]
bl=[]
cl=[]
dl=[]

for i in range(N):
 t,x,y=map(int,input().split())
 tl.append(t)
 xl.append(x)
 yl.append(y)
 al.append((x+y)%2)
 bl.append(t%2)

for i in range(N):
 c=abs((xl[i]+yl[i])-(xl[i-1]+yl[i-1]))
 d=abs(tl[i]-tl[i-1])
 cl.append(c)
 dl.append(d)

count=0
for i in range(N):
 if al[i]==bl[i] and (xl[i]+yl[i])<=tl[i] and cl[i]<=dl[i]:
  count+=1
if count==N:
  print("Yes")
else :
  print("No")

Solution (Python):
n = int(input())
maps = []
maps.append([0,0,0])
for i in range(n):
  t,x,y = map(int,input().split())
  maps.append([t,x,y])
count = 0
for j in range(n):
  tgap = maps[j+1][0] - maps[j][0]
  total = maps[j+1][1] - maps[j][1] + maps[j+1][2] - maps[j][2]
  gap = tgap - total
  if gap >= 0 and gap % 2 == 0:
    count += 1
if count == n:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
sx, sy = 0, 0
t = 0
check = True
for i in range(N):
  nt, nx, ny = list(map(int, input().split()))
  if abs(nx-sx) + abs(ny - sy) <= (nt -t) and (abs(nx-sx) + abs(ny - sy)) % 2 == (nt -t) % 2:
    sx, sy, t = nx, ny, nt
  else:
    check = False
    break
if check:
  print("Yes")
else:
  print("No")

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

n = INT()
pret = 0
prex = 0
prey = 0
for _ in range(n):
    t, x, y = MAP()
    dis = abs(x - prex) + abs(y - prey)
    delta = t - pret
    if delta - dis >= 0 and (delta - dis) % 2 == 0:
        pret = t
        prex = x
        prey = y
        continue
    else:
        print('No')
        exit()
print('Yes')

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