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())
info = [list(map(int,input().split())) for i in range(n)]

ans ="Yes"
kyori = abs(info[0][1])+abs(info[0][2])
zikan = info[0][0]
if not(kyori <= zikan and kyori%2 ==zikan%2):
  print("No")
  exit()
  
for i in range(1,n):
  kyori = abs(info[i][1]-info[i-1][1])+abs(info[i][2]-info[i-1][2])
  zikan = info[i][0]-info[i-1][0]
  if not(kyori <= zikan and kyori%2 ==zikan%2):
    ans ="No"
    break
    
    
print(ans)

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

route = [[0, 0, 0]]
judge = "Yes"
for _ in range(n):
  m = [int(i) for i in input().split()]
  route.append(m)
for i in range(1, n+1):
  delt = abs(route[i][0] - route[i-1][0])
  absx = abs(route[i][1] - route[i-1][1])
  absy = abs(route[i][2] - route[i-1][2])




  if (delt >= (absx + absy)) and (delt - (absx +absy)) % 2 == 0:
    continue
  else:
    judge = "No"
    break
    
print(judge)

Solution (Python):
N = int(input())
tmp_t, tmp_x, tmp_y = 0, 0, 0
flag = True
for _ in range(N):
    t, x, y = map(int, input().split())
    T = t - tmp_t
    D = abs(x - tmp_x) + abs(y - tmp_y)
    if T >= D and T%2 == D%2:
        pass
    else:
        flag = False
result = 'Yes' if flag else 'No'
print(result)

Solution (Python):
n = int(input())
 
start = 0
startX = 0
startY = 0
 
for i in range(n):
    t, x, y = map(int, input().split())
    t_diff = t - start
    dis = abs(x - startX) + abs(y - startY)
    if t_diff < dis or (dis + t_diff) % 2 != 0:
        print('No')
        exit()
    start, startX, startY = t, x, y
print('Yes')

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

Solution (Python):
n = int(input())
t = []
x = []
y = []
for _ in range(n):
    ti, xi, yi = map(int,input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
for i in range(n):
    if ((x[i]+y[i])%2==0 and t[i]%2==1 or (x[i]+y[i])%2==1 and t[i]%2==0 or x[i]+y[i]>t[i]):
        print("No")
        exit()
print("Yes")

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

ans = 'Yes'
for i in range(n):
    time = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i][1] - txy[i + 1][1]) + abs(txy[i][2] - txy[i + 1][2])
    if time - dist == 0:
        pass
    elif time - dist > 0 and (time - dist) % 2 == 0:
        pass
    else:
        ans = 'No'
        
print(ans)

Solution (Python):
count = int(input())
poslist = ["0 0 0"]
acheive = True
for n in range(count):
	poslist.append(input())
for i in range(count):
	cur,cx,cy = map(int,poslist[i].split())
	next,nx,ny  = map(int,poslist[i+1].split())
	dif = next - cur
	difx = nx - cx
	dify = ny - cy
	chk = dif- difx -dify
	if chk%2 != 0 or chk < 0:
		acheive = False
		break
if acheive:
	print('Yes')
else:
	print('No')

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

x=0
y=0

for _ in range(N):
    ti,xi,yi=map(int,input().split())
    if ti - (abs(x-xi) + abs(y-yi))<0 or (ti - (abs(x-xi) + abs(y-yi)))%2==1:
        print('No')
        exit()
print('Yes')

Solution (Python):
def inpl(): return list(map(int, input().split()))


n = int(input())

nt, nx, ny = 0, 0, 0
for _ in range(n):
    t, x, y = inpl()
    if (abs(nx-x)+abs(ny-y))%2 != (t-nt)%2 or abs(nx-x)+abs(ny-y) > t-nt:
        
        
        print("No")
        exit()
    nt, nx, ny = t, x, y
print("Yes")

Solution (Python):
N = int(input())
t=[0]
x,y=[0],[0]
for i in range(N):
    tmpt,tmpx,tmpy = (int(i) for i in input().split())
    t.append(tmpt)
    x.append(tmpx)
    y.append(tmpy)

ans = 'Yes'

for i in range(N):
    if t[i+1]-t[i]<abs(x[i+1]-x[i])+abs(y[i+1]-y[i]):
        ans = 'No'
        break
    elif ((t[i+1]-t[i])-(abs(x[i+1]-x[i])+abs(y[i+1]-y[i])))%2!=0:
        ans = 'No'
        break

print(ans)

Solution (Python):
n = int(input())
t = []
x = []
y = []
for _ in range(n):
    ti, xi, yi = map(int,input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
for i in range(n):
    if ((x[i]+y[i])%2==0 and t[i]%2==1 or (x[i]+y[i])%2==1 and t[i]%2==0 or x[i]+y[i]>t[i]):
        print("No")
        exit()
print("Yes")

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

now = 0
p = [0,0]
for i in range(n):
    t = a[i][0] - now
    dis = abs(a[i][1] - p[0]) + abs(a[i][2] - p[1])
    
    if dis <= t:
        if t % 2 == 0:
            if dis % 2 != 0:
                print('No')
                exit()
        else:
            if dis % 2 != 1:
                print('No')
                exit()
    else:
        print('No')
        exit()
        
    p[0] = a[i][1]
    p[1] = a[i][2]
    now = a[i][0]
else:
    print('Yes')

Solution (Python):
import numpy as np
num = int(input())
ary = [[0, 0, 0]]
for _ in range(num):
    ary += [list(input().split())]
ary = np.array(ary, dtype=int)

dt = ary[1:, 0] - ary[:-1, 0]
dx = ary[1:, 1:] - ary[:-1, 1:]
dx = np.abs(dx).sum(axis=1)

if np.all(dt >= dx) and np.all((dt - dx) % 2 == 0):
    print("Yes")
else:
    print("No")

Solution (Python):
import math
import sys

sys.setrecursionlimit(100000)

def solve():
    n = int(input())
    success_trip = True
    now_t, now_x, now_y = 0, 0, 0
    for i in range(n):
        next_t, next_x, next_y = map(int, input().split(' '))
        if success_trip:
            if not find_path(now_t, now_x, now_y, next_t, next_x, next_y):
                success_trip = False
            now_t, now_x, now_y = next_t, next_x, next_y
    
    if success_trip:
        print("Yes")
    else:
        print("No")

def find_path(now_t, now_x, now_y, next_t, next_x, next_y):
    time = next_t - now_t
    return recursion_find(time, now_x, now_y, next_x, next_y)
    
def recursion_find(time, now_x, now_y, target_x, target_y):
    
    
    
    
    
    
    

    if (abs(target_x - now_x) + abs(target_y - now_y) - time) % 2 == 1:
        
        return False

    if time == 0:
        if now_x == target_x or now_y == target_y:
            return True
        else:
            return False
    else:
        
        if time < abs(target_x - now_x) + abs(target_y - now_y):
            
            return False
            
        if recursion_find(time-1, now_x-1, now_y, target_x, target_y):
            return True
        elif recursion_find(time-1, now_x, now_y-1, target_x, target_y):
            return True
        elif recursion_find(time-1, now_x+1, now_y, target_x, target_y):
            return True
        elif recursion_find(time-1, now_x, now_y+1, target_x, target_y):
            return True
        else: 
            return False

if __name__ == "__main__":
    solve()

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    x, y, z = map(int, input().split())
    if(x < y + z):
        print('No')
        ans = 1
        break
    if(x%2 == (y+z)%2):
        continue
    else:
        print('No')
        ans = 1
        break
if(ans == 0):
    print('Yes')

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

def hantei(t, z):
    if t >= z and t % 2 == z % 2:return 'Y'
    else: return 'N'
    
E.insert(0, [0, 0 , 0])

a=''
for i in range(1, len(E)):
    if 'Y' == hantei(E[i][0] - E[i-1][0] , (E[i][1] + E[i][2]) - (E[i-1][1] + E[i-1][2])):
        continue
    else:
        a = 'No'
        break
if a != 'No':
    a = 'Yes'
print(a)

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

Solution (Python):
N = int(input())
txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
flag = True
for i in range(N):
    nt = txy[i+1][0]
    nx = txy[i+1][1]
    ny = txy[i+1][2]
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    move = nt - t
    tmp = abs(nx-x)+abs(ny-y)
    if move >= tmp:
        if abs(move-tmp) % 2 != 0:
            print('No')
            exit()
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
N = int(input())
txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
flag = True
for i in range(N):
    nt = txy[i+1][0]
    nx = txy[i+1][1]
    ny = txy[i+1][2]
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    move = nt - t
    tmp = abs(nx-x)+abs(ny-y)
    if move >= tmp:
        if abs(move-tmp) % 2 != 0:
            flag = False
            break
    else:
        flag = False
        break
print('Yes' if flag else 'No')

Solution (Python):
import sys
N = int(input())
t = [0]*N
x = [0]*N
y = [0]*N
for i in range(N):
    t[i],x[i],y[i] = [int(n) for n in input().split()]
dt = t[0]
d = x[0] + y[0]
if(dt < d or dt%2 != d%2):
    print("No")
    sys.exit()
for i in range(1,N):
    dt = t[i] - t[i-1]
    d = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])
    if(dt < d or dt%2 != d%2):
        print("No")
        sys.exit()
print("Yes")

Solution (Python):
def a():return input()
def ai():return int(input())
def ma():return map(int, input().split())
def ms():return map(str, input().split())
def lma():return list(map(int, input().split()))
def lms():return list(map(str, input().split()))
k= [0]
l = [0]
m=[]
co = range(1,10**5+2,2)
ce = range(0,10**5+2,2)
f = 1
def say(i):return print("Yes" if i == 1 else "No")
def Say(i):return print("YES" if i == 0 else "NO")

def addarray(k,l):
    for i in range(n):
        a ,b,c = map(int,input().split())
        k.append(a)
        l.append(b+c)
n = ai()
addarray(k,l)
for i in range(1,n+1):
    t = k[i]-k[i-1]
    if t%2==1 and abs(l[i]-l[i-1]) in co[:t//2+1]:
        f = 1
    elif t%2==0 and abs(l[i]-l[i-1]) in ce[:t//2+1]:
        f = 1
    else:
        f = 0
        break
say(f)

Solution (Python):
import sys

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):

    return [il(t) for _ in range(N)]


def solve():
    N = ii()
    
    
    T = [0] * (N + 1)
    X = [0] * (N + 1)
    Y = [0] * (N + 1)
    for n in range(N):
        t = il()
        T[n + 1] = t[0]
        X[n + 1] = t[1]
        Y[n + 1] = t[2]
    for i in range(N):
        dt = T[i + 1] - T[i]
        dst = abs(X[i + 1] - X[i]) + abs(Y[i + 1] - Y[i])
        if dt < dst or dt % 2 != dst % 2:
            return "No"
    return "Yes"


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

Solution (Python):
N = int(input())
data = [list(map(int,input().split())) for l in range(N)] 
data = [[0,0,0]] + data

for i in range(1,N+1):
    t_a,t_b = data[i][0],data[i-1][0]
    x_a,x_b = data[i][1],data[i-1][1]
    y_a,y_b = data[i][2],data[i-1][2]

    x_d = x_a - x_b
    y_d = y_a - y_b

    check = t_a - t_b - abs(x_d) - abs(y_d)
    if (check >= 0) and (check%2 == 0):
        continue
    else:
        print('No')
        exit()
else:
    print('Yes')

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

Solution (Python):
n = int(input())
l_t = []
l_pos = []

l_pos.append([0, 0])
l_t.append(0)

for i in range(n):
    a, b, c = (list)(map(int, input().split()))
    l_t.append(a)
    l_pos.append([b, c])


def manhattan(pos1, pos2):
    return abs(pos1[0]-pos2[0]) + abs(pos1[1]-pos2[1])



ans = 'Yes'
for i in range(n):
    dis = manhattan(l_pos[i], l_pos[i+1])
    time = abs(l_t[i+1]-l_t[i])
    if dis > time:
        ans = 'No'
        break
    elif dis % 2 != time % 2:
        ans = 'No'
        break

print(ans)

Solution (Python):
n = int(input())
l_t = []
l_pos = []

l_pos.append([0, 0])
l_t.append(0)

for i in range(n):
    a, b, c = (list)(map(int, input().split()))
    l_t.append(a)
    l_pos.append([b, c])


def manhattan(pos1, pos2):
    return abs(pos1[0]-pos2[0]) + abs(pos1[1]-pos2[1])



ans = 'Yes'
for i in range(n):
    dis = manhattan(l_pos[i], l_pos[i+1])
    time = abs(l_t[i+1]-l_t[i])
    if dis > time:
        ans = 'No'
        break
    elif dis % 2 != time % 2:
        ans = 'No'
        break

print(ans)

Solution (Python):
n = int(input())
l_t = []
l_pos = []

l_pos.append([0, 0])
l_t.append(0)

for i in range(n):
    a, b, c = (list)(map(int, input().split()))
    l_t.append(a)
    l_pos.append([b, c])


def manhattan(pos1, pos2):
    return abs(pos1[0]-pos2[0]) + abs(pos1[1]-pos2[1])



ans = 'Yes'
for i in range(n):
    dis = manhattan(l_pos[i], l_pos[i+1])
    time = abs(l_t[i+1]-l_t[i])
    if dis > time:
        ans = 'No'
        break
    elif dis % 2 != time % 2:
        ans = 'No'
        break

print(ans)

Solution (Python):
N = int(input())
txy = []
for i in range(N):
    txy.append(list(map(int,input().split())))
flag = 0
if N == 1:
    dt = txy[0][0]
    dx = txy[0][1]
    dy = txy[0][2]
    if (dx+dy-dt)%2 == 0 and (dx+dy) <= dt:
        pass
    else:
        flag = 1
        print("No")
for j in range(N-1):
    if j == 0:
        dt = txy[0][0]
        dx = txy[0][1]
        dy = txy[0][2]
    else:
        dt = txy[j+1][0]-txy[j][0]
        dx = abs(txy[j+1][1]-txy[j][1])
        dy = abs(txy[j+1][2]-txy[j][2])
    if (dx+dy-dt)%2 == 0 and (dx+dy) <= dt:
        pass
    else:
        flag = 1
        print("No")
        break
if flag == 0:
    print("Yes")

Solution (Python):

def read_input():
    n = int(input())

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

    return n, points


def check_transition(point1, point2):
    t_diff = point2[0] - point1[0]
    x_diff = point2[1] - point1[1]
    y_diff = point2[2] - point1[2]

    x_diff = abs(x_diff)
    y_diff = abs(y_diff)

    distance = x_diff + y_diff

    if t_diff >= distance:
        if t_diff % 2 == distance % 2:
            return True

    return False


def check_all_transition():
    n, points = read_input()
    for p1, p2 in zip(points, points[1:]):
        if not check_transition(p1, p2):
            return False
    return True


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

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

for _ in range(N):
    t, _x, _y = map(int, input().split())
    dist = abs(_y - y) + abs(_x - x)
    if dist > t or (t - dist) % 2 == 1:
        print('No')
        quit()
print('Yes')

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

temp_t, temp_x, temp_y = 0, 0, 0
is_reachable = True
for t, x, y in l:
    diff_t = t - temp_t
    diff_x = abs(x-temp_x)
    diff_y = abs(y-temp_y)
    distance = diff_x + diff_y
    if diff_t < distance or diff_t%2 != distance%2:
        print("No")
        is_reachable = False
        break

if is_reachable:
    print("Yes")

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

ans = 'Yes'
count = 0
for i in range(n):
    count += abs(A[i][1] - A[i+1][1]) + abs(A[i][2] - A[i+1][2])
    time = A[i+1][0]
    if time < count:
        ans = 'No'
    elif (time - count) % 2 != 0:
        ans = 'No'
    else:
        count += (time -count)
            
print(ans)

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

ans = 'Yes'
for i in range(n):
    dist = abs(A[i][1] - A[i + 1][1]) + abs(A[i][2] - A[i + 1][2])
    if A[i + 1][0] - A[i][0] - dist < 0:
        ans = 'No'
    elif (A[i + 1][0] - A[i][0] - dist) % 2 == 1:
        ans = 'No'
        
print(ans)

Solution (Python):
N = int(input())
now = [0, 0, 0]

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

Solution (Python):
def canContinue(d, p):
    distance = abs(d[p][1] - d[p - 1][1]) + abs(d[p][2] - d[p - 1][2])
    if d[p][0] - d[p - 1][0] < distance:
        return False
    remaining_action = d[p][0] - d[p - 1][0] - distance
    if remaining_action % 2 == 0:
        return True
    else:
        return False

N = int(input())
d = []
d.append([0,0,0])
i = 0
while i < N:
    d.append(list(map(int, input().split())))
    i += 1
position = 1
answer = True
while position < N + 1:
    if canContinue(d, position):
        i += 1
    else:
        answer = False
        break
    position += 1
if answer:
    print("Yes")
else:
    print("No")

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

s = (0, 0)
t = 0
success = True

for move in In:
    before_x, before_y = s
    tn, after_x, after_y = move

    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)
    walk = tn - t

    if walk < dist_xy:
        success *= False
        break

    if walk % 2 == 0 and dist_xy % 2 != 0:
        success *= False
        break
    elif walk % 2 != 0 and dist_xy % 2 == 0:
        success *= False
        break

    s = (after_x, after_y)
    t = tn

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

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

s = (0, 0)
t = 0
success = True

for move in In:
    before_x, before_y = s
    tn, after_x, after_y = move

    dist_xy = abs(after_x - before_x) + abs(after_y - before_y)
    walk = tn - t

    if walk < dist_xy:
        success *= False

    if walk % 2 == 0 and dist_xy % 2 != 0:
        success *= False
    elif walk % 2 != 0 and dist_xy % 2 == 0:
        success *= False

    s = (after_x, after_y)
    t = tn

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

Solution (Python):

N = int(input())

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

i = 0
while i<N:
    
    a, b, c = map(int, input().split(" "))
    t.append(a)
    x.append(b)
    y.append(c)

    i += 1

    

flag_yes = 0
    

for (num_t, num_x, num_y) in zip(t, x, y):
    
    
    flag = 0
    
    
    sum_xy = num_x + num_y
    
    
    if num_t>=sum_xy:
        flag += 1
        
    
    if num_t%2==0 and sum_xy%2==0 and flag==1:
        flag_yes += 1
        
    elif num_t%2==1 and sum_xy%2==1 and flag==1:
        flag_yes += 1
        

if len(t)==flag_yes:
    print("Yes")
    
else:
    print("No")

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

Solution (Python):
def main():
  n = int(input())
  t = [0] * n
  x = [0] * n
  y = [0] * n
  for i in range(n):
    t[i], x[i], y[i] = map(int, input().strip().split())
  
  ct = 0
  cx = 0
  cy = 0
  for nt, nx, ny in zip(t, x, y):
    diff = abs(nx - cx) + abs(ny - cy)
    if diff > nt or (diff - (nt - ct)) % 2 == 1:
      print('No')
      return
    ct, cx, cy = nt, nx, ny
  print('Yes')


if __name__ == '__main__':
  main()

Solution (Python):
n = int(input())
yo =[]
for i in range(n):
    yo.append(list(map(int,input().split())))
now =[0, 0, 0]
for i in range(n):
    c = yo[i][0] - now[0]-(abs(yo[i][1]-now[1]) + abs(yo[i][2]-now[2]))
    if c >= 0 and c%2 == 0:
        now =yo[i]
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
n = int(input())
yo =[]
for i in range(n):
    yo.append(list(map(int,input().split())))
now =[0, 0, 0]
for i in range(n):
    c = yo[i][0] - now[0]-(abs(yo[i][1]-now[1]) + abs(yo[i][2]-now[2]))
    if c >= 0 and c%2 == 0:
        now =yo[i]
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
n = int(input())
A = []
A.append([0, 0, 0])
for i in range(n):
    A.append([int(i) for i in input().split()])
ans = 'Yes'

for i in range(n):
    dist = abs(A[i][1] - A[i + 1][1]) + abs(A[i][2] - A[i + 1][2])
    if (A[i + 1][0] - A[i][0])  < dist:
        ans = 'No'
        break
    if ((A[i + 1][0] - A[i][0]) - dist) % 2 == 1:
        ans = 'No'
        break
    
print(ans)

Solution (Python):
n = int(input())
txy = []
for i in range(n):
    txy.append(list(map(int,input().split())))
ok = True
for i in range(n):
    if i == 0 : 
        if txy[0][0] < txy[0][1] + txy[0][2] or (txy[0][0] - txy[0][1] + txy[0][2])%2 != 0 :
            ok = False
    else:
        time = 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 < dis or (time-dis)%2 != 0:
            ok = False

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

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

Solution (Python):


def main():
    N = int(input())
    ta = []
    xa = []
    ya = []
    for i in range(N):
        sa = input().split(' ')
        ta.append(int(sa[0]))
        xa.append(int(sa[1]))
        ya.append(int(sa[2]))

    can_travel = True
    t = 0
    x = 0
    y = 0
    for i in range(N):
        if (ta[i] + xa[i] + ya[i]) % 2 != 0:
            can_travel = False
            break
        if ta[i] - t < abs(xa[i] - x) + abs(ya[i] - y):
            can_travel = False
            break
        t = ta[i]
        x = xa[i]
        y = ya[i]


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


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
t_list = []
x_list = []
y_list = []
position = [0,0]
time = 0
count = 0
for i in range(n):
    t,x,y = map(int,input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)
for i in range(n):
    if abs(x_list[i]-position[0]) + abs(y_list[i]-position[1]) == t_list[i]-time:
        time = t_list[i]
        position = [x_list[i],y_list[i]]
        count += 1
    elif abs(x_list[i]-position[0]) + abs(y_list[i]-position[1]) < t_list[i]-time and ((t_list[i]-time)-(abs(x_list[i]-position[0])+abs(y_list[i]-position[1]))) % 2 == 0:
        time = t_list[i]
        position = [x_list[i],y_list[i]]
        count += 1
    else:
        print('No')
        break
if count == n:
    print('Yes')

Solution (Python):
N=int(input())
a = [[]*N]*N
for i in range(N):
    a[i]=input().rstrip().split()




bool = True


for i in range(0,N):
    if bool==False:
        break

    p=int(a[i][1])+int(a[i][2])
    q=int(a[i][0])
    if p>q:
        bool=False
    if p%2==0:
        if q%2!=0:
            bool=False
    else:
        if q%2==0:
            bool=False
        

if bool==True:
    print('Yes')

if bool==False:
    print('No')

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

    for i in range(n):
        if abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) > (t[i + 1] - t[i]) or \
                abs(abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) - (t[i + 1] - t[i])) % 2 == 1:
            print("No")
            return 0
    print("Yes")


abc086_c()

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

ans="Yes"
ta = xa = ya = 0
for i in range(N):
    tb, xb, yb = map(int, input().split())
    sa = tb-ta-(abs(xb-xa)+abs(yb-ya))
    if (sa>=0)&(sa%2==0):
        continue
    else:
        ans="No"
        break
    
print(ans)

Solution (Python):

"""
Created on Sat Dec 22 18:54:37 2018
ABC086
@author: maezawa
"""

n = int(input())
tarr = []
xarr = []
yarr = []
for _ in range(n):
    t, x, y = list(map(int, input().split()))
    tarr.append(t)
    xarr.append(x)
    yarr.append(y)

is_ok = True
x0 = 0
y0 = 0
t0 = 0
for i in range(n):
    xi = xarr[i]
    yi = yarr[i]
    ti = tarr[i] - t0
    d = abs(xi-x0) + abs(yi-y0)
    if d > ti:
        is_ok = False
        break
    if ti % 2 == 1 and d % 2 == 0:
        is_ok = False
        break
    if ti % 2 == 0 and d % 2 == 1:
        is_ok = False
        break
    x0 = xi
    y0 = yi
    t0 = tarr[i]
    
if is_ok:
    print('Yes')
else:
    print('No')

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

nt = nx = ny = 0
for t,x,y in src:
    d = abs(nx-x) + abs(ny-y)
    if d <= t-nt and (t-nt)%2 == d%2:
        nt,nx,ny = t,x,y
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
def main():
    n = int(input())
    table = [list(map(int, input().split())) for _ in range(n)]
    ct = cy = cx = 0
    for t, x, y in table:
        dist = abs(y - cy) + abs(x - cx)
        time = t - ct
        if dist > time or (time - dist) % 2 != 0:
            print('No')
            return
        ct = t
        cy = y
        cx = x
    print('Yes')


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
t = [0]
x = [0]
y = [0]
for a in range(1,N+1):
    S = list(map(int,input().split()))
    t.append(S[0])
    x.append(S[1])
    y.append(S[2])
for b in range(0,N):
    t_dist = t[b+1] - t[b]
    x_dist = x[b+1] - x[b]
    y_dist = y[b+1] - y[b]
    step = abs(x_dist) + abs(y_dist)
    if t_dist - step >= 0 and (t_dist - step)%2 ==0:
        continue
    else:
        print('No')
        break
else:
    print('Yes')

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

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

def check(t, x, y):
    if t < (x + y):
        return False
    if t % 2 != (x+y) % 2:
        return False
    return True


ok = True
for t, x, y  in data:
    if not check(t, x, y):
        ok = False
        break
print('Yes') if ok else print('No')

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

flag=0
for i in range(n):
  t,x,y=[int(i) for i in input().split()]
  if t < x+y or (t+x+y)%2 == 1:
    flag=1
print('Yes' if flag==0 else 'No')

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

prevt, prevx, prevy = 0, 0, 0
t = True
for n in range(N):
  t, x, y = map(int, input().strip().split())
  if t - prevt >= abs(x-prevx) + abs(y-prevy) and (t-prevt) % 2 == (abs(x-prevx) + abs(y-prevy)) % 2:
    prevt, prevx, prevy = t, x, y
  else:
    t = False
    break

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

Solution (Python):
N = int(input())
L = [input() for i in range(N)]
for l in L:
  t, x, y = map(int, l.split(" "))
  flag_t = t %2 == 0
  flag_xy = (x+y) % 2 == 0
  if flag_t == flag_xy and (x+y) <= t:
    continue
  else:
    print("No")
    exit(0)
print("Yes")

Solution (Python):
import sys
input()
pt, px, py = 0, 0, 0
for ct, cx, cy in [map(int, e.split()) for e in sys.stdin]:
    d = (ct - pt) - abs(cx - px) - abs(cy - py)
    if d < 0 or d % 2 == 1:
        print('No')
        break
    pt, px, py = ct, cx, cy
else:
    print('Yes')

Solution (Python):
import sys
input()
pt, px, py = 0, 0, 0
for e in sys.stdin:
    ct, cx, cy = map(int, e.split())
    d = (ct - pt) - abs(cx - px) - abs(cy - py)
    if d < 0 or d % 2 == 1:
        print('No')
        break
    pt, px, py = ct, cx, cy
else:
    print('Yes')

Solution (Python):
import sys
input()
e = [[0, 0, 0]] + [list(map(int, e.split())) for e in sys.stdin]
for (t0, a0, b0), (t1, a1, b1) in zip(e, e[1:]):
    d = (t1 - t0) - abs(a1 - a0) - abs(b1 - b0)
    if d < 0 or d % 2 == 1:
        print('No')
        exit()
print('Yes')

Solution (Python):
import sys
input()
for e in sys.stdin:
    t, x, y = map(int, e.split())
    d = t - (x + y)
    if d < 0 or d % 2 == 1:
        print('No')
        exit()
print('Yes')

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

Solution (Python):
N = int(input())
L = [[0, 0, 0]] + [[int(i) for i in input().split()] for _ in range(N)]
YN = "Yes"
for i in range(N):
    a = (L[i + 1][0] - L[i][0])
    b = (abs(L[i + 1][1] - L[i][1]) + abs(L[i + 1][2] - L[i][2]))
    if b > a:
        YN = "No"
        break
    if a % 2 == 0 and b % 2 != 0:
        YN = "No"
        break
    if a % 2 != 0 and b % 2 == 0:
        YN = "No"
        break
print(YN)

Solution (Python):
n = int(input())
l = [input().split() for _ in range(n)]
ot = ox = oy = 0
can = True
for (t, x, y) in l:
    dt = int(t) - ot
    dist = abs(int(x) - ox) + abs(int(y) - oy)
    if dt < dist:
        can = False
    if (dist % 2 != dt % 2):
        can = False
    ox = int(x)
    oy = int(y)
    ot = int(t)

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

Solution (Python):
def movement(x0, y0 , t, x1, y1) :
    total = abs(x1 - x0) + abs(y1 - y0)
    if total <= t and (t - total) % 2 == 0 :
        return "Yes"
    else :
        return "No"

n = int(input())
plan = []
x0, y0 = 0, 0


for i in range(n) :
    plan.append(list(map(int, input().split(" "))))

for i in range(1,n) :
    plan[n-i][0] -= plan[n-1-i][0]

for i in range(n) :
    judge = movement(x0, y0, plan[i][0], plan[i][1], plan[i][2])
    if judge == "Yes" :
        x0, y0 = plan[i][1], plan[i][2]
    else :
        print(judge)
        break

if x0 == plan[n-1][1] and y0 == plan[n-1][2] :
    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
N = int(input())
for _ in range(N):
    t, x, y = map(int, input().split())
    if (t >= x + y) & ((t - (x + y)) % 2 == 0):
        continue
    print('No')
    sys.exit()
print('Yes')

Solution (Python):
import sys
N = int(input())
t, x, y = 0, 0, 0
for i in range(N):
    in_t, in_x, in_y = map(int, input().split())
    t = in_t - t
    x = abs(in_x - x)
    y = abs(in_y - y)
    if (t >= x + y) & ((t - (x + y)) % 2 == 0):
        continue
    print('No')
    sys.exit()
print('Yes')

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

Solution (Python):
n=int(input())
A=[]
for i in range(n):
  a,b,c=map(int,input().split())
  if a<b+c or (b+c)%2!=a%2:
    print("No")
    exit()
  A.append([a,b,c])
if n==1:
  print("Yes")
  exit()
for i in range(n-1):
  if not A[i+1][0]-A[i][0]>=A[i+1][2]+A[i+1][1]-A[i][1]-A[i][2]:
    print("No")
    exit()
print("Yes")