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

num=0

t,x,y=map(int,input().split())
num+=(x+y)
if t%num!=0:
  print("NO")
  exit()
  
for i in range(n-1):
  t,x,y=map(int,input().split())
  num-=(x+y)
  num=abs(num)
  if t%num!=0:
    print("NO")
    exit()
    
print("YES")

Submission status: Runtime Error

Solution code:
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(1,en(pos)):
  diff = pos[i+1][0]-pos[i][0]
  num = abs(pos[i][1]-pos[i+1][1]) + abs(pos[i][2]-pos[i+1][2])
  if((pos[i][0]-pos[i-1][0])>=(abs(pos[i][1]-pos[i-1][1])+abs(pos[i][2]-pos[i-1][2])) and (pos[i][0]-pos[i-1][0])%2==(abs(pos[i-1][1]-pos[i][1])+abs(pos[i][2]-pos[i-1][2]))%2):
    pass
  else:
    print("No")
    sys.exit()      
print("Yes")

Submission status: Runtime Error

Solution code:
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(1,en(pos)):
  diff = pos[i+1][0]-pos[i][0]
  num = abs(pos[i][1]-pos[i+1][1]) + abs(pos[i][2]-pos[i+1][2])
  if((pos[i][0]-pos[i-1][0])>=(abs(pos[i][1]-pos[i-1][0])+abs(pos[i][2]-pos[i-1][0])) and (pos[i][0]-pos[i-1][0])%2==(abs(pos[i-1][1]-pos[i][1])+abs(pos[i][0]-pos[i-1][0]))%2):
    pass
  else:
    print("No")
    sys.exit()      
print("Yes")

Submission status: Runtime Error

Solution code:
import sys
n = int(input())
pos = [list(map(int,input().split())) for p in range(n)]
for i in range(len(pos)):
  if i == 0:
    num = abs(pos[i][1]-0) + abs(pos[i][2]-0)
    if num <= diff and diff * (diff%2) == num%2:
      pass
    else:
      print("No")
      sys.exit()     
  else:
    diff = pos[i][0]-pos[i-1][0]
    num = abs(pos[i][1]-pos[i-1][1]) + abs(pos[i][2]-pos[i-1][2])
    if num <= diff and diff * (diff%2) == num%2:
      pass
    else:
      print("No")
      sys.exit()      
print("Yes")

Submission status: Runtime Error

Solution code:
Row = int(input())
List = []
for i in range (Row):
  List.append(list(map(int, input().split())))
x = 0
y = 0
flag = True
for i in range(Row):
  reqT = List[i][1]-x+List[i][2]-y
  chck= reqT - T
  if chck < 0 or chck % 2 == 1:
    flag = False
    break
  x = List[i][1]
  y = List[i][2]
if flag:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
xy=[]
try :
  while True:
    t = input().split()
    t = list(map(int,t))
    xy.append(t)
except EOFError:
  pass
loc = [0,0]
time = 0
for i in range(N+1):
  a = xy[i]
  time = a[0]-time
  dis = abs(loc[0]-a[1])+abs(loc[1]-a[2])
  if (time-dis)<0 :
    print("No")
    break
  elif (time-dis)%2 == 0:
    loc = [a[1],a[2]]
    
  else :
    print("No")
    break
else :
  print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
txylist=[[0,0,0,]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
if n==1:
    p=False
    t1,x1,y1=txylist[1]
    lengs=t-abs(x1)+abs(y1)
    if lengs>=0 and lengs%2==0:
        p=True
    else:
        print("No")
        print(lengs)
else:
    for i in range(n):
        p=False
        t0,x0,y0=txylist[i]
        t1,x1,y1=txylist[i+1]
        t=t1-t0
        x=x1-x0
        y=y1-y0
        longs=abs(x)+abs(y)
        lengs=t-longs
        if lengs>=0 and lengs%2==0:
            p=True
        else:
            print("No")
            print(lengs)
            break
if p==True:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
txylist=[[0,0,0,]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
if n==1:
    p=False
    t1,x1,y1=txylist[1]
    lengs=abs(x1)+abs(y1)-t
    if lengs>=0 and lengs%2==0:
        p=True
    else:
        print("No")
else:
    for i in range(n):
        p=False
        t0,x0,y0=txylist[i]
        t1,x1,y1=txylist[i+1]
        t=t1-t0
        x=x1-x0
        y=y1-y0
        longs=abs(x)+abs(y)
        lengs=longs-t
        if lengs>=0 and lengs%2==0:
            p=True
        else:
            print("No")
            break
if p==True:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
txylist=[[0,0,0,]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
if n==1:
    p=False
    t1,x1,y1=txylist[1]
    lengs=abs(x1)+abs(y1)-t
    if lengs%2==0:
        p=True
    else:
        print("No")
else:
    for i in range(n):
        p=False
        t0,x0,y0=txylist[i]
        t1,x1,y1=txylist[i+1]
        t=t1-t0
        x=x1-x0
        y=y1-y0
        longs=abs(x)+abs(y)
        lengs=longs-t
        if lengs%2==0:
            p=True
        else:
            print("No")
            break
if p==True:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
txylist=[[0,0,0,]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
if n==1:
    t1,x1,y1=txylist[1]
    if t==abs(x1)+abs(y1):
        p=True
    else:
        print("No")
else:
    for i in range(n):
        p=False
        t0,x0,y0=txylist[i]
        t1,x1,y1=txylist[i+1]
        t=t1-t0
        x=x1-x0
        y=y1-y0
        longs=abs(x)+abs(y)
        if longs==t:
            p=True
        else:
            print("No")
            break
if p==True:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
txylist=[[0,0,0,]]
for i in range(n):
    txy=list(map(int,input().split(" ")))
    txylist+=[txy]
if n==1:
    t1,x1,y1=txylist[2]
    if t==abs(x1)+abs(y1):
        p=True
    else:
        print("No")
else:
    for i in range(n):
        p=False
        t0,x0,y0=txylist[i]
        t1,x1,y1=txylist[i+1]
        t=t1-t0
        x=x1-x0
        y=y1-y0
        longs=abs(x)+abs(y)
        if longs==t:
            p=True
        else:
            print("No")
            break
if p==True:
    print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
txylist=[[0,0,0,]]
for i in range(n):
  txy=list(map(int,input().split(" ")))
  txylist+=txy
if n==1:
  t1,x1,y1=txylist[2]
  if t==abs(x1)+abs(y1):
    p=True
  else:
    print("No")
else:
  for i in range(n):
    p=False
    t0,x0,y0=txylist[i]
    t1,x1,y1=txylist[i+1]
    t=t1-t0
    x=x1-x0
    y=y1-y0
    longs=abs(x)+abs(y)
    if longs==t:
      p=True
    else:
      print("No")
      break
if p==True:
  print("Yes")

Submission status: Runtime Error

Solution code:
#13 C - Traveling
N = int(input())

plan = []
for _ in range(N):
    ti,xi,yi = map(int,input().split())
    plan.append((ti,xi,yi))
    
#今いる場所の座標と時間
spot = (0,0,0)#始点
result = 'Yes'
for t,x,y in plan:
    tdiff = t-spot[0]
    xdiff = abs(x-spot[1])
    ydiff = abs(y-spot[2])
    #(x,y)の変化量の和の偶奇と時間の差の偶奇が一致している
    #時間の変化量より(x,y)の変化量の方が小さい
    if (tdiff%2 == (xdiff+ydiff)%2) and ((xdiff + ydiff)<=tdiff):
    '''
    xdiff<=tdiff and ydiff<=t だと(3,3,2)などの範囲外に対応できない
    if (tdiff%2 == (xdiff+ydiff)%2) and (xdiff<=tdiff) and (ydiff<=tdiff):
    '''
        spot = (t,x,y)
    else:
        result = 'No'
        break
print(result)

Submission status: Runtime Error

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

import sys

n = int(sys.stdin.readline().strip())

txy = [(0,0,0)]+[tuple(map(int, l.strip().split(" "))) for l in sys.stdin.readlines()]
check_txy = [abs(_x - _xp) + abs(_y -_ yp) <= _t - _tp and (_t + _x + _y) % 2 == 0 for (_t, _x, _y), (_tp, _xp, _yp) in zip(txy[1:], txy)]
if all(check_txy):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
    n = int(input())
    pos = [list(map(int, input().split())) for _ in range(n)]
     
    def func(n, pos):
        c_t, c_x, c_y = 0, 0, 0
     
        for i in pos:
            d_t = i[0] - c_t
            z = abs(i[1] - c_x) + abs(i[2] - c_y)
     
            if z > d_t or (d_t - z) % 2 != 0:
                return "No"
            else:
                c_t, c_x, c_y = 0, 0, 0
     
        return "Yes"
     
     
    print(func(n, pos))

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    dis = abs(T[i][2]-T[i][2])+abs(T[i][1]-T[i][1])
    _t = T[i][0]-T[i][0]
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    dis = abs(T[i+1][2]-T[i][2])+abs(T[i+1][1]-T[i][1])
    _t = T[i+1][0]-T[i][0]
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
	dis = abs(T[i+1][2]-T[i][2])+abs(T[i+1][1]-T[i][1])
	_t = T[i+1][0]-T[i][0]
	if dis > _t or _t%2 != dis%2:
		flag = 'No'
	i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-2:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i]
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-2:
    t1,x1,y1 = T[i] 
#     t2,x2,y2 = T[i+1]
    t2,x2,y2 = T[i]
#     dis = abs(x2-x1)+abs(y2-y1)
#     _t = t2-t1
#     if dis > _t or _t%2 != dis%2:
#         flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-2:
    t1,x1,y1 = T[i] 
#     t2,x2,y2 = T[i+1]
    t2,x2,y2 = T[i]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-2:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
for i in range(len(T)-1):
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
        break
    else:
        flag = 'Yes'
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
#     dis = abs(x2-x1)+abs(y2-y1)
#     _t = t2-t1
#     if dis > _t or _t%2 != dis%2:
#         flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
for i in range(len(T)-1):
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    else:
        flag = 'Yes'
    if not flag:
        break
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
for i in range(len(T)-1):
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    else:
        flag = 'Yes'
    if not flag:
        break
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or (_t%2 != dis%2):
        flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = (x2-x1)+(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
# for i in range(len(T)-1):
flag = 'Yes'
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = (x2-x1)+(y2-y1)
    _t = t2-t1
    if dis > _t or (_t-dis)%2 != 0:
        flag = 'No'
    i += 1        
print(flag)

Submission status: Runtime Error

Solution code:
dt = 0
dx = 0
dy = 0
for i in range(N):
    if abs(txy[i][1]-dx)+abs(txy[i][2]-dy) > txy[i][0]-dt or (txy[i][1]+txy[i][2])%2 != txy[i][0]%2:
        print("No")
        break
    dt = txy[i][0]
    dx = txy[i][1]
    dy = txy[i][2]
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
N=int(input())
P=[(0,0,0)]*(N+1)

D=[0]*(N+1)

P[0]=(0,0,0)
D[0]=1
for i in range(1,N+1):
    t,x,y=map(int,input().split())
    dt=t-P[i-1][0]
    dx=abs(x-P[i-1][1])
    dy=abs(y-P[i-1][2])
    if dt < (dx+dy): 時間<移動距離
        print('No')
        break
    if ((dx+dy)==0 and dt%2!=0):移動しない場合には時間はmod2==0
        print('No')
        break
    #if (dt-(dx+dy))%2==0 or dt%(dx+dy)==0:
    if (dt-(dx+dy))%2!=0:
        print('No')
        break
    
    P[i]=(t,x,y)
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
N=int(input())
t=[]
x=[]
y=[]
x_2=0
y_2=0
counter=0
hantei=[-1,1]
for i in range(N):
  t_1, x_1, y_1=map(int, input(),split())
  t.append(t_1)
  x.append(x_1)
  y.append(y_1)
  
for i in range(N):
  x_2=0
  y_2=0
  for j in range(t[i]):
    for k in hantei:
      for l in hantei:
        x_2+=k
        y_2+=l
        if x_2==x[i]&&y_2==y[i]:
          counter+=1

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

Submission status: Runtime Error

Solution code:
N = int(input())
t=0
x=0
y=0
for i in range(N)
    nt, nx, ny = map(int, input().split())
    km = abs(nx-x) + abs(ny-y)
    if km > (nt-t) or (km - (nt-t)) % 2 == 1:
        print("No")
        exit(0)
    t, x, y = nt, nx, ny
print("Yes")

Submission status: Runtime Error

Solution code:
N = int(input())
t=0
x=0
y=0
for i in range(N)
    nt, nx, ny = map(int, input().split())
    km = abs(nx-x) + abs(ny-y)
    if km > (nt-t) or (km - (nt-t)) % 2 = 1:
        print("No")
        exit(0)
    t, x, y = nt, nx, ny
print("Yes")

Submission status: Runtime Error

Solution code:
N = int(input())
t=0
x=0
y=0
for i in range(N)
    nt, nx, ny = map(input().split())
    km = abs(nx-x) + abs(ny-y)
    if km > (nt-t) or (km - (nt-t)) % 2 = 1:
        print("No")
        exit(0)
    t, x, y = nt, nx, ny
print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
import math
n = int(input())
t = 0
x = 0
y = 0
# txy = []
# for i in range(n):
#     ti, xi, yi = list(map(int, input().split()))
#     txy.append((ti, xi, yi))

for ti, xi, yi in map(int, input().split()):
    if abs(xi - x) + abs(yi - y) > abs(ti - t):
        print("No")
        exit()
    elif (abs(xi - x) + abs(yi - y) - abs(ti - t)) % 2 != 0:
        print("No")
        exit()
    else:
        t = ti
        x = xi
        y = yi
print("Yes")

Submission status: Runtime Error

Solution code:
prev = (0,0)
pt = t
b = True

def f(a,b): return abs(b[0]- a[0]) + abs(b[1] - a[1])
for _ in range(int(raw_input())):
	t,x,y  = map(int, raw_input().split())
	if (t - pt) < f((x,y), prev):
		b = False
		break 
	prev,pt = (x,y),t

print 'Yes' if b else 'No'

Submission status: Runtime Error

Solution code:
import sys

N = int(input())
old_t = -1
for i in sys.stdin:
    a = list(map(int, i.split(' ')))
    t = a[0]
    x = a[1]
    y = a[2]
    if (t <= old_t):
      	print('No')
        sys.exit(0)
    else:
      	old_t = t
    if (a[1] > N or a[2] > N):
        print('No')
        sys.exit(0)
    if ((x + y) > t + 1):
        print('No')
        sys.exit(0)
    if (t % 2 != (x + y) % 2):
        print('No')
        sys.exit(0)
print('Yes')

Submission status: Runtime Error

Solution code:
import sys

N = int(input())
old_t = 0
for i in sys.stdin:
    a = list(map(int, i.split(' ')))
    t = a[0]
    x = a[1]
    y = a[2]
    if (t <= old_t):
      	print('No')
        sys.exit(0)
    else:
      	old_t = t
    if (a[1] > N or a[2] > N):
        print('No')
        sys.exit(0)
    if ((x + y) > t + 1):
        print('No')
        sys.exit(0)
    if (t % 2 != (x + y) % 2):
        print('No')
        sys.exit(0)
print('Yes')

Submission status: Runtime Error

Solution code:
import sys

N = int(input())
for i in sys.stdin:
    a = lsit(map(int, i.splist(' ')))
    t = a[0]
    x = a[1]
    y = a[2]
    if (a[1] > N or a[2] > N):
        print('No')
        return
    if ((x + y) > t + 1):
        print('No')
        return
    if (t % 2 === (x + y) % 2):
        print('No')
        return
print('Yes')

Submission status: Runtime Error

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

for txyi, txyip in zip([[0, 0, 0]] + txy[:-1], txy):
    ti, xi, yi = txyi
    tip, xip, yip = txyip
    dift = tip - ti
    difd = abs(xip-xi) + abs(yip-yi)
    if difd%2 != dfit%2:
        print('No')
        exit()
    if dift < difd:
        print('No')
        exit()
print('Yes')

Submission status: Runtime Error

Solution code:
n = int(input())

for _ in range(n):
    t, x, y = map(int, n.split())
    if x + y > t or (t - x - y) % 2:
        print("No")
        exit()
print("Yes")

Submission status: Runtime Error

Solution code:
n = int(input())

for _ in range(0, n):
    t, x, y = map(int, n.split())
    if x + y > t or (t - x - y) % 2:
        print("No")
        exit()
print("Yes")

Submission status: Runtime Error

Solution code:
n = input()

for _ in range(0, n):
    t, x, y = map(int(), n.split())
    if x + y > t or (t - x - y) % 2:
        print("No")
        exit()
print("Yes")

Submission status: Runtime Error

Solution code:
count = int(input())
lis = [input() for i in range(count)]
n = [-1] * count
x = [-1] * count
y = [-1] * count
for i in range(len(lis)):
    n[i],x[i],y[i] =  map(int,lis[i].split())
i = 0    
n0 = 0
x0 = 0
y0 = 0 
res = 1
for i in range(len(n)):
    nt = n[i] - n0
    xt = x[i] - x0 
    yt = y[i] - y0
    if xt == 0 and yt == 0:
        res= -1
        break:
    elif xt + yt <= nt:
        if nt%2 == 0 and (xt+yt)%2 == 0:

            nt = n[i]
            xt = x[i]
            yt = y[i]
        elif nt%2 == 1 and (xt+yt)%2 == 1:

            nt = n[i]
            xt = x[i]
            yt = y[i]
        else:
 
            res = -1
            break
    else:
    
        res = -1
        break
if res > 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N, A, B = map(int, input().split())
print(sum(i for i in range(1, N+1) if A <= sum(map(int, str(i))) <= B))

Submission status: Runtime Error

Solution code:
N = int(input())
t, x, y = map(int, input().split())
if t < x+y :
  print("NO")
elif t%2 != p%2:
  print("NO")
else:
  print("YES")

Submission status: Runtime Error

Solution code:
n = int(input())
found = True
for _ in range(n):
  t,x,y = map(int,input().split())
  if t==0:
  	if x==0 and y==0:
      found = False
  else:
    if t%(x+y) != 0:
      found = False
if found:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
#奇数のとき、xとy足して奇数になる点にしか止まれない。偶数の時も同じ
#xとyの和がステップ数より多いとき、たどり着けない
N = int(input())
for i in range(N)
  t, x, y = map(int, input().split())
  wa = x+y
  if t < wa:
    print('No')
    exit()
  if t%2 == 0 and wa%2 != 0:
    print('No')
    exit()
  if t%2 == 1 and wa%2 != 1:
    print('No')
    exit()
print('Yes')

Submission status: Runtime Error

Solution code:
n = int(input())
tp, xp, yp = 0, 0, 0
for _ in range(n):
  t, x, y = map(int, input().split())
  td = t - tp
  xd = x - xp
  yd = y - yp
  if td < abs(xd) + abs(yd) or (td - abs(xd) - abs(yd)) % 2 == 1:
    print('No')
    break
    tp = t
    xp = x
    yp = y
    else:
      print('Yes')

Submission status: Runtime Error

Solution code:
N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=x+y-p-q
  e=t-r
  if a<=e:
    if (e-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p=x
  q=y
  r=t
print(flag)N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=x+y-p-q
  e=t-r
  if a<=e:
    if (e-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p=x
  q=y
  r=t
print(flag)

Submission status: Runtime Error

Solution code:
n=int(input())
 
for i in range(n):
 x_start=0
 y_start=0
 t_start=0
t,x,y=map(int,input().split())
 
 dist=abs(t-t_start)
 dt=abs(x-x_start)+abs(y-y_start)
 
 if dist>dt or dt%2!=dist%2:
  print("No")
  exit()
  
print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())
 
for i in range(n):
 x_start=0
 y_start=0
 t_start=0
 
 
 dist=abs(t-t_start)
 dt=abs(x-x_start)+abs(y-y_start)
 
 if dist>dt or dt%2!=dist%2:
  print("No")
  exit()
  
print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())

for i in range(n)
 x_start=0
 y_start=0
 t_start=0


 dist=abs(t-t_start)
 dt=abs(x-x_start)+abs(y-y_start)

 if dist>dt or dt%2!=dist%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())
 dist=abs(t+1-t)
 dt=abs(x+1-x)+abs(y+1-y)
 if dist<dt or (dist%2) != (dt%2):
  print("No")
  exit()
  
print("Yes"

Submission status: Runtime Error

Solution code:
n=input()
for i in range(n):
 z,x,y=map(int, input().split())
 dist=x+y
 if dist>z or dist%2!=z%2
  print("No")

print("Yes")

Submission status: Runtime Error

Solution code:
#!/user/bin/env 

n = int(input())
t = [-1 for _ in
x = [-1 for _ in
y = [-1 for _ in
for i in range(n
    t[i], x[i], 

dt = [-1 for _ i
dx = [-1 for _ i
dy = [-1 for _ i
for i in range(n
    if i == 0:
        dt[0] = 
        dx[0] = 
        dy[0] = 
    else:
        dt[i] = 
        dx[i] = 
        dy[i] = 

ok = True
for i in range(n
    tr = dt[i]%2
    pr = (dx[i]+
    if (tr == pr
        pass
    else:
        ok = Fal
#        import 
        break

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

Submission status: Runtime Error

Solution code:
n=int(input())
ans='Yes'
t,a,b=map(int,input().split())
if (a+b)<t or (a+b-t)%2==1:
  ans='No'
for i in range(n):
  u,x,y=map(int,input().split())
  if (u-t)<abs(x-a)+abs(y-b) or ((u-t)-abs(x-a)-abs(y-b))%2==1:
    ans='No'
    break
  t,a,b=u,x,y
print(ans)

Submission status: Runtime Error

Solution code:
int(input())
# 初期位置
x_old, y_old, t_old = 0, 0, 0

for _ in range(n):
    # 都度読み込み
    t, x, y = map(int, input().split())
    d = (t - t_old) - abs(x - x_old) - abs(y - y_old)
    if d >= 0 and d % 2 == 0:
        x_old, y_old, t_old = x, y, t
    else:
        print('No')
        exit()

print('Yes')

Submission status: Runtime Error

Solution code:
import sys
from itertools import combinations
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


N = I()
prev_t = 0
prev_x = 0
prev_y = 0
for i in range(N):
    t, x, y = LI()
    if (x+y) > (t - prev_t) or (abs(prev_x-x) + abs(prev_y-y) + (t - prev_t)) % 2:
        print('No')
        exac()
    prev_t = t
    prev_x = x
    prev_y = y
print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())
plan = [0] + list(map(int, input().split())) for i in range(N)
f = True
for i in range(N):
    time = plan[i+1][0]-plan[i][0]
    dist = abs(plan[i+1][1]-plan[i][1])+abs(plan[i+1][2]-plan[i][2])
    if dist>time or dist%2 != time%2:
        f = False    
print('Yes' if f else 'No')

Submission status: Runtime Error

Solution code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
cnt = 0
sum = 0
flag = 0
T = X = Y = 0 
for i in range(N):
        cnt = x[i][0] - T
        sum = abs(x[i][1]- X) + abs(x[i][2]- Y)
        T = x[i][0]
        X = x[i][1]
        Y = x[i][2]
    if cnt < sum or cnt % 2 != sum % 2:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
dx = [1, -1, 0, 0]
dy = [0, 0, 1, -1]
cnt = 0
sum = 0
flag = 0
for i in range(N):
    if i == 0:
        cnt = x[i][0]
        sum = x[i][1]
    else:
        cnt = x[i][0] - x[i-1][0]
        sum = x[i][1]+x[i][2] - x[i-1][1]+x[i-1][2]
    if cnt >= sum and cnt % sum == 0:
        flag = 0
    else:
        flag = 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n = int(inupt())
s = [0, 0, 0]

for i in range(n):
  l = list(map(int, input().split()))
  diff_t = l[0] - s[0]
  diff_x = abs(s[1] - l[1])
  diff_y = abs(s[2] - l[2])
  s = [l[0], l[1], l[2]]
  if diff_x + diff_y > diff_t or (diff_t - diff_x - diff_y) % 2 != 0:
    print('No')
    break
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
n = int(inupt())
s = [0, 0, 0]

for i in range(n):
  l = map(int, input().split())
  diff_t = l[0] - s[0]
  diff_x = abs(s[1] - l[1])
  diff_y = abs(s[2] - l[2])
  if diff_x + diff_y > diff_t or (diff_t - diff_x - diff_y) % 2 != 0:
    print('No')
    break
else:
  print('Yes')

Submission status: Runtime Error

Solution code:
s = input()

while(True):
  for i in ['dream', 'dreamer', 'erase', 'eraser']:
    if s.endwith(i):
      s = s[:-len(i)]
      break
  else:
    print('NO')
    break
  
  if not s:
    print('YES')
    break

Submission status: Runtime Error

Solution code:
N = int(input())
a = [input().split() for _ in range(N)]
flag = 0
 
if N >1: 
  for i in range(N-1):
    dt = a[i+1][0]-a[i][0]
    dist = abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])
    if dt < dist:
      flag = flag +1
    if dt % 2 != dist % 2:
      flag = flag +1
else:
  dt = a[0]
  dist = abs(a[1])+abs(a[2])
  if dt < dist:
      flag = flag +1
  if dt % 2 != dist % 2:
      flag = flag +1
    
print('Yes' if flag == 0 else 'No')

Submission status: Runtime Error

Solution code:
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]
flag = 0
 
if N >1: 
  for i in range(N-1):
    dt = a[i+1][0]-a[i][0]
    dist = abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])
    if dt < dist:
      flag = flag +1
    if dt % 2 != dist % 2:
      flag = flag +1
else:
  dt = a[0]
  dist = abs(a[1])+abs(a[2])
  if dt < dist:
      flag = flag +1
  if dt % 2 != dist % 2:
      flag = flag +1
    
print('Yes' if flag == 0 else 'No')

Submission status: Runtime Error

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

for i in range(N):
  dt = a[i+1][0]-a[i][0]
  dist = abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])
  if dt > dist:
    flag = flag +1
  else dt % 2 != dist % 2:
    flag = flag +1

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

Submission status: Runtime Error

Solution code:
N = int(input())

T, X, B = 0, 0, 0

for _ in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-X)+abs(y-Y)
    time = t-T
    if time<dist or time%2!=dist%2:
        print('No')
        break
    T, X, Y = t, x, y
else:
    print('Yes')

Submission status: Runtime Error

Solution code:
スコード 拡げる

Copy
Copy
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
T=X=Y=0
ans = "Yes"
 
for t,x,y in txy:
  a = (t-T) - (abs(X-x) + abs(Y-y))
  if a % 2 == 0 and abs(X-x) + abs(Y-y) <= t - T:
    T,X,Y = t,x,y
  else:
    ans = "No"
    break
print(ans)

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