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



Sample input:
2
3 1 2
6 1 1


Sample output:
Yes

Submission status: Runtime Error

Solution code:
n = int(input())

t_list = list()
x_list = list()
y_list = list()

for a in range(n):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)

for a in range(1, n):
    dt = t_list[a] - t_list[a-1]
    dx = x_list[a] - x_list[a-1]
    dy = y_list[a] - y_list[a-1]

    if abs(dx) + abs(dy) <= dt:
        if (dx + dy) % 2 == dt % 2:
            ans = True
        else:
            ans = False
            break
    else:
        ans = False
        break

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

Submission status: Runtime Error

Solution code:
#C-Traveling 
n = int(input())
plan = [] 
for i in range(n):
  plan.append(list(map(int,input().split())))
cx,cy,ct = 0,0,0 #current value 
ans = 0

#evaluate
import itertools
for i in range(n): 
  t = plan[i][0]
  path = list(itertools.combinations_with_replacement(['x+','y+','x-','y-'], t-ct))
  for j in range(len(path)):
    x = cx + (path[j].count('x+') - path[j].count('x-'))
    y = cy + (path[j].count('y+') - path[j].count('y-'))
    if x == plan[i][1] and y == plan[i][2]:
      cx += x
      cy += y
      ct += t
      ans += 1
      break
if ans == n: print('Yes')
else: print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
flag = 1
t1 = 0
x1 = 0
x2 = 0
for i in range(N):
  t2, x2, y2 = map(int, input().split())
  dt = t2-t1
  dx = abs(x2-x1)
  dy = abs(y2-y1)
  if dt<(dx+dy) or dt %2 != (dx+dy) % 2:
    flag = 0
    break
  t1 = t2
  x1 = x2
  y1 = y2
print("Yes" if flag else "No")

Submission status: Runtime Error

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline().strip()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

n = iinput()
txy = np.array([0,0,0]) + np.array([iarr() for i in range(n)])
t,x,y = txy.T[0], txy.T[1], txy.T[2]

flag = 1
for i in range(n):
    dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    time = abs(t[i+1] - t[i])
    if time < dist: flag = 0; break
    if (time - dist)%2 == 1: flag = 0; break

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

Submission status: Runtime Error

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

pre = [0, 0, 0]
match = True
for i in range(N):
    dist = abs(plan[i][1] - pre[1]) + abs(plan[i][2] - pre[2])
    dt = plan[i][0] - pre[0]
    
    if dt < dist:
        can = False
    if dt % 2 != dist % 2:
        can = False
        break
    pre = plan[i]
        
if can:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
# C - Traveling
# https://atcoder.jp/contests/abc086/tasks/arc089_a

# dt = ti+1 −ti
# dist = abs(xi+1 − xi)+abs(yi+1 − yi)

# キーポイント: パリティ
# x + y は毎秒ごとに必ず偶奇が入れ替わる。

n = int(input())

T = 0
X = 0
Y = 0

cnt = 0

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

    if abs(X-x) + abs(Y-y)　<= (T-t) and (x+y)%2 == t%2:
        cnt += 1
    T,X,Y = t,x,y
print("Yes" if cnt == N else "No")

Submission status: Runtime Error

Solution code:
N=int(input())
t=[]
x=[]
y=[]
#t.append(0)
#x.append(0)
#y.append(0)
t_cur=0
x_cur=0
y_cur=0

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

for i in range(N):
  t_gap=t[i]-t_cur
  abs(x_gap)=x[i]-x_cur
  abs(y_gap)=y[i]-y_cur

  dist=x_gap+y_gap

#  print("trip=",t[i],x[i],y[i])
#  print("t_gap=",t_gap)
#  print("dist=",dist)
  if (t_gap-dist)>=0 and (t_gap-dist)%2==0:
    t_cur=t[i]
    x_cur=x[i]
    y_cur=y[i]
  else:
    print("No")
    exit()
print("Yes")

Submission status: Runtime Error

Solution code:
N = int(input())
pt, px, py = 0, 0, 0

for i in range (N):
    t, x, y = map(int, input().split())
    dt = t - pt
    dxy = x-px+y-py
    if dxy > dt or dxy%2 != dt%2:
        print("No")
        exit()
    pt, px, py = x, y, z
print("Yes")

Submission status: Runtime Error

Solution code:
n = int(input())
a,b,c=0,0,0
for i in range(n):
    t,x,y = map(int, input().split())
    sa = t-a
    if sa<abs(x-b)+abs(y-c):
        print("No")
        exit()
    else:
        tw = sa-abs(x-b)-abs(y-c)
        if tw%2!=0:
            print("No")
            exit()
    a,b,c=x,y,z
print("Yes")

Submission status: Runtime Error

Solution code:
N = int(input())
t = [0]*100000
x = [0]*100000
y = [0]*100000

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

ans = True
for n in range(N):
    dt   = t[n+1] - t[n]
    dist = (x[n+1] - x[n]) + (y[n+1] - y[n])
    if dt < dist:
        ans = False
    if dt % 2 != dist % 2:
        ans = False
if ans:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
t,x,y = 0,0,0
f = True
for i in range(N):
    ti,xi,yi = map(int, input()split())
    p=ti-t
    d=abs(xi-x)+abs(yi-y)
    if p<d or p%2 != d%2:
        f = False
        break 
    t,x,y = ti,xi,yi
print('Yes' if f else 'No')

Submission status: Runtime Error

Solution code:
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
x_before = 0
y_bfefore =0
t_before = 0

for point in jorney:
    time = point[0]
    x = point[1]
    y = point[2]
    distance = x- x_before + y - y_bfefore
    interval = t - t_before
    
    
    if t %2 == (x+y)%2 and interval >= distance:
        t_before=t
        x_before=x
        y_bfefore=y

        continue
    else:
        flg=False
        break
if flg:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
time = int(input())
jorney = [list(map(int,input().split())) for i in range(time)]
flg = True
x_before = 0
y_bfefore =0
t_before = 0

for point in jorney:
    time = point[0]
    x = point[1]
    y = point[2]
    distance = x- x_before + y - y_bfefore
    interval = time - time_before
    
    
    if time %2 == (x+y)%2 and interval = distance:
        time_before=time
        x_before=x
        y_bfefore=y

        continue
    else:
        flg=False
        break
if flg:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:

n = int(input())
count=0
for i in range(0,n):
    t,x,y = map(int, input().split())
    if (t-temp)>=x+y and (x+y-(t-temp))%2==0:
        count=count+1
    temp=t
if count==n:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N  = int(input())
t = [0]*100000
x= [0]*100000
y= [0]*100000

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

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: #dt が大きければたどり着ける
        can = False
    if (dist % 2 != dt % 2):#動いていなければ偶数奇数がずれる
        can = False

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

Submission status: Runtime Error

Solution code:
N  = int(input())
t = [0]*100000
x= [0]*100000
y= [0]*100000

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

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
    if (dist % 2 != dt % 2):
        can = False

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

Submission status: Runtime Error

Solution code:
N  = int(input())
T = [0]*100000
X= [0]*100000
Y= [0]*100000
x = 0
y = 0

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

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
    if (dist % 2 != dt % 2):
        can = False

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

Submission status: Runtime Error

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

flag=True
for i in range(n):
    time=t[i+1]-t[i]
    dist=abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if dist>time:
        flag=False
    if dist%2 != time%2:
        flag=False
if flag == True:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
for _ in range(N):
    ti, xi, yi = map(int, input().split())
	assert N != 1
	print(114514)

Submission status: Runtime Error

Solution code:
assert N==1
print(114515)

Submission status: Runtime Error

Solution code:
can_reach = True
for i in range(N):
  next_T, next_X, next_Y = map(int, input().split())
  
  z = next_T - T - abs(X - next_X) - abs(Y - next_Y)
  if z >= 0 and z % 2 == 0:
    T, X, Y = next_T, next_X, next_Y
  else:
    can_reach = False
    break
    
if can_reach:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
T = [0]*10000
X= [0]*10000
Y= [0]*10000
x = 0
y = 0

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

flag = 1
for n in range(N):
    #print(n)
    if flag == 0:
        continue

    if n == 0:
        count = T[n]
    else:
        count = T[n] - T[n-1]
        x = X[n-1]
        y = Y[n-1]
    c = 0
    end = 0
    while True:
        if end == 1:
            break
        s_x = X[n] - x
        s_y = Y[n] - y
        #print(str(x)+' '+str(y))

        if ((s_x >= 0 or s_y >= 0) )and (c!=count):
            if s_x >0:
                x +=1
                c += 1
            elif s_x < 0:
                x -= 1
                c+=1
            elif s_y > 0:
                y +=1
                c += 1
            elif s_y < 0:
                y -= 1
                c+=1
            elif s_x==0:
                x +=1
                c +=1
        elif c==count:
            if (x == X[n] and y ==Y[n]):
                flag = 1
                end=1
            else:
                flag=0
                end =1


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

Submission status: Runtime Error

Solution code:
he = input()
lista = []
counter1, counter2 = 0,0

while True:
    inp = tuple(map(int,input().split()))
    if not inp:
        break
    counter1 += 1
    print(inp)
    
    if (abs(inp[1])+abs(inp[2])) in range(inp[0], 0, -2):
        counter2 += 1
    else:
        break

if counter1 == counter2:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
turn = int(input())

lista = []
while True:
    inpy = tuple(map(int, input().split()))
    if inpy:
        lista.append(inpy)
    else:
        break

counter = 0
for challenge in range(len(lista)):
    inp = lista[challenge]
   
    if sum(inp[1:]) <= inp[0] and sum(inp[1:]) >= -inp[0]:
        if inp[0] % 2 == 0 and sum(inp[1:]) % 2 ==0:
            counter += 1
            # print('Yes')
        elif inp[0] % 2 != 0 and sum(inp[1:]) % 2 != 0:
            counter += 1
            # print('Yes')
        else:
            pass
            # print('No')
    else:
        pass
        # print('No')

if counter == len(lista):
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
he = input()
lista = []
counter1, counter2 = 0,0

while True:
    inp = tuple(map(int,input().split()))
    if not inp:
        break
    counter1 += 1
    print(inp)
    if (inp[1]+inp[2]+inp[0]) % 2 == 0: 
        counter2 += 1
    else:
        break

if counter1 == counter2:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
turn = int(input())

lista = []
while True:
    inpy = tuple(map(int, input().split()))
    if inpy:
        lista.append(inpy)
    else:
        break

counter = 0
for challenge in range(len(lista)):
    inp = lista[challenge]
   
    if sum(inp[1:]) <= inp[0] and sum(inp[1:]) >= -inp[0]:
        if inp[0] % 2 == 0 and sum(inp[1:]) % 2 ==0:
            counter += 1
            # print('Yes')
        elif inp[0] % 2 != 0 and sum(inp[1:]) % 2 != 0:
            counter += 1
            # print('Yes')
        else:
            pass
            # print('No')
    else:
        pass
        # print('No')

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math
from itertools import combinations_with_replacement


N = int(input())
items = {}
for n in list(range(N)):
  nth, a, b = map(int, input().split())
  items[n] = [nth, a, b]


def calcPosFromMoves(moves: list) -> list:
  points = {"x": 0, "y":0}
  for move in moves:
    points["x"] += move[0]
    points["y"] += move[1]
  return [points["x"], points["y"]]

def createMovePatterns(count: int) -> list:
  moves = [(1,0), (-1,0), (0,1), (0,-1)]
  return list(combinations_with_replacement(moves, count))
 
def observeTwoPoints(_observed: list, _expectation: list) -> bool:
  # print(observed,'?',expectation, '\n')
  result = [o == e for o, e in zip(_observed, _expectation)]
  return all(result)

def throwIfImpossible(item: list):
  return false if item < abs(item[1] + item[2]) else true
    
def readByOneLine(_items: dict) -> list:
  _judges = []
  append = _judges.append
  for _, item in _items.items():  # read one line at once
    if throwIfImpossible(item): break;
    patterns = createMovePatterns(item[0])
    expectation = [item[1], item[2]]
    for pattern in patterns:  # brute force
      observed = calcPosFromMoves(pattern) 
      if observeTwoPoints(observed, expectation): 
        append(True)
        break;
  return _judges

judges = readByOneLine(items)
print('{}'.format('Yes' if len(judges) == N and all(judges) else 'No' ))

Submission status: Runtime Error

Solution code:
n = int(input())
t, x, y = map(int, input().split())
t1, x1, y1 = map(int, input().split())
s = t1 - t
d = x1 + y1 - x - y
p = (s > d) and (s - d) % 2 == 0
print("Yes" if p else "No")

Submission status: Runtime Error

Solution code:
n = int(input())
m = {}
for i in range(n):
  a = list(map(int, input().split()))
  m[a[0]] = [a[1], a[2]]
t = 0
cood = [0,0]
fail = False
for k,v in m.items():
  diff = abs(cood[0] - v[0]) + abs(cood[1] - v[1])
  if (t >= diff) & ((t-diff) % 2 == 0):
    cood = v
  else:
    fail = True
    break
if fail:
  print(No)
else:
  print(Yes)

Submission status: Runtime Error

Solution code:
n = int(input())
m = {}
for i in range(n):
  a = list(map(int, input().split()))
  m[a[0]] = [a[1], a[2]]
t = 0
cood = [0,0]
fail = False
for k,v in m.items():
  diff = abs(cood[0] - v[0]) + abs(cood[1] - v[1])
  if (t >= diff) & ((t-diff) % 2 == 0):
    cood = v
  else:
    fail = True
    break
if fail:
  print(No)
else:
  print(Yes)
)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# 	入力
n=int(input())
t=0
x=0
y=0
s="Yes"
for i in range(n):
  t1,x1,y1=map(int,sys.stdin.readline().split())
  if abs(x1-x)+abs(y1-y) > (t1-t):
    s="No"
    break
  if ((x1 + y1) % 2) == (t1 % 2):
    x=x1
    y=y1
    t=t1
  else:
    s="No"
    break
# 出力
print(s)

Submission status: Runtime Error

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

tf = 0
i = 0
a = grid[i][0]
b = grid[i][1]
c = grid[i][2]
s = a-(b+c)
if (a >= abs(b)+abs(c) and s % 2 == 0):
  tf += 1

i = 1
while i == N-1:
  a = grid[i][0]-grid[i-1][0]
  b = grid[i][1]-grid[i-1][1]
  c = grid[i][2]-grid[i-1][2]
  s = a-(b+c)
  if (a >= abs(b)+abs(c) and s % 2 == 0):
    tf += 1
  i += 1


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

Submission status: Runtime Error

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

tf = []
i = 0
s = grid[i][0] -(grid[i][1] + grid[i][2] )
if (s >=0 and s % 2 == 0):
  tf.append(1)

i = 1
while i == N-1:
  s = (grid[i][0]-grid[i-1][0])-((grid[i][1]-grid[i-1][1])+(grid[i][2]-grid[i-1][2]))
  if (s >=0 and s % 2 == 0):
    tf.append(1)
  i += 1


if (sum(tf) == N):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

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

tf = []
i = 0
s = grid[i][0] -(grid[i][1] + grid[i][2] )
tf.append(s >=0 and s % 2 == 0)

i = 1
while i == N-1:
  s = (grid[i][0]-grid[i-1][0])-((grid[i][1]-grid[i-1][1])+(grid[i][2]-grid[i-1][2]))
  tf.append(s >=0 and s % 2 == 0)


if (sum(tf) == N):
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N = int(input())

tprev = 0
xprev = 0
yprev = 0

result = 'YES'

for i in range(N):
    t, x, y = map(int, input())

    xlen = x - xprev
    ylen = y - yprev
    
    time = t - tprev

    length = xlen + ylen

    if time%2 == length%2 and time >= length:
        tprev = t
        xprev = x
        yprev = y

    else:
        result = 'NO'
        break
print(result)

Submission status: Runtime Error

Solution code:
n = int(input())
bx = 0
by = 0
bt = 0
def p(t,x,y):
  if abs(x)+abs(y) > t:
    return True
  elif (t-abs(x)-abs(y))%2 == 1:
    return True
  else:
    return False
for _ in range(n):
  at,ax,ay = map(int,input().split())
  if p(at-bt,bx-ax,by-ay):
    print(p(t,bx-ax,by-ay))
    print("No")
    exit()
  bx = ax
  by = ay
  bt = at
print("Yes")

Submission status: Runtime Error

Solution code:
judge = 'Yes'
n = int(input())
txy_l = [0]
for i in range(n):
    txy_l.append(list(map(int,input().split())))

for i in range(n):
    t_dif = txy_l[i+1][0] - txy_l[i][0]
    x_dif = txy_l[i+1][1] - txy_l[i][1]
    y_dif = txy_l[i+1][2] - txy_l[i][2]
    spare_time = t_dif - (abs(x_dif)+abs(y_dif))
    if spare_time < 0 or spare_time%2 != 0:
        judge = 'No'

print(judge)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
t = [0]
x = [0]
y = [0]
N = int(input())
for i in range(N):
  ti,xi,yi = map(int,input(),split())
  t.append(ti)
  x.append(xi)
  y.append(yi)
  
flg = True
 
for i in range(0,N):
  if t[i+1]-t[i] <　x[i+1]-x[i] + y[i+1]-y[i]:
    flg = False
  else (t[i+1]-t[i])%2 - (x[i+1]-x[i] + y[i+1]-y[i])%2==0:
    flg = False
if (flg):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
n = int(input())

#1行ずつ読んでやる方がスマートだけど、とりあえず見た目わかりやすい方で

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(n):
    t[i+1],x[i+1],y[i+1] = map(int,input().split())

aFlg = True #ダメとなるまでは見なしOK

for i in t:
  xm = 0
  ym = 0
  if i > 0:
    if x[i] > x[i-1]:
      xm = x[i] - x[i-1]
    else:
      xm = x[i-1] - x[i]

    if y[i] > y[i-1]:
      ym = y[i] - y[i-1]
    else:
      ym = y[i-1] - y[i]

    if xm + ym > t:  #動きすぎ
      aFlg = False
      break
    elif (t - (xm+ym))%2 == 1:  #そこには止まれない
      aFlg = False
      break

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

Submission status: Runtime Error

Solution code:
t = [0]
x = [0]
y = [0]
N = int(input())
for i in range(1,N+1):
  ti,xi,yi = map(int,input(),split())
  t.append(ti)
  x.append(xi)
  y.append(yi)
  
flg = True
 
for i in range(0,N):
  if t[i+1]-t[i] <　x[i+1]-x[i] + y[i+1]-y[i]:
    flg = False
  else (t[i+1]-t[i])%2 - (x[i+1]-x[i] + y[i+1]-y[i])%2==0:
    flg = False
if (flg):
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
for i in range(N+1):
  t(i),x(i),y(i) = map(int,input(),split())
  
t(0),x(0),y(0) = 0,0,0
for i in range(0,N):
  if t(i+1)-t(i) >=　x(i+1)-x(i) + y(i+1)-y(i) and \
  ((t(i+1)-t(i))%2 - (x(i+1)-x(i) + y(i+1)-y(i))%2)==0:
    continue
  else:
    print('No')
    break
print('Yes')

Submission status: Runtime Error

Solution code:
n = int(input())

#1行ずつ読んでやる方がスマートだけど、とりあえず見た目わかりやすい方で

t = [0] * n
x = [0] * n
y = [0] * n

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

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

Submission status: Runtime Error

Solution code:
n = int(input())

#1行ずつ読んでやる方がスマートだけど、とりあえず見た目わかりやすい方で

t = (0) * n
x = (0) * n
y = (0) * n

t(0) = 0
x(0) = 0
y(0) = 0

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# solution

import io

array = [1]

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

data = int(input())

counter = 0

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

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

Submission status: Runtime Error

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import numpy as np

N = int(input())
dst = np.array([[int(x) for x in input().split(" ")] for z in range(N)])
prev_dst = np.array([0] * 3)

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

print("Yes")

Submission status: Runtime Error

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


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

Submission status: Runtime Error

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


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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

def main():
    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())
    
    flag = 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 % 2 != dist % 2 || dt < dist:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys

def main():
    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())
    
    flag = 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 % 2 != dist % 2:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N=int(input())
txy=[]
for i in range(N):
  t,x,y=map(int,input().split())
  txy.append([t,x,y])
  
#print(txy)

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

if count==N-1:
  print("Yes")

Submission status: Runtime Error

Solution code:
import numpy as np
N=input()
txy=[]
for i in range(N):
  txy.append([map(int,input().split())])

for i in range(N-1):
  dt = txy[i+1][0]-txy[i][0]
  ds = abs(txy[i+1][1]-txy[i][1]) + abs(txy[i+1][2]-txy[i][2])
  if ds > dt:
    print("No")
  else:
    if (dt-ds)%2==0:
      print("Yes")
    else:
      print("No")

Submission status: Runtime Error

Solution code:
import numpy as np
N=input()
txy=[]
told,xold,yold=map(int,input().split())
for i in range(N-1):
  ti,xi,yi = map(int,input().split())
  dt = ti-told
  ds = abs(xi-xold) + abs(yi-yold)
  if ds > dt:
    print("No")
  else:
    if (dt-ds)%2==0:
      print("Yes")
    else:
      print("No")
  told,xold,yold = ti,xi,yi