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

for i in range(N):
  d = abs(Sorted[i+1][1] - Sorted[i][1]) + abs(Sorted[i+1][2] - Sorted[i][2])
  t = Sorted[i+1][0] - Sorted[i][0]
  if  d > t or d % 2 != t % 2:
    print("No")
    break
else:
  print("Yes")

Solution (Python):
N = int(input())
X, Y, T = 0, 0, 0
flag = True

for _ in range(N):
    t, x, y = map(int, input().split())
    duration = t - T
    x_diff = x - X
    y_diff = y - Y
    if abs(x_diff) + abs(y_diff) > duration:
        flag = False
    if (x_diff + y_diff + duration)%2:
        flag = False
    X = x
    Y = y
    T = t
        
if flag:
    print("Yes")
else:
    print("No")

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

old_t = 0
old_x = 0
old_y = 0

for _ in range(N):
    t, x, y = list(map(int, input().split()))
    rest_t = t - old_x
    diff = abs(x - old_x) + abs(y - old_y)
    if (rest_t < diff) or (old_t - t + old_x - x + old_y -y) % 2 != 0:
        print("No")
        exit()
    old_t = t
    old_x = x
    old_y = y

print("Yes")

Solution (Python):
t = [0]
x = [0]
y = [0]
n = int(input())
for i in range(n):
    ti, xi, yi = map(int, input().split())
    t.append(ti)
    x.append(xi)
    y.append(yi)
    
flg=True
for i in range(1, n+1):
    if((x[i]-x[i-1])+(y[i]-y[i-1])>(t[i]-t[i-1])):
        flg=False
    elif(((x[i]-x[i-1])+(y[i]-y[i-1]))%2!=(t[i]-t[i-1])%2):
        flg=False
if(flg):
    print("Yes")
else:
    print("No")

Solution (Python):
















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

pos = [0,0]
time = 0
for row in rows:
    t,x,y = row
    tt = t - time
    xx = abs(x-pos[0])
    yy = abs(y-pos[1])
    num = tt-(xx+yy)
    if num>=0 and num%2==0:
        pos = [x,y]
        time = t
    else:
        print("No")
        exit()

print("Yes")

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

for t, x, y in txy:
    dist = x + y
    if t < dist or t % 2 != dist % 2:
        print('No')
        exit()
print('Yes')

Solution (Python):
def myAnswer(N:int, txy:list) -> str:
   prex = 0
   prey = 0
   pret = 0
   for t,x,y in txy:
      xy =abs(x - prex)+abs(y - prey)
      if(xy > (t -pret) or  xy % 2 != (t - pret) % 2):
         return "No"
      else:
         prex = x
         prey = y
         pret = t
   return "Yes"

def modelAnswer():
   return
def main():
   N = int(input())
   txy = []
   for _ in range(N):
      txy.append(list(map(int,input().split())))
   print(myAnswer(N,txy[:]))
if __name__ == '__main__':
   main()

Solution (Python):
num_list=int(input())
a=[0,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and dt%2==d%2:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break

Solution (Python):
n = int(input())
location = [[0]*3]*n

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



for i in range(n):
    if location[i][1] + location[i][2] > location[i][0]:
        print("No")
        flag = False
        break
    elif location[i][0] % 2 != (location[i][1] + location[i][2]) % 2:
        print("No")
        flag = False
        break
    else:
        flag = True

if flag:
    print("Yes")

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
flag = True
for i in range(n):
    t,x,y = iim()
    if x+y > t or t%2 != (x+y)%2:
        flag = False

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

Solution (Python):
import sys

IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))

INIT_VAL = 0
DP2 = lambda d1,d2: [[INIT_VAL]*d2 for _ in range(d1)]
DP3 = lambda d1,d2,d3: [[[INIT_VAL]*d3 for _ in range(d2)] for _ in range(d1)]

DIVC = lambda x,y: -(-x//y)
DIVF = lambda x,y: x//y

def main():
    n = II()
    now_t = 0
    now_x = now_y = 0
    for i in range(n):
        t, x, y = MII()
        dt = t - now_t
        dx = x - now_x
        dy = y - now_y
        if dx+dy > dt: print('No'); return None
        if (dx+dy)%2 != dt%2: print('No'); return None
    print('Yes')

if __name__ == '__main__':
    main()

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

arrive = True
pre_spot = [0, 0, 0]
for spot in route:
    cost = abs(spot[1] - pre_spot[1]) + abs(spot[2] - pre_spot[2])
    time = spot[0] - pre_spot[0]
    if (time - cost < 0) or ((time - cost) % 2 != 0):
        arrive = False
        break

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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    def d(C0,C1):
        return abs(C0[0]-C1[0])+abs(C0[1]-C1[1])
    N=int(input())
    t=[0]*(N+1)
    C=[[0,0] for _ in range(N+1)]
    for i in range(1,N+1):
        t[i],C[i][0],C[i][1]=map(int,input().split())
    for i in range(N):
        a=d(C[i],C[i+1])
        if a<=t[i+1]-t[i] and a%2==(t[i+1]-t[i])%2:
            continue
        else:
            print('No')
            exit()
    print('Yes')

if __name__ == '__main__':
    main()

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

s=0
for i in range(1,N+1):
  x=abs(L[i][1]-L[i-1][1])
  y=abs(L[i][2]-L[i-1][2])
  t=L[i][0]-L[i-1][0]
  if x+y>t or (t-x-y)%2==1:
    s=1
    break

print("Yes" if s==0 else "No")

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

for i in range(N): 
    if i ==0:
        t0,x0,y0=0,0,0
        t1,x1,y1=t[0],x[0],y[0]
    else:
        t0,x0,y0=t[i-1],x[i-1],y[i-1]
        t1,x1,y1=t[i],x[i],y[i]
    dt=t1-t0
    dx=x1-x0
    dy=y1-y0
    if (dx+dy)%2==0 and (dt%2)==0 and (dx+dy)<=dt:
        
        continue
    elif (dx+dy)%2==1 and (dt%2)==1 and (dx+dy)<=dt:
        
        continue
    else:
        print("No")
        break
else:
    print("Yes")

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

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

for i in range(N) :
	t_t, t_x, t_y = [int(i) for i in input().split()]
	t.append(t_t)
	x.append(t_x)
	y.append(t_y)

output = 'Yes'

p_t, p_x, p_y = [0,0,0]

for i in range(N) :
	time = t[i] - p_t
	dis_x = x[i] - p_x
	dis_y = y[i] - p_y
	time -= ( abs(dis_x) + abs(dis_y) )
	if ( time < 0 ) or ( time % 2 != 0 ) :
		output = 'No'
		break
	p_t = t[i]
	p_x = x[i]
	p_y = y[i]

print(output)

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

txylist=[]
old_t,old_x,old_y=0,0,0
for i in range(N):
  t,x,y=map(int,input().split())
  txylist.append((t-old_t,abs(x-old_x),abs(y-old_y)))
  old_t,old_x,old_y=t,x,y


for t,x,y in txylist:
  if t%2!=(x+y)%2:
    print("No")
    break
  elif t<x+y:
    print("No")
    break
else:
  print("Yes")

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

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

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

Solution (Python):
N = int(input())
t = [list(map(int, input().split())) for i in range(N)] 
t.insert(0, [0,0,0]) 
flag = True
for i in range(N):
    dt = t[i+1][0] - t[i][0]
    dist = abs(t[i+1][1]-t[i][1]) + abs(t[i+1][2]-t[i][2])
    if dt < dist:
        flag = False
    if dt%2!=dist%2:
        flag = False
print('Yes' if flag else 'No')

Solution (Python):
n = int(input())
a,b,c = 0,0,0
for i in range(n):
  d,e,f = map(int,input().split())
  time = d-a
  kyori = (e-b)+(f-c)
  if time>=kyori and (time-kyori)%2==0:
     a,b,c = d,e,f
  else:
    print("No")
    break
else:
  print("Yes")

Solution (Python):

n = int(input())

pre_x, pre_y = 0, 0
pre = 0
trip = []
for _ in range(n):
    t, x, y = map(int, input().split())
    trip.append((t, x, y))
for t, x, y in trip:
    d = abs(x - pre_x) + abs(y - pre_y)
    if d <= (t - pre) and d % 2 == (t - pre) % 2:
        pre, pre_x, pre_y = t, x, y
        continue
    else:
        print('No')
        break
else:
    print('Yes')

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

now_t = now_x = now_y = 0

can = True
for i in range(N):
    t, x, y = map(int, input().split())
    time = t - now_t
    dist = abs(now_x - x) + abs(now_y - y)
    if dist > time:
        can = False
    if not dist % 2 == time % 2:
        can = False
    now_t = t
    now_x = x
    now_y = y

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

Solution (Python):


import io

array = [1]

def tommy(numbers):
  t, x, y = map(int, numbers.split())
  time_x = t - x
  time_y = time_x - y
  if time_y%2 == 0 and time_y >=0:
    array.append(1)
  else:
    array.append(-1)

data = int(input())

counter = 0

while counter < data:
  tommy(input())
  counter += 1

if array.count(1) == data+1:
  print('Yes')
else:
  print('No')

Solution (Python):
from sys import stdin
import sys

data = []

N = int(stdin.readline().rstrip())
for i in range(0, N):
    data.append(stdin.readline().rstrip().split())

cur_t = 0
cur_x = 0
cur_y = 0

for i in range(0, len(data)):
    (next_t, next_x, next_y) = data[i]
    next_t = int(next_t)
    next_x = int(next_x)
    next_y = int(next_y)

    sub_t = next_t - cur_t
    sub_x = abs(next_x - cur_x)
    sub_y = abs(next_y - cur_y)

    if sub_t < sub_x + sub_y:
        print('No')
        sys.exit()

    if sub_t % 2 != (sub_x + sub_y)%2:
        print('No')
        sys.exit()

    cur_t = next_t
    cur_x = next_x
    cur_y = next_y

print('Yes')

Solution (Python):
from sys import stdin
import sys

data = []

N = int(stdin.readline().rstrip())
for i in range(0, N):
    data.append(stdin.readline().rstrip().split())

cur_t = 0
cur_x = 0
cur_y = 0

for i in range(0, len(data)):
    (next_t, next_x, next_y) = data[i]
    next_t = int(next_t)
    next_x = int(next_x)
    next_y = int(next_y)

    sub_t = next_t - cur_t
    sub_x = abs(next_x - cur_x)
    sub_y = abs(next_y - cur_y)
    
    
    
    

    
    
    if sub_t < sub_x + sub_y:
        print('No')
        sys.exit()

    if sub_t % 2 != (sub_x + sub_y)%2:
        print('No')
        sys.exit()



    cur_t = next_t
    cur_x = next_x
    cur_y = next_y

print('Yes')

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

Solution (Python):
N=int(input())
schedule=[list(map(int,input().split()))for i in range(N)]
move_time =0
dist=0
res=0
move_time = schedule[0][0]
dist= schedule[0][1]+schedule[0][2]
if move_time<dist:
	res=1
for time in range(N-1):
	move_time=schedule[time+1][0]-schedule[time][0]
	dist = abs((schedule[time+1][1]-schedule[time][1]))+abs((schedule[time+1][2]-schedule[time][2]))
	if dist>move_time:
		res=1
		break
	if schedule[time][0]%2==0 and (schedule[time][1]+schedule[time][2])%2!=0:
		res=1
	elif schedule[time][0]%2==1 and (schedule[time][1]+schedule[time][2])%2!=1:
		res=1
if res ==1:
	print('No')
else:
	print('Yes')

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    n = int(input())
    mat = [list(map(int, readline().split())) for _ in range(n)]
    ct, cx, cy = 0, 0, 0

    for nt, nx, ny in mat:
        dist = abs(nx - cx) + abs(ny - cy)
        interval = nt - ct

        if dist > (nt - ct) or (dist - interval) % 2 == 1:
            print('No')
            sys.exit()
        ct, cx, cy = nt, nx, ny

    print('Yes')


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
p_t, p_x, p_y = 0, 0, 0

available = True

for i in range(n) :
	t, x, y = map(int, input().split())
	judge = (t - p_t) - ( abs(x - p_x) + abs(y - p_y) )
	if judge < 0 or judge % 2 != 0 :
		available = False
		break
	p_t, p_x, p_y = t, x, y

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

Solution (Python):
N=int(input())
t =[0]*N
x =[0]*N
y =[0]*N
for i in range(0,N):
    t[i],x[i],y[i] =map(int,input().split())
check=0
d=0
if abs(x[0])+abs(y[0])>t[0] or (abs(x[0])+abs(y[0]))%2!=(t[0])%2:
    check=1
if check==1:
    print('No')
    d=1
for i in range(1,N):
    if d==1:
        break
    check=0
    if abs(x[i]-x[i-1])+abs(y[i]-y[i-1])>t[i]-t[i-1] or (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2!=(t[i]-t[i-1])%2:
        check=1
    if check==1:
        print('No')
        d=1
        break
if d!=1:
    print('Yes')

Solution (Python):
def main():
  N = int(input())
  A = [[int(_) for _ in input().split()] for __ in range(N)]
  t0 = x0 = y0 = 0
  for a in A:
    t, x, y = a
    if (t - t0 < abs(x - x0) + abs(y - y0)) or (t%2 == 0 and (x + y)%2 == 1) or (t%2 == 1 and (x + y)%2 == 0):
      print('No')
      break
    t0, x0, y0 = t, x, y
  else:
    print('Yes')
  return

if __name__ == '__main__':
  main()

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

    for i in range(n):
        if i == 0:
            b_t = 0
            b_x = 0
            b_y = 0
        dist = abs(X[i] - b_x) + abs(Y[i] - b_y)
        time = T[i] - b_t

        if time < dist:
            print('No')
            return
        m = time % dist
        if m % 2 != 0:
            print('No')
            return
        b_t = T[i]
        b_x = X[i]
        b_y = Y[i]
    print('Yes')
if __name__ == '__main__':
    main()

Solution (Python):
import math
N=int(input())
C=[0,0,0]
for i in range(N):
  B=C
  C=list(map(int,input().split()))
  x=abs(B[1]-C[1])
  y=abs(B[2]-C[2])
  t=abs(B[0]-C[0])
  if x+y>t or (t-x-y) % 2 != 0:
    print('No')
    break
else:
  print('Yes')

Solution (Python):
import sys
input=sys.stdin.readline
















N = int(input())
txy = [list(map(int,input().split())) for _ in range(N)]
t = 0
x = 0
y = 0
j = 0
for i in range(N):
    a = abs(txy[i][1]-x) + abs(txy[i][2]-y)
    b = txy[i][0]-t
    x = txy[i][1]
    y = txy[i][2]
    t = txy[i][0]
    if b >= a and (b-a) % 2 == 0:
        continue
    else:
        j = 1
        break
if j == 0:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

def main():
    N = int(input())
    t, x, y = 0, 0, 0

    for _ in range(N):
        next_t, next_x, next_y = [int(__) for __ in input().split()]

        delta_t = next_t - t
        distance = abs(next_x - x) + abs(next_y - y)

        if distance > delta_t:
            print("No")
            sys.exit()

        if (delta_t - distance) % 2 != 0:
            print("No")
            sys.exit()

        t, x, y = next_t, next_x, next_y

    print("Yes")

main()

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

f = True
for i in range(N):
    dt = t[i+1] - t[i]
    dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    if dt < dist:
        f = False
    if dist%2 != dt%2:
        f = False

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

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

print('Yes')

Solution (Python):
n = int(input())
ti,xi,yi = [0],[0],[0]
ans = 'No'

for ni in range(n):
 t,x,y = [int(x) for x in input().split()]
 ti.append(t)
 xi.append(x)
 yi.append(y)

for i in range(n):
  dt = ti[i+1] - ti[i]
  dx = xi[i+1] - xi[i]
  dy = yi[i+1] - yi[i]

  if dt < abs(dx)+abs(dy):
    break

  odev1 = (xi[i]+yi[i])%2
  odev2 = (xi[i+1]+yi[i+1])%2

  if dt%2 == 0:
    if odev1 != odev2:
      break
  else:
    if odev1 == odev2:
      break
  if i == n-1:
    ans = 'Yes'

print(ans)

Solution (Python):
import sys
N = int(input())
pre_t, pre_x, pre_y = 0, 0, 0
for _ in range(N):
    tmp_t, tmp_x, tmp_y = map(int,input().split())
    t, x, y = tmp_t - pre_t, tmp_x - pre_x, tmp_y - pre_y
    pre_t, pre_x, pre_y = tmp_t, tmp_x, tmp_y
    if x >= 0:
        if y >= 0 and not (x + y <= t and (x + y - t) % 2 == 0):
            print('No')
            sys.exit()
        elif y < 0 and not (x - y <= t and (x + y - t) % 2 == 0):
            print('No')
            sys.exit()
    else:
        if y >= 0 and not (y - x <= t and (x + y - t) % 2 == 0):
            print('No')
            sys.exit()
        elif y < 0 and not (- x - y <= t and (x + y - t) % 2 == 0):
            print('No')
            sys.exit()
print('Yes')

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

flag = True
px, py = 0, 0
for i in range(n):
    t, x, y = txy[i]
    d = abs(x-px) + abs(y-py)
    if d <= t:
        if d % 2 != t % 2:
            flag = False
    else:
        flag = False

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

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

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

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

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

Solution (Python):
import sys
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
x = 0
y = 0
t = 0
for i in range(n):
    if abs(a[i][1] - x) + abs(a[i][2] - y) > abs(a[i][0] - t) or (a[i][1] - x + a[i][2] - y) % 2 != (a[i][0] - t) % 2:
        print('No')
        sys.exit()
    else:
        x = a[i][1]
        y = a[i][2]
        t = a[i][0]
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())

ans = "Yes"
for i in range(N):
  dd = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  dt = t[i+1] - t[i]
  if dt < dd:
    ans = "No"
  elif (dd - dt) % 2 != 0:
    ans = "No"
print(ans)

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

Solution (Python):



N = int(input())
prev_dst = [0,0,0]

for n in range(N):
    t, x, y = map(int, input().split(" "))
    a = (t - prev_dst[0]) - (abs(prev_dst[1]-x) + abs(prev_dst[2]-y))
    if a >= 0 and a % 2 == 0:
        prev_dst = [t, x, y]
    else:
        print("No")
        exit(0)

print("Yes")

Solution (Python):



import numpy as np

N = int(input())
prev_dst = [0,0,0]

for n in range(N):
    t, x, y = map(int, input().split(" "))
    a = (t - prev_dst[0]) - (np.abs(prev_dst[1]-x) + np.abs(prev_dst[2]-y))
    if a >= 0 and a % 2 == 0:
        prev_dst = [t, x, y]
    else:
        print("No")
        exit(0)

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

ans = "Yes"
for i in range(N):
  dd = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  dt = t[i+1] - t[i]
  if dt < dd:
    ans = "No"
  elif (dd - dt) % 2 != 0:
    ans = "No"
print(ans)

Solution (Python):



def judge(b_point, a_point):
    b_point = list(map(int, b_point.split()))
    a_point = list(map(int, a_point.split()))

    t = a_point[0] - b_point[0]
    x_b = b_point[1]
    x_a = a_point[1]
    y_b = b_point[2]
    y_a = a_point[2]

    distance = abs(x_a - x_b) + abs(y_a - y_b)
    if distance > t:
        return 0
    elif (t -distance) % 2 == 0:
        return 1
    else:
        return 0


def main():
    N = int(input())
    points = ["0 0 0"]
    points.extend([input() for i in range(N)])
    for i, point in enumerate(points):
        if i+1 == len(points):
            break
        else:
            if judge(points[i],points[i+1]):
                continue
            else:
                print("No")
                return
    print("Yes")


if __name__ == "__main__":
    main()

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

def check_distance(move_distance, move_time):
  buf_result = False

  if move_time >= move_distance:
    buf_val = move_time - move_distance

    if buf_val % 2 == 0:
      buf_result = True

  return buf_result

current_posi = [0, 0]
next_posi = []

current_time = 0
next_time = 0

result = False

for i in range(n):
  input_i = list(map(int, input().split()))
  next_time = input_i[0]
  next_posi = [input_i[1], input_i[2]]

  move_distance = abs(current_posi[0] - next_posi[0]) + abs(current_posi[1] - next_posi[1])

  move_time = next_time - current_time

  result = check_distance(move_distance, move_time)

  if result == False:
    break
  else:
    current_time = input_i[0]
    current_posi = [input_i[1], input_i[2]]


if result == False:
  print("No")
else:
  print("Yes")

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

Solution (Python):
def is_ok(a, b):
    d = abs(b[1]- a[1]) + abs(b[2] - a[2]) - (b[0] - a[0])
    if d <= 0 and d % 2 == 0:
        return True
    else:
        return False

N = int(input())
L = [[] for i in range(N + 1)]

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

ans = 'Yes'
for i in range(N):
    if not is_ok(L[i], L[i + 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 (t + x + y)%2 != 0:
        print("No")
        exit()
print("Yes")

Solution (Python):
n=int(input())
T,X,Y=0,0,0

a='Yes'
for i in range(n):
    t,x,y=map(int,input().split())
    if abs(x-X)+abs(y-Y)>t-T or t%2!=(x+y)%2:
        a='No'
        break
    T,X,Y=t,x,y
print('{}'.format(a))

Solution (Python):
n=int(input())
T,X,Y=0,0,0

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

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

Solution (Python):
N=int(input())
last_t,last_x,last_y=0,0,0
for _ in range(N):
    t,x,y = map(int,input().split())
    move = abs(x-last_x)+abs(y-last_y)
    time = t - last_t
    if (time >= move) and (time - move) % 2 == 0:
        last_t,last_x,last_y=t,x,y
    else:
        print("No")
        break
else:
    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())
for _ in range(N):
    t, x, y = map(int, input().split())
    if x + y > t or (t + x + y)%2 != 0:
        print("No")
        exit()
print("Yes")

Solution (Python):
import sys
input = sys.stdin.readline
n = int(input().strip())
t = 0
x = 0
y = 0
ans = "Yes"
for _ in range(n):
  tn,xn,yn = map(int,input().split())
  if tn%2 != (xn+yn)%2 or abs(xn-x)+abs(yn-y) > (tn - t):
    ans = "No"
    break
print(ans)

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())
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
if count==N:
    print('Yes')
else:
    print('No')

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

T = 0
X = 0
Y = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if (t - T) < abs(x-X) + abs(y-Y) or ((t - T) + abs(x-X) + abs(y-Y))%2 == 1:
        print("No")
        break
    T = t
    X = x
    Y = y
else:
    print("Yes")

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

T = 0
X = 0
Y = 0
for i in range(N):
    t, x, y = map(int, input().split())
    if ((t - T) + abs(x-X) + abs(y-Y))%2 == 1 or (t - T) < abs(x-X) + abs(y-Y):
        print("No")
        break
else:
    print("Yes")

Solution (Python):
n = int(input())
d = dict()
d[0] = [0,0,0]
can = True
for i in range(n):
    l = list(map(int, input().split()))
    d[i+1] = l

for j in range(n):
    
    t = d[j+1][0]-d[j][0]
    x = d[j+1][1]-d[j][1]
    y = d[j+1][2]-d[j][2]
    
    c = t - (abs(x) + abs(y))
    
    if c < 0 or c%2 == 1:
        can = False
        break
        
if can:
    print("Yes")
else:
    print("No")

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

xnow, ynow = 0, 0
tnow = 0
ans = "Yes"
for m in M:
    t, x, y = m
    min_len = abs(x - xnow) + abs(y - ynow)
    time_len = t - tnow
    if time_len >= min_len:
        if (time_len - min_len) % 2 == 0:
            xnow, ynow = x, y
            tnow = t
            continue
        else:
            ans = "No"
            break
    else:
        ans = "No"
        break

print(ans)

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

P = [[0, 0, 0]]

ans = 'Yes'

for i in range(N):
    l = list(map(int, input().split()))
    P.append(l)

for i in range(N):
    c = P[i+1][0] - P[i][0]
    d = abs(P[i+1][1] - P[i][1]) + abs(P[i+1][2] - P[i][2])

    if c % d != 0:
        ans = 'No'
        break

print(ans)

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

Solution (Python):

import sys
import numpy as np

def main():
    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")
    

        


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): 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 LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline

N = I()
prev_t = 0
prev_x = 0
prev_y = 0
flag = True
for i in range(N):
    t,x,y = map(int,input().split())
    t = t-prev_t
    if abs(x-prev_x)+abs(y-prev_y) > t:
        flag = False
        break
    elif (abs(x-prev_x)+abs(y-prev_y)) %2 != t%2:
        flag = False
        break
    prev_t = t+prev_t
    prev_x = x
    prev_y = y
print('Yes' if flag else 'No')

Solution (Python):
N = int(input())
l = [[] for _ in range(N)]
for i in range(N):
    l[i] = list(map(int,(input().split())))
l.append([0,0,0])
for i in range(N):
    dt = l[i][0] - l[i-1][0] 
    dx = abs(l[i][1] - l[i-1][1])
    dy = abs(l[i][2] - l[i-1][2])
    d = dx + dy
    if d > dt:
        print("No")
        break
    else:
        if (d-dt)%2 == 1:
            print("No")
            break
else:
    print("Yes")

Solution (Python):
N = int(input())
D = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
for i in range(1, N + 1):
  t = D[i][0] - D[i - 1][0]
  d = D[i][1] - D[i - 1][1] + D[i][2] - D[i - 1][2]
  if (t < d) or (t % 2 != d % 2):
    print('No')
    break
else:
  print('Yes')

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

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

    if dt<abs(dx)+abs(dy):
        print("No")
        exit()

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

print("Yes")

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

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

    if dt<abs(dx)+abs(dy):
        print("No")
        exit()

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

print("Yes")