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())
T = [0]*100000
X= [0]*100000
Y= [0]*100000
o_x = 0
o_y = 0

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

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

    if n == 0:
        count = T[n]
    else:
        count = T[n] - T[n-1]
        o_x = X[n-1]
        o_y = Y[n-1]
    c = 0
    x = o_x
    y = o_y

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

        if ((s_x >= 0 or s_y >= 0) )and (c!=count):
            if s_x >0:
                x +=1
                c += 1
            elif s_x < 0:
                x -= 1
                c+=1
            elif s_y > 0:
                y +=1
                c += 1
            elif s_y < 0:
                y -= 1
                c+=1
            elif s_x==0:
                x +=1
                c +=1

        elif c==count:
            if (x == X[n] and y ==Y[n]):
                flag = 1
                end=1
            else:
                flag=0
                end =1


if flag == 1:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
n=int(input())

start=[0,0,0]

ans=0

for i in range(n):
    
    cont=list(map(int,input().split()))
    
    if abs(start[0]-cont[0])!=abs(start[1]-cont[1])+abs(start[2]-cont[2]):
        ans=1
        
    start=cont
        
if ans==0:
    print('Yes')
    
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n=int(input())

start=[0,0,0]

ans=0

for i in range(n):
    
    cont=list(map(int,input().split()))
    
    if abs(start[0]-cont[0])!=abs(start[1]-cont[1])+abs(start[2]-cont[2]):
        print('No')
        ans=1
        
    start=cont
        
if ans==0:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 'Yes'

tt, tx, ty = 0, 0, 0,
for _ in range(N):
    t, x, y = map(int, input().split())
    ct = t-tt
    cx = x-tx
    cy = y-ty
    if ct < (cx+cy):
        ans = 'No'
        break
    if cx+cy == 0:
        ans = 'No'
        break
    if ct%2 != (cx+cy)%2:
        ans = 'No'
        break
    tt, tx, ty = t, x, y

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 'Yes'

tt, tx, ty = 0, 0, 0,
for _ in range(N):
    t, x, y = map(int, input().split())
    ct = t-tt
    cx = x-tx
    cy = y-ty
    if ct < (cx+cy):
        ans = 'No'
        break
    if cx+cy == 0:
        ans = 'No'
        break
    if ct%(cx+cy) != 0:
        ans = 'No'
        break
    tt, tx, ty = t, x, y

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = 'Yes'
for _ in range(N):
    t, x, y = map(int, input().split())
    if t < (x+y):
        ans = 'No'
    if t%(x+y) != 0:
        ans = 'No'

print(ans)

Submission status: Wrong Answer

Solution code:
# ABC086 C

def main():
    n = int(input())
    
    res = 'Yes'

    for i in range(n):
        t, x, y = map(int, input().split())
        
        if i != 0:
            t, x, y = t - t_prev, x - x_prev, y - y_prev

        if x + y > t:
            res = 'No'
            break
        elif (not t%2 and (x+y)%2) or (t%2 and not ((x+y)%2)):
            res = 'No'
            break
        
        t_prev, x_prev, y_prev = t, x, y
    
    print(res)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
target_point = [list( map(int,input().split())) for i in range(n)]
current_point = [0, 0, 0]
for i in range(n):
    dist = abs(target_point[i][1] - current_point[1]) + abs(target_point[i][2]) - current_point[2]
    time = target_point[i][0] - current_point[0]
    if time >= dist and (time - dist) % 2 == 0:
        current_point = target_point[i]
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
target_point = [list( map(int,input().split())) for i in range(n)]
current_point = [0, 0, 0]
for i in range(n):
    dist = abs(target_point[i][1] - current_point[1]) + abs(target_point[i][2]) - current_point[2]
    time = target_point[i][0] - current_point[0]
    if (dist == time) or ((time > dist) and (time - dist) % 2 == 0):
        current_point = target_point[i]
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
location = [list(map(int, input().split())) for j in range(n)]
counter = 0
adj_t, adj_x, adj_y = 0,0,0

for i in range(n):
    time = location[i][0] - adj_t
    x = location[i][1] - adj_x
    y = location[i][2] - adj_y
    dst = abs(x) + abs(y)
    if dst <=time and dst in range(time, 0, -2):
        counter += 1
    adj_t = time
    adj_x = x
    adj_y = y
    
if counter == len(location):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
location = [list(map(int, input().split())) for j in range(n)]
counter = 0
adj_t, adj_x, adj_y = 0,0,0

for i in range(n):
    time = location[i][0] - adj_t
    x = location[i][1] - adj_x
    y = location[i][2] - adj_y
    dst = abs(x) + abs(y)
    if dst <=time and abs(x + y) in range(time, 0, -2):
        counter += 1
    adj_t = time
    adj_x = x
    adj_y = y
    
if counter == len(location):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
location = [list(map(int, input().split())) for j in range(n)]
counter = 0
adj_t, adj_x, adj_y = 0,0,0

for i in range(n):
    time = location[i][0] - adj_t
    x = location[i][1] - adj_x
    y = location[i][2] - adj_y
    if abs(x)<= time and abs(y) <=time and abs(x + y) in range(time, 0, -2):
        counter += 1
    adj_t = time
    adj_x = x
    adj_y = y
    
if counter == len(location):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
location = [list(map(int, input().split())) for j in range(n)]
counter = 0
adj_t, adj_x, adj_y = 0,0,0

for i in range(n):
    time = location[i][0] - adj_t
    x = location[i][1] - adj_x
    y = location[i][2] - adj_y
    if abs(x + y) in range(time, 0, -2):
        counter += 1
    adj_t = time
    adj_x = x
    adj_y = y
    
if counter == len(location):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

tmp = [tuple(map(int,input().split())) for i in range(N)]

ct = cx = cy = 0
for t,x,y in tmp:
    dst = abs(cx - x) + abs(cy - y)
    if dst > t-ct or dst%2 != (t-ct)%2:
        print('NO')
        exit()
    ct,cx,cy = t,x,y
print('YES')

Submission status: Wrong Answer

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

ct = 0
cx = 0
cy = 0
for t,x,y in tmp:
    dst = abs(cx - x) + abs(cy - y)
    if dst > t-ct or dst%2 != (t-ct)%2:
        print('NO')
        exit()
    ct,cx,cy = t,x,y

print('YES')

Submission status: Wrong Answer

Solution code:
def is_even(i: int) -> bool:
    return i % 2 == 0


def is_odd(i: int) -> bool:
    return i % 2 != 0


def is_まず実現不可能(t_list, x_list, y_list):
    for t, x, y in zip(t_list, x_list, y_list):
        sum_x_y = x + y

        # 時刻t >= x+y でないと無理
        if t < sum_x_y:
            return True

        # 偶数時刻で、x+yが奇数は実現不可能
        if is_even(t) and is_odd(sum_x_y):
            return True

        # 奇数時刻で、x+yが偶数は実現不可能
        if is_odd(t) and is_even(sum_x_y):
            return True

    return False  # とりあえず実現する可能性が残っている


def actual(N, t_list, x_list, y_list):
    if is_まず実現不可能(t_list, x_list, y_list):
        return 'No'

    return 'Yes'

N = int(input())

t_list, x_list, y_list = [], [], []
for _ in range(N):
  t, x, y = list(map(int, input().split()))
  t_list.append(t)
  x_list.append(x)
  y_list.append(y)
  
print(actual(N, t_list, x_list, y_list))

Submission status: Wrong Answer

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

flag = True
for i in range(1, n + 1):
    t = txy[i][0] - txy[i - 1][0]
    x = txy[i][1] - txy[i - 1][1]
    y = txy[i][2] - txy[i - 1][2]

    if not t >= x + y or not t % 2 == (x + y) % 2:
        flag = False
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [list(map(int,input().split())) for _ in range(N)]
t = 0
x = 0
y = 0

for i in range(N):
  time = T[i][0] - t
  dis = T[i][1] + T[i][2] -(x+y)
  t = T[i][0]
  x = T[i][1]
  y = T[i][2]
  if time >= dis and time % 2 == dis % 2:
    continue
  else:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
T = [list(map(int,input().split())) for _ in range(N)]
t,x,y = 0,0,0

for i in range(N):
  time = T[i][0] - t
  t = T[i][0]
  dis = T[i][1] + T[i][2] -(x+y)
  x = T[i][1]
  y = T[i][2]
  if time >= dis and time % 2 == dis % 2:
    continue
  else:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
for i in range(N):
  t,x,y = map(int, input().split())
  if (t%2)+(x+y)%2 == 1 or 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 (t%2 == 1 and (x+y)%2 == 0) or (t%2 == 0 and (x+y)%2 == 1) or 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 or (t+x+y)%2 == 1:
      print("No")
      exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
turn = int(input())
counter = 0
for challenge in range(turn):
    inp = tuple(map(int,input().split()))
   
    if sum(inp[1:]) <= inp[0] and sum(inp[1:]) >= -inp[0]:
        if inp[0] % 2 == 0 and sum(inp[1:]) % 2 ==0:
            counter += 1
            # print('Yes')
        elif inp[0] % 2 != 0 and sum(inp[1:]) % 2 != 0:
            counter += 1
            # print('Yes')
        else:
            pass
            # print('No')
    else:
        pass
        # print('No')

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

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [[int(x) for x in input().split()]for i in range(N)]
T = 0            ####現在時刻
place = (0,0)    ####現在地
for i in range(N):
  if ((A[i][0]-T) + abs(A[i][1]-place[0]) + abs(A[i][2]-place[1]))%2 == 0:
    T = A[i][0]
    place = (A[i][1], A[i][2])
  elif ((A[i][0]-T) + abs(A[i][1]-place[0]) + abs(A[i][2]-place[1]))%2 == 1:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
N = int(input())
A = [[int(x) for x in input().split()]for i in range(N)]
T = 0            ####現在時刻
place = (0,0)    ####現在地
for i in range(N):
  if ((A[i][0]-T) + abs(A[i][1]-place[0]) + abs(A[i][2]-place[1]))%2 == 0:
    T = A[i][0]
    place = (A[i][1], A[i][2])
  else:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [[int(x) for x in input().split()]for i in range(N)]
T = 0            ####現在時刻
place = (0,0)    ####現在地
for i in range(N):
  if ((A[i][0]-T) + abs(A[i][1]-place[0]) + abs(A[i][2]-place[1]))%2 == 0:
    T = A[i][0]
    place = (A[i][1], A[i][2])
  else:
    print("No")
    exit()
print("Yes")

Submission status: Wrong Answer

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


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


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

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

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

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

Submission status: Wrong Answer

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


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


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

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

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

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

Submission status: Wrong Answer

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


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


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

def createMovePatterns(count: int) -> list:
  moves = [(1,0), (-1,0), (0,1), (0,-1)]
  return list(combinations_with_replacement(moves, count))
 
def observeTwoPoints(_observed: list, _expectation: list) -> bool:
  # print(observed,'?',expectation, '\n')
  result = [o == e for o, e in zip(_observed, _expectation)]
  return all(result)
    
def readByOneLine(_items: dict) -> list:
  _judges = []
  append = _judges.append
  for l, item in _items.items():  # read one line at once
    patterns = createMovePatterns(item[0])
    expectation = [item[1], item[2]]
    for pattern in patterns:  # brute force
      observed = calcPosFromMoves(pattern) 
      if observeTwoPoints(observed, expectation): 
        append(True)
        break;
  return _judges

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

Submission status: Wrong Answer

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


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


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

def createMovePatterns(count: int) -> list:
  moves = [(1,0), (-1,0), (0,1), (0,-1)]
  return list(combinations_with_replacement(moves, count))
 
def observeTwoPoints(_observed: list, _expectation: list) -> bool:
  # print(observed,'?',expectation, '\n')
  result = [o == e for o, e in zip(_observed, _expectation)]
  return all(result)
    
def readByOneLine(_items: dict) -> list:
  _judges = []
  append = _judges.append
  for l, item in _items.items():  # read one line at once
    patterns = createMovePatterns(item[0])
    expectation = [item[1], item[2]]
    for pattern in patterns:  # brute force
      observed = calcPosFromMoves(pattern) 
      if observeTwoPoints(observed, expectation): 
        append(True)
        break;
  return _judges

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

Submission status: Wrong Answer

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

j = True

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


for d in range(0, n) :
    if t[d] % 2 == 1 and (x[d] + y[d]) %2 != 1 :
        j = False
    if t[d] % 2 == 0 and (x[d] + y[d]) %2 != 0 :
        j = False

for k in range(0, n-1) :
    a = t[k+1] - t[k]
    b = abs(x[k+1] - x[k]) + abs(y[k+1] - y[k])
    if a < b :
        j = False


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

Submission status: Wrong Answer

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

x = 0
y = 0
t = 0
for i in range(n):
    sub = abs(txy[i][1] - x) + abs(txy[i][2] - y)
    if not ((txy[i][0] - t == sub) or (txy[i][0] - t > sub and (txy[i][0] - t) % 2 == 0)):
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())

tp = 0
xp = 0
yp = 0
flag = [0]*n
for i in range(n):
  t, x, y = map(int,input().split())
  dt = t-tp
  dx = abs(xp-x)
  dy = abs(yp-y)
  if dx+dy==dt:
    flag[i]=1
  elif dt%2==0 and dx%2==0 and dy%2==0:
    flag[i]=1
  elif dt%2==0 and dx%2==1 and dy%2==1:
    flag[i]=1
  elif dt%2==1 and dx%2==0 and dy%2==1:
    flag[i]=1
  elif dt%2==1 and dx%2==1 and dy%2==0:
    flag[i]=1
  tp=t
  xp=x
  yp=y

f=1
for i in range(n):
  f *= flag[i]
  
if f==1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())

tp = 0
xp = 0
yp = 0
flag = 0
for i in range(n):
  t, x, y = map(int,input().split())
  dt = t-tp
  dx = abs(xp-x)
  dy = abs(yp-y)
  if dx+dy==dt:
    flag=1
  elif dt%2==0 and dx%2==0 and dy%2==0:
    flag=1
  elif dt%2==0 and dx%2==1 and dy%2==1:
    flag=1
  elif dt%2==1 and dx%2==0 and dy%2==1:
    flag=1
  elif dt%2==1 and dx%2==1 and dy%2==0:
    flag=1
  tp=t
  xp=x
  yp=y

if flag==1:
  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 = (0,0)
now_t = 0
ok = True
for t,x,y in TXY:
  d = abs(x-now[0]) + abs(y-now[0])
  if d <= (t-now_t) and ((t - now_t) - d) % 2 == 0:
    now = (x,y)
    now_t = t
    continue
  ok = False
  break
  
if ok:
  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 = (0,0)
now_t = 0
ok = True
for t,x,y in TXY:
  d = abs(x-now[0]) + abs(y-now[0])
  if d <= (t-now_t) and (t - now_t -d) % 2 == 0:
    now = (x,y)
    now_t = t
    continue
  ok = False
  break
  
if ok:
  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 = (0,0)
ok = True
for t,x,y in TXY:
  d = abs(x-now[0]) + abs(y-now[0])
  if d <= t and (t-d) % 2 == 0:
    now = (x,y)
    continue
  ok = False
  break
  
if ok:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N = int(input())

pt, px, py = map(int, input().split())
for _ in range(1, N):
    t, x, y = map(int, input().split())
    ts = abs(t - pt)
    xys = abs(x - px) + abs(y - py)
    if ts < xys:
        print('No')
        break

    if ts % 2 != xys % 2:
        print('No')
        break
    
    pt, px, py = t, x, y
else:
    print('Yes')

Submission status: Wrong Answer

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

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

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


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

Submission status: Wrong Answer

Solution code:
n = int(input())

flag = 0
for _ in range(n):
  t, x, y = map(int, input().split())
  if t%2 == (x+y)%2 and t >= (x+y):
    continue
  else:
    flag = 1
    
print('YES') if not flag else print('NO')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n=int(input())
l=[[] for i in range(n+1)]
l[0]=[0,0,0]
for i in range(1,n+1):
    l[i]=list(map(int,input().split()))
for i in range(n):
    flag=False
    t=l[i+1][0]-l[i][0]
    x=l[i+1][1]-l[i][1]
    y=l[i+1][2]-l[i][2]
    for a in range(t):
        for b in range(t-a):
            c=a-x
            d=b-y
            if a+b+c+d==t:
                flag=True
                break
        if flag: break
    if not flag:
        print("No")
        break
if flag: print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

to, xo, yo = 0, 0, 0

for i in range(N):
  t, x, y = map(int, input().split())
  DeltaT = abs(t - to)
  DeltaX = abs(x - xo)
  DeltaY = abs(y - yo)
  if DeltaT >= DeltaX + DeltaY:
    if (DeltaT % 2 == 1 and (DeltaX + DeltaY) % 2 == 1) or (DeltaT % 2 == 0 and (DeltaX + DeltaY) % 2 == 0):
      to, xo, yo = t, x, y
  else:
    print('No')
    break
    
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t, x, y = 0, 0, 0
t1, x1, y1 = 0, 0, 0
p = False
for i in range(n):
	t, x, y = t1, x1, y1
	t1, x1, y1 = map(int, input().split())
	s = t1 - t
	d = x1 + y1 - x - y
	p = x >= 0 and y >= 0 and (abs(s) >= abs(d)) and ((s - d) % 2 == 0)
	print("{},{}".format(s, d))
	if p == False:
		break
print("Yes" if p else "No")

Submission status: Wrong Answer

Solution code:
N = int(input())
 
T = []
ti = 0
xi = 0
yi = 0
flag = True
# t+1に点(x+1,y),(x−1,y),(x,y+1),(x,y−1)の
for i in range(N):
    T.append(list(map(int, input().split())))
 
if len(T) == 0:
    print("No")
 
for t, x, y in T:
    dift = t - ti
    difx = x - xi
    dify = y - yi
    dif = difx + dify
    ti = t
    xi = x
    yi = y
    if dift % dif == 0:
        continue
    else:
        flag = False
        break
 
 
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())

T = []
ti = 0
xi = 0
yi = 0
flag = True
# t+1に点(x+1,y),(x−1,y),(x,y+1),(x,y−1)の
for i in range(N):
    T.append(list(map(int, input().split())))


for t, x, y in T:
    dift = t - ti
    difx = x - xi
    dify = y - yi
    dif = difx + dify
    ti = t
    xi = x
    yi = y
    if dift % dif == 0:
        continue
    else:
        flag = False
        break


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

Submission status: Wrong Answer

Solution code:
n = int(input())
t1 = 0
x1 = 0
y1 = 0
count = 0
for _ in range(n):
    t,x,y = map(int,input().split())
    t = abs(t - t1)
    x = abs(x - x1)
    y = abs(y - y1)
    if x + y <= t and x+y % 2 == t % 2:
        t1 = t
        x1 = x
        y1 = y
        count += 1
if count == n:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
t1 = 0
x1 = 0
y1 = 0
count = 0
for _ in range(n):
    t,x,y = map(int,input().split())
    t = t - t1
    x = x - x1
    y = y - y1
    if x + y <= t and x+y % 2 == t % 2:
        t1 = t
        x1 = x
        y1 = y
        count += 1
if count == n:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(N):
    dt = t[i + 1] - t[i]
    dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    if dt < dist:
        print("NO")
        exit(0)

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

print("YES")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int, input().split())) for i in range(n)]
for i in txy:
    if i[0] % 2 != (i[1] + i[2]) % 2:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
t, x, y = 0, 0, 0
list1 = []

for i in range(n):
  t_i, x_i, y_i = map(int, input().split())
  list1.append((t, x, y))
  
for t_i, x_i, y_i in list1:
  distance = (x_i - x) + (y_i - y)
  if distance > (t_i - t) or (t_i - t)%2 == 0:
    print('No')
    break
  t, x, y = t_i, x_i, y_i
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t = 0
x = 0
y = 0
list1 = []

for i in range(n):
  t_i, x_i, y_i = map(int, input().split())
  list1.append((t, x, y))
  
for t_i, x_i, y_i in list1:
  distance = (x_i - x) + (y_i - y)
  if distance > (t_i - t) or (t_i - t)%2 == 1:
    print('No')
    break

print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N = int(input())


cood = []
xbefore = 0
ybefore = 0
tbefore = 0
trigger = 0


for i in range(N):
    line = list(map(int ,input().split()))
    
    min_time = abs(line[1] - xbefore) + abs(line[2] - ybefore)
    time = line[0] - tbefore
    
    
        
    
    if time >= min_time:

        if line[1:3] == [0,0]:
            trigger = 1
            
        elif min_time % 2 == time % 2:
            trigger = 1
        
        else:
            print("No")
            break
            
        
        tbefore,xbefore,ybefore = line
    
    
    else:
        print("No")
        break
        
    
if trigger == 1:
    print("Yes")