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: Wrong Answer

Solution code:
N = int(input())
now_t = 0
now_x = 0
now_y = 0
flag = 0
for i in range(N):
    t,x,y = map(int,input().split())
    if abs(x-now_x)+abs(y-now_y) %2 ==(now_t-t)%2:
        now_t = t
        now_x = x
        now_y = y
    else:
        flag += 1
        break
if flag == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

def f(x1,y1,x2,y2,t):
    l = abs(x1-x2)+abs(y1-y2)
    if l <= t:
        if l%2 == t%2:
            return True
    return False

if __name__ == "__main__":
    n = I()
    t = [0]
    x = [0]
    y = [0]
    for i in range(n):
        a,b,c = I2()
        t.append(a)
        x.append(b)
        y.append(c)
    for i in range(n):
        print(x[i],y[i],x[i+1],y[i+1],t[i+1]-t[i])
        if not f(x[i],y[i],x[i+1],y[i+1],t[i+1]-t[i]):
            print("No")
            exit()
    print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
curx, cury = 0, 0
ans = 'Yes'
prev_t = 0
for _ in range(n):
   t, x, y = map(int, input().split())
   d = abs(x - curx) + abs(y - cury)
   if d > (t - prev_t) or (t - prev_t) % 2 != d % 2:
      ans = 'No'
      break
   prev_t = t

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
t = []
p = [0, 0, 0]
while(n):
    a, b, c = input().split(' ')
    t.append([int(a), int(b), int(c)])
    n-=1
for i in t:
    while(p[0] < i[0]):
        p[0]+=1
        if i[1] > p[1]:
            p[1]+=1
        elif i[2] > p[2]:
            p[2]+=1
        elif i[1] < p[1]:
            p[1]-=1
        elif i[2] < p[2]:
            p[2]-=1
        else:
            p[1]-=1
        print(p)
    if p != i:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int (input ())
t2 = 0
x2 = 0
y2 = 0
for i in range (N):
    t,x,y = map(int, input().split())
    if abs (t-t2) >= abs ((x-x2)+(y-y2)):
        if (round (((t-t2)-((x-x2)+(y-y2)))/2))*2 ==((t-t2)-((x-x2)+(y-y2))):
            ans = 'YES'
        else:
            ans = 'NO'
            break
    else:
        ans = 'NO'
        break
    t2 = t
    x2 = x
    y2 = y
print (ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
found = True
for _ in range(n):
  t,x,y = map(int,input().split())
  rt = x+y
  t = t-rt
  if t < 0 or t&1:
    found = False
print("Yes" if found else "No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
from sys import exit

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

l.insert(0, [0, 0, 0])
for i in range(n):
    t1, x1, y1 = l[i]
    t2, x2, y2 = l[i+1]
    if abs(x2 - x1) + abs(y2 - y1) > t2 - t1 or abs(x2 - x1) + abs(y2 - y1) + (t2 - t1) % 2 == 1:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

l.insert(0, [0, 0, 0])
for i in range(n):
    t1, x1, y1 = l[i]
    t2, x2, y2 = l[i+1]
    if abs(x2 - x1) + abs(y2 - y1) > t2 - t1 or abs(x2 - x1) + abs(y2 - y1) + (t2 - t1) % 2 == 1:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

for i in range(N):
  t1,x1,y1=map(int,input().split())
  AbsT=t1-t0
  AbsX=abs(x1-x0)
  AbsY=abs(y1-y0)
  if AbsX+AbsY>AbsT or (AbsX+AbsY-AbsT)%2!=0:
    print("No")
    break

else:
  print("Yes")

Submission status: Wrong Answer

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

flag = True
tmp_loc = [0, 0]
tmp_time = 0
for l_i in l:
        
    m_dist = (l_i[1] - tmp_loc[0] ) + ( l_i[2] - tmp_loc[1] )
    if m_dist > l_i[0] - tmp_time:
        print('No')
        flag = False
        break
    elif (l_i[0] - tmp_time  - m_dist) % 2 != 0:
        print('No')
        flag = False
        break
    tmp_loc = [l_i[1], l_i[2]]
    tmp_time = l_i[0]
    

if flag:
    
    print('Yes')

Submission status: Wrong Answer

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

for i in range(n):
    if i>0:
        dist = abs(data[i][1]-data[i-1][1])+abs(data[i][2]-data[i-1][2])
    else:
        dist = abs(data[i][1])+abs(data[i][2])
    
    if dist <= abs(data[i][0]):
        if (data[i][0] + data[i][1] + data[i][2])% 2 == 0:
            continue
        else:
            break
    else:
        break
else:
    print("Yes")
    sys.exit()

print("No")

Submission status: Wrong Answer

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

for i in range(n):
    judge = abs(data[i][1]) + abs(data[i][2])
    if judge <= abs(data[i][0]):
        if data[i][0] % 2 == 0:
            if judge % 2 == 0:
                continue
            else:
                break
        else:
            if judge % 2 == 1:
                continue
            else:
                break        
    else:
        break
else:
    print("Yes")
    sys.exit()

print("No")

Submission status: Wrong Answer

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

for i in range(n):
    judge = abs(data[i][1]) + abs(data[i][2])
    if judge <= abs(data[i][0]):
        if data[i][0] % 2 == 0:
            if (data[i][1]+data[i][2]) % 2 == 0:
                continue
            else:
                break
        else:
            if (data[i][1]+data[i][2]) % 2 == 1:
                continue
            else:
                break        
    else:
        break
else:
    print("Yes")
    sys.exit()

print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
X,Y = 0,0
T = 0
for i in range(N):
  t,x,y = map(int,input().split())
  dist = abs(X-x)+abs(Y-y)
  if (T-t)%2 ==dist%2:
    X += x
    Y += y
    T += t
    pass
  else:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())

for _ in range(n):
    t, x, y = map(int, input().split())
    if (x+y)%2 == t%2 and x+y <= t:
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
nt, nx, ny = 0, 0, 0
for i in range(n):
    t, x, y = map(int, input().split())
    t = t-nt
    location = abs(nx-x) + abs(ny-y)
    if location <= t and (t-location)%2 == 0:
        nt, nx, ny = t, x, y
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [0]*n

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

t_ = 0
x_ = 0
y_ = 0

for i in range(n):
  dx = 0
  dy = 0
  t = txy[i][0]
  x = txy[i][1]
  y = txy[i][2]
  dx = abs(x-x_)
  dy = abs(y-y_)
  d = dx + dy
  if d == abs(t - t_):
    t_ = t
    x_ = x
    y_ = y
  elif d > abs(t - t_):
    print("No")
    exit()
  else:
    if abs(t - t_)%2 == 0:
      t_ = t
      x_ = x
      y_ = y      
    else:
      print("No")
      exit()
      
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [0]*n

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

t_ = 0
x_ = 0
y_ = 0

for i in range(n):
  dx = 0
  dy = 0
  t = txy[i][0]
  x = txy[i][1]
  y = txy[i][2]
  dx = abs(x-x_)
  dy = abs(y-y_)
  d = dx + dy
  if d == t - t_:
    t_ = t
    x_ = x
    y_ = y
  elif d > t - t_:
    print("No")
    exit()
  else:
    if abs(t - t_)%2 == 0:
      t_ = t
      x_ = x
      y_ = y      
    else:
      print("No")
      exit()
      
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [0]*n

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

t_ = 0
x_ = 0
y_ = 0

for i in range(n):
  dx = 0
  dy = 0
  t = txy[i][0]
  x = txy[i][1]
  y = txy[i][2]
  dx = abs(x-x_)
  dy = abs(y-y_)
  d = dx + dy
  if d == t - t_:
    t_ = t
    x_ = x
    y_ = y
  elif d > t - t_:
    print("No")
    exit()
  else:
    if d != 0 and abs(t - t_) > d:
      t_ = t
      x_ = x
      y_ = y
    elif d == 0 and abs(t - t_)%2 == 0:
      t_ = t
      x_ = x
      y_ = y      
    else:
      print("No")
      exit()
      
print("Yes")

Submission status: Wrong Answer

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

# check
t, x, y = 0, 0, 0
for T, X, Y in TXY:
    required_time = (X - x) + (Y - y)
    if(T - t) < required_time or (T - (t + required_time)) % 2 != 0:
        print("No")
        exit(0)
    x, y = X, Y
    t = T
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
tb,xb,yb = 0,0,0
for _ in range(n):
    ta,xa,ya = list(map(int, input().split()))
    tdiff = abs(ta-tb)
    mdiff = abs(xa-xb) + abs(ya-yb)
    if tdiff < mdiff or (tdiff + mdiff) & 1:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
A = [[0,0]]
N = int(input())
for _ in range(N):
    t,x,y = map(int,input().split())
    A.append([t,x+y])
for i in range(1,N+1):
    if A[i][0]-A[i-1][0] >= A[i][1]-A[i-1][1] and (A[i][0]-A[i-1][0])%2 == (A[i][1]-A[i-1][1])%2:
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
A = []
N = int(input())
for _ in range(N):
    t,x,y = map(int,input().split())
    A.append(t-x-y)
for i in range(1,N):
    if A[i]%2!=A[i-1]%2:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []
for i in range(N):
  a.append(list(map(int,input().split())))
  
ans = []  
for i in range(N):  
  if a[i][0]<a[i][1]+a[i][2]:
    print("No")
    exit()
    
  if a[i][0]%2==1 and (a[i][1]+a[i][2])%2==1:
    ans.append("Yes")
  elif a[i][0]%2==0 and (a[i][1]+a[i][2])%2==0:
    ans.append("Yes")
  else:
    ans.append("No")
    
if ans.count("Yes")==N:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
from pprint import pprint

# import math
# import collections

n = int(input())
# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))
t, x, y = [0], [0], [0]
d = [0]

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

    d.append(abs(x[i] - x[0]) + abs(y[i] - y[0]))

# 時刻の奇遇と距離の奇遇は一致する
# 距離 <= t である
movable = [False] * (n + 1)

for i in range(n + 1):
    if d[i] <= t[i] and (t[i] % 2 == d[i] % 2):
        movable[i] = True

if all(movable):
    res = 'Yes'
else:
    res = 'No'

# pprint(d)
# pprint(movable)
print(res)

Submission status: Wrong Answer

Solution code:
from pprint import pprint

# import math
# import collections

n = int(input())
# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))
t, x, y = [0], [0], [0]
d = [0]

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

    d.append(abs(x[i] - x[0]) + abs(y[i] - y[0]))

# 時刻の奇遇と距離の奇遇は一致する
# 距離 <= t である
movable = [False] * (n + 1)

for i in range(n + 1):
    if d[i] <= t[i] and (t[i] % 2 == d[i] % 2):
        movable[i] = True

if all(movable):
    res = 'YES'
else:
    res = 'NO'

# pprint(d)
# pprint(movable)
print(res)

Submission status: Wrong Answer

Solution code:
N = int(input())

R = [[int(x) for x in input().split()] for n in range(N)]

T,X,Y = 0,0,0

flag = 0

for r in R:

    t,x,y = r[0], r[1], r[2]
    N = t - T 

    for i in range(N+1):
        # print(i, abs(X - i), x == abs(X - i), abs(Y - y), abs(Y - y) == N - i)
        if x == abs(X - i):
            if abs(Y - y) == N-i:
                # print("OK")
                flag = 1
                T,X,Y = r[0], r[1], r[2]

                break

            else:

                continue

        else:
            continue



    if flag == 0:
        break


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    pos = (0, 0)
    time_before = 0
    can = True

    for i in range(n):
        t, x, y = map(int, input().split())
        dist = abs(pos[0] - x) + abs(pos[1] - y)
        time = t - time_before
        # 時間内に到達不可
        if dist > time:
            can = False
            break
        if dist % 2 == 0 and time % 2 != 0:
            can = False
            break
        if dist % 2 != 0 and time % 2 == 0:
            can = False
            break
    print('Yes' if can else 'No')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
now = [0, 0, 0]
def ng():
  print('No')
  exit()
for i in range(n):
  t, x, y = map(int, input().split())
  if t % 2 != (x + y) % 2:
    ng()
  if abs(x - now[1]) + abs(y - now[2]) > t - now[0]:
    ng()
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
x=0
y=0
fl=True
for i in range(n):
  t,nx,ny=map(int,input().split())
  dist=abs(x-nx)+abs(y-ny)
  if t%2!=dist%2 or t<dist:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

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

l = [[0, 0, 0]]
l.extend(L)

flag = True
for c in range(1, len(L)):
    dt = l[c][0] - l[c-1][0]
    dist = abs(l[c][1] - l[c-1][1]) + abs(l[c][2] - l[c-1][2])

    if dist > dt or (dist % 2) != (dt % 2):
        flag = False

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

Submission status: Wrong Answer

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

l = [[0, 0, 0]]
l.extend(L)

flag = True
for c in range(1, len(L)):
    dt = l[c][0] - l[c-1][0]
    dist = abs(l[c][1] - l[c-1][1]) + abs(l[c][2] - l[c-1][2])

    if dist > dt or dist % 2 != dt % 2:
        flag = False

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

Submission status: Wrong Answer

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

l = [[0, 0, 0]]
l.extend(L)

flag = True
for c in range(1, len(L)):
    dt = l[c][0] - l[c-1][0]
    dist = abs(l[c][1] - l[c-1][1]) + abs(l[c][2] - l[c-1][2])

    if dist > dt or dist % 2 != dt % 2:
        flag = False

print("YES" if flag else "NO")

Submission status: Wrong Answer

Solution code:
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
flag = 0
t1 = 0
x1,y1 = 0,0
for i in range(N):
    t2,x2,y2 = X[i]
    dt = t2-t1
    d = dist((x1,y1),(x2,y2))
    if dt>=d and (dt-d)%2==0:continue
    flag = 1
    break
    t1,x1,y1 = t2,x2,y2
if flag==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
flag = 0
t1 = 0
x1,y1 = 0,0
for i in range(N):
    t2,x2,y2 = X[i]
    dt = t2-t1
    d = dist((x1,y1),(x2,y2))
    if dt>=d and (dt-d)%2==0:continue
    flag = 1
    break
    t2,x2,y2 = t1,x1,y1
if flag==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
flag = 0
t1 = 0
x1,y1 = 0,0
for i in range(N):
    t2,x2,y2 = X[i]
    dt = t2-t1
    d = dist((x1,y1),(x2,y2))
    if dt>=d and (dt-d)%2==0:continue
    flag = 1
    break
    t1,x2,y2 = t1,x1,y1
if flag==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
X, Y, T=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:
        continue
    else:
        print('No')
        quit()
    X, Y, T= x, y, T
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if x+y <= t and (x+y-t) % 2 == 0:
        continue
    else:
        print('No')
        quit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
bx, by=0, 0
for i in range(n):
    t,x,y=map(int, input().split())
    if t<abs(x-bx)+abs(y-by):
        print('No')
        exit()
    bx, by=x, y
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
tc, xc, yc = 0, 0, 0
ans = 'Yes'
for i in range(N):
  t, x, y = map(int, input().split())
  if (t - tc - abs(x-xc) - abs(y-yc)) % 2 == 1 or t - tc - abs(x-xc) - abs(y-yc) < 0:
    ans = 'No'
    break
print(ans)

Submission status: Wrong Answer

Solution code:
def dist(x,y):
    return abs(x[0]-y[0])+abs(x[1]-y[1])
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
flag = 0
t1 = 0
x1,y1 = 0,0
for i in range(N):
    t2,x2,y2 = X[i]
    dt = t2-t1
    d = dist((x1,y1),(x2,y2))
    if dt>=d and (dt-d)%2==0:continue
    flag = 1
    break
if flag==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

t_0 = 0
x_0 = 0
y_0 = 0
flag = True

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

    if abs(x-x_0) + abs(y-y_0) <= abs(t-t_0) and (abs(x-x_0)+abs(y-y_0))%2 == abs(t-t_0)%2:
        continue
    flag = False

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

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [0 for _ in range(N)]
X = [0 for _ in range(N)]
Y = [0 for _ in range(N)]
count = 0
t = 0
x = 0
y = 0

for i in range(N):
    T[i], X[i], Y[i] = map(int, input().split())
    t = T[i] -t
    x = X[i] -x
    y = Y[i] -y
    if t>= x+y:
        if t%2==(x+y)%2==0 or (t%2 != 0 and (x+y)%2 != 0):
            count +=1
        else:
            break
print('Yes' if count==N else 'No')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0 for _ in range(N)]
x = [0 for _ in range(N)]
y = [0 for _ in range(N)]
count = 0

for i in range(N):
    t[i], x[i], y[i] = map(int, input().split())
    if t[i]>= x[i]+y[i]:
        if t[i]%2==(x[i]+y[i])%2==0 or (t[i]%2 != 0 and (x[i]+y[i])%2 != 0):
            count +=1
        else:
            break

print('Yes' if count==N else 'No')

Submission status: Wrong Answer

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)

Submission status: Wrong Answer

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
  t=t-r
  if a<=t:
    if (t-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p=x
  q=y
  r=t
print(flag)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
for _ in range(n):
    t, x, y = map(int, input().split())
    if t < x + y:
        print('No')
        break
    else:
        if (t - x - y)%2 == 1:
            print('No')
            break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
TP = [[0, 0, 0]]
for _ in range(n):
    TP.append(list(map(int, input().split())))
for i in range(1, n + 1):
    td = TP[i][0] - TP[i-1][0]
    pd = TP[i][1] - TP[i-1][1] + TP[i][2] - TP[i-1][2]
    if td >= pd and td % 2 == pd % 2:
        continue
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

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

X=Y=T=0
ok = True
for t,x,y in txy:
    if abs(X-x)+abs(Y-y) <= t-T:
        if (t-T)%2 == 0:
            if (abs(X-x)+abs(Y-y))%2!=0:
                ok = False
                break
        else:
            if (abs(X-x)+abs(Y-y))%2==0:
                ok = False
                break
    else:
        ok = False
        break
    T,X,Y = t,x,y
print("Yes" if ok else "NO")

Submission status: Wrong Answer

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

X,Y = 0,0
ans = "Yes"
for t,x,y in txy:
    T = abs(x-X) + abs(y-Y)
    t -= T
    X,Y = x,y
    if t >= 0 and t%2==0: continue
    else: ans = "No"
print(ans)

Submission status: Wrong Answer

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

X,Y = 0,0
ans = "Yes"
for t,x,y in txy:
    T = abs(x-X) + abs(y-Y)
    if T == t: continue
    else:
        t -= T
        if t > 0 and t%2==0: continue
        else: ans = "No"
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N):
    t,x,y = map(int,input().split())
    if (abs(x+y)<=t) & ((x+y+t)%2 == 0):
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N):
    t,x,y = map(int,input().split())
    z=t+x+y
    if (z>2*t) or (z%2 != 0):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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 != 0):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())

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

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N):
    t,x,y = map(int,input().split())
    if ((x+y+t)%2 != 0) & (abs(x+y)>t):
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N):
    t,x,y = map(int,input().split())
    z=x+y
    if ((z+t)%2 == 0) & (abs(z)<=t):
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N):
    t,x,y = map(int,input().split())
    if ((x+y+t)%2 == 0) & (abs(x+y)<=t):
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())

for i in range(N):
    t,x,y = map(int,input().split())
    if ((x+y-t)%2 == 0) & (abs(x+y)<=t):
        continue
    else:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())

position=[[0,0,0]]
judge=[0]

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

for j in range(N):
    if ((position[1+j][1]+position[1+j][2]-position[1+j][0])%2 == 0) & (abs(x+y)<=t):
        judge.append(0)
    else:
        judge.append(1)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [list(map(int,input().split())) for i in range(N)]
for i in range(0,N-1):
    b = (a[i+1][0]-a[i][0])
    c = (abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2]))
    if b>=c:
        if b%2==0 and c%2==0:
            print("Yes")
        elif b%2==1 and c%2==1:
            print("Yes")
        else:
            print("No")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
a = [list(map(int,input().split())) for i in range(N)]
for i in range(0,N-1):
    b = (a[i+1][0]-a[i][0])
    c = (abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2]))
    if b>=c:
        if b%2==0 and c%2==0:
            print("Yes")
        elif b%2==1 and c%2==1:
            print("Yes")
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
n=int(input())
old_t = 0
old_x = 0
old_y = 0
for i in range(n):
  t, x, y = map(int, input().split())
  if (t - old_t) < abs(x-old_x)+abs(y-old_y) or (t - old_t)%2 != (abs(x-old_x)+abs(y-old_y))%2:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
tpr, xpr, ypr = 0, 0, 0
count = 0
for i in range(N):
    t, x, y = map(int, input().split())
    d = abs(x-xpr) + abs(y-ypr)
    n = ((t-tpr) - d) / 2
    if n >= 0:
        count += 1
    tpr, xpr, ypr = t, x, y
if count == N:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
tpr, xpr, ypr = 0, 0, 0
count = 0
for i in range(N):
    t, x, y = map(int, input().split())
    d = abs(x-xpr) + abs(y-ypr)
    n = ((t-tpr) - d) / 2
    if n >= 0:
        count += 1
    tpr, xpr, ypr = t, x, y
if count == N:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

now_x, now_y = 0, 0
pre_t = 0

for t, x, y in txy:
    walk = abs(now_x - x) + abs(now_y - y)
    if t - pre_t < walk:
        print('No')
        exit()
    if (t-pre_t) % 2 != walk % 2:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

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: Wrong Answer

Solution code:
n=int(input())
for i in range(n):
 z,x,y=map(int, input().split())
 dist=abs(z+1-z)
 dt=abs(x+1-x)+abs(y+1-y)
 if dist<z or (dist%2) != (dt%2):
  print("No")
  exit()
  
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
p = [list(map(int, input().split())) for _ in range(n)]
ans = 'Yes'
t_diff = 0
x_diff = 0
y_diff = 0
for i in p:
  t_diff = i[0] - t_diff
  x_diff = abs(i[1] - x_diff)
  y_diff = abs(i[2] - y_diff)
  if t_diff > x_diff + y_diff:
    if (t_diff - x_diff - y_diff)%2 != 0:
      ans = 'No'
      break
  else:
    ans = 'No'
    break
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [list(map(int,input().split())) for _ in range(n)]
now = 0
now_t = 0
flag = 1
for i in range(n):
    t,x,y = s[i][0],s[i][1],s[i][2]
    next = x+y
    dist = abs(next - now)
    time = t - now_t
    if dist == 0 and time == 1:
        print('No')
        exit()
    if dist > time:
        print('No')
        exit()
    elif dist == time:
        now_t = t
        now = next
    else:
        if dist - time % 2 == 0:
            now_t = t
            now = next
        else:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [list(map(int,input().split())) for _ in range(n)]
now = 0
now_t = 0
flag = 1
for i in range(n):
    t,x,y = s[i][0],s[i][1],s[i][2]
    next = x+y
    dist = abs(next - now)
    time = t - now_t
    if dist > time:
        print('No')
        exit()
    elif dist == time:
        now_t = t
        now = next
    else:
        if dist - time % 2 == 0:
            now_t = t
            now = next
        else:
            print('No')
            exit()
print('Yes')