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())
ex_x = 0
ex_y = 0
ex_t = 0
for _ in range(N):
    t, x, y = map(int, input().split(' '))
    dist = abs(x - ex_x) + abs(y - ex_y)
    dt = t - ex_t
    if dist > dt:
        print('No')
        break
    if dist % 2 != dt % 2:
        print('No')
        break
else:
    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")
    	break
else:
    print("Yes")

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

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

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

for i in range(N):
    d = p[i+1][0] - p[i][0]
    diff = abs(p[i+1][1]-p[i][1]) + abs(p[i+1][2]-p[i][2])
    if d < diff or d % 2 != diff % 2:
        print('No')
        quit()
print('Yes')

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

t, x, y = 0, 0, 0

for i in range(N):
    tn, xn, yn = map(int, input().split())
    l = abs(x-xn) + abs(y-yn)
    if l > tn - t or (l - (tn - t)) % 2 == 1:
        print('No')
        exit()
    t, x, y = tn, xn, yn
print('Yes')

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

t = 0
x = 0
y = 0

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

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

print('Yes')

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

l=[list(map(int,input().split())) for i in range(n)]
l.insert(0,[0,0,0])
c=[]
for i in range(n):
  t=l[i+1][0]-l[i][0]
  x=l[i+1][1]-l[i][1]
  y=l[i+1][2]-l[i][2]

  if t >=abs(x+y):
    if t%2 == (x+y)%2:
      c.append("Y")
    else:
      print("No")
      c.append("N")
      break
  else:
    print("No")
    c.append("N")
    break

if not "N" in c:
  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())
txy = [[int(i) for i in input().split()] for j in range(N)]

txy.insert(0, [0, 0, 0])

for i in range(1, N+1):
    t = txy[i][0] - txy[i-1][0]
    x = abs(txy[i][1] - txy[i-1][1])
    y = abs(txy[i][2] - txy[i-1][2])
    dis = x + y
    if dis > t:
        print('No')
        sys.exit()
    if (t - dis) % 2:
        print('No')
        sys.exit()

print('Yes')

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

nx = 0
ny = 0
nt = 0
ans = "Yes"
for i in range(n):
  t,x,y = map(int, input().split())
  if ans == "Yes":
    if ((t - nt) % 2 == ((x-nx) + (y-ny)) % 2 and  ((x-nx) + (y-ny)) <= (t - nt)):
      nt = t
      nx = x
      ny = y
    else:
      ans = "No" 
  

print(ans)

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

curr = [0,0,0]
tf = 1

for t in n:
    plc = [int(x) for x in t]
    dif = plc[0]-curr[0] - (plc[1]-curr[1] + plc[2]-curr[2])
    if dif < 0 or dif % 2 != 0:
        tf = 0
        break

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

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

Solution (Python):
n=int(input())
tt,xx,yy=0,0,0
ans=0
for i in range(n):
  t,x,y=map(int,input().split())
  if (x-xx+y-yy)%2!=(t-tt)%2:
    ans=1
  if x-xx+y-yy>t-tt:
    ans=1
  tt,xx,yy=t,x,y
print("YNeos"[ans::2])

Solution (Python):
N = int(input())
 
t_prev, x_prev, y_prev = 0, 0, 0
for _ in range(N):
    t, x, y = [int(x) for x in input().split()]
    l = (t - t_prev) - ((x - x_prev) + (y - y_prev))
    if not (l >= 0 and l % 2 == 0):
        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) % 2 != t % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
N = int(input())
p = [list(map(int, input().split())) for _ in range(N)]
ans = True
for i in range(N):
    if p[i][1] + p[i][2] > p[i][0]:
        ans = False
        break
    if (p[i][1] + p[i][2]) % 2 != p[i][0] % 2:
        ans = False
        break
if ans:
    print("Yes")
else:
    print("No")

Solution (Python):

def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
n=I()
Q=[]
for i in range(n):
    Q.append(IL())
t,x,y=0,0,0
for i in range(n):
    tt=Q[i][0]-t
    tx=Q[i][1]-x
    ty=Q[i][2]-y
    if tx+ty<=tt and (tt-(tx+ty))%2==0:
        t,x,y=Q[i]
    else:
        print("No")
        break
else:
    print("Yes")

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

bool = True
for i in range(N):
    d_t = abs(t[i+1]-t[i])
    d_xy = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    if d_t < d_xy:
        bool = False
    elif d_t % 2 != d_xy % 2:
        bool = False

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

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

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

Solution (Python):
N = int(input())
t = [0] * (N + 1)
x = [0] * (N + 1)
y = [0] * (N + 1)
for i in range(1, N + 1):
    t[i], x[i], y[i] = map(int, input().split())
for i in range(1, N + 1):
    if t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        print('No')
        exit()
    elif t[i] % 2 != (x[i] + y[i]) % 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())
flag = True
for i in range(N):
    if not(t[i] >= x[i] + y[i] and (x[i] + y[i]) %2 == t[i] %2):
        flag = False
        
print('Yes') if flag else print('No')

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

for i in range(N):
    d = abs(txy[i+1][1] - txy[i][1]) + abs(txy[i+1][2] - txy[i][2])
    td = txy[i+1][0] - txy[i][0]
    if d > td:
        print("No")
        exit()
    if d % 2 == 0 and td % 2 == 1:
        print("No")
        exit()
    elif d % 2 == 1 and td % 2 == 0:
        print("No")
        exit()
print("Yes")

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())
is_able = 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:
    is_able = False
  if dt % 2 != dist % 2:
    is_able = False
  
if is_able:
  print("Yes")
else:
  print("No")

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

grid = [[0,0,0]]

for i in range(N):
  array = list(map(int, input().strip().split()))
  grid.append(array)
    
for h in range(N):
  bool = False
  t = 0
  x = 0
  y = 0
  t = grid[h+1][0] - grid[h][0]
  x = abs(grid[h+1][1] - grid[h][1])
  y = abs(grid[h+1][2] - grid[h][2])
  
  if grid[h+1][0] < 0 or grid[h+1][1] < 0 or grid[h+1][2] <0:
    break 

  if (t - x - y) % 2 == 0 and t >= x + y:
    bool = True
  
if bool:
  print("Yes")
else:
  print("No")

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(x-nx) + abs(y-ny) > t - nt or (t - nt) % 2 != (x-nx + y-ny) % 2:
        print('No')
        exit()
    nt, nx, ny = t, x, y
print('Yes')

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

flag = True

for i in range(n):
    if abs(L[i][1] + L[i][2])>L[i][0] or (L[i][1] + L[i][2])%2 != L[i][0]%2:
        flag=False
if flag:
    print('Yes')
else:
    print('No')

Solution (Python):

N =int(input())

List=[list(map(int,input().split())) for i in range(N)]
for i,l in enumerate(List):
    dt =List[i][0] - List[i-1][0]
    distance = abs(List[i][1] - List[i-1][1])+abs(List[i][2] - List[i-1][2])
        
    if i==0 and l[0] ==abs(l[1])+abs(l[2]):
        continue
    elif i==0 and l[0] !=abs(l[1])+abs(l[2]):
        print('No')
        exit()
    elif i!=0 and dt%2==distance%2 and distance<=dt:
        continue
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
n=int(input())
flag=True
ts=0
xs=0
ys=0
for i in range(n):
  te,xe,ye=map(int,input().split())
  if (te-ts)%2 == ((xe+ye)-(xs+ys))%2 and ((xe+ye)-(xs+ys))<=(te-ts):
    flag = True
  else:
    flag = False
    break;
  ts,xs,ys=te,xe,ye
if flag:
  print('Yes')
else:
  print('No')

Solution (Python):
n=int(raw_input())
t=[list(map(int,raw_input().split())) for i in range(n)]
flag=False
if n==1:
	if (t[0][1]+t[0][2])%2!=t[0][0]%2 or t[0][0]<t[0][1]+t[0][2]:
		flag=True
else:
	for i in range(n-1):
		dt=t[i+1][0]-t[i][0]
		dx=t[i+1][1]-t[i][1]
		dy=t[i+1][2]-t[i][2]
		if (dx+dy)%2!=dt%2 or dt<dx+dy:
			flag=True
			break

print "YNeos"[flag::2]

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

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

print('Yes')

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

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

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

print(judge)

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

flag = True
for i in range(len(l)-1):
    d = l[(i+1)][0] - l[i][0]
    d_x = l[(i+1)][1] - l[i][1]
    d_y = l[(i + 1)][2] - l[i][2]
    distance = abs(d_x)+abs(d_y)
    if distance > d:
        flag = False
    elif distance % 2 != d % 2:
        flag = False

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

Solution (Python):
n = int(input())
nl = set(range(n))
txy = [[0, 0, 0]]
ans = 'Yes'
for i in nl:
    txy.append(list(map(int, input().split())))
    tmp = [txy[i+1][k] - txy[i][k] for k in range(3)]
    time_diff = tmp[0]
    time_even_odd = 'Even' if time_diff % 2 == 0 else 'Odd'
    distance_diff = abs(tmp[1]) + abs(tmp[2])
    distance_even_odd = 'Even' if distance_diff % 2 == 0 else 'Odd'
    if (time_diff < distance_diff) or (distance_even_odd != time_even_odd):
        ans = 'No'
        break
print(ans)

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

flag = 'Yes'
for i in range(n):
    if (t[i][1] +t[i][2]) > t[i][0] or (t[i][1] + t[i][2]) % 2 != t[i][0] % 2:
        flag = 'No'
print(flag)

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

src_t = 0
src_x = 0
src_y = 0
success = True

for i in range(n):
    t, x, y = map(int, input().split(' '))
    if success == True:
        dt = t - src_t
        dist = abs(x - src_x) + abs(y - src_y)
        if dist <= dt and dist % 2 == dt % 2:
            src_t = t
            src_x = x
            src_y = y
            continue
        else:
            success = False

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

Solution (Python):
def main():
    N = int(input())
    t_x_ys = []
    for _ in range(N):
        t_x_ys.append(list(map(int, input().split())))
    
    t_x_yi_minus_1 = [0, 0, 0]
    for t_x_yi in t_x_ys:
        ti_minus_1, xi_minus_1, yi_minus_1 = t_x_yi_minus_1
        ti, xi, yi = t_x_yi
        delta_t = ti - ti_minus_1
        dis = abs(xi - xi_minus_1) + abs(yi - yi_minus_1)

        if delta_t < dis:
            print("No")
            return 
        elif delta_t == dis:
            t_x_yi_minus_1 = t_x_yi
            continue
        else:
            if (dis - delta_t) % 2:
                print("No")
                return 
            else:
               t_x_yi_minus_1 = t_x_yi
               continue
             
    print("Yes")

main()

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

prev_t = 0
prev_x = 0
prev_y = 0

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

    dt = t - prev_t
    dx = abs(x - prev_x)
    dy = abs(y - prev_y)
    dist = dx + dy

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

print('Yes')

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

r_init = [0, 0]
parity = 0 
for i in range(1, n+1):
    dt = t[i] - t[i-1]
    dx = abs(x[i] - x[i-1])
    dy = abs(y[i] - y[i-1])
    dist = dx + dy

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

print('Yes')

Solution (Python):
n=int(input())
txy=[[0, 0, 0]]+[list(map(int, input().split())) for i in range(n)]
def C(txy0, txy1):
    xx=txy1[1]-txy0[1]
    yy=txy1[2]-txy0[2]
    tt=txy1[0]-txy0[0]
    if xx+yy<=tt and (xx+yy-tt)%2==0:
        return True
    return False
if all(C(txy[i], txy[i+1]) for i in range(n)):
    print('Yes')
else:
    print('No')

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

r_init = [0, 0]
parity = 0 
for i in range(1, n+1):
    t_diff = t[i] - t[i-1]
    x_diff = abs(x[i] - x[i-1])
    y_diff = abs(y[i] - y[i-1])
    d_diff = x_diff + y_diff

    if d_diff > t_diff:
        print('No')
        exit()
    
    if (x[i] + y[i]) % 2 == 0:
        current_parity = 0
    else:
        current_parity = 1

    
    if t_diff % 2 == 0:
        
        if current_parity != parity:
            print('No')
            exit()
    else:
        
        if current_parity == parity:
            print('No')
            exit()

    parity = current_parity
    

print('Yes')

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

    if (t + x + y) % 2 == 1 or (x + y) > t:
        print("No")
        exit()

print("Yes")

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

for i in range(n):
    t_diff = txy[i+1][0] - txy[i][0]
    xy_diff = (txy[i+1][1] + txy[i+1][2]) - (txy[i][1] + txy[i][2])

    if t_diff % 2 != xy_diff % 2 or xy_diff > t_diff:
        print("No")
        exit()

print("Yes")

Solution (Python):
n = int(input())
xs = []

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

tx = [0, (0, 0)]
ans = True

for i in range(n):
    dxy = (abs(xs[i][1][0]-tx[1][0])+abs(xs[i][1][1]-tx[1][1]))
    dt = xs[i][0]-tx[0]
    if dxy == dt:
        tx = xs[i]
    elif dxy < dt and (dt - dxy) % 2 == 0:
        tx = xs[i]
    else:
        ans = False
        break

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

Solution (Python):
def main():
    N = int(input())
    st, sx, sy = 0, 0, 0
    ans = []
    for _ in range(N):
        nt, nx, ny = map(int, input().split())
        if (nx + ny - sx - sy) > (nt - st):
            ans.append(False)
            continue
        if (nx + ny - sx - sy) % 2 != (nt - st) % 2:
            ans.append(False)
            continue
        ans.append(True)
    print('YNeos'[not all(ans)::2])


main()

Solution (Python):
n = int(input())
point_f = (0, 0, 0)
for i in range(n):
  point = list(map(int, input().split()))
  diff = point[0] - point_f[0] - abs(point[1] + point[2] - point_f[1] - point_f[2])
  if (diff >= 0 and diff % 2 == 0):
    if i == n - 1:
      print("Yes")
    else:
      continue
  else:
    print("No")
    break

Solution (Python):
n = int(input())
T = [0] + [None] * n
X = [0] + [None] * n
Y = [0] + [None] * n
for i in range(1, n + 1):
  T[i], X[i], Y[i] = map(int, input().split())

for i in range(len(T) - 1):
  dt = T[i + 1] - T[i]
  dx = abs(X[i + 1] - X[i])
  dy = abs(Y[i + 1] - Y[i])
  if (dt % 2 != (dx + dy) % 2 or (dx + dy) > dt):
    print('No')
    exit()

print('Yes')

Solution (Python):
n = int(input())
T = [0] + [None] * n
X = [0] + [None] * n
Y = [0] + [None] * n
for i in range(1, n + 1):
  T[i], X[i], Y[i] = map(int, input().split())

for i in range(len(T) - 1):
  dt = T[i + 1] - T[i]
  dx = abs(X[i + 1] - X[i])
  dy = abs(Y[i + 1] - Y[i])
  if (not (dt % 2 == (dx + dy) % 2 and (dx + dy) <= dt)):
    print('No')
    exit()

print('Yes')

Solution (Python):
n = int(input())
T = [0] + [None] * n
X = [0] + [None] * n
Y = [0] + [None] * n
for i in range(1, n + 1):
  T[i], X[i], Y[i] = map(int, input().split())

for i in range(len(T) - 1):
  dt = T[i + 1] - T[i]
  dx = abs(X[i + 1] - X[i])
  dy = abs(Y[i + 1] - Y[i])
  if (dt % 2 == (dx + dy) % 2 and (dx + dy) <= dt):
    res = True
  else:
    print('No')
    exit()

print('Yes')

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

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

f = True

for i in range(0, n):
    l = abs(p[i][1] - p[i + 1][1]) + abs(p[i][2] - p[i + 1][2])
    dt = p[i + 1][0] - p[i][0]
    if l == 0 and dt == 1:
        f = False
        break
    if dt < l:
        f = False
        break
    else:
        if (dt - l) % 2 == 1:
            f = False
            break

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

Solution (Python):
N = int(input())
def travel():
    t, x, y = 0, 0, 0
    for _ in range(N):
        nt, nx, ny = map(int, input().split())
        dt = nt - t
        dist = abs(nx - x) + abs(ny - y)
        if dt < dist:
            return False
        if (dt % 2) == (dist % 2):
            t, x, y = nt, nx, ny
        else:
            return False
    return True

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

Solution (Python):
n=int(input())
X=[[0,0,0]]
for i in range(n):
    t,x,y=map(int,input().split())
    X.append([t,x,y])
ans='Yes'
for i in range(n):
    if (X[i+1][0]-X[i][0]-abs(X[i+1][1]-X[i][1])+abs(X[i+1][2]-X[i][2]))%2==1 or (X[i+1][0]-X[i][0]-abs(X[i+1][1]-X[i][1])-abs(X[i+1][2]-X[i][2]))<0:
        ans='No'
print(ans)

Solution (Python):
N=int(input())
listP = [[0,0,0]]
while True:
    try:
        listP.append(list(map(int,input().split())))
    except:
        break;

output = "Yes"

dxy=[0,0,0]
for t in range(N):
    for i in range(3):
        dxy[i] = listP[t+1][i]-listP[t][i]
    if (dxy[0] >= abs(dxy[1])+abs(dxy[2])) and ((dxy[0]-dxy[1]-dxy[2])%2 == 0) :
        continue
    else:
        output = "No"
        break

print(output)

Solution (Python):
N = int(input())
tmp = [[int(i) for i in input().split()] for i in range(N)]
tmp.insert(0, [0, 0, 0])
ans = 'Yes'

for i in range(N):
    t = tmp[i+1][0] - tmp[i][0]
    dx = abs(tmp[i+1][1] - tmp[i][1])
    dy = abs(tmp[i+1][2] - tmp[i][2])
    d = dx + dy
    if t < d \
    or t % 2 != d % 2:
        ans = 'No'
print(ans)

Solution (Python):
import sys


n = int(input())
c_now = [0, 0, 0]
for i in range(n):
    txy = list(map(int, input().split()))
    t = txy[0] - c_now[0]
    dis = abs(txy[1] - c_now[1]) + abs(txy[2] - c_now[2])
    if t < dis or (t - dis) % 2 != 0:
        print("No")
        sys.exit()
    c_now = txy
print("Yes")

Solution (Python):



import sys



N = int(input())


def solve(l):
  td,xd,yd = [0,0,0]
  for i in range(N):
    t,x,y = l[i]
    td,xd,yd = [t-td, abs(x-xd), abs(y-yd)]
    if td < xd+yd:
      return False
    elif (td - xd - yd) & 1 > 0:
      return False
  return True


txy = [[0 for j in range(3)] for i in range(N)]
for i in range(N):
  txy[i] = list(map(int, input().split()))

if solve(txy):
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
z_t = []*N
t0 = 0
x0 = 0
y0 = 0
ans = 'No'
for i in range(N):
    s = input().rstrip().split()
    z_t.append(s)

for i in range(N):
    dt = int(z_t[i][0]) - t0
    dx = abs(int(z_t[i][1]) - x0)
    dy = abs(int(z_t[i][2]) - y0)
    extra_t = dt - (dx+dy)
    if extra_t >=  0 and extra_t%2 == 0:
        t0 = int(z_t[i][0])
        x0 = int(z_t[i][1])
        y0 = int(z_t[i][2])
        if i == N-1:
            ans = 'Yes'
    else:
        break
print(ans)

Solution (Python):
n = int(input())
TXY = [list(map(int,input().split())) for _ in range(n)]
pret = 0
prex = 0
prey = 0
flag = True
for t,x,y in TXY:
    if t-pret < abs(x-prex)+abs(y-prey):
        flag = False
        break
    elif t-pret > abs(x-prex)+abs(y-prey)  and (abs(x-prex)+abs(y-prey))%2 != (t-pret)%2:
        flag = False
        break
    pret = t
    prex = x
    prey = y
if flag:
    print("Yes")
else:
    print("No")

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

can = True
for n in range(N):
    if x[n + 1] + y[n + 1] - x[n] - y[n] > t[n + 1] - t[n]:
        print("No")
        exit()
    elif (x[n + 1] + y[n + 1] - x[n] - y[n]) % 2 == (t[n + 1] - t[n]) % 2:
        pass
    else:
        can = False

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

Solution (Python):
N = int(input())
answer = 'Yes'
place_now = [0,0,0]
for i in range(N):
  place_next = list(map(int, input().split()))
  if place_next[0]-place_now[0] < place_next[1]+place_next[2]-place_now[1]-place_now[2]:
    answer = 'No'
    break
  elif (place_next[0]-place_now[0])%2 != (place_next[1]+place_next[2]-place_now[1]-place_now[2])%2:
    answer = 'No'
    break

print(answer)

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

def hantei(A,x):
  abs_0 = abs(A[0][1]) + abs(A[0][2])
  if A[0][0] < abs_0 or (A[0][0] - abs_0) % 2 != 0:
    return("No")
  for i in range(1, x):
    abs_i = abs(A[i][1] - A[i-1][1]) + abs(A[i][2] - A[i-1][2])
    if A[i][0] - A[i-1][0] < abs_i or (A[i][0] - A[i-1][0] - abs_i) % 2 != 0:
      return("No")
  return("Yes")

print(hantei(txy, N))

Solution (Python):
N = int(input())
f = True
for i in range(N):
    t, x, y = map(int, input().split())
    time_left = t - (x + y)
    if time_left < 0 or time_left % 2 != 0:
        f = False
        break
print('Yes' if f else 'No')

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

for i in range(n+1):
    if i == 0:
        continue
    t, x, y = txy[i-1]
    nt, nx, ny = txy[i]
    if abs(nx - x) + abs(ny - y) > nt - t:
        print("No")
        exit()
    if (abs(nx - x) + abs(ny - y)) % 2 != (nt - t) % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
n = int(input())
x, y = 0, 0
for _ in range(n):
  t, xnew, ynew = map(int, input().split())
  dist = abs(x - xnew) + abs(y - ynew)
  if dist > t or (dist - t) % 2 == 1:
    print("No")
    exit()
print("Yes")

Solution (Python):

import sys
input_ = sys.stdin.readline

n = int(input_())
t0, x0, y0 = 0, 0, 0

for i in range(n):
  ti, xi, yi = map(int, input_().split())
  test = (ti - t0) - (xi + yi - x0 - y0)
  
  if test >= 0 and test % 2 == 0:
    t0, x0, y0 = ti, xi, yi
    if i == n-1:
      print("Yes")
  else:
    print("No")
    break

Solution (Python):
n = int(input())
t0, x0, y0 = 0, 0, 0

for i in range(n):
  ti, xi, yi = map(int, input().split())
  test = (ti - t0) - (xi + yi - x0 - y0)
  
  if test >= 0 and test % 2 == 0:
    t0, x0, y0 = ti, xi, yi
    if i == n-1:
      print("Yes")
  else:
    print("No")
    break

Solution (Python):
n=int(input())
txy=[[int(i) for i in input().split()] for _ in range(n)]
ans='Yes'
for t,x,y in txy:
    if (x+y)%2!=t%2:
        ans='No'
        break
    if x+y>t:
        ans='No'
        break
print(ans)

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

def solve(x0,y0,x1,y1,t):
    if (t >= (abs(x1-x0) + abs(y0-y1))) and (((t -abs(x1-x0)-abs(y0-y1))%2)==0):
        return True
    else:
        return False
x0=0
y0=0
t0=0
for i in range(N):
    ti,xi,yi = map(int,input().split())
    if solve(x0,y0,xi,yi,ti-t0) == True:
        x0 = xi
        y0 = yi
        t0 = ti
    else:
        print("No")
        exit()

print("Yes")

Solution (Python):
N = int(input())
t_x_y = [(0, 0, 0)] + [tuple(map(int, input().split())) for _ in range(N)]
flag = True
for i in range(1, N + 1):
    d = t_x_y[i][0] - t_x_y[i-1][0] - abs(t_x_y[i][1] - t_x_y[i-1][1]) - abs(t_x_y[i][2] - t_x_y[i-1][2])
    if d < 0 or d % 2:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

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

for i in range(N):
    T[i], X[i], Y[i] = map(int, input().split())

def is_reachable(t, x, y):
    x, y = abs(x), abs(y)
    if t >= (x + y):
        if (t - x - y) % 2 == 0:
            return True
    return False

ans = 'No'
if is_reachable(T[0], X[0], Y[0]):
    ans = 'Yes'
    for i in range(N-1):
        t, x, y = T[i+1], X[i+1], Y[i+1]
        t, x, y = t - T[i], x - X[i], y - Y[i]
        if not is_reachable(t, x, y):
            ans = 'No'
            break
print(ans)

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

def canMove():
    for i in range(1, N+1):
        t = place[i][0] - place[i-1][0]
        x = place[i][1] - place[i-1][1]
        y = place[i][2] - place[i-1][2]
        if x + y <= t and (t -x-y)%2 == 0:
            continue
        else:
            return "No"
    return "Yes"

print(canMove())

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

Solution (Python):
n = int(input())
a = list(range(n))
for i in range(n):
    a[i] = list(map(int, input().split()))
dx = 0
dy = 0
c = 0
k = 0
for s in range(n):
    dx = a[s][1] - dx
    dy = a[s][2] - dy
    if((dx+dy)>a[s][0]):
        print("No")
        break
    if(((abs(dx)+abs(dy))%2) == ((a[s][0]-k)%2)):
        c += 1
        k += a[s][0]
    else:
        print("No")
        break
if(c == n):
    print("Yes")

Solution (Python):
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def pf(s): return print(s, flush=True)

N = I()
txy = []
for i in range(N):
    txy.append(LI())

txy = sorted(txy, key=lambda x:x[0])

count = 0
current = [0,0]
for item in txy:
    
    dist = abs(current[0] - item[1]) + abs(current[1] - item[2])
    if dist > item[0] - count:
        
        print('No')
        exit()
    elif dist == item[0] - count:
        
        count = item[0]
        current = [item[1], item[2]]
    else:
        
        rest = item[0] - count - dist
        count = item[0]
        current = [item[1], item[2]]
        
        if rest % 2 != 0:
            
            print('No')
            exit()
print("Yes")

Solution (Python):
import sys
N =int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
    tmp_t,tmp_x,tmp_y = map(int,input().split())
    t.append(tmp_t)
    x.append(tmp_x)
    y.append(tmp_y)
for i in range(1,N+1):
    distance = abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    if t[i]-t[i-1] < distance or (distance+(t[i]-t[i-1]))%2 != 0 :
        print('No')
        sys.exit()
print('Yes')

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

Solution (Python):
import sys
def check(t1,x1,y1,t2,x2,y2):
  if t2-t1<abs(x1-x2)+abs(y1-y2):
    return False
  if ((t2-t1)-abs(x1-x2)-abs(y1-y2))%2==0:
    return True
  return False
n=int(input())
data=[[int(i) for i in l.split()] for l in sys.stdin]
t1=0
x1=0
y1=0
for i in range(n):
  t2,x2,y2=data[i]
  if check(t1,x1,y1,t2,x2,y2):
    t1=t2
    x1=x2
    y1=y2
  else:
    print('No')
    exit()
print('Yes')

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

def can_move(fr, to):
    from_t, from_x, from_y = fr
    to_t, to_x, to_y = to
    dist = abs(from_x - to_x) + abs(from_y - to_y)
    time = to_t - from_t
    if dist > time:
        return False
    return time%2 == dist%2

before_txy = (0, 0, 0)
for txy in txyn:
    if not can_move(before_txy, txy):
        print("No")
        break
    before_txy = txy
else:
    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())

def travel(x,y,t):
    if abs(t-t_st) >= abs(x-x_st) + abs(y-y_st) and abs(t-t_st) % 2 == (abs(x-x_st) + abs(y-y_st)) % 2:
        return True
    else:
        return False

t_st = 0
x_st = 0
y_st = 0

ans = travel(x[0],y[0],t[0])

for i in range(1,n):
    x_st = x[i-1]
    y_st = y[i-1]
    t_st = t[i-1]
    if travel(x[i],y[i],t[i]):
        pass
    else:
        ans = False

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

Solution (Python):
import sys
N = int(input())
t, x, y = 0, 0, 0
for i in range(N):
    T, X, Y = map(int, input().split())
    if abs(X-x)+abs(Y-y) <= T-t and ((T-t)-(abs(X-x)+abs(Y-y)))%2 == 0:
        t, x, y = T, X, Y
    else:
        print('No')
        sys.exit()
print('Yes')