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())
plan = []
for i in range(N):
    A = input().split()
    plan.append(A)

judge = 0
now = [0, 0, 0]

for i in range(N):
    t = int(plan[i][0])
    x = int(plan[i][1])
    y = int(plan[i][2])
    
    dis = abs(x - now[1]) + abs(y - now[2])
    t_ = t - now[0]
    
    if t_ < dis:
        judge = 1
        break
    else:
        t_ = t_ - dis
        
        if t_ % 2 != 0:
            judge = 1
            break
    
    now = [t, x, y]

if judge == 0:
    print("Yes")
else:
    print("No")

Solution (Python):


N = int(input())

l = [(0,0,0)]
for _ in range(N):
    line = input().split(" ")
    t = int(line[0])
    x = int(line[1])
    y = int(line[2])
    l.append((t, x, y))

def judge(s1, s2):
    t = abs(s1[1]-s2[1])
    t += abs(s1[2]-s2[2])
    diff = (s2[0]-s1[0]) - t

    if diff==0:
        return True
    elif diff<0:
        return False
    else:
        return diff%2==0

for i in range(len(l)-1):
    s1 = l[i]
    s2 = l[i+1]
    if not judge(s1,s2):
        print("No")
        exit()
print("Yes")

Solution (Python):
num=int(raw_input())
startTime =0
startX=0
startY=0
endTime =0
endX=0
endY=0

flag=False
for i in range(num):
	test=raw_input().split(" ")
	test=map(int, test)
	endTime = test[0]
	endX = test[1]
	endY = test[2]
	now = abs(startTime-endTime) - (abs(startY-endY) + abs(startX-endX))
	if not(now >= 0 and now%2==0):
		flag=True
		break
	startY = endY
	startX = endX
	startTime = endTime

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

Solution (Python):
def reachable(dt,dx,dy):
  r = dx + dy
  c1 = dt >= r
  c2 = ((dt - r) % 2 == 0)
  return c1 & c2

def solve():
  N = int(input())
  t=0
  x=0
  y=0
  ans = "Yes"
  for i in range(N):
    raw = list(map(int,input().split(" ")))
    dt=raw[0]-t
    dx=raw[1]-x
    dy=raw[2]-y
    t = raw[0]
    x = raw[1]
    y = raw[2]
    if not reachable(dt,dx,dy):
      ans = "No"
      break
    
  return ans

if __name__ == '__main__':
  
  ans = solve()
  print(ans, flush=True)

Solution (Python):
N = input()
list=[]
flg = 0 
for i in range(N):
    list.append(map(int, raw_input().split()))
if N == 1:
	rem = abs(list[0][1]) + abs(list[0][2])
	if rem == 1:
		print("Yes")
	else:
		print("No")
else:
	for i in range(N-1):
		rem = abs(list[i][1]-list[i+1][1]) + abs(list[i][2]-list[i+1][2])
		time = list[i+1][0]-list[i][0]
		if (time-rem) < 0:
			    flg = 1
		            break
		elif (time-rem) % 2 ==1:
			    flg = 1
		            break
		            
	if flg == 0:
		print("Yes")
	else:
		print("No")

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

init_x, init_y, init_t = 0, 0, 0
for i in range(N):
    t, x, y = map(int, input().split())
    diff_t = t - init_t
    dist = x - init_x + y - init_y
    if (diff_t >= dist) and ((diff_t % 2 == 0 and dist % 2 == 0) or (diff_t % 2 != 0 and dist % 2 != 0)):
        init_x, init_y, init_t = t, x, y
    else:
        print("No")
        break
else:
    print("Yes")

Solution (Python):
import numpy as np
N = int(input())
S = []
for i in range(N):
    S.append(list(map(int,input().split())))
now = [0,0]
time = 0
flag = True
for i in range(N):
    dis = abs(S[i][1]-now[0])+abs(S[i][2]-now[1])
    if(dis > S[i][0] or (S[i][0]-time)%2 != dis%2):
        flag = False
        break
    now[0] = S[i][1]
    now[1] = S[i][2]
    time = S[i][0]
    
if flag:
    print("Yes")
else:
    print("No")

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

plan = []

for i in range(N):
    num = map(int, raw_input().split())
    plan.append(num)



pre_time  = 0
pre_cord_x = 0
pre_cord_y = 0

available = True

while len(plan) > 0:
    case = plan.pop(0)
    dif_t = case[0] - pre_time
    dif_x = case[1] - pre_cord_x
    dif_y = case[2] - pre_cord_y

    if ((dif_x + dif_y) <= dif_t) and (((dif_t - (dif_x + dif_y)) % 2) == 0):
        available = True
    else:
        available = False
        break
    
    pre_time   = case[0]
    pre_cord_x = case[1]
    pre_cord_y = case[2]

if available == True:
    print 'Yes'
else:
    print 'No'

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

                
print("Yes")

Solution (Python):
def acceptable(t, a, b, t_next, a_next, b_next):
    distance = abs(a_next - a) + abs(b_next - b)

    if (t_next - t) < distance:
        return False

    if (t_next - t) % 2 != distance % 2:
        return False

    return True


n = int(input())
t_next, a_next, b_next = 0, 0, 0
for i in range(n):
    t, a, b = t_next, a_next, b_next
    t_next, a_next, b_next = map(int, input().strip().split())

    if not acceptable(t, a, b, t_next, a_next, b_next):
        print('No')
        exit(0)

print('Yes')

Solution (Python):
import numpy as np
N=int(input())
x_origin=0
y_origin=0
t_origin=0
flag=0
a=[]
for i in range(N):
    a.append(list(map(int,input().split())))

for i in range(N):
    b=np.abs(a[i][0]-t_origin)
    c=np.abs(a[i][1]-x_origin)
    d=np.abs(a[i][2]-y_origin)
    if b>=c+d:
        if (b-(c+d))%2==0:
            continue
        else:
            flag=1
            break
    else:
        flag=1
        break
if flag==1:
    print("No")
else:
    print("Yes")

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

for i in range(n):
    t,x,y = map(int,input().split())
    ts.append(t); xs.append(x); ys.append(y)

flag=1
for i in range(n):
    t = ts[i]
    d = abs(xs[i]) + abs(ys[i])
    if t>=d and (t-d)%2==0: continue
    else: flag=0; break

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

Solution (Python):
def c_Traveling(N, P):
    t_old = x_old = y_old = 0
    for t, x, y in P:
        t1 = t - t_old
        x1 = x - x_old
        y1 = y - y_old
        cond1 = abs(x1) + abs(y1)
        cond2 = t1 % 2
        cond3 = cond1 % 2
        if t1 >= cond1 and cond2 == cond3:
            pass
        else:
            return 'No'
        t_old, x_old, y_old = t, x, y
    return 'Yes'

N = int(input())
P = [[int(i) for i in input().split()] for j in range(N)]
print(c_Traveling(N, P))

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

    _t, _x, _y = 0, 0, 0
    for t, x, y in txy:
        ok = False
        diff_t = t - _t
        diff_x = x - _x
        diff_y = y - _y

        dx = abs(diff_x)
        dy = abs(diff_y)
        if diff_t >= dx + dy:
            rem = dx + dy - diff_t
            if rem % 2 == 0:
                ok = True
                _t, _x, _y = t, x, y

        if not ok:
            print("No")
            return

    print("Yes")

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
def dist(x1,y1,x2,y2):
    return abs(y1-y2)+abs(x1-x2)
result = "Yes"
pre_t,pre_x,pre_y = (0,0,0)
for i in range(n):
    tmp_t,tmp_x,tmp_y = map(int,input().split())
    if (dist(pre_x,pre_y,tmp_x,tmp_y) > tmp_t - pre_t) or ((dist(pre_x,pre_y,tmp_x,tmp_y)-(tmp_t - pre_t))%2!=0):
        result = "No"
    pre_t,pre_x,pre_y = tmp_t,tmp_x,tmp_y
print(result)

Solution (Python):
N = int(input())
T=[0];X=[0];Y=[0]
for i in range(N):
    t,x,y=map(int,input().split())
    T.append(t);X.append(x);Y.append(y)
def check(t,x,y):
    if t < x+y:
        return False
    elif (x+y-t)%2==0:
        return True
    else:
        return False
for i in range(N):
    if check(T[i+1]-T[i],abs(X[i+1]-X[i]),abs(Y[i+1]-Y[i])):
        pass
    else:
        print("No")
        exit()
print("Yes")

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

X =list()

Y = 0

for i in range(0,N):
    X.append(list(map(int,input().strip().split(' '))))

if (X[0][1]+X[0][2]-X[0][0])%2 == 0 and X[0][1]+X[0][2] <= X[0][0]:
    for i in range(0,N-1):
        T = X[i+1][0]-X[i][0]
        A = X[i+1][1]-X[i][1]
        B = X[i+1][2]-X[i][2]
        if (A+B-T)%2 == 0 and A+B <= T:
            Y = Y
        else:
            Y += 1
    if Y == 0:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Solution (Python):
def LI(): return [int(x) for x in input().split(" ")]
def LS(): return [str(x) for x in input().split(" ")]
def ItoS(L): return [str(x) for x in L]
def StoI(L): return [int(c) for c in L]


def solve():
    while 1:
        try:
            n = int(input())
            T, X, Y = [], [], []
            for _ in range(n):
                tmp1, tmp2, tmp3 = LI()
                T.append(tmp1)
                X.append(tmp2)
                Y.append(tmp3)

            T.insert(0, 0)
            X.insert(0, 0)
            Y.insert(0, 0)
            for i in range(n):
                if X[i + 1] == X[i] and Y[i + 1] == Y[i]:
                    raise EndLoop
                time = T[i + 1] - T[i]
                dis = abs(X[i + 1] - X[i]) + abs(Y[i + 1] - Y[i])
                if not ((time == dis) or (time > dis and (time - dis) % 2 == 0)):
                    raise EndLoop

            print("Yes")
            break
        except:
            print("No")
            break


solve()

Solution (Python):
import math
def get_while(n):
    ts = [0]
    ans = [[0, 0]]
    for _ in range(n):
        s = list(map(lambda x: int(x), input().split(" ")))
        ts.append(s[0])
        ans.append([s[1], s[2]])
    return ts, ans

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

def solve(ts, ps, n):
    for x in range(n):
        d = get_distance(ps[x], ps[x+1])
        if ((ts[x+1] - ts[x]) - d) < 0:
            return "No"
        if ((ts[x+1] - ts[x]) - d) % 2 != 0:
           return "No"
    return "Yes"
        

if __name__ == '__main__':
    n = int(input())
    ts, ps = get_while(n)
    print(solve(ts, ps, n))

Solution (Python):
n=int(input())
l=[]
l.append([0,0,0])
f=0
for i in range(n):
    ll=list(map(int,input().split()))
    l.append(ll)
for i in range(n):
    dt=abs(l[i][0]-l[i+1][0])
    da=abs(l[i][1]-l[i+1][1])
    db=abs(l[i][2]-l[i+1][2])
    if dt<da+db:
        f=1
    if dt==0 and da+db!=0:
        f=1
    if (da+db)%2 != (dt)%2 and dt>da+db:
        f=1
if f==0:
    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())

ans = True
for i in range(N):
    dt = t[i + 1] - t[i]
    dl = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    if dl > dt or (dl <= dt and dl % 2 != dt % 2):
        ans = False

print(('No', 'Yes')[ans])

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

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

current_t = 0
current_x = 0
current_y = 0

flag = True

for i in range(N):
    dist = (X[i] - current_x) + (Y[i] - current_y)
    time = T[i] - current_t
    if dist > time:
        flag = False
        break
    elif (time - dist)%2 != 0:
        flag = False
        break
    else:
        current_t = T[i]
        current_x = X[i]
        current_y = Y[i]
        
if flag == True:
    print("Yes")
else:
    print("No")

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




def solve(px,py,i,pt):
	global t, x, y
	diff = abs(x[i] - px) + abs(y[i] - py)
	if diff <= t[i] - pt:
		return True
	else:
		return False

ok = True
for i in range(N):
	shortest_time = 0
	if i == 0:
		if solve(0,0,i,0) == True:
			shortest_time = abs(x[i]) + abs(y[i])
		else:
			ok = False
			break
	else:
		if solve(x[i-1],y[i-1],i,shortest_time) == True:
			shortest_time = abs(x[i] - x[i-1]) + abs(y[i] - y[i-1])
		else:
			ok = False
			break


if ok == True:
	for i in range(N):
		if t[i] % 2 != ((x[i] + y[i]) % 2):
			ok = False


print("Yes" if ok == True else "No")

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

x_a=abs(x[0])
y_a=abs(y[0])

if t[0]%2==(x_a+y_a)%2 and t[0]>=(x_a+y_a):
    for i in range(n-1):
        x_a=abs(x[i+1]-x[i])
        y_a=abs(y[i+1]-y[i])
        if (t[i+1]-t[i])%2==(x_a+y_a)%2 and (t[i+1]-t[i])>=(x_a+y_a):
            count=1
        else:
            count=0
            break
else:
    count=0


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

Solution (Python):

import math

N = int(input())

flag = True
currentt = 0
currentx = 0
currenty = 0

for i in range(N):
    tmp = input().split()
    nextt = int(tmp[0])
    nextx = int(tmp[1])
    nexty = int(tmp[2])
    
    subt = nextt - currentt
    subx = abs(nextx - currentx)
    suby = abs(nexty - currenty)

    if (subx + suby) > subt:
        flag = False
    
    tmp = subt - (subx + suby)
    if tmp % 2 == 1:
        flag = False

    currentt = nextt
    currentx = nextx
    currenty = nexty


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

Solution (Python):
import numpy as np


def check(t_diff, x_diff, y_diff):
    l1 = abs(x_diff) + abs(y_diff)
    if l1 > t_diff:
        return False
    elif (t_diff - l1) % 2 == 1:
        return False
    else:
        return True

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

for j in range(N):
    t_diff = t[j+1] - t[j]
    x_diff = x[j+1] - x[j]
    y_diff = y[j+1] - y[j]
    if not check(t_diff, x_diff, y_diff):
        print("No")
        exit()

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())		
	T.append(t)
	X.append(x)
	Y.append(y)





x0 = 0
y0 = 0
ans = 'No'




for i in range(N):
	t = T[i+1] - T[i]
	x = abs(X[i+1] - X[i])
	y = abs(Y[i+1] - Y[i])
	
	
	if t < (x+y):
		
		break
	
	
	a = t - (x+y)
	if a%2==0:
		continue
	else:
		
		break

else:
	ans='Yes'


print(ans)

Solution (Python):
def main():
    N = int(input())
    T = tuple(tuple(map(int, input().split())) for _ in [0] * N)

    for t, x, y in T:
        if t < x + y or t & 1 != (x + y) & 1:
            print('No')
            break
    else:
        print('Yes')

main()

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

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

t_pre = 0
x_pre = 0
y_pre = 0

cond = True
for i in range(N):
    t, x, y = map(int, input().split(' '))
    
    d = abs(x - x_pre) + abs(y - y_pre)
    
    if d > t:
        cond = False
        break         
        
    if (d % 2 == 0 and (t - t_pre) % 2 == 0) or (d % 2 == 1 and (t - t_pre) % 2 == 1):
        t_pre = t
        x_pre = x
        y_pre = y         
    
    else:
        cond = False
        break 


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

Solution (Python):


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

for i in range(1, N+1):
    def_t = a[i][0] - a[i-1][0]
    def_d = abs(a[i][1] - a[i-1][1]) + abs(a[i][2] - a[i-1][2])
    if abs(def_t - def_d) % 2 != 0 or def_t < def_d:
        print('No')
        exit()

print('Yes')

Solution (Python):
n = int(input())
t, x, y = 0, 0, 0
flag = 0
for i in range(n):
    t_in, x_in, y_in = map(int, input().split())
    time_dis = t_in - t
    move_dis = abs(x_in-x) + abs(y_in-y)
    if time_dis < move_dis:
        flag = -1
    elif abs(move_dis - time_dis) % 2 == 1:
        flag = -1
    else:
        t, x, y = t_in, x_in, y_in

if flag == -1:
    print("No")
else:
    print("Yes")

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

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


def get_distance(a1, a2):
    return abs(a1[1] - a2[1]) + abs(a1[2] - a2[2])

for i, a in enumerate(aa):
    if i > 0:
        xy_d = get_distance(aa[i], aa[i-1])
        t_d = aa[i][0] - aa[i-1][0]
        if xy_d > t_d or (xy_d - t_d) & 1:
            print('No')
            break
else:
    print('Yes')

Solution (Python):


N = int(raw_input())

xtmp = 0
ytmp = 0
ttmp = 0
flag = True
allinfo = []
for i in range(N):
    t, x, y = map(int, raw_input().split())
    allinfo.append((t, x, y))

for t, x, y in allinfo:
    xdif = abs(x - xtmp)
    ydif = abs(y - ytmp)
    tdif = t - ttmp
    if tdif >= xdif + ydif:
        if tdif % 2 == (xdif + ydif) % 2:
            continue
        else:
            flag = False
            break
    else:
        flag = False
        break

if flag:
    print 'Yes'
else:
    print 'No'

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

Solution (Python):


import math

N = int(input())

T = []
X = []
Y = []

for i in range(N):
    t, x, y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)


def l1_distance(p,q):
    return int(math.fabs(p[0] - q[0]) + math.fabs(p[1] - q[1]))



if l1_distance([0,0], [X[0],Y[0]]) <= T[0] and (T[0] - l1_distance([0,0], [X[0],Y[0]])) % 2 == 0:
    pass
else:
    print("No")
    quit()

for i in range(N-1):
    if l1_distance([X[i],Y[i]], [X[i+1],Y[i+1]]) <= T[i+1] - T[i] and (T[i+1] - T[i] - l1_distance([X[i],Y[i]], [X[i+1],Y[i+1]])) % 2 == 0:
        pass
    else:
        print("No")
        quit()

print("Yes")

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

base_t = 0
base_x = 0
base_y = 0
judge = True
for i in range(num):
    t, x, y = map(int, input().split())
    if (abs(base_t-t) - abs(base_x-x) +abs(base_y-y)) %2 == 0 and (abs(base_t-t) - abs(base_x-x) -abs(base_y-y)) >= 0:
        base_x = x
        base_y = y
        base_t = t
    else:
        judge = False
        break

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

Solution (Python):
import sys
import math




def isEnable(now, next):
    distance = abs(next[1] - now[1]) + abs(next[2] - now[2])
    time_len = next[0] - now[0]

    if distance <= time_len and (time_len - distance) % 2 == 0:
        return True
    else:
        return False


N = int(input())

roots = []

roots.append((0, 0, 0))

for i in range(N):
    r = tuple(map(int, input().split(" ")))
    roots.append(r)

for i in range(N):
    if isEnable(roots[i], roots[i+1]):
        continue
    else:
        print('No')
        sys.exit()

print('Yes')

Solution (Python):
N=input()
prev_x=0
prev_y=0
prev_t=0
a=[]
for i in range(N):
	t,x,y=map(int,raw_input().split())
	l=abs(x-prev_x)+abs(y-prev_y)
	t_diff=t-prev_t
	a.append( (t_diff,l) )
	prev_x=x
	prev_y=y
	prev_t=t


for i,j in a:
	if i>=j and (i-j)%2==0:
		continue
	else:
		print "No"
		quit()
else:
	print "Yes"

Solution (Python):
from pprint import pprint as pp
import collections
import math

n = int(input())
txy = [tuple(map(int, input().split())) for _ in range(n)]

now_t = 0
now_x = 0
now_y = 0

for t, x, y in txy:
  dt = t - now_t
  dx = x - now_x
  dy = y - now_y
  dp = dx + dy
  diff = dt - dp
  if ((diff % 2) == 1) or (diff < 0):
    print('No')
    break
  now_t = t
  now_x = x
  now_y = y
else:
  print('Yes')

Solution (Python):
n = int(input())
t = [0]
x = [0]
y = [0]
result = "Yes"
for i in range(1,n+1):
    T,X,Y = map(int, input().split())
    t.append(T)
    x.append(X)
    y.append(Y)
for j in range(1,n+1):
    r = abs(x[j]-x[j-1]) + abs(y[j]-y[j-1])
    if r > abs(t[j]-t[j-1]) :
        result = "No"
    if (abs(t[j]-t[j-1]) - r)%2 != 0:
        result = "No"
print(result)

Solution (Python):
n = int(input())
t = []
x = []
y = []
for i in range(n):
	ttemp,xtemp,ytemp = map(int,input().split())
	t.append(ttemp)
	x.append(xtemp)
	y.append(ytemp)
check = True
nowx = 0
nowy = 0
for i in range(n):
	disx = x[i] - nowx
	disy = y[i] - nowy
	total = disx + disy
	if i == 0:
		if t[i] >= total and (t[i]%2 == total%2):
			nowx = x[i]
			nowy = y[i]
		else:
			check = False
			break
	else:
		if (t[i]-t[i-1]) >= total and ((t[i]-t[i-1])%2 == total%2):
			nowx = x[i]
			nowy = y[i]
		else:
			check = False
			break
if check:
	print('Yes')
else:
	print('No')

Solution (Python):
N = int(input())
a = []
a.append([0, 0, 0])
for i in range(N):
    a.append(list(map(int, input().split())))
travel = True
for i in range(N):
    c = abs(a[i+1][1]-a[i][1]) + abs(a[i+1][2]-a[i][2])
    if c <= a[i+1][0]-a[i][0] and (a[i+1][0] - a[i][0] - c) % 2 == 0:
        pass
    else:
        travel = False
        break
if travel == True:
    print("Yes")
else:
    print("No")

Solution (Python):


N = int(input())

tc = 0
xc = 0
yc = 0
ok_flg = 1
for n in range(N):
    t, x, y = map(int, input().split())
    t_diff = tc - t
    x_diff = abs(x - xc)
    y_diff = abs(y - yc)
    xy_diff = x_diff + y_diff
    if t%2 == 0:
        if xy_diff <= t and xy_diff%2 ==0:
            continue
        else:
            ok_flg = 0
    else:
        if xy_diff <= t and xy_diff%2 ==1:
            continue
        else:
            ok_flg = 0
if ok_flg == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
N=int(input())
i=0
f = 0
t0,x0,y0 = 0,0,0
while i <N:
    t1,x1,y1 = map(int,input().split(' '))
    dt = int(t1 - t0)
    dl = int(abs(x0-x1)+abs(y0-y1))
    if dt >= dl and int(dt-dl)%2 == 0:
        t0 = t1
        x0 = x1
        y0 = y1
        i += 1
    else:
        f = 1
        break
if f == 1:
    print('No')
else:
    print('Yes')

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

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

Solution (Python):
N = int(input())
t = []
x = []
y = []

now_x = 0
now_y = 0
now_time = 0
flag = 0

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

for i in range(N):
    if now_x < x[i]:
        now_time += x[i] - now_x
    else:
        now_time += now_x - x[i]
    now_x = x[i]

    if now_y < y[i]:
        now_time += y[i] - now_y
    else:
        now_time += now_y - y[i]
    now_y = y[i]

    if now_time <= t[i]:
        if (t[i] - now_time) % 2 == 0:
            now_time = t[i]
        else:
            flag = 1
            break
    else:
        flag = 1
        break

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

Solution (Python):
import sys
N=int(input())
dt=0
dx=0
dy=0
for i in range(N):
  t,x,y=map(int,input().split())
  t=t-dt
  x=x-dx
  y=y-dy
  if(x+y > t):
    print('No')
    sys.exit()
  if( (x+y)%2==0 and t%2==1 ):
    print('No')
    sys.exit()
  elif( (x+y)%2==1 and t%2==0 ):
    print('No')
    sys.exit()
print('Yes')

Solution (Python):
import sys

N = int(input())
old_t, old_x, old_y = 0, 0, 0

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

print("Yes")

Solution (Python):
n = int(input())
t = 0
x = 0
y = 0
f = True
for _ in range(n):
    ti, xi, yi = (int(x) for x in input().split())
    dt = ti - t
    dd = abs(xi - x) + abs(yi - y)
    if dd > dt or (dt-dd)%2 != 0:
        f = False
        break
    else:
        t = ti
        x = xi
        y = yi
print('Yes' if f else 'No')

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

Solution (Python):
n = int(input())
r = [(0, 0, 0)]
for _ in range(n):
    t, x, y = [int(x) for x in input().split()]
    r.append((t, x, y))
for i in range(1, len(r)):
    l = abs(r[i][1] - r[i - 1][1]) + abs(r[i][2] - r[i - 1][2])
    t = r[i][0] - r[i - 1][0]
    if l > t or (l - t) % 2 == 1:
        print("No")
        exit()
print("Yes")

Solution (Python):





flag = 1
st = 0
sx = 0
sy = 0
for _ in range(int(input())):
	t, x, y = [int(x) for x in input().split()]
	dur = abs(t-st)
	dx = abs(x-sx)
	dy = abs(y-sy)
	if(dx+dy > dur):
		flag = 0
	else:
		if((dx+dy)&1 and not(dur&1)):
			flag = 0
		elif(not((dx+dy)&1) and (dur&1)):
			flag = 0
	st = t
	sx = x
	sy = y
print("Yes" if flag else "No")

Solution (Python):





N = input()
N = int(N)

t_prev = 0
x_prev = 0
y_prev = 0

flag = True
for i in range(N ) : 
    s = input().split(" ")
    s = [int(i) for i in s]
    t = s[0]
    x  =s[1]
    y = s[2]
    
    eq = t - t_prev - abs(x - x_prev) - abs(y - y_prev)
    if eq < 0 : flag = False
    if eq % 2 == 1 : flag = False
    
    t_prev = t
    x_prev = x
    y_prev = y
    
if flag : print("Yes")
else : print("No")

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

  moves = []

  for i in range(N):
    moves.append([int(j) for j in input().split()])

  
  pre_t = 0
  pre_x = 0
  pre_y = 0

  for move in moves:
    new_t, new_x, new_y = move[0], move[1], move[2]

    
    delta_t = new_t - pre_t

    
    delta_x = abs(new_x - pre_x)
    delta_y = abs(new_y - pre_y)
    delta_sum = delta_x + delta_y

    remain_time = delta_t - delta_sum

    
    if remain_time == 0:
      pre_t, pre_x, pre_y = new_t, new_x, new_y

    
    elif remain_time > 0:
      
      if remain_time % 2 == 0:
        pre_t, pre_x, pre_y = new_t, new_x, new_y
      else:
        print("No")
        return

    
    else:
      print("No")
      return

  print("Yes")
  return

main()

Solution (Python):
import sys

t, x, y = 0, 0, 0
for _ in range(input()):
    [t2, x2, y2] = map(int, raw_input().split())
    d1 = abs(x2 - x) + abs(y2 - y)
    d2 = t2 - t
    if d1 > d2:
        print 'No'
        sys.exit(0)
    if d1 == d2 or (d2 - d1) % 2 == 0:
        t = t2
        x = x2
        y = y2
    else:
        print 'No'
        sys.exit(0)
        
print 'Yes'

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
t=[0]
x=[0]
y=[0]
ss="Yes"
for i in range(n):
 s=i2()
 t.append(s[0])
 x.append(s[1])
 y.append(s[2])
for i in range(n):
 tx=abs(x[i+1]-x[i])
 ty=abs(y[i+1]-y[i])
 if not(t[i+1]-t[i]>=tx+ty and (t[i+1]-t[i])%2==(tx+ty)%2):
   ss="No"
   break
print(ss)

Solution (Python):
n = int(input())
t = [0]
x = [0]
y = [0]
text = 'Yes'
for i in range(1,n+1):
  tt, xt, yt = map(int, input().split())
  t.append(tt)
  x.append(xt)
  y.append(yt)
  if abs(x[i] - x[i-1]) + abs(y[i]-y[i-1]) > t[i] - t[i-1]:
    text = 'No'

  if (t[i]-t[i-1] - abs(x[i]-x[i-1]) - abs(y[i]-y[i-1]))%2 != 0:
    text = 'No'

print(text)

Solution (Python):
n = int(input())
pret, prea, preb = 0, 0, 0
flag = True
for i in range(n):
    t, a, b = map(int, input().split())
    if (t - pret) % 2 == abs((a + b) - (prea + preb)) % 2 and t - pret >= abs((a + b) - (prea + preb)):
        pass
    else:
        print("No")
        break

    if i == n - 1:
        print("Yes")

Solution (Python):
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 = True
for i in range(N):
    d = abs(X[i] - X[i + 1]) + abs(Y[i] - Y[i + 1])
    t = T[i + 1] - T[i]
    if d > t or d % 2 != t % 2:
        ans = False

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

Solution (Python):
n = int(input())
pretime, prex, prey = 0, 0, 0
for i in range(n):
    nowtime, nowx, nowy = map(int, input().split())
    time = nowtime - pretime
    x = abs(nowx - prex)
    y = abs(nowy - prey)
    if x+y > time:
        print("No")
        exit()
    if (x+y) % 2 != time % 2:
        print("No")
        exit()
    pretime = nowtime
    prex, prey = nowx, nowy
else:
    print("Yes")

Solution (Python):
p = [map(int, raw_input().split()) for _ in xrange(input())]
ct, cx, cy = 0, 0, 0
flag = True
for dt, dx, dy in p:
    _ = dx - cx + dy - cy
    if dt < _ or (dt - _) % 2:
        flag = False
        break
print 'Yes' if flag else 'No'

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())
prev_t = 0
now = [0] * 2
for i in range(N):
	t,x,y = map(int,input().split(" "))

	dis = abs(x-now[0]) + abs(y-now[1])
	if (t - prev_t - dis)%2 == 0 and (dis <= t-prev_t):
		now = [x,y]
		prev_t = t
	else:
		print("No")
		exit(0)

print("Yes")