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 = []
for i in range(n):
    txy.append([int(i) for i in input().split()])

ans = "Yes"
bx = 0
by = 0
bt = 0
for i in range(n):
    tmp = ((txy[i][1] - bx) + (txy[i][2] - by))
    if tmp % 2 != (txy[i][0] - bt) % 2 or tmp > (txy[i][0] - bt):
        ans = "No"
    bx = txy[i][1]
    by = txy[i][2]
    bt = txy[i][0]
print(ans)

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

for i,t in enumerate(txy[1::]):
    dist=abs(t[1]-txy[i][1])+abs(t[2]-txy[i][2])
    time=t[0]-txy[i][0]
    if dist<=time and (time-dist)%2==0:
        pass
    else:
        answer="No"
        break
print(answer)

Solution (Python):
def main():
    n = int(input())
    txy = []
    for _ in range(n):
        txy.append(list(map(int,input().split())))
    
    x = 0
    y = 0
    pt = 0
    for t in txy:
        d = abs(t[1]-x) + abs(t[2]-y)
        dt = t[0]-pt
        if d > dt or (d % 2) != (dt % 2):
            print("No") 
            exit(0)
        x = t[1]
        y = t[2]
        pt = t[0]
    
    print("Yes")

if __name__ == '__main__':
    main()

Solution (Python):
from sys import exit
N = int(input())
posx = 0
posy = 0
now = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    time_elapsed = t - now
    now = t
    if abs(posx - x) + abs(posy - y) <= time_elapsed and time_elapsed % 2 == (abs(posx - x) + abs(posy - y)) % 2:
        posx = x
        posy = y
    else:
        print("No")
        exit()
print("Yes")

Solution (Python):
N = int(input())
now = (0,0,0)
for i in range(N):
    t,x,y = map(int,input().split())
    diff_dist = abs(x-now[1]) + abs(y-now[2])
    diff_time = t - now[0]
    if diff_time % diff_dist == 0 and diff_time >= diff_dist:
        pass
    else:
        print("No")
        exit()
    now = (t,x,y)
print("Yes")

Solution (Python):
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]
T = X = Y = 0
ans = "Yes"
for t, x, y in txy:
  a = (t-T) - (abs(X-x) + abs(Y-y))
  if a % 2 == 0 and abs(X-x) + abs(Y-y) <= t - T:
    T, X, Y = t, x, y
  else:
    ans = "No"
    break
print(ans)

Solution (Python):
N = int(input())
TXY = [tuple(map(int,input().split())) for i in range(N)]
ct = cx = cy = 0
for t,x,y in TXY:
    d = abs(cx-x) + abs(cy-y)
    if d > t-ct or d%2 != (t-ct)%2:
        print('No')
        exit()
    ct,cx,cy = t,x,y
print('Yes')

Solution (Python):
from collections import deque
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    t=x=y=0
    for _ in range(n):
        nt,nx,ny=MI()
        d=abs(x-nx)+abs(y-ny)
        dt=nt-t
        if d&1!=dt&1 or d>dt:
            print("No")
            exit()
        t,x,y=nt,nx,ny
    print("Yes")

main()

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

flg = False
for i in range(n):
    t, x, y = txy[i]
    if x + y > t:
        flg = False
        break

    if (x + y) % 2 == 0:
        if t % 2 == 0:
            flg = True
        else:
            flg = False
            break
    else:
        if t % 2 != 0:
            flg = True
        else:
            flg = False
            break
if flg:
    print("Yes")
else:
    print("No")

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

Solution (Python):

nt, nx, ny = [0]*3
cant = False
for i in range(int(input())):
	t, x, y = map(int, input().split())
	a = abs(x-nx)+abs(y-ny)
	if a>t or (t-nt-a)%2: cant = True
	nt, nx, ny = t, x, y
print("YNeos"[cant::2])

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

t = 0
x = 0
y = 0
for t1, x1, y1 in info:
    diff = abs(x - x1) + abs(y - y1)
    diff_t = abs(t - t1)
    if diff_t >= diff and diff % 2 == diff_t % 2:
        continue
    else:
        print("No")
        exit()
print("Yes")

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
from decimal import Decimal
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = [inpl() for _ in range(n)]
now = nx = ny = 0
for i,z in enumerate(a):
    t,x,y = z
    nex = now + abs(nx-x) + abs(ny-y)
    if nex > t or (t-nex)%2:
        print('No')
        break
    now = t
    nx = x; ny = y
    
else:
    print('Yes')

Solution (Python):
n=int(input())
X=0
Y=0
T=0
f=1
for _ in range(n):
    t,x,y=map(int,input().split())
    dx=abs(x-X)
    dy=abs(y-Y)
    dt=t-T
    if dt>=dx+dy and dt%2==(dx+dy)%2:
        pass
    else:
        f=0
print("Yes" if f else "No")

Solution (Python):


def main():
    import sys

    input = sys.stdin.readline
    N = int(input())
    prev = 0
    x = 0
    y = 0

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


main()

Solution (Python):
def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    TXY = [[int(i) for i in input().split()] for j in range(N)]
    time = 0
    px = 0
    py = 0
    for t, x, y in TXY:
        move = abs(py-y) + abs(px - x)
        if (t-time) < move or (t - time) % 2 != move % 2:
            return print("No")
        time = t
        px = x
        py = y
    print("Yes")


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
t0 = x0 = y0 = 0
for _ in range(N):
    t1, x1, y1 = map(int, input().split())
    d = abs(x1 - x0) + abs(y1 - y0)
    if d > t1 - t0 or d % 2 != (t1 - t0) % 2:
        print('No')
        exit()
    t0, x0, y0 = t1, x1, y1
print('Yes')

Solution (Python):
n = int(input())
nt, nx, ny = 0, 0, 0
for _ in range(n):
  t, x, y = map(int, input().split())
  d = abs(x-nx) + abs(y-ny)
  dt = t - nt
  if d > dt or d%2 != dt%2:
    print("No")
    break
  nt, nx, ny = t, x, y
else:
  print("Yes")

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

for i in range(n):
    time = abs(txy[i][0] - txy[i+1][0])
    dis = abs(txy[i][1] - txy[i+1][1]) + abs(txy[i][2] - txy[i+1][2])
    if time % 2 == dis % 2:
        if dis % 2 == 0:
            if dis == 0 or dis == time:
                continue
            else:
                ans = False
                break
        else:
            if dis == 1 or dis == time:
                continue
            else:
                ans = False
                break
    else:
        ans = False
        break
    
if ans:
    print('Yes')
else:
    print('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())
v = [0, 0]
c = 0
ans = 1
for _ in range(n):
    t, x, y = map(int, input().split())
    m = t - c
    d = abs(x - v[0]) + abs(y - v[1])
    if d > m:
        ans = 0
    if d % 2 != m % 2:
        ans = 0
    v = [x, y]
    c = t
print("Yes" if ans == 1 else "No")

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

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

    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 dist > dt:
            print('No')
            return
        if ((dt % 2 == 0) != (dist % 2 == 0)):
            print('No')
            return
    
    print('Yes')


def main():
    solve()

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
t = [0]
x = [0]
y = [0]
count = 0
for i in range(n):
    val_list = input().split()
    if val_list:
        t.append(int(val_list[0]))
        x.append(int(val_list[1]))
        y.append(int(val_list[2]))
for i in range(n):
    distance = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    if distance > t[i + 1] - t[i]:
        break
    elif distance == t[i + 1] - t[i]:
        count += 1
    elif distance - (t[i + 1] - t[i]) % 2 == 0:
        count += 1
    else:
        break
if count == n:
    print('Yes')
else:
    print('No')

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

for i in range(n):
    dt = plan[i+1][0] - plan[i][0]
    dx = plan[i+1][1] - plan[i][1]
    dy = plan[i+1][2] - plan[i][2]
    if (dx+dy)%2 == 0:
        if dt%2 == 0 and dt >= dx+dy:
            pass
        else:
            print('No')
            exit()
    else:
        if dt%2 == 1 and dt >= dx+dy:
            pass
        else:
            print('No')
            exit()
print('Yes')

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

for i in range(n):
    dt = plan[i+1][0] - plan[i][0]
    dx = plan[i+1][1] - plan[i][1]
    dy = plan[i+1][2] - plan[i][2]
    if (dx+dy)%2 == 0:
        if dt%2 == 0 and dt >= dx+dy:
            pass
        else:
            print('No')
            exit()
    else:
        if dt%2 == 1 and dt >= dx+dy:
            pass
        else:
            print('No')
            exit()
print('Yes')

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

a, b = 0, 0
c = 0
ans = 0
for i in range(n):
    t, x, y = map(int, input().split())
    if (t - c) % 2 == (abs(x - a) + abs(y - b)) % 2 and abs(x - a) + abs(y - b) <= t - c:
        continue
    else:
        ans = 1
if ans == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
arr = [[0,0,0]]
flg = 0
for i in range(n):
  arr.append(list(map(int, input().split())))
  if arr[i+1][0]-arr[i][0] < arr[i+1][1] + arr[i+1][2] - arr[i][1] - arr[i][2] or (arr[i+1][0]-arr[i][0]) % 2 != (arr[i+1][1] + arr[i+1][2] - arr[i][1] - arr[i][2]) % 2:
    flg = 1
if flg == 0:
  print('Yes')
else:
  print('No')

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

p, sx, sy = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    d, dx, dy = t - p, abs(x - sx), abs(y - sy)
    if (dx + dy) > d or (dx + dy - d) % 2 == 1:
        print("No")
        exit()
    p, sx, sy = t, x, y
else:
    print("Yes")

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

for i in range(1, n+1):
    a = abs(t[i] - t[i-1])
    b = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])
    if a>=b and a%2 == b%2:
        continue
    else:
        print("No")
        break
else:
    print("Yes")

Solution (Python):
def ans():
    N = int(input())
    old_t, old_x, old_y = 0, 0, 0
    for _ in range(N):
        t, x, y = map(int, input().split())

        dt = t - old_t
        dx = x - old_x
        dy = y - old_y
        if abs(dx) + abs(dy) > dt or (abs(dx) + abs(dy)) % 2 != dt % 2:
            print('No')
            return
    
    print('Yes')
    return

ans()

Solution (Python):
N = int(input())
S = []
for i in range(N):
    S.append(list(map(int, input().split())))
tn = 0
xn = 0
yn = 0
isOk=True
for sl in S:
    ti = sl[0]
    xi = sl[1]
    yi = sl[2]
    t = ti-tn
    distance = abs(xi-xn)+abs(yi-yn)
    if (t>=distance)&((t-distance)%2==0):
        pass
    else:
        isOk=False
        break
if isOk:
    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(1,n+1):
    t[i],x[i],y[i]=map(int,input().split())
flag=True
for i in range(1,n+1):
    d=abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    tt=t[i]-t[i-1]
    if d<=tt and d%2==tt%2:
        continue
    else:
        flag=False
        break
print('Yes') if flag 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)
count=0
t,x,y=0,0,0
for i in range(N):
    
    
    if abs(X[i]-x)+abs(Y[i]-y)<=T[i]-t and T[i]%2==(X[i]+Y[i])%2:
        count+=1
    t,x,y=T[i],X[i],Y[i]
if count==N:
    print('Yes')
else:
    print('No')

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

nexttime = 0
nextx = 0
nexty = 0


for s in range(0, len(data)):
  nexttime = data[s][0]
  nextx = data[s][1]
  nexty = data[s][2]
  if ( (nexttime < nextx+nexty) or ((((nextx + nexty) ) % 2) != (nexttime % 2) ) ):
    print("No")
    exit()


print("Yes")

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

cnt = 0

for l in range(len(L)-1):
    length = abs(L[l+1][1] - L[l][1]) + abs(L[l+1][2] - L[l][2]) - abs(L[l+1][0] - L[l][0]) 
    if not (length <= 0 and length % 2 == 0):
        print("No")
        break
    else:
        cnt += 1

if cnt == len(L) - 1:
    print("Yes")

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

t.append(0)
x.append(0)
y.append(0)

for i in range(N):
    if t[i] >= x[i] + y[i]:
        if t[i] % 2 == (x[i] + y[i]) % 2:
            t[i + 1] -= t[i]
            x[i + 1] -= x[i]
            y[i + 1] -= y[i]
        else:
            print('No')
            quit()
            
    else:
        print('No')
        quit()
        
print('Yes')

Solution (Python):
N = int(input())
ans = True
for _ in range(N):
  t, x, y = map(int, input().split())
  if t < x + y:
    ans = False
  if t % 2 != (x + y) % 2:
    ans = False
if ans:
  print('Yes')
else:
  print('No')

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

Now = (0,0,0)
flag = 0
for Next in Point:
    
    dist = abs((Next[1]+Next[2]) - (Now[1]+Now[2]))
    
    T = Next[0]-Now[0]
    if T<dist:
        flag=1
        break
    else:
        if T%2!=dist%2:
            flag=1
            break
if flag==0:
    print("Yes")
else:
    print("No")

Solution (Python):
if __name__ == '__main__':
    l_c = int(input())
    trips = []
    for i in range(l_c):
        trips.append([int(v) for v in input().split(' ')])
    pos = [0, 0, 0]
    for t in trips:
        time = t[0] - pos[0]
        dist = abs(pos[1] - t[1]) + abs(pos[2] - t[2])
        e_or_o = [time % 2, dist % 2]
        if time < dist or e_or_o[0] != e_or_o[1]:
            print('No')
            exit(0)
        pos = t
    print('Yes')

Solution (Python):
if __name__ == '__main__':
    l_c = int(input())
    trips = []
    for i in range(l_c):
        trips.append([int(v) for v in input().split(' ')])
    pos = [0, 0, 0]
    for t in trips:
        time = t[0] - pos[0]
        n = pos[1] - t[1]
        if n < 0:
            n *= -1
        n2 = pos[2] - t[2]
        if n2 < 0:
            n2 *= -1
        dist = n + n2

        e_or_o = [time % 2, dist % 2]
        if time < dist or e_or_o[0] != e_or_o[1]:
            print('No')
            exit(0)
        pos = t
    print('Yes')

Solution (Python):

def resolve():
    N=int(input())
    T, X, Y = [0] *(N+1) , [0] *(N +1), [0] * (N+1)
    for i in range(N):
        T[i+1], X[i+1], Y[i+1] = map(int, input().split())

    def main():
        for i in range(N):
            if T[i+1]-T[i]==abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i]):
                continue
            else:
                if T[i + 1] - T[i] > abs(X[i + 1] - X[i]) + abs(Y[i + 1] - Y[i])\
                and (T[i + 1] - T[i])%2==(abs(X[i + 1] - X[i]) + abs(Y[i + 1] - Y[i]))%2:

                    continue
                else:
                    return 'No'
        return 'Yes'

    print(main())



resolve()

Solution (Python):
import sys
import math

def main():
    def iterate_position():
        yield list(map(int, sys.stdin.readline().rstrip().split()))

    N = int(sys.stdin.readline().rstrip())
    now_position = [0, 0, 0]
    for x in range(N):
        try:
            next_position = next(iterate_position())
            dt = next_position[0] - now_position[0]
            dx = next_position[1] - now_position[1]
            dy = next_position[2] - now_position[2]
            if dt < abs(dx) + abs(dy):
                print("No")
                sys.exit()
            check = dt - (dx + dy)
            if check % 2 == 1:
                print("No")
                sys.exit()
            now_position = next_position
        except StopIteration:
            print("No")
    else:
        print("Yes")

if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
now=[0,0,0]
f=True
for i in range(n):
    t,x,y=map(int,input().split())
    k=abs(x-now[1])+abs(y-now[2])
    l=abs(t-now[0])
    if not(k<=l and abs(k-l)%2==0):
        f=False
    now=[t,x,y]
print("Yes" if f else "No")

Solution (Python):




def main():
    N = int(input())
    TXY = [[0, 0, 0]]
    TXY.extend([list(map(int, input().split())) for _ in range(N)])

    result = 'Yes'
    for i in range(N):
        t1, x1, y1 = TXY[i - 1]
        t2, x2, y2 = TXY[i]
        td = abs(t1 - t2)
        xyd = abs(x1 - x2) + abs(y1 - y2)
        if xyd <= td and xyd % 2 == td % 2:
            continue
        else:
            result = 'No'
            break
    print(result)


if __name__ == "__main__":
    main()

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

for i in range(n):
    dt = abs(l[i + 1][0] - l[i][0])
    dx = abs(l[i + 1][1] - l[i][1])
    dy = abs(l[i+1][2]-l[i][2])
    if dt < dx + dy:
        break
    elif dt % 2 != (dx + dy) % 2:
        break
else:
    ans = "Yes"

print(ans)

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

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

judge = True
for i in range(len(T)):
    if i == 0:
        time = T[i][0]
        distance = sum(T[i][1:])
    else:
        time = T[i][0] - T[i-1][0]
        distance = abs(sum(T[i][1:]) - sum(T[i-1][1:]))
    if time >= distance and (time - distance) % 2 == 0:
        continue
    else:
        judge = False
        break

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

Solution (Python):
N = int(input())
T, X, Y = 0, 0, 0
count = 0
for i in range(N):
  t, x, y = map(int, input().split())
  dt = t - T
  dist = abs(x - X) + abs(y - Y)
  if dist <= dt 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())
t=[]
x=[]
y=[]
flag=False
for i in range(N):
  t1,x1,y1=[int(i) for i in input().split()]
  t.append(t1)
  x.append(x1)
  y.append(y1)
for i in range(N):
  if(i>0):
    t[i]=t[i]-t[i-1]
    x[i]=x[i]-x[i-1]
    y[i]=y[i]-y[i-1]

for i in range(N):
  if((x[i]+y[i])%2==t[i]%2 and abs(x[i])+abs(y[i])<=t[i]):
    flag=True
  else:
    flag=False
    break

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

Solution (Python):
N=int(input())
t=[]
x=[]
y=[]
for i in range(N):
  t1,x1,y1=[int(i) for i in input().split()]
  t.append(t1)
  x.append(x1)
  y.append(y1)
flag=1
for i in range(N):
  if t[i]<x[i]+y[i]:
    flag=0
  if t[i]%2 != (x[i]+y[i])%2:
    flag=0
if flag==1:
  print("Yes")
else:
  print("No")

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

ans = "Yes"
for i in range(N):
	norm = abs(P[i+1][1]-P[i][1])+abs(P[i+1][2]-P[i][2])
	move = (P[i+1][0]-P[i][0]) - norm
	if ((move%2 != 0) or (move < 0)):
		ans = "No"
		break
	
print(ans)

Solution (Python):
n = int(input())
p = [0, 0]
time = 0

for _ in range(n):
    t, x, y = map(int, input().split())
    dist = abs(x-p[0]) + abs(y-p[1])
    if dist > t-time:
        print('No')
        exit()
    else:
        if (t-time)%dist==0:
            time += dist
            p = [x, y]
        else:
            print('No')
            exit()

print('Yes')

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)
ans = "Yes"
for i in range(1,N+1):
    if X[i]-X[i-1]+Y[i]-Y[i-1]<=T[i]-T[i-1] and (T[i]-T[i-1])%2 == (X[i]-X[i-1]+Y[i]-Y[i-1])%2:
       continue
    else:
        ans="No"
        break
print(ans)

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

for i in range(n):
    t = l[i][0]
    x = l[i][1]
    y = l[i][2]
    d = x + y
    if d <= t and (d - t) % 2 == 0:
        continue
    else:
        print('No')
        quit()
print('Yes')

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

for i in range(n):
    t = l[i][0]
    x = l[i][1]
    y = l[i][2]
    d = x + y
    if d <= t and (d - t) % 2 == 0:
        continue
    else:
        print('No')
        quit()
print('Yes')

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

x = 0
y = 0
for i in range(n):
    t = l[i][0]
    x = l[i][1]
    y = l[i][2]
    d = x + y
    if d <= t and (d - t) % 2 == 0:
        continue
    else:
        print('No')
        quit()
print('Yes')

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

x = 0
y = 0
for i in range(n):
    t = l[i][0]
    x = l[i][1]
    y = l[i][2]
    d = x + y
    if d <= t and (d - t) % 2 == 0:
        continue
    else:
        print('No')
        quit()
print('Yes')

Solution (Python):
N = int(input())
L = [[0,0,0]]
A = 0
for i in range(N):
    t,x,y = map(int, input().split())
    L.append([t,x,y])
for i in range(N):
    dx = abs(L[i+1][1])-abs(L[i][1])
    dy = abs(L[i+1][2])-abs(L[i][2])
    dt = L[i+1][0] - L[i][0]
    if dt < dx + dy or (dt - (dx + dy)) % 2 != 0:
        A += 1
        break
if A == 0:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
pre_t=0
pre_x=0
pre_y=0
flg="Yes"
for i in range(N):
    t,x,y=map(int,input().split())
    dt=t-pre_t
    dist=abs(x-pre_x) + abs(y-pre_y)
    pre_t=t
    pre_x=x
    pre_y=y
    if(dist > dt ):
        flg="No"
        break
    if((dist)%2 != dt%2):
        flg="No"
        break
print(flg)

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())
x = [[0,0,0]]+sorted([list(map(int, input().split())) for _ in range(n)])
ans = 'Yes'
for i in range(n):
    d = (x[i+1][0]-x[i][0]-abs(x[i+1][1]-x[i][1])-abs(x[i+1][2]-x[i][2]))
    if d<0 or d%2==1:
        ans = 'No'
print(ans)

Solution (Python):
import sys


N = int(input())
t, x, y = 0, 0, 0
ans = 'No'
for s in sys.stdin.readlines():
    nt, nx, ny = map(int, s.split())
    T = nt - t
    D = abs(nx - x) + abs(ny - y)
    if T < D or T % 2 != D % 2:
        break
    t, x, y = nt, nx, ny
else:
    ans = 'Yes'

print(ans)

Solution (Python):
def main():
    N = int(input())
    t,x,y = 0,0,0
    ans = 'Yes'
    for i in range(N):
        ti,xi,yi = (int(x) for x in input().split())
        dt = ti - t
        dist = abs(xi-x) + abs(yi-y)
        if dt < dist or dist%2 != dt%2:
            ans = 'No'
            break
        else:
            t,x,y = ti,xi,yi
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
TXY=[list(map(int,input().split(' '))) for i in range(N)]
t,x,y=0,0,0
for i,j,k in TXY:
    chk=(i-t-(abs(x-j)+abs(y+k)))
    if chk<0 or chk%2!=0:
        print('No')
        exit()
print('Yes')

Solution (Python):
n=int(input())
u=0
p=0
q=0
for _ in range(n):
  t,x,y=map(int,input().split())
  if abs(p-x)+abs(q-y)<=t-u and (t-u-abs(p-x)-abs(q-y))%2==0:
    u=t
    p=x
    q=y
  else:
    print('No')
    break
else:
  print('Yes')

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

t0, x0, y0 = 0, 0, 0
cnt = 0

for _ in range(n):
    t, x, y = map(int, input().split())
    diff_t = t-t0
    distance = abs(x0-x)+abs(y0-y)
    if diff_t >= distance and (diff_t - distance == 0 or (diff_t - distance) % 2 == 0):
        cnt += 1
    t0, x0, y0 = t, x, y

print('Yes' if cnt == n else 'No')

Solution (Python):
T, X, Y = 0, 0, 0
cnt = 0
for n in range(int(input())):
  t, x, y = map(int,input().split())
  dist = abs(x-X) + abs(y-Y)
  dt = t - T
  cnt += all([dist <= dt, (dist - dt) % 2 == 0])
  T, X, Y = t, x, y
print("YNeos"[n+1!=cnt::2])

Solution (Python):
for _ in range(int(input())):
  t, x, y = map(int,input().split())
  if (t+x+y)%2 + (t<x+y):
    s = 1
    break
  s = 0
print("YNeos"[s::2])

Solution (Python):
N = int(input())
T, X, Y = 0, 0, 0
cnt = 0
for _ in range(N):
  t, x, y = map(int,input().split())
  dist = abs(x-X) + abs(y-Y)
  dt = t - T
  cnt += all([dist <= dt, (dist - dt) % 2 == 0])
  T, X, Y = t, x, y
print("YNeos"[N!=cnt::2])

Solution (Python):
n = int(input())
travel_list = [[0,0,0]]
for i in range(n):
    travel_list.append([int(num) for num in input().split(" ")])
for i in range(1,n+1):
    t_step = travel_list[i][0]-travel_list[i-1][0]
    x_step = abs(travel_list[i][1]-travel_list[i-1][1])
    y_step = abs(travel_list[i][2]-travel_list[i-1][2])
    if x_step+y_step>t_step:
        print("No")
        exit()
    elif (t_step - (x_step + y_step))%2==1:
        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())
nowt, nowx, nowy = 0, 0, 0
ans = 'Yes'
for i in range(n):
    t, x, y = map(int, input().split())
    dift, difxy = t - nowt, abs(x - nowx) + abs(y - nowy)
    if dift < difxy or dift&1 != difxy&1:
        ans = 'No'
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())
txy = [list(map(int,input().split())) for _ in range(n)]
f=0
for i in range(n):
    if(txy[i][0]<txy[i][1]+txy[i][2] or txy[i][0]%2!=(txy[i][1]+txy[i][2])%2):
        f=1
        print("No")
        break
if f==0:
    print("Yes")

Solution (Python):
import numpy as np

N = int(input())

l = []
for i in range(N):
    if i == 0:
        before = list(map(int, input().split()))
        road = before[0] - before[1] - before[2]
        
        if road < 0:
            ans = 'No'
            break
        elif road >= 0 and road%2 == 1:
            ans = 'No'
            break
        else:
            ans = 'Yes'
    else:
        after = list(map(int, input().split()))
        road = after[0] - before[0] - after[1] + before[1] - after[2] + before[2]
        
        if road < 0:
            ans = 'No'
            break
        elif road >= 0 and road%2 == 1:
            ans = 'No'
            break
        else:
            ans = 'Yes'
            before = after

print(ans)

Solution (Python):
import sys

N = int(input())




success = "Yes"

(t0,x0,y0)=(0,0,0)
for i in range(N):
    (t,x,y)=map(int, input().split())
    

    d=(x-x0)+(y-y0)
    dt=t-t0
    

    if d>dt or (d % 2 != dt %2):
        success = "No"
        break
 
    (t0,x0,y0)=(t,x,y)

print(success)

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

now = [0, 0]
for p in txy:
    d = abs(p[1] - now[0]) + abs(p[2] - now[1])
    if p[0] % 2 == d % 2 and p[0] >= d:
        continue
    else:
        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())
t=0
x=0
y=0
ans ="Yes"
for i in range(n):
  tt,xx,yy = map(int,input().split())
  dif = abs(x-xx)
  dif +=abs(y-yy)
  if dif>(tt-t) or dif%2 !=(tt-t)%2:
    ans = "No"
    break;
  t=tt
  x=xx
  y=yy
print(ans)

Solution (Python):
n=int(input())
s=v=w=0
for _ in range(n):
  t,x,y=map(int,input().split())
  dt,dx,dy=t-s,x-v,y-w
  if (dt+dx+dy)%2>0 or dt<abs(dx)+abs(dy): print('No'); break
  s,v,w=t,x,y
else: print('Yes')

Solution (Python):
def ynf(dt,dx,dy):

    if (dx+dy)>dt:
        return 0
    if (dx+dy)%2 != dt%2:
        return 0
    return 1

icase=0
if icase==0:
    n=int(input())
    txy=[]
    for i in range(n):
        txy.append(list(map(int,input().split())))
elif icase==1:
    n=2
    txy=[]
    txy.append([3, 1, 2])
    txy.append([6, 1, 1])
elif icase==2:
    n=1
    txy=[]
    txy.append([2, 100, 100])
elif icase==3:
    n=2
    txy=[]
    txy.append([5, 1, 1])
    txy.append([100, 1, 1])

dt=txy[0][0]
dx=txy[0][1]
dy=txy[0][2]

yn=1
for i in range(n):
    if ynf(dt,dx,dy)==0:
        yn=0
        break
    elif i==n-1:
        break
    else:
        dt=txy[i+1][0]-txy[i][0]
        dx=txy[i+1][1]-txy[i][1]
        dy=txy[i+1][2]-txy[i][2]
        
if yn==0:
    print("No")
else:
    print("Yes")