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())
tt = []
xx = []
yy = []
for i in range(n):
    t,x,y = map(int,input().split())
    tt.append(t)
    xx.append(x)
    yy.append(y)
ans = "Yes"

for i in range(n):
    if i == 0:
        dist = xx[i] + yy[i]
        time = tt[i]
    else:
        dist = abs(xx[i]-xx[i-1]) + abs(yy[i]-yy[i-1])
        time = tt[i]-tt[i-1]
    if time < dist or (time - dist)%2 != 0:
        ans = "No"
        break

print(ans)

Solution (Python):

N = int(input())
flag = True
for i in range(N):

    t,x,y = map(int, input().split())

    if x+y>t or t%2 !=(x+y)%2:
        flag=False
        break

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

Solution (Python):

n=int(input())
flag=True
for i in range(n):
    t,x,y=map(int,input().split())
    if x+y>t or t%2!=(x+y)%2:
        flag=False
        break
print("Yes" if flag else "No")

Solution (Python):
n = int(input())
t, x, y = 0,0,0
for _ in range(n):
    next_t, next_x, next_y = map(int, input().split())
    diff = abs(next_x - x) + abs(next_y - y)
    if ((next_t - t) < diff) or (diff - (next_t - t)) % 2 ==1:
        print('No')
        exit()
print('Yes')

Solution (Python):
t, x, y = 0, 0, 0
for i in range(int(input())):
  next_t, next_x, next_y = map(int, input().split())
  diff = abs(x - next_x) + abs(y - next_y)

  if diff > (next_t - t) or (diff - (next_t - t)) % 2 == 1:
    print("No")
    exit(0)
  t, x, y = next_t, next_x, next_y
print("Yes")

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

t0, x0, y0 = 0, 0, 0
for _ in range(N):
    t, x, y = map(int, input().split())
    dt = t - t0
    dx = x - x0
    dy = y - y0
    dxy = abs(dx) + abs(dy)  
    if dt%2 == dxy%2 and dxy <= dt :
        t0, x0, y0 = t, x, y
    else:
        print('No')
        break
else:
    print('Yes')

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

t0, x0, y0 = 0, 0, 0
for _ in range(N):
    t, x, y = map(int, input().split())
    dt = t - t0
    dx = x - x0
    dy = y - y0
    dxy = abs(dx) + abs(dy)  
    isEvenOdd = (dt%2 == 0 and dxy%2 == 0) or (dt%2 != 0 and dxy%2 != 0)
    if isEvenOdd and dxy <= dt :
        t0, x0, y0 = t, x, y
    else:
        print('No')
        break
else:
    print('Yes')

Solution (Python):
import sys
readline = sys.stdin.readline
N = int(readline())
t = []
x = []
y = []
for i in range(N):
    _t, _x, _y = list(map(int, readline().split()))
    t.append(_t)
    x.append(_x)
    y.append(_y)

p = [0, 0]
pt = 0
px = 0
py = 0
f = True
for i in range(N):
    a = t[i] - pt
    b = abs(px - x[i]) + abs(py - y[i])
    
    if a < b or (a % 2 != b % 2):
        f = False
        break
    px = x[i]
    py = y[i]
    pt = t[i]

if f == True:
    print('Yes')
else:
    print('No')

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

result = "Yes"

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

for i in range(n + 1):
    if i == 0:
        continue
    time = t[i] - t[i-1]
    kyori = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])
    if time < kyori:
        result = "No"
        break
    elif t[i] % 2 != (x[i] + y[i]) % 2:
        result = "No"
        break

print(result)

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



l = len(p_list)

for i in range(l):
        if p_list[i][0] < (p_list[i][1] + p_list[i][2]) or p_list[i][0] % 2 != (p_list[i][1] + p_list[i][2]) % 2:
                print('No')
                exit(0)
        for j in range(3):
                if i != l-1:
                        p_list[i+1][j] -= p_list[i][j]

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(1,n+1):
    time_diff = t[i] - t[i-1]
    x_diff = abs(x[i] - x[i-1])
    y_diff = abs(y[i] - y[i-1])
    if (time_diff < x_diff+y_diff or (time_diff-x_diff-y_diff)%2 != 0):
        ans = 'No'

print(ans)

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())
    if (t[i] - t[i-1]) < abs(x[i] - x[i-1]) + abs(y[i] - y[i-1]): 
        print("No")
        break
    elif t[i]%2 != (x[i]+y[i])%2: 
        print("No")
        break
    if i == N:
        print("Yes")

Solution (Python):
N = int(input())
result = "Yes"
if N == 1:
    t,x,y = map(int,input().split())
    if (x+y+t) % 2 == 0 and x+y<=t and x+y+t>=0:
        pass
    else:
        result = "No"
else:
    S = [[int(i) for i in input().split()] for i in range(N)]
    for i in range(N-1):
        a,b = S[i],S[i+1]
        dt = b[0]-a[0]
        dx = b[1]-a[1]
        dy = b[2]-a[2]
        if (dx+dy+dt) % 2 == 0 and dx+dy<=dt and dx+dy+dt>=0:
            pass
        else:
            result = "No"
            break
print(result)

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


def is_even(num):
    if num %2 ==0:
        return 0
    else:
        return 1

a = 0
for i in range(N):
    start = A[i][1]+A[i][2]
    goal = A[i+1][1]+A[i+1][2]
    if is_even(A[i+1][0] - A[i][0]) == is_even(start - goal):
        if abs(A[i][1]-A[i+1][1])+abs(A[i][2]-A[i+1][2]) <= (A[i+1][0] - A[i][0]):
            a += 1
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()
print("Yes")

Solution (Python):
import sys
import numpy as np

I = np.array(sys.stdin.read().split(), dtype=np.int64)
n = I[0]
txy = I[1:].reshape(-1, 3)

def main():
    t1, x1, y1 = txy[0]
    d1 = x1 + y1
    if d1 > t1 or (t1 - d1) & 1:
        return 'No'
    dt, dx, dy = np.absolute(np.transpose(txy[1:] - txy[:-1]))
    d = dx + dy

    return 'No' if np.any(np.logical_or(d > dt, (dt - d) & 1)) else 'Yes'

if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
n = int(input())
coordinate_list = []
t_init = 0
x_init = 0
y_init = 0
count = 0

for i in range(n):
    child_list = list(map(int, input().split()))
    coordinate_list.append(child_list)

for coordinate in coordinate_list:
    flag = True
    t, x, y = coordinate[0], coordinate[1], coordinate[2]
    t -= t_init
    x -= x_init
    y -= y_init
    t_init, x_init, y_init = coordinate[0], coordinate[1], coordinate[2]
    if t >= abs(x) + abs(y):
        if t % 2 == 0 and x % 2 == 0 and y % 2 == 0 or t % 2 == 0 and x % 2 == 1 and y % 2 == 1:
            flag = False
        elif t % 2 == 1 and x % 2 == 1 and y % 2 == 0 or t % 2 == 1 and x % 2 == 0 and y % 2 == 1:
            flag = False
    
    if flag:
        break
    count += 1

if n == count:
    print("Yes")
else:
    print("No")

Solution (Python):

N = int(input())
t = [0]
x = [0]
y = [0]
for i in range(N):
  a,b,c = map(int, input().split())
  t.append(a)
  x.append(b)
  y.append(c)
dt = t[i+1]-t[i]
dist = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
ans = ""
for i in range(N):
  if dt < dist:
    ans = "No"
    break
  if (dt%2 == 0 and dist%2 == 0) or (dt%2 == 1 and dist%2 == 1):
    ans = "Yes"
  else:
    ans = "No"
    break
print(ans)

Solution (Python):


def is_even(num):
    if num % 2 == 0:
        return True
    else:
        return False

N = int(input())
t_list = [0]
x_list = [0]
y_list = [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)




is_reachable = False
for i in range(N):
    
    num_steps = t_list[i+1] - t_list[i]
    x_dist = abs(x_list[i+1] - x_list[i])
    y_dist = abs(y_list[i+1] - y_list[i])
    dist = x_dist + y_dist
    
    

    if num_steps >= dist and is_even(num_steps) == is_even(dist):
        is_reachable = True
    else:
        is_reachable = False
        break

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

Solution (Python):
import sys
input = sys.stdin.readline
import numpy as np
N = int(input())
A = [[0,0,0]]
for _ in range(N):
    A.append([int(x) for x in input().split()])
A = np.array(A)
for i in range(1, N+1):
    A_ = abs(A[i] - A[i-1])
    if A_[0] < A_[1] + A_[2]:
        print("No")
        sys.exit()
    A_mod = (A_[1] + A_[2]) % 2
    if A_[0] % 2 != A_mod:
        print("No")
        sys.exit()
print("Yes")

Solution (Python):
N=int(input())
t1=0
x1=0
y1=0
out='Yes'
for i in range(N):
  t2, x2, y2=map(int, input().split())
  if (t2-t1)%2!=(abs(x2-x1)+abs(y2-y1))%2 or (t2-t1)<abs(x2-x1)+abs(y2-y1):
    out='No'
  t1=t2
  x1=x2
  y1=y2
print(out)

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

Solution (Python):
n=int(input())
nx=0
ny=0
nt=0
for i in range(n):
  t,x,y=map(int,input().split())
  k=abs(x-nx)+abs(y-ny)
  if k>t-nt:
    print("No")
    exit()
  elif k%2 != (t-nt)%2:
    print("No")
    exit()
  nt,nx,ny=t,x,y
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())

can = 'Yes'
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) or (dt%2 != dist%2): 
        can = 'No'

print(can)

Solution (Python):
N=int(input())
t0,x0,y0=0,0,0
for i in range(N):
    ti,xi,yi = map(int,input().split())
    dT,dX,dY = abs(t0-ti),abs(x0-xi),abs(y0-yi)
    if dT>=dX+dY:
        if dT%2==(dX+dY)%2:
            t0,x0,y0 = ti,xi,yi
            continue
        else:
            print('No')
            exit()
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):

import sys
input = sys.stdin.readline

n = int(input())
info = [list(map(int,input().split())) for i in range(n)]
info = [[0,0,0]] + info

dif_time_length = [0 for _ in range(n)]
cnt = 0
for pre_i,i in zip(info,info[1::]):
    dif_time_length[cnt] = (i[0]-pre_i[0],abs(i[1]-pre_i[1]) + abs(i[2]-pre_i[2]))
    cnt+=1

def solve():
    for i in info:
        if i[0]%2!=(i[1]+i[2])%2:
            return "No"
    for t,d in dif_time_length:
        if t<d:
            return "No"
    return "Yes"
print(solve())

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

for a in A:
    if a[0] % 2 == 0:
        if (a[1] + a[2]) % 2 != 0 or (a[1] + a[2]) > a[0]:
            ans = 'No'
            break
    else:
        if (a[1] + a[2]) % 2 == 0 or (a[1] + a[2]) > a[0]:
            ans = 'No'
            break

print(ans)

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

for _ in range(n):
    travel_list.append(list(map(int, input().split())))

complete = True
for i in range(n):
    time = travel_list[i+1][0] - travel_list[i][0]
    x_distance =  abs(travel_list[i+1][1] - travel_list[i][1])
    y_distance =  abs(travel_list[i+1][2] - travel_list[i][2])
    xy_distance = x_distance + y_distance

    if time >= xy_distance:
        if time % 2 != xy_distance % 2:
            complete = False
            break
    else:
        complete = False
        break       

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

Solution (Python):
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
time, x, y = 0, 0, 0
for i in range(N):
    timei, xi, yi = A[i][0], A[i][1], A[i][2]
    time = timei - time
    x = xi - x
    y = yi - y
    move = x + y
    if time >= move:
        if(move*time)%2==1 or (move*time)%4==0:
            ans = "Yes"
        else:
            ans = "No"
            break
    else:
        ans = "No"
        break
    time, x, y = timei, xi, yi
print(ans)

Solution (Python):
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
time, x, y = 0, 0, 0
for i in range(N):
    timei, xi, yi = A[i][0], A[i][1], A[i][2]
    time = timei - time
    x = xi - x
    y = yi - y
    move = x + y
    if time >= move:
        if(move*time)%2==1 or (move*time)%4==0:
            ans = "Yes"
        else:
            ans = "No"
            break
    else:
        ans = "No"
        break
    time, x, y = timei, xi, yi
print(ans)

Solution (Python):
n = int(input())
tlist = [0]
xlist = [0]
ylist = [0]
for i in range(n):
  a = list(map(int,input().split()))
  tlist.append(a[0])
  xlist.append(a[1])
  ylist.append(a[2])

count = 0
for i in range(n):
  dt = tlist[i+1] - tlist[i]
  dis = abs(xlist[i+1]-xlist[i]) + abs(ylist[i+1]-ylist[i])
  if dis > dt:
    print("No")
    exit()
  else:
    if dt%2 == 0 and dis%2==0:
      count +=1
    elif dt%2 == 1 and dis%2==1:
      count +=1
    else:
      print("No")
      exit()
      
      
if count == n:
  print("Yes")

Solution (Python):
N = int(input())
flag = 'Yes'
txy = [[0,0,0]]
for i in range(N):
    a = list(map(int,input().split()))
    txy.append(a)
    td = txy[i+1][0] - txy[i][0]
    xd = abs(txy[i+1][1] - txy[i][1])
    yd = abs(txy[i+1][2] - txy[i][2])
    if (td < xd + yd) or ((td-(xd+yd))%2 == 1):
        flag = 'No'
print(flag)

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

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

tm = 0 
t_x = 0 
t_y = 0 
ans = "Yes"

for i in range(N):
        if abs(t_x - x[i]) + abs(t_y - y[i]) <= t[i] - tm and ((t[i] % 2 == 0) == ((x[i] + y[i]) % 2 == 0)):
                pass
        else:
                ans = "No"

        t_x = x[i]
        t_y = y[i]
        tm = t[i]

print(ans)

Solution (Python):
N = int(input())
t_list = [0]
x_list = [0]
y_list = [0]
A = 'Yes'
for i in range(N):
    ti, xi, yi = map(int, input().split())
    t_list.append(ti)
    x_list.append(xi)
    y_list.append(yi)
    if ((abs(x_list[i+1] - x_list[i]) + abs(y_list[i+1] - y_list[i]) > (t_list[i+1] - t_list[i]))):
        A = 'No'
        break
    if (x_list[i+1] + y_list[i+1] - t_list[i+1])%2 != 0:
        A = 'No'
        break
print(A)

Solution (Python):
n = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(n):
    T, X, Y = map(int, input().split())
    t.append(T)
    x.append(X)
    y.append(Y)
    
can = 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:
        can = False
    elif dist%2 != dt%2:
        can = False
        
print('Yes' if can else 'No')

Solution (Python):
n=int(input())
d=[(0,0,0)]+[tuple(map(int,input().split())) for _ in range(n)]
ans = 'Yes'
for i in range(n):
	dt = d[i+1][0]-d[i][0]
	dd = abs(d[i+1][1]-d[i][1])+abs(d[i+1][2]-d[i][2])
	if dt < dd or dt%2!=dd%2:
		ans='No'
		break
print(ans)

Solution (Python):
N=int(input())
t=[]
x=[]
y=[]
for i in range(N):
    t1, x1, y1=map(int, input().split())
    t.append(t1)
    x.append(x1)
    y.append(y1)
for j in range (N):
    if t[j]%2==(x[j]+y[j])%2 and x[j]+y[j]<=t[j]:
        continue
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
N=int(input())
t=[]
x=[]
y=[]
for i in range(N):
    t1, x1, y1=map(int, input().split())
    t.append(t1)
    x.append(x1)
    y.append(y1)
for j in range (N):
    if t[j]%2==(x[j]+y[j])%2 and x[j]<=t[j] and y[j]<=t[j] and x[j]+y[j]<=t[j]:
        continue
    else:
        print('No')
        exit()
print('Yes')

Solution (Python):
import sys
N = int(input())
txy2 = [list(map(int,input().split())) for _ in range(N)]
txy = [[0,0,0]]
for i in range(N):
    txy.append(txy2[i])
for i in range(N):
    if abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2]) > txy[i+1][0]-txy[i][0]:
        print("No")
        sys.exit()
    elif ((txy[i+1][0]-txy[i][0]) - (abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])))%2 != 0:
        print("No")
        sys.exit()
print("Yes")

Solution (Python):
N = int(input())
pt, px, py = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    a = abs(x - px) + abs(y - py)
    b = t - pt
    if b < a or (a - b) % 2 != 0:
        print("No")
        exit()
    pt, px, py = t, x, y
print("Yes")

Solution (Python):
import sys
n = int(input())
prev_time = 0
prev_x = 0
prev_y = 0
for i in range(n):
  time, x, y = map(int,input().split())
  diff = (time - prev_time) - (x-prev_x) - (y - prev_y)
  if diff >= 0 and diff % 2 == 0:
    prev_time = time
    prev_x = x
    prev_y = y
  else:
    print("No")
    sys.exit()
print("Yes")

Solution (Python):
import sys
n = int(input())
prev_time = 0
prev_x = 0
prev_y = 0
for i in range(n):
  time, x, y = map(int,input().split())
  diff = (time - prev_time) - (x-prev_x) - (y - prev_y)
  if diff >= 0 and diff % 2 == 0:
    prev_time = time
    prev_x = x
    prev_y = y
  else:
    print("No")
    sys.exit()
print("Yes")

Solution (Python):
import sys
n = int(sys.stdin.readline())

L = [list(map(int, sys.stdin.readline().split())) for _ in range(n)]
L.insert(0, [0,0,0])
flag='Yes'
for i in range(1, n+1):
    tmp = L[i][0] - L[i-1][0] -abs(L[i][1] - L[i-1][1]) - abs(L[i][2] - L[i-1][2])
    if tmp<0 or tmp%2!=0:
        flag='No'
        break
print(flag)

Solution (Python):
N = int(input())
now = [0, 0, 0] 
for i in range(N):
    next = [int(i) for i in input().split()]
    if abs(next[1] - now[1]) + abs(next[2] - now[2]) > next[0] - now[0]:
        print("No")
        exit()
    if (abs(next[1] - now[1]) + abs(next[2] - now[2])) % 2 != (next[0] - now[0]) % 2:
        print("No")
        exit()
print("Yes")

Solution (Python):
n = int(input())
plan = [tuple(map(int, input().split())) for _ in range(n)]
plan.insert(0, (0, 0, 0))
for i in range(1, n + 1):
    time_limit = plan[i][0] - plan[i - 1][0]
    distance = abs(plan[i][1] - plan[i - 1][1]) + \
        abs(plan[i][2] - plan[i - 1][2])
    if time_limit < distance or (time_limit % 2 != distance % 2):
        print('No')
        exit()
print('Yes')

Solution (Python):
N = int(input())
t = [0]
x = [0]
y = [0]
for _ in range(N):
    t0, x0, y0 = map(int, input().split())
    t.append(t0)
    x.append(x0)
    y.append(y0)

count = 0
for i in range(1, len(t)):
    dt = t[i]-t[i-1]; dist = abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
    if dist > dt:
        break
    else:
        if (dt%2==0 and dist%2==0) or (dt%2==1 and dist%2==1):
            count = count + 1

if count == N:
    print('Yes')
else:
    print('No')

Solution (Python):
import sys

if sys.platform =='ios':
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

N = INT()
A = [MAP() for _ in range(N)]



for a in A:
	t, x, y = a
	d = x+y
	if t < d or d%2 != t%2:
		print('No')
		sys.exit()
print('Yes')

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

Solution (Python):
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('No')
        exit()
    elif ((t2-t1)-(x2-x1 + y2-y1) ) % 2 == 0:
        t1=t2
        x1=x2
        y1=y2
    else:
        print('No')
        exit()

print('Yes')

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

Solution (Python):

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

flg = False
for point in points:
  flg = (point[0] >= (point[1] + point[2])) and ((point[0] % 2 == 1) and ((point[1] + point[2]) % 2 == 1) or (point[0] % 2 == 0) and ((point[1] + point[2]) % 2 == 0))
  if not flg:
    break
print('Yes') if flg 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):
N = int(input())
now_x = 0
now_y = 0
now_t = 0
for i in range(N):
    t,x,y = map(int, input().split())
    margin = (t- now_t) - abs(x - now_x) - abs(y - now_y)
    if margin < 0 or margin%2!=0:
        print("No")
        break
    else:
        now_x = x
        now_y = y
        now_t = t
else:
    print("Yes")

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

t = 0
x = 0
y = 0
i = 0
flag = True
for i in range(n):
    if abs(l[i][1]-x)+abs(l[i][2]-y) <= l[i][0]-t:
        if (l[i][0]-t) % 2 != (l[i][1]-x + l[i][2]-y) % 2:
            flag = False
            break
    else:
        flag = False
        break
    t = l[i][0]
    x = l[i][1]
    y = l[i][2]

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

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

x = 0
y = 0

for _ in range(N):
    t, a, b = [int(i) for i in input().split()]

    diff_a = abs(a - x)
    diff_b = abs(b - x)

    p = t - (diff_a + diff_b)
    if p < 0 or p % 2 != 0:
        print('No')
        exit()

print('Yes')

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
txy = [LIST() for _ in range(N)]

def dist(p1, p2):
	return abs(p1[0]-p2[0])+abs(p1[1]-p2[1])

now = [0, 0]
time = 0
for t, x, y in txy:
	if (t-time) < dist(now, [x, y]) or ((t-time) - dist(now, [x, y]))%2!=0:
		print("No")
		break
	time = t
	now[0] = x
	now[1] = y
else:
	print("Yes")

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

Solution (Python):


N = int(input())
txy = [[0, 0, 0]]
for n in range(N):
    txy.append([int(i) for i in input().split()])

for n in range(N):
    now_time = txy[n][0]
    now_x = txy[n][1]
    now_y = txy[n][2]
    next_time = txy[n+1][0]
    next_x = txy[n+1][1]
    next_y = txy[n+1][2]

    interval = abs(next_time - now_time)

    distance_x = abs(next_x - now_x)
    distance_y = abs(next_y - now_y)
    distance_sum = distance_x + distance_y

    if distance_sum > interval:
        print('No')
        break
    else:
        margin = interval - distance_sum
        if margin % 2 != 0:
            print('No')
            break
else:
    print('Yes')

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

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

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

Solution (Python):
def odd_even(a, b):
    if a % 2 == b % 2:
        return True
    else:
        return False

n = int(input())
T, X, Y = [0], [0], [0]
for _ in range(n):
    t, x, y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

ans = 'Yes'

for i in range(1,n+1):
    t_dif = T[i] - T[i-1]
    x_dif = abs(X[i]-X[i-1])
    y_dif = abs(Y[i]-Y[i-1])
    if t_dif >= (x_dif + y_dif) and odd_even(t_dif, x_dif+y_dif):
        pass
    else:
        ans = 'No'
        break

print(ans)

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

for i in range(len(ls)-1):
    t = ls[i+1][0] - ls[i][0]
    minkyori = abs(ls[i+1][1] - ls[i][1]) + abs(ls[i+1][2] - ls[i][2])
    if (t - minkyori) % 2 != 0 or (t - minkyori) < 0: 
        print('No')
        exit()
print('Yes')

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

Solution (Python):
N=input()

Flag= True
while True:
    try:
        ti,xi,yi = map(int, input().split())
        if ti>=(xi+yi) and ti%2==(xi+yi)%2:
            continue
        else:
            print("No")
            Flag=False
            break
    except:
        break

if Flag==True:
    print("Yes")

Solution (Python):
N = int(input())
now_x = 0
now_y = 0
now_t = 0
Flag = False
for i in range(N):
    t , x, y = map(int,input().split())
    dx = abs(x - now_x)
    dy = abs(y - now_y)
    dt = abs(t - now_t)
    if (dt - (dx + dy)) % 2 != 0 or dt < (dx + dy):
        Flag = True
    now_x = x
    now_y = y
    now_t = t
print("No" if Flag else "Yes")

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

for i in range(n):
    if i == 0:
        diff_t = txy[i][0]
        diff_ab = abs(txy[i][1]) + abs(txy[i][2])
    else:
        diff_t = txy[i][0] - txy[i-1][0]
        diff_ab = abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2]-txy[i-1][2])
    
    if diff_ab > diff_t:
        print('No')
        exit()
    
    if diff_ab % 2 != diff_t % 2:
        print('No')
        exit()
print('Yes')

Solution (Python):
N=int(input())
t=0
x=0
y=0
hantei=True
for i in range(N):
  t_,x_,y_=map(int,input().split())
  if abs(x-x_)+abs(y-y_)>t_-t or abs(abs(x-x_)+abs(y-y_)-(t_-t))%2==1:
    hantei=False
    break
  else:
    t=t_
    x=x_
    y=y_
print('Yes' if hantei else 'No')

Solution (Python):
n = int(input())
 
travel = []
for i in range(n):
    t,x,y = map(int, input().split())
    tmp = [t,x,y]
    travel.append(tmp)
 
now = [0, 0]
pre_time = 0
for tra in travel:
    diff_time,x,y = tra[0]-pre_time,tra[1],tra[2]
    for _ in range(diff_time):
        if now[0] < x:
            now[0] += 1
        elif x < now[0]:
            now[0] -= 1
        elif now[1] < y:
            now[1] += 1
        elif y < now[1]:
            now[1] -= 1
        else:
            now[1] -= 1
    
    if now[0] == x and now[1] == y:
        pass
    else:
        print('No')
        exit()

    pre_time = tra[0]
 
print('Yes')

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

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

x = 0
y = 0
t = 0
ans = 'Yes'

for i in lst:
  diff_t = i[0] - t
  dis = abs(i[1] - x) + abs(i[2] - y)
  if (diff_t < dis):
    ans = 'No'
    break
  if ((dis - diff_t) % 2 != 0):
    ans = 'No'
    break
  x = i[1]
  y = i[2]
  t = i[0]
print(ans)

Solution (Python):
n = int(input())
flg = True
t, x, y = 0, 0, 0
for i in range(n):
    nt, nx, ny = map(int, input().split()) 
    dist = abs(x - nx) + abs(y - ny)
    dt = nt - t
    if dist > dt or (dist - dt) % 2 == 1:
        print("No")
        flg = False
        break
    t, x, y = nt, nx, ny
if flg == True:
    print("Yes")

Solution (Python):
nums = int(input())
tmp = list()
for num in range(nums):
    tmp.append([int(_) for _ in str(input()).split(" ")])

for num, case in enumerate(tmp):
    t, x, y = case
    if t < abs(x) + abs(y):
        print("No")
        break
    else:
        if ((abs(x) + abs(y)) % 2) and (t % 2):
            if num +1 == len(tmp):
                print("Yes")
        elif ((abs(x) + abs(y)) % 2 == 0) and (t % 2 == 0):
            if num +1 == len(tmp):
                print("Yes")
        else:
            print("No")
            break

Solution (Python):
_,*l=map(int,open(0).read().split());print("YNeos"[any((t+x+y)%2+(t<x+y)for t,x,y in zip(*[iter(l)]*3))::2])

Solution (Python):
N = int(input())
T = []
Z = []
time = []
T.append([0,0,0])
for i in range(N):
    t = list(map(int, input().split()))
    T.append(t)
goal = True

for l in range(len(T)-1):
    Z.append(abs(T[l+1][1]-T[l][1]) + abs(T[l+1][2]-T[l][2]))
    time.append(T[l+1][0] - T[l][0])

for j in range(len(T)-1):
    if Z[j] > time[j] or Z[j]%2 != time[j]%2:
        goal = False
        break

if goal == False:
    print('No')
else:
    print('Yes')

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

txy = [[0, 0, 0]]
for i in range(N):
    tmp = list(map(int, input().split()))
    txy.append(tmp)
    
for i in range(len(txy)-1):
    start = txy[i]
    goal = txy[i+1]
    time = goal[0] - start[0]
    move_x = abs(goal[1] - start[1])
    move_y = abs(goal[2] - start[2])
    if move_x + move_y <= time:
        if (time - (move_x + move_y)) % 2 == 0:
            pass
        else:
            print("No")
            exit()
    else:
        print("No")
        exit()

print("Yes")

Solution (Python):
N = int(input())
prevt,prevx,prevy = 0,0,0
for i in range(N):
    t, x, y = map(int,input().split())
    dt,dx,dy = t-prevt,x-prevx,y-prevy
    if dt < dx+dy or (dt-dx-dy)%2 != 0:
        print('No')
        exit()
    prevt,prevx,prevy = t,x,y
print('Yes')

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

result = 1
bt=0
bx=0
by= 0

for i in range(N):
	t, x, y = map(int, input().split())
	distance = abs(x-bx) + abs(y-by)
	dur = t - bt

	if dur - distance >= 0 and (dur - distance) %2 == 0:
		(bt,bx,by) = (t,x,y)
		continue
	else:
		result = 0
		break

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

Solution (Python):


import numpy
import scipy



N = int(input())
P = []
for n in range(N):
    P.append(list(map(int, input().split())))

for i, p in enumerate(P):
    if i == 0:
        t_p, x_p, y_p = 0, 0, 0
    else:
        t_p, x_p, y_p = P[i-1][0], P[i-1][1], P[i-1][2]
    t, x, y = p
    dt = t - t_p
    dx = x - x_p
    dy = y - y_p
    dist = abs(dx) + abs(dy)

    if dist > dt:
        print("No")
        exit()

    if dist%2 != dt%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")