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())
flg = True
cnt,now,posx,posy=0,0,0,0
while cnt < N and flg:
  t,x,y=map(int,input().split())
  if abs(x-posx)+abs(y-posy) > (t-now):
    flg = False
    print('No')
  elif (t-now)%2==0 and ((abs(x-posx)+abs(y-posy))%2 ==1):
    flg =False
    print('No')
  elif (t-now)%2==1 and ((abs(x-posx)+abs(y-posy))%2 ==0):
    flg =False
    print('No')
  else:
    now = t
    posx = x
    posy = y
    cnt += 1
if flg:
  print('Yes')

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

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

t = [0] + [col[0] for col in grid]
xs = [0] + [col[1] for col in grid]
ys = [0] + [col[2] for col in grid]

res = 'Yes'
for i in range(N):
    interval = t[i+1] - t[i]
    x_dist = xs[i+1] - xs[i]
    y_dist = ys[i+1] - ys[i]
    dist = x_dist + y_dist
    if dist == 0 and interval % 2 == 1:
        res = 'No'
        break
    if dist > interval or dist % 2 != interval % 2:
        res = 'No'
        break

print(res)

Solution (Python):
import sys
n=int(input())
L=[list(map(int,input().split())) for i in range(n)]
L.insert(0,[0,0,0])
for i in range(n):
    a,b=L[i+1][0]-L[i][0],abs(L[i+1][1]-L[i][1])+abs(L[i+1][2]-L[i][2])
    if (a-b)%2==0 and a>=b:
        continue
    else:
        print("No")
        sys.exit()
print("Yes")

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

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

for i in range(N):
    if i == 0:
        if txy[i][0] < abs(txy[i][1]) + abs(txy[i][2]) or txy[i][0]%2 != (txy[i][1] + txy[i][2])%2:
            print("No")
            exit()
    else:
        if txy[i][0] - txy[i-1][0] < abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) \
        or txy[i][0]%2 != (txy[i][1] + txy[i][2])%2:
            print("No")
            exit()

print("Yes")

Solution (Python):
def solve():
    N = int(input())
    t, x, y = 0, 0, 0
    for i in range(N):
        t_i, x_i, y_i = list(map(int, input().split()))
        delta_t = t_i - t
        distance = x_i - x + y_i - y
        if not (delta_t >= distance and (delta_t - distance) % 2 == 0):
            print("No")
            return
        else:
            t, x, y = t_i, x_i, y_i
    print("Yes")
            


solve()

Solution (Python):






class TravelingPlan(object):

    def __init__(self):
        from collections import OrderedDict
        self._points = OrderedDict()

    def add_point(self, name: str):
        if name not in self._points:
            self._points[name] = Point()
        return self._points[name]

    def is_executable(self):
        for j in range(len(self._points) - 1):
            current_point = self._points[str(j + 1)]
            previous_point = self._points[str(j)]
            result = self._can_move(previous_point, current_point)

            if result is False:
                return False
        return True

    def _can_move(self, previous_point, current_point):
        delta_x = current_point.x - previous_point.x
        delta_y = current_point.y - previous_point.y
        delta_x_y = delta_x + delta_y
        delta_t = current_point.t - previous_point.t

        if delta_x_y == delta_t:
            return True
        elif delta_x_y < delta_t:
            return self._is_reachable(delta_x_y, delta_t)
        elif delta_x_y > delta_t:
            return False

    def _is_reachable(self, delta_x_y, delta_t):
        for i in range(delta_t + 1):
            if (1 * i + (-1) * (delta_t - i)) == delta_x_y:
                return True
        return False


class Point(object):

    def __init__(self):
        self._x = 0
        self._y = 0
        self._t = 0

    @property
    def x(self):
        return self._x

    @x.setter
    def x(self, value):
        self._x = value

    @property
    def y(self):
        return self._y

    @y.setter
    def y(self, value):
        self._y = value

    @property
    def t(self):
        return self._t

    @t.setter
    def t(self, value):
        self._t = value


if __name__ == '__main__':
    point_count = int(input())
    points = [list(map(int, input().split(" "))) for _ in range(point_count)]
    plan = TravelingPlan()
    origin = plan.add_point(str(0))

    for i in range(0, len(points)):
        point = plan.add_point(str(i + 1))
        point.t = points[i][0]
        point.x = points[i][1]
        point.y = points[i][2]

    if plan.is_executable() is True:
        print("Yes")
    else:
        print("No")

Solution (Python):
n = int(input())
li = [list(map(lambda x:int(x),input().split())) for i in range(n)]
ok = True
for i in range(n-1):
    mo = (li[i+1][2] - li[i][2]) + (li[i+1][1] - li[i][1])
    ti = li[i+1][0] - li[i][0]
    if (mo%2)!=(ti%2) or mo>ti or (mo != 0 and ti == 0):
        ok = False
mo = (li[0][2] - 0) + (li[0][1] - 0)
ti = li[0][0] -0
if (mo%2)!=(ti%2) or mo>ti or (mo != 0 and ti == 0):
    ok = False
if ok :
    print("Yes")
else :
    print("No")

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

ts = 0
xs = 0
ys = 0

for i in range(N):
    t, x, y = [int(c) for c in input().split()]
    min_len = x-xs + y-ys
    dt = t-ts
    if min_len > dt or (dt - min_len) % 2 == 1:
        print('No')
        sys.exit()
    ts = t
    xs = x
    ys = y

print('Yes')

Solution (Python):
N = int(input())
x, y, t = (0, 0, 0)
f = True
for i in range(N) :
    nt, nx, ny = list(map(int, input().split()))
    dist = abs(nx - x) + abs(ny - y)
    if dist > nt - t or (nx+ny+nt-t)%2 != (x+y)%2 :
        f = False
print("Yes" if f else "No")

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

nt, nx, ny = 0, 0, 0
canTravel = True
for i in range(N):
	t, x, y = map(int, input().split())
	d = (x - nx) + (y - ny)
	dt = t - nt
	if(d <= dt and d % 2 == dt % 2):
		continue
	else:
		canTravel = False
		break

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

Solution (Python):
a = int(input())
x = 0
y = 0
time = 0
for i in range(a):
    aa,b,c = map(int,input().split())
    if (abs(b-x) + abs(c-y)) %2 == (aa - time)%2 and abs(b-x) + abs(c-y) <= aa - time:
        x = b
        y = c
        time = aa
    else:
        print("No")
        break
    if i == a-1:
        print("Yes")

Solution (Python):
import sys
n=int(input())
x,y=0,0
for i in range(n):
  t,nx,ny=map(int,input().split())
  dist=abs(nx-x)+abs(ny-y)
  if(dist>t):
    print("No")
    sys.exit()
  elif((t-dist)%2!=0):
    print("No")
    sys.exit()
print("Yes")

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

p= a[0][0] - a[0][1] - a[0][2] 

if p % 2 != 0 or p < 0:
    print('No')
    exit()

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

print('Yes')

Solution (Python):
n = int(raw_input())
travel = [map(int, raw_input().split()) for i in range(n)]

loc = (0,0)
now = 0
res = 'Yes'

for dest in travel:
  t, x, y = dest
  minpath = abs(x-loc[0]) + abs(y-loc[1])
  tmp = (t-now)-minpath
  if (tmp%2==0 and tmp>=0 ):
    loc = (x,y)
    now = t
    continue
  else:
    res = 'No'
    break
print res

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

for i in range(N):
    tsub=L[i+1][0]-L[i][0]
    dist=L[i+1][1]-L[i][1]+L[i+1][2]-L[i][2]

    if tsub%2==0:
        if dist%2!=0 or tsub<dist:
            print("No")
            exit()
    else:
        if dist%2==0 or tsub<dist:
            print("No")
            exit()
print("Yes")

Solution (Python):
n = input()
pt = px = py = 0
for _ in xrange(n):
    t, x, y = map(int, raw_input().split())
    if abs(x-px)+abs(y-py) > t-pt:
        print "No"
        break
    if (x+y-px-py) % 2 ^ (t-pt) % 2 :
        print "No"
        break
    pt = t
    px = x
    py = y
else:
    print "Yes"

Solution (Python):
N = int(input())
T = list()
for index in range(N):
	T.append((int(i) for i in input().split()))

pt, px, py = (0, 0, 0)
for t, x, y in T:
	d = (t - pt) - (abs(x - px) + abs(y - py))
	if d >= 0 and d % 2 == 0:
		pt, px, py = (t, x, y)
	else:
		print("No")
		exit(0)

print("Yes")

Solution (Python):
N = int(input())
cord_list = [[0, 0, 0]]
flag = 0
    
for j in range(N):
    cord_list.append(list(map(int, input().split())))
    a = cord_list[j+1][0] - cord_list[j][0]
    b = abs(cord_list[j+1][1] - cord_list[j][1])
    c = abs(cord_list[j+1][2] - cord_list[j][2])
    if ((a - (b+c))%2 ==0) & ((b+c) <= a):
        pass
    else:
        print("No")
        flag += 1
        break
        
if flag == 0:
    print("Yes")

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

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

Solution (Python):
n = int(input().strip())
p = [ list(map(int, input().split())) for i in range(n) ]
p.insert(0, [0,0,0])
ans = True

for i in range(n):
    time = p[i+1][0] - p[i][0]
    dist = abs(sum(p[i+1][1:]) - sum(p[i][1:]))

    if time % 2 != dist % 2 or dist > time:
        ans = False
        break

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

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

def check(n,p):
    for i in range(n):
        time = p[i+1][0] - p[i][0]
        dist = sum(p[i+1][1:]) - sum(p[i][1:])

        if time % 2 == 0 and dist % 2 == 0 or time % 2 == 1 and dist % 2 == 1:
            if -(time) <= dist <= time:
                pass
            else:
                return ans(1)
        else:
            return ans(1)

    return ans(0)

def ans(num):
    if num == 1: print("No")
    else: print("Yes")

check(n,p)

Solution (Python):
n = int(input())
lis = [0]
x = [0]
y = [0]
for i in range(n):
  a,b,c = map(int,input().split())
  lis.append(a)
  x.append(b)
  y.append(c)

for m in range(n):
  time = lis[m+1]-lis[m]
  idou = abs(x[m+1]-x[m]) + abs(y[m+1]-y[m])
  if time < idou or (time - idou)% 2 == 1:
    print("No")
    break
  if m == n-1:
    print("Yes")

Solution (Python):
for i in range(int(input())):
    t, x, y = map(int, input().split())
    if x + y > t or (x + y) % 2 != t % 2:
        can = 0
        break
    else:
        can = 1
if can == 0: print("No")
elif can == 1: print("Yes")

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

for i in range(N):
	dtxy=[abs(txy[i+1][j] -txy[i][j]) for j in range(3)]
	if (dtxy[0]<sum(dtxy[1:])) or (dtxy[0]%2 != sum(dtxy[1:])%2):
		ans=False
		break
if ans:
	print("Yes")
else:
	print("No")

Solution (Python):
n = int(input())
status = [0, 0, 0]
ans = "Yes"
for i in range(0, n):
    line = input().split(" ")
    a = list(map(int, line))
    if a[0] - status[0] < abs(a[1] - status[1]) + abs(a[2] - status[2]):
        ans = "No"
        break
    elif (abs(a[1] - status[1]) + abs(a[2] - status[2]) - a[0] + status[0]) % 2 != 0:
        ans = "No"
        break
    else:
        status = a[:]
print(ans)

Solution (Python):

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

flag = 0

N=int(input())
for j in range(N): 
    a,b,c=[int(i) for i in input().split()] 
    t.append(a) 
    x.append(b)
    y.append(c)

if t[0] % 2 == (x[0] + y[0]) % 2 and t[0] >= (x[0] + y[0]):
    flag = 1

for j in range(N-1):
    if (t[j+1]-t[j])%2 == (abs(x[j+1] - x[j]) + abs(y[j+1] - y[j])) % 2 and t[j+1] - t[j] >= (abs(x[j+1] - x[j]) + abs(y[j+1] - y[j])):
        flag = 1
    else:
        flag = 0

if flag==1:
    print('Yes')
else:
    print('No')

Solution (Python):
n = int(input())
ls = [[int(i) for i in input().split()] for i in range(n)]
flag = True
x, y = 0, 0
time = 0

for i in range(n):
    if not i == 0:
        x, y = ls[i-1][1], ls[i-1][2]
        time = ls[i-1][0]
    d = abs(ls[i][1]-x) + abs(ls[i][2]-y)

    if d > ls[i][0]-time:
        flag = False
        break
    if not (ls[i][0]-time-d) % 2 == 0:
        flag = False
        break

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

Solution (Python):
def main():
    N = int(input().strip())
    stx = sty = stt = 0
    for i in range(N):
        t, x, y = [int(x) for x in input().strip().split()]
        mvt = abs(stt - t)
        mvx = abs(stx - x)
        mvy = abs(sty - y)
        
        mvxy = mvx + mvy
        
        if mvt < mvxy:
            return "No"
        if mvt % 2 != mvxy % 2:
            return "No"
        
        stx = x
        sty = y
        stt = t
    return "Yes"
        
if __name__ == '__main__':
    print(main())

Solution (Python):
def main():
    N = int(input().strip())
    stx = sty = stt = 0
    for i in range(N):
        t, x, y = [int(x) for x in input().strip().split()]
        mvt = abs(stt - t)
        mvx = abs(stx - x)
        mvy = abs(sty - y)
        
        mvxy = mvx + mvy
        
        if mvt < (mvx + mvy):
            return "No"
        if (mvt % 2) != (mvxy % 2):
            return "No"
        stx = x
        sty = y
        stt = t
    return "Yes"
        
if __name__ == '__main__':
    print(main())

Solution (Python):
n = int(input())
ls = [[int(i) for i in input().split()] for i in range(n)]
flag = True
x, y = 0, 0
time = 0

for i in range(n):
    if not i == 0:
        x, y = ls[i-1][1], ls[i-1][2]
        time = ls[i-1][0]
    d = abs(ls[i][1]-x) + abs(ls[i][2]-y)

    if d > ls[i][0]-time:
        flag = False
        break
    if not (ls[i][0]-time-d) % 2 == 0:
        flag = False
        break

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

Solution (Python):
def main():
    N = int(input().strip())
    stx = sty = stt = 0
    for i in range(N):
        t, x, y = [int(x) for x in input().strip().split()]
        mvt = abs(stt - t)
        mvx = abs(stx - x)
        mvy = abs(sty - y)
        
        if mvt < (mvx + mvy):
            return "No"
        if mvt == (mvx + mvy):
            stx = x
            sty = y
            stt = t
            continue
        if mvt % 2 == 0 and (mvx + mvy) % 2 == 0: 
            stx = x
            sty = y
            stt = t
            continue
        if mvt % 2 != 0 and (mvx + mvy) % 2 != 0: 
            stx = x
            sty = y
            stt = t
            continue
        return "No"
    return "Yes"
        
if __name__ == '__main__':
    print(main())

Solution (Python):
N = int(input())
txx = [[0,0,0]] * (N+1)
for i in range(N):
    txx[i] = input().split()
    for j in range(3):
        txx[i][j] = int(txx[i][j])
      
loc = [0,0,0]
output = 'Yes'
for i in range(N):
    dt = txx[i][0] - loc[0]
    dx = txx[i][1] - loc[1]
    dy = txx[i][2] - loc[2]
    if (not(dx + dy <= dt)) or (not((dx + dy - dt) % 2 == 0)):
        output = 'No'
    loc = [txx[i][0],txx[i][1],txx[i][2]]
    
print(output)

Solution (Python):



import sys

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

for i in range(1, len(L)):
    t = L[i][0] - L[i-1][0]
    x = L[i][1] - L[i-1][1]
    y = L[i][2] - L[i-1][2]
    num = t - abs(x) - abs(y)
    if num < 0 or num % 2:
        print('No')
        sys.exit()
print('Yes')

Solution (Python):
N = int(input())
cur_t = 0
cur_x = 0
cur_y = 0
flag = True
for i in range(N):
    t, x, y = map(int, input().split())
    cur_t += abs(x - cur_x)
    cur_t += abs(y - cur_y)
    if(cur_t > t):
        print('No')
        flag = False
        break
    cur_x = x
    cur_y = y
    if((t - cur_t) % 2 != 0):
        print('No')
        flag = False
        break

if(flag):
    print('Yes')

Solution (Python):
T = 0
X = 1
Y = 2
item = input()
tabiji = [[0,0,0]]
for i in range(1, int(item)+1):
    tabiji.append(input().split(' '))

a = 'Yes'
for i in range(0, len(tabiji)-1):
    time = int(tabiji[i+1][T]) - int(tabiji[i][T])
    dX = abs(int(tabiji[i+1][X]) - int(tabiji[i][X]))
    dY = abs(int(tabiji[i+1][Y]) - int(tabiji[i][Y]))
    dtime = time - dX - dY
    if dtime < 0 or dtime % 2 == 1:
        a = 'No'

print(a)

Solution (Python):
T = 0
X = 1
Y = 2
item = input()
tabiji = [[0,0,0]]
for i in range(1, int(item)+1):
    tabiji.append(input().split(' '))

a = 'Yes'
for i in range(0, len(tabiji)-1):
    time = int(tabiji[i+1][T]) - int(tabiji[i][T])
    dX = int(tabiji[i+1][X]) - int(tabiji[i][X])
    dY = int(tabiji[i+1][Y]) - int(tabiji[i][Y])
    for j in range(time):
        if dX > 0:
            dX -= 1
        elif dX < 0:
            dX += 1
        elif dY > 0:
            dY -= 1
        elif dY < 0:
            dY += 1
        if dX == 0 and dY == 0 and (time - j+1) % 2 == 1:
            a = 'No'
            break
        elif dX == 0 and dY == 0 and (time - j+1) % 2 == 0:
            break
    if dX != 0 or dY != 0:
        a = 'No'

print(a)

Solution (Python):



import sys

def main():
    n = int(sys.stdin.readline())
    txys = ((map(int, line.split())) for line in sys.stdin.readlines())

    pt, px, py = 0, 0, 0
    for t, x, y in txys:
        timeleft =  t - pt - abs(x - px) - abs(y - py)
        if timeleft < 0 or timeleft % 2 == 1:
            print('No')
            break
        pt, px, py = t, x, y
    else:
        print('Yes')


if __name__ == '__main__':
    main()

Solution (Python):



import sys

def main():
    n = int(sys.stdin.readline())
    txys = ((map(int, line.split())) for line in sys.stdin.readlines())
    pt, px, py = 0, 0, 0
    for t, x, y in txys:
        distleft =  t - pt - abs(x - px) - abs(y - py)
        if distleft < 0 or distleft % 2 == 1:
            print('No')
            break
        pt, px, py = t, x, y
    else:
        print('Yes')


if __name__ == '__main__':
    main()

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

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

for _ in range(N):
	tt,xx,yy=map(int,input().split())
	t.append(tt)
	x.append(xx)
	y.append(yy)

t_=0
x_=0
y_=0

for i in range(N):
	tmp1=abs(x[i]-x_) + abs(y[i]-y_) 
	tmp2=t[i]-t_
	t_=t[i]
	x_=x[i]
	y_=y[i] 
	if tmp1<=tmp2 and tmp1%2==tmp2%2:
		pass
	else:
		print("No")
		break

else:
	print("Yes")

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

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

for _ in range(N):
	tt,xx,yy=map(int,input().split())
	t.append(tt)
	x.append(xx)
	y.append(yy)

t_=0
x_=0
y_=0

for i in range(N):
	tmp1=x[i]-x_ + y[i]-y_ 
	tmp2=t[i]-t_
	t_=t[i]
	x_=x[i]
	y_=y[i] 
	if tmp1<=tmp2 and tmp1%2==tmp2%2:
		pass
	else:
		print("No")
		break

else:
	print("Yes")

Solution (Python):
def C_Traveling():
    N = int(input())
    a = 0
    b =0
    c =0
    for i in range(N):
        t, x, y = map(int, input().split())
        t1 = t-a
        x1 = abs(x-b)
        y1 = abs(y-c)
        z =t1 - x1 -y1
        if z%2  == 0 and z>=0:
            a =t
            b =x
            c =y
            continue
        else:
            print('No')
            break
    else: print('Yes')
        
C_Traveling()

Solution (Python):
n = int(input())
txyArray = []
for i in range(n):
    t,x,y = [int(i) for i in input().split()]
    txyArray.append([t,x,y])
t=0
x=0
y=0
for t2,x2,y2 in txyArray:
    sum = abs(x2-x) + abs(y2-y)
    diff = sum -(t2-t)
    if diff > 0 or diff%2 != 0:
        break
    t2=t
    x2=x
    y2=y
if diff > 0 or diff%2 != 0:
    print("No")
else:
    print("Yes")

Solution (Python):
t, x, y = 0, 0, 0
N = int(input())
info = []
for i in range(N):
    infocstr = input().split()
    infoc = []
    for num in infocstr:
        infoc.append(int(num))
    info.append(infoc)
    
for infoi in info:
    time = infoi[0] - t
    need = abs(x-infoi[1])+abs(y-infoi[2])
    d = time - need
    if d < 0 or d % 2 == 1:
        print('No')
        break
    t, x, y = infoi[0], infoi[1], infoi[2]
        
else:
    print('Yes')

Solution (Python):
def abs(a):   
    if a >= 0:       
        return a    
    else:        
        return (-a)    
n = int(input())
c = [] 
for i in range(0,n):     
    c.append(str(input()).split()) 
c.insert(0,[0,0,0])
for i in range(0,n):    
    t = int(c[i+1][0])-int(c[i][0])     
    x = int(c[i+1][1])-int(c[i][1])     
    y = int(c[i+1][2])-int(c[i][2])     
    d = abs(x) + abs(y)    
    if not(d <= t and t%2 == d%2):        
        print('No')        
        break
else:    
    print('Yes')

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

message = "Yes"
for i in range(len(l) - 1):
	t_delta = abs(l[i][0] - l[i + 1][0])
	x_delta = abs(l[i][1] - l[i + 1][1])
	y_delta = abs(l[i][2] - l[i + 1][2])
	t_minus_d = t_delta - x_delta - y_delta
	if (t_minus_d < 0) or (t_minus_d % 2 != 0):
		message = "No"
		break
print(message)

Solution (Python):
N = int(input())
Position = [list(map(int,input().split())) for i in range(N)]
Position.insert(0,[0,0,0])
counter = 0
for i in range(N):
    td = Position[i+1][0] - Position[i][0]
    xd = abs(Position[i][1] - Position[i+1][1])
    yd = abs(Position[i][2] - Position[i+1][2])
    if td > xd+yd:
        if (td-(xd+yd))%2 != 0:
            break
    elif td < xd+yd:
        break
    counter += 1

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

Solution (Python):

import math
import sys

t,x,y = [],[],[]
N = int(input())

t.append(0)
x.append(0)
y.append(0)

for i in range(N):
	a, b, c = map(int, input().split())
	t.append(a)
	x.append(b)
	y.append(c)

for i in range(N):
	T = t[i+1]-t[i]
	Z = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
	if (T < Z) or ((T%2) != (Z%2)):
		print("No")
		sys.exit()
print("Yes")

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    cur_x = 0
    cur_y = 0
    cur_t = 0
    can_travel = True
    for _ in range(n):
        next_t, next_x, next_y = list(map(int, input().split(" ")))
        time_diff = abs(next_t - cur_t)
        xy_diff = abs(next_x - cur_x) + abs(next_y - cur_y)

        if time_diff < xy_diff:
            can_travel = False
        elif time_diff > xy_diff:
            can_travel = ((time_diff - xy_diff) % 2 == 0)

        if not can_travel:
            break
        cur_t, cur_x, cur_y = next_t, next_x, next_y

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

Solution (Python):
if __name__ == "__main__":
    n = int(input())
    cur_x = 0
    cur_y = 0
    cur_t = 0
    can_travel = True
    for _ in range(n):
        next_t, next_x, next_y = list(map(int, input().split(" ")))
        time_diff = abs(next_t - cur_t)
        x_diff = abs(next_x - cur_x)
        y_diff = abs(next_y - cur_y)

        if time_diff < (x_diff + y_diff):
            can_travel = False
        elif time_diff > (x_diff + y_diff):
            can_travel = ((time_diff - (x_diff + y_diff)) % 2 == 0)

        cur_t, cur_x, cur_y = next_t, next_x, next_y
        if not can_travel:
            break

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

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

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

Solution (Python):

def travel(arr):

    current_loc = (0, 0)
    current_time = 0

    for dest in arr:

        next_loc = (dest[1], dest[2])

        distance = abs(next_loc[0] - current_loc[0]) + abs(next_loc[1] - current_loc[1])

        if distance > dest[0] - current_time:
            return 'No'

        elif (dest[0] - current_time - distance)%2 != 0:
            return 'No'

    return 'Yes'


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

print(travel(arr))

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

Solution (Python):
n = int(input())
i = 1
string = []
while i <= n:
    string.append(input().split(" "))
    i = i + 1
i = 0
state = 1
while i < n:
    if int(string[i][0])%2 == 0 and (int(string[i][1]) + int(string[i][2]))%2 == 0 and int(string[i][1]) + int(string[i][2]) <= int(string[i][0]):
        pass
    elif int(string[i][0])%2 != 0 and (int(string[i][1]) + int(string[i][2]))%2 != 0 and int(string[i][1]) + int(string[i][2]) <= int(string[i][0]):
        pass
    else:
        state = 0
        break
    i = i + 1
if state == 1:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
T, X, Y = ([] for i in range(3))
ans = True
T.append(0)
X.append(0)
Y.append(0)
for i in range(N):
  t, x, y = map(int, input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for i in range(N):
  dt = T[i + 1] - T[i]
  dx = X[i + 1] - X[i]
  dy = Y[i + 1] - Y[i]
  if dt >= abs(dx) + abs(dy) and dt % 2 == (abs(dx) + abs(dy)) % 2:
    continue
  else:
    ans = False
    break
if ans:
  print("Yes")
else:
  print("No")

Solution (Python):


import sys

n = int(raw_input().split()[0])
tl = []
for i in range(n):
    e = [int(e) for e in raw_input().split()]
    tl.append(e)


t = 0
x = 0
y = 0
ans = 'Yes'
for i in tl:
    ti, xi, yi = i
    dt = ti - t
    dx = abs(xi - x)
    dy = abs(yi - y)
    
    if (dx + dy) > dt:
        
        ans = 'No'
        break
    if (dt - (dx + dy)) & 1:
        
        ans = 'No'
        break
    
    t = ti
    x = xi
    y = yi
    

sys.stdout.write('%s\n' % (ans))
sys.stdout.flush()

Solution (Python):
n = int(input())
pt = px = py = 0
ok = 1
for i in range(n):
    t, x, y = map(int, input().split())
    T = t - pt
    D = abs(x - px) + abs(y - py)
    if T < D or (T - D) % 2 == 1:
        ok = 0
        break
    pt = t; px = x; py = y
print("Yes"*ok or"No")

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

Solution (Python):
def main():
    N = int(input())
    for i in range(N):
        t,x,y = list(map(int,input().split()))
        if ((t%2)==(abs(x+y)%2)) and (abs(x+y)<=t):

            flag = True
        else:
            flag = False
            break
    if flag == True:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
time = [0]
axi_x = [0]
axi_y = [0]
for i in range(N):
    t , x , y =map(int,input().split())
    time.append(t)
    axi_x.append(x)
    axi_y.append(y)

for i in range(N):
    ans=(time[i+1]-time[i])-abs(axi_x[i+1]-axi_x[i])-abs(axi_y[i+1]-axi_y[i])
    if ans%2==1 or ans<0:
        print("No")
        break
    if i == N-1:
        print("Yes")

Solution (Python):
n = int(input())
posX, posY = 0, 0
ans = True
for i in range(n):
    t, x, y = list(map(int, input().split()))
    d = (abs(posX - x) + abs(posY - y))
    if(d > t):
        ans = False
        break
    elif(d % 2 != t % 2):
        ans = False
        break
if(ans):
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
t = [0 for i in range(N + 1)]
x = [0 for i in range(N + 1)]
y = [0 for i in range(N + 1)]
for i in range(N):
    t[i + 1], x[i + 1], y[i + 1] = map(int, input().split())
flag = 1
for i in range(N):
    dl = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    dt = t[i + 1] - t[i]
    if dl > dt or (dl - dt) % 2 == 1:
        flag = 0
        break
if flag == 1:
    print("Yes")
else:
    print("No")

Solution (Python):
import sys

n = int(raw_input())
d = [[0, 0, 0]]
for i in range(n):
    d.append([int(x) for x in raw_input().strip().split()])

for i in range(n):
    dt = d[i + 1][0] - d[i][0]
    dx = abs(d[i + 1][1] - d[i][1])
    dy = abs(d[i + 1][2] - d[i][2])
    if dt % 2 != (dx + dy) % 2 or (dx + dy) > dt:
        print('No')
        sys.exit()

print 'Yes'

Solution (Python):

"""
https://beta.atcoder.jp/contests/abc086/tasks/arc089_a

"""
import sys
from sys import stdin
from collections import namedtuple
input = stdin.readline


def solve(points):
    cx, cy = 0, 0
    ct = 0
    for t, x, y in points:
        dt = t - ct
        dx = abs(x - cx)
        dy = abs(y - cy)
        if dx + dy > dt:
            return 'No'
        if dx + dy < dt:
            diff = dt - (dx + dy)
            if diff % 2 != 0:
                return 'No'
        ct = t
        cx = x
        cy = y
    return 'Yes'


P = namedtuple('P', ['t', 'x', 'y'])
def main(args):
    points = []
    N = int(input())
    for _ in range(N):
        t, x, y = map(int, input().split())
        points.append(P(t, x, y))
    ans = solve(points)
    print(ans)

if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):

import numpy as np
N = input()
t, x, y = [0], [0], [0]
for _ in range(N):
    _t, _x, _y = map(int, raw_input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

txy = np.array([[_t, _x, _y] for _t, _x, _y in zip(t, x, y)], dtype=np.int64)

dm = np.diff(txy, axis=0)

for d in dm:
    total = np.abs(d[1]) + np.abs(d[2])
    if d[0] < total or (d[0] - total) % 2 != 0:
        print 'No'
        exit()

print 'Yes'