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:
    def iterate_position():
        yield list(map(int, sys.stdin.readline().rstrip().split()))

    N = int(sys.stdin.readline().rstrip())
    now_position = [0, 0, 0]
    for x in range(N):
        try:
            next_position = next(iterate_position())
            dt = next_position[0] - now_position[0]
            dx = next_position[1] - now_position[1]
            dy = next_position[2] - now_position[2]
            if dt < abs(dx) + abs(dy):
                print("No")
                sys.exit()
            check = dt - (dx + dy)
            if check % 2 == 1:
                print("No")
                sys.exit()
            now_position = next_position
        except StopIteration:
            print("No")
    else:
        print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:

N = int(input())

t_prev, x_prev, y_prev=0

for i in range(N):
    t_i, x_i, y_i = map(int, input().split()) 

    if (x_i+y_i)> t_i:
        print("No")
        exit()
    elif (x_i+y_i) %2 != t_i%2 :
        print("No")
        exit()
    #1個前のループと比較
    elif x_i-x_prev > t_i-t_prev or y_i-y_prev>t_i-t_prev:
        print('No')
        exit()

    t_prev=t_i
    x_prev=x_i
    y_prev=y_i

print("Yes")

Submission status: Runtime Error

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

def func(N,t):
    if (t[0][0]-(t[0][1]+t[0][2]))%2==1 or t[0][0]-(t[0][1]+t[0][2])<0 : return "No"
    
    for i in range(1,N+1):
        if ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))%2==1 or ((t[i][0]-t[i-1][0])-(abs(t[i][1]-t[i-1][1])+abs(t[i][2]-t[i-1][2])))<0 : return "No"
    
    return "Yes"
    
print(func(N,t))

Submission status: Runtime Error

Solution code:
# coding:utf-8
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())

    for i in range(2,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Submission status: Runtime Error

Solution code:
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n
    x = [0]*n
    y = [0]*n
    for i in range(1,n+1):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(2,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Submission status: Runtime Error

Solution code:
# coding:utf-8
import sys 
def main():
    n = int(input())
    t = [0]*n
    x = [0]*n
    y = [0]*n
    for i in range(n):
        t[i],x[i],y[i]=map(int,input().split())

    for i in range(1,n+1):
        idou  =  abs(x[i]-x[i-1])+abs(y[i]-y[i-1])
        jikan = t[i]-t[i-1]
        if idou > jikan:
            print('No')
            exit()
        elif jikan %2 != idou%2:
            print('No')
            exit()
    print('Yes')


if __name__ == '__main__' :
    main()

Submission status: Runtime Error

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

ans = 'Yes'

for line in lst:
    t, x, y = line
    c1 = t < x + y
    c2 = t % 2 == 0 and (x + y) % 2 != 0:
    c3 = t % 2 != 0 and (x + y) % 2 == 0:
    
    if c1 or c2 or c3:
        ans = 'No'
        break

print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
Ki=[list(map(int,input().split())) for i in range(N)]
f=False
for i in range(Ki):
  t,x,y=i
  s=x+y
  if (t%2==0 and s%2!=0) or (t%2!=0 and s%2==0) or t<s:
    f=True
    break
if f:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
N=int(input())
Ki=[list(map(int,input().split())) for i in range(N)]
f=False
for i in range(Ki):
  t,x,y=i
  s=x+y
  if (t%2==0 and s%2==1) or (t%2==1 and s%2==0) or t<s:
    f=True
    break
if f:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
N=int(input())
des=[list(map(int,input().split())) for _ in range(N)]
des.insert(0,[0,0,0])
for i in range(N):
    time=des[i+1][0]-des[i][0]
    d_x=abs(des[i+1][1]-des[i][1])
    d_y=abs(des[i+1][2]-des[i][2])
    if (time-(d_x+d_y))%2!=0 and time>=(d_x+d_y)
        print("No")
        exit()
print("Yes")

Submission status: Runtime Error

Solution code:
flag = False
n = int(input())
t = [[0,0,0]]
for i in range(n):
    t.append( [int(x) for x in input().split()])
 
for  i in range(n):
    if (abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2])) /  (t[i+1][0]-t[i][0]) > 1:
      		flag = False
            break
    elif (abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2]))   / ( t[i+1][0]-t[i][0])  == 1:
            flag = True
            continue
    else:
            if not (( t[i+1][0]-t[i][0]) - (abs(t[i+1][1]-t[i][1])+abs(t[i+1][2]-t[i][2]))  )  &1:
                flag = True
                continue
            else:
              	flag = False
                break
if flag:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]
a.insert([0,0,0])
ans = True
for i in range(1,n+1):
  t = a[i][0]-a[i-1][0]
  xy = a[i][1]+a[i][2]-a[i-1][1]-a[i-1][2]
  if not (t >= xy and t%2 == xy%2):
    ans = False
    break
print("Yes" if ans else "No")

Submission status: Runtime Error

Solution code:
jN = int(input())

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

current = [0, 0, 0]
can = True
for m in M:
  dt = m[0] - current[0]
  dist = abs(m[1] - current[1]) + abs(m[2] - current[2])
  if (dist > dt):
    can = False
    break
  else:
    if (dist % 2 != dt % 2):
      can = False
      break
  current = m

result = "Yes" if (can == True) else "No"
print(result)

Submission status: Runtime Error

Solution code:
import sys
n = int(input())
pret = 0
prex = 0
prey = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 2 == 0:
            pret = t
            prex = x
            prey = y
        else:
            print('No')
            sys.exit()
print('Yes')

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    posi = [0, 0]
    time = 0
    flag = True
    for i in range(N):
        t, x, y = (int(i) for i in input().split())
        move = abs(posi[0] - x) + abs(posi[1] - y)
        if (t - time) >= move and (t - time) % move:
            flag = False
        time = t
        posi = [x, y]
    if flag:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def boolean(a,b):
    if(abs(a[0] - b[0]) == abs(a[1] - b[1]) + abs(a[2] - b[2])):
        return 0
    else:
        return 1

N = int(input())
lists=[0 for i in range(n+1)]
lists[0]=[0,0,0]
for i in range(N):
    a=list(map(int,input().split()))
    lists[i+1]=a
ans = "Yes"
for i in range(1,N + 1):
    if(boolean(txy[i-1],txy[i])):
        ans = "No"
        break
print(ans)

Submission status: Runtime Error

Solution code:
def boolean(a,b):
    if(abs(a[0] - b[0]) == abs(a[1] - b[1]) + abs(a[2] - b[2])):
        return 0
    else:
        return 1

N = int(input())
txy[0] = [0,0,0]
txy = [input() for i in range(1,N + 1)]
txy = [list(map(int, txy[i].split())) for i in range(N+ 1)]
ans = "Yes"
for i in range(1,N + 1):
    if(boolean(txy[i-1],txy[i])):
        ans = "No"
        break
print(ans)

Submission status: Runtime Error

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

if len(t)>1:
    for i in range(n-1):
        dist = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
        diff = t[i+1]-t[i]
        if dist>diff or dist%2!=diff%2:
            print('No')
            exit()
    print('Yes')
else:
    dist = abs(x[0]-0) + abs(y[0]-0)
    if t[0] < dist or t[0]%2!=diff%2:
        print('No')
    else:
        print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())

t, x, y = 0, 0, 0

for i in range(N):
    tn, xn, yn = map(int, input().split())
    l = abs(x-xn) + abs(y-yn)
    if l > tn - t or (l - (tn - t)) % 2 == 1:
        print('No')
        exit()
    t, x, y = tn, xn, yn
print('Yes')
yandy

Submission status: Runtime Error

Solution code:
sal
n = int(input())
tn,xn,yn = 0,0,0
for _ in range(n):
  to,xo,yo = tn,xn,yn
  tn,xn,yn = map(int,input().split())
  if tn-to >= abs(xn-xo)+abs(yn-yo) and (tn-to)%2 == (abs(xn-xo)+abs(yn-yo))%2:
    continue
  else:
    print("No")
    break
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
n = int(input())
for i in range(n)
  t,x,y=map(int,input().split())
  if (x+y) > t or (x+y+t)%2:
    print("NO")
    exit()
  print("YES")

Submission status: Runtime Error

Solution code:
import sys
n = int(input())
ts=0
xs=0
ys=0
ans = "Yes"
for i in range(n):
    t,x,y = map(int,input().split())
    
    if (t-ts) % (abs(x-xs)+abs(y-ys)) == 0 and t-ts >= (abs(x-xs)+abs(y-ys)):
        xs = x
        ys = y
        ts = t
    else:
        ans = "No"
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
time = []
point = []
for _ in range(n):
    time_point = list(map(int, input().split()))
    time.append(time_point[0])
    point.append(time_point[1:])

point_dict = dict(zip(time, point))
direction = [[1, 0], [-1, 0], [0, 1], [0, -1]]
moved = [[] for _ in range(time[-1] + 1)]

def dfs(t, x, y, dx, dy):
    nx = x + dx
    ny = y + dy
    if [nx, ny] in moved[t]:
        return 0
    moved[t].append([nx, ny])
    if [nx, ny] != point_dict.get(t, [nx, ny]):
        return 0
    if t == time[-1]:
        return 1
    else:
        return dfs(t+1, nx, ny, *direction[0]) + dfs(t+1, nx, ny, *direction[1]) + dfs(t+1, nx, ny, *direction[2]) + dfs(t+1, nx, ny, *direction[3])
        
for i in range(4):
    if dfs(1, 0, 0, *direction[i]) >= 1:
        print('Yes')
        break
else:
    print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
time = []
point = []
for _ in range(n):
    time_point = list(map(int, input().split()))
    time.append(time_point[0])
    point.append(time_point[1:])

direction = [[1, 0], [-1, 0], [0, 1], [0, -1]]
moved = [[] for _ in range(time[-1] + 1)]

def dfs(t, x, y, dx, dy):
    nx = x + dx
    ny = y + dy
    if [nx, ny] in moved[t]:
        return 0
    moved[t].append([nx, ny])
    if [nx, ny] != point_dict.get(t, [nx, ny]):
        return 0
    if t == time[-1]:
        return 1
    else:
        return dfs(t+1, nx, ny, *direction[0]) + dfs(t+1, nx, ny, *direction[1]) + dfs(t+1, nx, ny, *direction[2]) + dfs(t+1, nx, ny, *direction[3])
        
for i in range(4):
    if dfs(1, 0, 0, *direction[i]) >= 1:
        print('Yes')
        break
else:
    print('No')

Submission status: Runtime Error

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

res = [0 for i in range(n)]
pos = [0, 0]
flag = True

def serch_travel (des, pos, k, i, res):
  if k == 0:
    if des == pos:
      res[i] = 1
  else:
    pos1 = [pos[0]+1, pos[1]]
  	pos2 = [pos[0]-1, pos[1]]
 	pos3 = [pos[0], pos[1]+1]
  	pos4 = [pos[0], pos[1]-1]
  
  	serch_travel (des, pos1, k-1, i, res)
  	serch_travel (des, pos2, k-1, i, res)
  	serch_travel (des, pos3, k-1, i, res)
  	serch_travel (des, pos4, k-1, i, res)
      
for i in range(n):
  pos1 = [pos[0]+1, pos[1]]
  pos2 = [pos[0]-1, pos[1]]
  pos3 = [pos[0], pos[1]+1]
  pos4 = [pos[0], pos[1]-1]
  serch_travel (list[i][1:3], pos1, list[i][0], i, res)
  serch_travel (list[i][1:3], pos2, list[i][0], i, res)
  serch_travel (list[i][1:3], pos3, list[i][0], i, res)
  serch_travel (list[i][1:3], pos4, list[i][0], i, res)
  
if(flag):
  print("Yes")

Submission status: Runtime Error

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

res = [0 for i in range(n)]
pos = [0, 0]

def serch_travel (des, pos, k, i, res):
  if k == 0:
    if des == pos:
      res[i] = 1
  else:
    pos1 = [pos[0]+1, pos[1]]
  	pos2 = [pos[0]-1, pos[1]]
 	pos3 = [pos[0], pos[1]+1]
  	pos4 = [pos[0], pos[1]-1]
  
  	serch_travel (des, pos1, k-1, i, res)
  	serch_travel (des, pos2, k-1, i, res)
  	serch_travel (des, pos3, k-1, i, res)
  	serch_travel (des, pos4, k-1, i, res)
      
for i in range(n):
  pos1 = [pos[0]+1, pos[1]]
  pos2 = [pos[0]-1, pos[1]]
  pos3 = [pos[0], pos[1]+1]
  pos4 = [pos[0], pos[1]-1]
  serch_travel (list[i][1:3], pos1, list[i][0], i, res)
  serch_travel (list[i][1:3], pos2, list[i][0], i, res)
  serch_travel (list[i][1:3], pos3, list[i][0], i, res)
  serch_travel (list[i][1:3], pos4, list[i][0], i, res)
  
for i in range(n):
  if(res[i] == 0):
    print("No")
    flag = False
    break
if(flag):
  print("Yes")

Submission status: Runtime Error

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

res = [0 for i in range(n)]
pos = [0, 0]

def serch_travel (des, pos, k, i):
  if k == 0:
    if des == pos:
      res[i] = 1
  else:
    pos1 = [pos[0]+1, pos[1]]
  	pos2 = [pos[0]-1, pos[1]]
 	pos3 = [pos[0], pos[1]+1]
  	pos4 = [pos[0], pos[1]-1]
  
  	serch_travel (des, pos1, k-1, i)
  	serch_travel (des, pos2, k-1, i)
  	serch_travel (des, pos3, k-1, i)
  	serch_travel (des, pos4, k-1, i)
      
for i in range(n):
  pos1 = [pos[0]+1, pos[1]]
  pos2 = [pos[0]-1, pos[1]]
  pos3 = [pos[0], pos[1]+1]
  pos4 = [pos[0], pos[1]-1]
  serch_travel (list[i][1:3], pos1, list[i][0], i)
  serch_travel (list[i][1:3], pos2, list[i][0], i)
  serch_travel (list[i][1:3], pos3, list[i][0], i)
  serch_travel (list[i][1:3], pos4, list[i][0], i)
  
for i in range(n):
  if(res[i] == 0):
    print("No")
    flag = False
    break
if(flag):
  print("Yes")

Submission status: Runtime Error

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

res = [0 for i in range(n)]
pos = [0, 0]

def serch_travel (des, pos, k, i):
  if k == 0:
    if des == pos:
      res[i] = 1
  else:
    pos1 = [pos[0]+1, pos[1]]
  	pos2 = [pos[0]-1, pos[1]]
 	pos3 = [pos[0], pos[1]+1]
  	pos4 = [pos[0], pos[1]-1]
  
  	serch_travel (list[i][1:3], pos1, list[i][0]-1, i)
  	serch_travel (list[i][1:3], pos2, list[i][0]-1, i)
  	serch_travel (list[i][1:3], pos3, list[i][0]-1, i)
  	serch_travel (list[i][1:3], pos4, list[i][0]-1, i)
      
for i in range(n):
  pos1 = [pos[0]+1, pos[1]]
  pos2 = [pos[0]-1, pos[1]]
  pos3 = [pos[0], pos[1]+1]
  pos4 = [pos[0], pos[1]-1]
  serch_travel (list[i][1:3], pos1, list[i][0], i)
  serch_travel (list[i][1:3], pos2, list[i][0], i)
  serch_travel (list[i][1:3], pos3, list[i][0], i)
  serch_travel (list[i][1:3], pos4, list[i][0], i)
  
for i in range(n):
  if(res[i] == 1):
    print("No")
    flag = False
    break
if(flag):
  print("Yes")

Submission status: Runtime Error

Solution code:
n = int(input())

flg = True
t_ = 0
x_ = 0
y_ = 0
for i in range(n):
  t, x, y = map(int, input().split())
  t_ -= t
  x_ -= x
  y_ -= y
  
  if (t_ - x_ - y_) % 2 != 0:
  	print('No')
  	flg = False
    break

if flg:
  print('Yes')

Submission status: Runtime Error

Solution code:
import sys
N = int(input())
t0, x0, y0 = 0, 0, 0

for i in range(N):
    t1,x1,y1 = [int(j) for j in input().split()]
    dt = t1 - t0
    dist = abs(x0-x1) + abs(y0-y1)

    if dist > dt:
        print('No')
	sys.exit()
    elif (dist -	dt)%2 ==1:
	print('No')
	sys.exit()

    else:
        t0, x0, y0 = t1, x1, y1



print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())
t0, x0, y0 = 0, 0, 0
flag=True
for i in range(N):
    t1,x1,y1 = [int(j) for j in input().split()]
    dt = t1 - t0
    dist = abs(x0-x1) + abs(y0-y1)

    if dist > dt:
        print('No')
	break
    elif (dist -	dt)%2 ==1:
	print('No')
        break

    else:
        t0, x0, y0 = t1, x1, y1


if flag:
    print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())
t0, x0, y0 = 0, 0, 0
flag=True
for i in range(N):
    t1,x1,y1 = [int(j) for j in input().split()]
    dt = t1 - t0
    dist = abs(x0-x1) + abs(y0-y1)

    if dist > dt:
        print('No')
        flag=False
	break

    elif (dist%2==0 and dt%2==0) or  (dist%2==1 and dt%2==1):
        t0, x0, y0 = t1, x1, y1

    else:
        print('No')
        flag=False
	break

if flag:
    print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())
t0, x0, y0 = 0, 0, 0
flag=True
for i in range(N):
    t1,x1,y1 = [int(j) for j in input().split()]
    dt = t1 - t0
    dist = abs(x0-x1) + abs(y0-y1)

    if dist > dt:
	print('NO')
	flag=False

    elif (dist%2==0 and dt%2==0) or  (dist%2==1 and dt%2==1):
	t0, x0, y0 = t1, x1, y1

    else:
	print('NO')
	flag=False

if flag:
    print('YES')

Submission status: Runtime Error

Solution code:
import sys
N = int(input())
t, a, b = [0] * N, [0] * N, [0] * N
for i in range(N): t[i], a[i], b[i] = map(int, input().split())

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

Submission status: Runtime Error

Solution code:
N = int(input())
t, a, b = [0] * N, [0] * N, [0] * N
for i in range(N): t[i], a[i], b[i] = map(int, input().split())

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

Submission status: Runtime Error

Solution code:
N = int(input())
t, a, b = [0] * N, [0] * N, [0] * N
for i in range(N): t[i], a[i], b[i] = map(int, input().split())
d = a[0] + b[0]
t = t[0]
if (t < d or t % 2 != d % 2):
    print('No')
    exit()

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

Submission status: Runtime Error

Solution code:
N = int(input())
t, a, b = [0] * N, [0] * N, [0] * N
for i in range(N): t[i], a[i], b[i] = map(int, input().split())
for i in range(1, N):
    d = abs(a[i] - a[i - 1]) + abs(b[i] - b[i - 1])
    t = t[i] - t[i - 1]
    if (t < d or t % 2 != d % 2):
        print('No')
        exit()
print('Yes')

Submission status: Runtime Error

Solution code:
n=int(input())

from numpy import array

i=0
o=array([0,0,0])
while i<n:
   c=list(map(int,input().split()))
   z=array(c)
   w=z-o
   a,b=map(int,[w[0],abs(w[1])+abs(w[2])])

   if a<b:
       print("No")
        break

   else:
       if (a+b)%2==0:
           o=z
           i=i+1
       else:
           print("No")
           break
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())

from numpy import array

i=0
o=array([0,0,0])
while i<n:
   t,x,y=map(int,input().split())
   z=array([t,x,y])
   w=z-o
   a,b=map(str,[w[0],w[1]+w[2]])

   if w[0]<w[1]+w[2]:
       print("No")
       break

   else:
       if (a+b)%2==0:
           o=o+w
           i=i+1
       else:
           print("No")
           break
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())

import array from numpy

i=0
o=array([0 0 0])
while i<n
   t,x,y=map(int,input().split())
   z=array([t x y])
   w=z-o
   a,b=map(str,bin(w[1]),bin(w[2]+w[3]))

   if w[1]<w[2]+w[3]:
       print("No")
       break

   else:
       if a==b:
           o=o+w
           i=i+1
       else:
           print("No")
           break
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
li=[]
#while True:
for u in range(2):
    try:
        li.append(list(map(int,input().split())))
    except:
        break

#ans=Trueにしておいて、チェックにひっ掛かったらFalseに変える
ans=True

#設定より負の値になっていればNO
for i in range(n):
    if li[i][1]>=0 and li[i][2]>=0:
        continue
    ans=False
    print('No')
    break
        
        
#進める最大値よりも先に存在した場合にNOを出す
if ans==True:
    for j in range(n):
        if li[j][0]<=li[j][1]+li[j][2]:
            continue
        ans=False
        print('No')
        break
#秒数とマス目の和の偶奇を調べる
if ans==True:        
    for k in range(n):
        if li[k][0]%2==(li[k][1]+li[k][2])%2:
            continue
        ans=False
        print('No')
        break
        
if ans==True:
    print('Yes')

Submission status: Runtime Error

Solution code:
li=[]
n=int(input())
while True:
    try:
        li.append(list(map(int,input().split())))
    except:
        break
if li[i][1]<0 or li[i][2]<0 for i in range(n):
    print('NO')
else:
    nl=li[:][1,2]
    for j in range(n-1):
        d=nl[j+1][:]-nl[j][:]
        if not d==[1,0] or [0,1] or [-1,0] or [0,-1]:
            print('NO')
            break
    print('YES')

Submission status: Runtime Error

Solution code:
n = int(input)

for i in range(n):
    t, x, y = map(int, input().split())
    if x+y > t or x+y+t % 2:
        print("NO")
        exit()
print("YES")

Submission status: Runtime Error

Solution code:
def func(t, x, y):
    if t%2 == 0:
        for j in range( int(t/2 + 1) :
            if not y == x + j*2 and y == -x - j*2 and y == -x + j*2 and y == x - j*2:
                return 1
    if t == 1:
        for j in range( int((t-1)/2 + 1) ):
            if not y == x + j*2+1 and y == -x - j*2-1 and y == -x + j*2+1 and y == x - j*2-1 :
                return 1
            if  (y == 0 and x == 0):
                return 1
    else:
        for j in range( int((t-1)/2 + 1) ):
            if not y == x + j*2+1 and y == -x - j*2-1 and y == -x + j*2+1 and y == x - j*2-1 :
                return 1

n = int(input())
# t, x, y = [map(int, input().split()) for _ in range(n)]
t, x, y = [0]*(n+1),[0]*(n+1),[0]*(n+1)
flg = 0
for i in range(1,n+1):
    t[i], x[i], y[i] = map(int, input().split())
    flg = func(t[i]-t[i-1], x[i]-x[i-1], y[i]-y[i-1])
if flg == 1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
def func(t, x, y):
    if t%2 == 0:
        for j in range(t/2 + 1):
            if not y == x + j*2 and y == -x - j*2 and y == -x + j*2 and y == x - j*2:
                return 1
    if t == 1:
        for j in range( int((t-1)/2 + 1) ):
            if not y == x + j*2+1 and y == -x - j*2-1 and y == -x + j*2+1 and y == x - j*2-1 :
                return 1
            if  (y == 0 and x == 0):
                return 1
    else:
        for j in range( int((t-1)/2 + 1) ):
            if not y == x + j*2+1 and y == -x - j*2-1 and y == -x + j*2+1 and y == x - j*2-1 :
                return 1

n = int(input())
# t, x, y = [map(int, input().split()) for _ in range(n)]
t, x, y = [0]*(n+1),[0]*(n+1),[0]*(n+1)
flg = 0
for i in range(1,n+1):
    t[i], x[i], y[i] = map(int, input().split())
    flg = func(t[i]-t[i-1], x[i]-x[i-1], y[i]-y[i-1])
if flg == 1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
/home/hiroya/.pyenv/versions/anaconda3-5.3.1/bin/python /home/hiroya/06_coding/aa.py
2
5 1 1
100 1 1No

Process finished with exit code 0

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

import numpy
import scipy
#import sys


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

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

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

    if dist%2 != dt%2:
        print("No")
        exit()

print("Yes")

Submission status: Runtime Error

Solution code:
N = int(input())
txy = [tuple() for _ in range(N)]
for i in range(N - 1):
    now = txy[i]
    next = txy[i + 1]
    root = abs(next[1] - now[1]) + abs(next[2] - now[2])
    time = next[0] - now[0]
    if time < root:
        print("No")
        break
    else:
        if time == root:
            pass
        else:
            if (time - root) % 2 != 0:
                print("No")
                break
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
import math


# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = math.sqrt((x - self.now_x) * (y - self.now_y))
        duration = t - self.now_t
        if duration < distance:
            return False

        if (t - self.now_t) % 2 != (x + y - (self.now_x + self.now_y)) % 2:
            return False
        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('No')
        exit()
print('Yes')

Submission status: Runtime Error

Solution code:
import math


# Me
class Check():
    def __init__(self):
        self.now_t, self.now_x, self.now_y = 0, 0, 0

    def do(self, t, x, y):
        distance = math.sqrt((x - self.now_x) * (y - self.now_y))
        duration = t - self.now_t
        print('distance', distance)
        print('duration', duration)
        if duration < distance:
            return False

        if (t - self.now_t) % 2 != (x + y - (self.now_x + self.now_y)) % 2:
            return False
        self.now_t, self.now_x, self.now_y = t, x, y
        return True


N = int(input())
c = Check()
for i in range(N):
    a = [int(x) for x in input().split()]
    if not c.do(a[0], a[1], a[2]):
        print('NO')
        exit()
print('YES')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
t = []
for i in range(n):
    txy = list(map(int,input().split()))
    t.append(txy)
if t[0][0]<sum(t[0][1:]) or t[1][0]<sum(t[1][1:]):
    print('No')
else:
    if sum(t[0][1:]) == 0 or sum(t[1][1:]) == 0:
        if t[0]%2==0:
            print('Yes')
        else:
            print('No')
    elif t[0][0]%sum(t[0][1:])==0 and t[1][0]%sum(t[1][1:])==0:
        print('Yes')
    else:
        print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
t = []
for i in range(n):
    txy = list(map(int,input().split()))
    t.append(txy)
if t[0][0]<sum(t[0][1:]) or t[1][0]<sum(t[1][1:]):
    print('No')
else:
    if t[0][0]%sum(t[0][1:])==0 and t[1][0]%sum(t[1][1:])==0:
        print('Yes')
    else:
        print('No')

Submission status: Runtime Error

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
lst.sort(reverse=False,lambda x:x[0])
for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])==1:
    if lst[j][2]==lst[j+1][2]:
      pass
    else:
      print('No')
      sys.exit()
  if abs(lst[j][2]-lst[j+1][2])==1:
    if lst[j][1]==lst[j+1][1]:
      pass
    else:
      print('No')
      sys.exit()    
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Runtime Error

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
lst.sort(lambda x:x[0])
for j in range(n-1):
  if (abs(lst[j][1]-lst[j+1][1])==1) or (abs(lst[j][2]-lst[j+1][2])==1) :
    pass 
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Runtime Error

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
lst.sort(lambda x:x[0])
for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])==1 or abs(lst[j][2]-lst[j+1][2])==1:
    lst=lst  
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Runtime Error

Solution code:
import sys
n=int(input())
lst=[]
for i in range(n):
  T,X,Y=map(int,input().split())
  lst.append([T,X,Y])
lst.sort(lambda x:x[0])
for j in range(n-1):
  if abs(lst[j][1]-lst[j+1][1])==1 or abs(lst[j][2]-lst[j+1][2])==1:
    pass
  else:
    print('No')
    sys.exit()
print('Yes')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
t=0
x=0
y=0
for i in range(n):
  g,h,j=map(int,input().split())
  if (g-t)%2==(abs(h-x)+abs(j-y)%2:
               print("Yes")
  else:
               print("No")

Submission status: Runtime Error

Solution code:
import sys
N=int(input())
for i in range (N):
    x,y,t=map(int,input().split())
    if x+y<=t and (x+y)%2==t%2:
        pass
    else print("NO")
    sys.exit()
print("YES")

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(n):
    t,x,y=map(int,input().split())
    if x+Y>t or (x+y+t)%2==1:
      print("NO")
      exit()
print("YES")

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(n):
    t,x,y=map(int,input().split())
    if x+Y>t or (x+y+t)%2:
      print("NO")
      exit()
print("YES")

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(n):
    t,x,y=map(int,input().split())
    if x+y<=t and t%2==(x+y)%2:count+=1
print("YES" if count==n else "NO")

Submission status: Runtime Error

Solution code:
n=int(input())
for i in range(n):
    t,x,y=map(int,input().split())
    if x+y<=n and t%2==(x+y)%2:count+=1
print("YES" if count==n else "NO")

Submission status: Runtime Error

Solution code:
n=input()
for i in range(n):
    t,x,y=map(int,input().split())
    if x+y<=n and t%2==(x+y)%2:
        count+=1
print("YES" if count==n else "NO")