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())
l = []
now = [0,0,0]
ans = 'Yes'
for _ in range(N):
    inp = list(map(int,input().split()))
    l.append(inp)

for i in range(N):
    shortest = abs(l[i][1] - now[0]) + abs(l[i][2] - now[1])
    if shortest > l[i][0] - now[0]:
        ans = 'No'
        break
    a = l[i][0] - shortest
    if a % 2 !=0:
        ans = 'No'
        break
    else:
        now = l[i]
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
l = []
now = [0,0,0]
ans = 'Yes'
for _ in range(N):
    inp = list(map(int,input().split()))
    l.append(inp)
for i in range(N):
    shortest = abs(l[i][1] - now[0]) + abs(l[i][2] - now[1])
    if shortest > l[i][0]:
        ans = 'No'
        break
    a = l[i][0] - shortest
    if a % 2 !=0:
        ans = 'No'
        break
    else:
        now = l[i]
print(ans)

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)%2!=t%2:
    print("No")
    break
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
#ans = 'Yes'

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

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 'Yes'

for i in range(N):
    t,x,y = map(int,input().split())
    t-=x+y
    if t%2==0:
        continue
    else:
        ans = 'No'
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = 'Yes'

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

Submission status: Wrong Answer

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

pT, pX, pY = 0, 0, 0

for i in range(n):
    cT, cX, cY = d[i]

    canMove = cT - pT

    if canMove == 1 and cX == pX and cY == pY:
        print('No')
        exit()

    if pT != 0:
        if cT%pT == 0 and cX == pX and cY == pY:
            print('No')
            exit()

    if abs(cX-pX)>canMove or abs(cY - pY)>canMove:
        print('No')
        exit()

    pT, pX, pY = d[i]

print('Yes')

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())

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

out='Yes'
for i in range(1,N+1):
    x = np.array(txy[i])
    y = np.array(txy[i-1])
    mv = x-y
    # print(mv)
    dam = mv[0] - (mv[1] + mv[2])
    if dam%2==1 or dam<0:
        out='No'

print(out)

Submission status: Wrong Answer

Solution code:
import sys
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')
        sys.exit()
print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:

def check(dest,start):
    tmp = dest[1] - start[1] + dest[2] - start[2] - (dest[0] - start[0])
    if tmp <= 0 and tmp%2 == 0 :
        return True
    else:
        return False

n = int(input())
start = [0,0,0]
for i in range(n):
    dest = list(map(int, input().split()))
    if check(dest,start):
        start = dest
    else:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 21 23:53:42 2020

@author: liang
"""

N = int(input())

prev = (0, 0, 0)

flag = True

for i in range(N):
    t, x, y = map(int, input().split())
    if t%2 != (x+y)%2:
        flag = False
    if x+y - prev[1] - prev[2] > t-prev[0]:
        flag = False
    prev = (t,x,y)

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

Submission status: Wrong Answer

Solution code:
N = int(input())

px = 0
py = 0
pt = 0

for _ in range(N):
  T, X, Y = (int(i) for i in input().split())

  d = (X - px + Y - py)
  dt = (T - pt)
  if d > dt or (d % 2) != (dt % 2):
    print('No')
    import sys
    sys.exit()
  else:
    px = X
    py = Y
    pt = T

print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
prev_time = 0
prev_point = (0, 0)
for i in range(n):
    t, x, y = map(int, input().split())
    dist = abs(x - prev_point[0]) + abs(y - prev_point[1])
    if dist > (t - prev_time):
        print('No')
        sys.exit(0)

    if (t - prev_time) % 2 != dist % 2:
        print('No')
        sys.exit(0)
    prev_time = t
    prev_point = (x, y)
    print(prev_time, prev_point)
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
prev_time = 0
prev_point = (0, 0)
for i in range(n):
    t, x, y = map(int, input().split())
    dist = abs(x - prev_point[0]) + abs(y - prev_point[1])
    if dist > t:
        print('No')
        sys.exit(0)

    if (t - prev_time) % 2 != dist % 2:
        print('No')
        sys.exit(0)
    prev_time = t
    prev_point = (x, y)
print('Yes')

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

n = int(input())
prev_point = (0, 0)
prev_time = 0
for i in range(n):
    t, x, y = map(int, input().split())
    dist = abs(x - prev_point[0]) + abs(y - prev_point[1])
    if dist > t:
        print('No')
        sys.exit(0)

    if (t - prev_time) % 2 != dist % 2:
        print('No')
        sys.exit(0)
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())

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

for i in range(N-1):
    move = abs(x[i+1]-x[i]) + abs(y[i+1]-y[i])
    time = t[i+1]-t[i]
    if time%2 ^ move%2 == 1 or time < move:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

for i in range(N-1):
    move = x[i+1]-x[i] + y[i+1]-y[i]
    time = t[i+1]-t[i]
    if time%2 ^ move%2 == 1 or time < move:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())

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

for i in range(N):
    move = x[i+1]-x[i] + y[i+1]-y[i]
    time = t[i+1]-t[i]
    if time%2 ^ move%2 == 1 or time < move:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
t,x,y = map(int,input().split())

NO = 0

for i in range(n):
    if abs(x)+ abs(y) > t or (abs(x) + abs(y) + t) % 2==1:
        NO = NO + 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
t,x,y = map(int,input().split())

No = 0

for i in range(n):
    if abs(x)+ abs(y) > t or (abs(x) + abs(y) + t) % 2==1:
        No = No + 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
t,x,y = map(int,input().split())

No = 0

for i in range(n):
    if (x + y) > t or (x + y + t) % 2:
        No = No + 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
t,x,y = map(int,input().split())

No = 0

for i in range(n):
    if (x + y) > t or (x + y + t) % 2 == 1 or(x + y + t) % 2 == -1 :
        No = No + 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
t,x,y = map(int,input().split())

No = 0

for i in range(n):
    if (x + y) > t or abs((x + y + t) % 2 == 1):
        No = No + 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())
t,x,y = map(int,input().split())

No = 0

for i in range(n):
  if (x + y) > t or (x + y + t) % 2 == 1:
    No = No + 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())

No = 0

for i in range(n):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t) % 2 == 1:
    No = No + 1

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

Submission status: Wrong Answer

Solution code:
n = int(input())

No = 0

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

Submission status: Wrong Answer

Solution code:
n = int(input())

No = 0

for i in range(n):
    t,x,y = map(int,input().split())
    if (x + y) > t or (x + y + t) % 2 == 1:
        No = No + 1
    else:
        No = No + 0

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

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

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())

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

Submission status: Wrong Answer

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

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

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

for n in range(1, N + 1):
    if t[n] < abs(x[n] - x[n - 1]) + abs(y[n] - y[n - 1]) or (abs(x[n] - x[n - 1]) + abs(y[n] - y[n - 1])) % 2 != (t[n] - t[n-1]) % 2:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

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

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

for n in range(1, N + 1):
    if t[n] < abs(x[n] - x[n - 1]) + abs(y[n] - y[n - 1]) or (x[n] + y[n]) % 2 != (t[n] - t[n-1]) % 2:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

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

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

for n in range(1, N + 1):
    if t[n] < abs(x[n] - x[n - 1]) + abs(y[n] - y[n - 1]) or (x[n] + y[n]) % 2 != t[n] % 2:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

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

for n in range(N):
    if n == 0:
        if t[n] < abs(x[n] - 0) + abs(y[n] - 0) or (x[n] + y[n]) % 2 != t[n] % 2:
            print('No')
            exit()
    if t[n] < abs(x[n] - x[n - 1]) + abs(y[n] - y[n - 1]) or (x[n] + y[n]) % 2 != t[n] % 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())
  if (x + y) < t or (x + y + t) % 2:
    print("Yes")
    exit()
print("No")

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

Submission status: Wrong Answer

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

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

for n in range(N):
    if t[n] < abs(x[n]) + abs(y[n]) or (x[n] + y[n]) % 2 != t[n] % 2:
        print('No')
        exit()

print('Yes')

Submission status: Wrong Answer

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

for i in range(N):
  dt = txy[i+1][0] - txy[i][0]
  dx = txy[i+1][1] - txy[i][1]
  dy = txy[i+1][2] - txy[i][2]
  print(dt, dx, dy, dt - (dx + dy))
  
  if dt < abs(dx + dy):
    print('No')
    break
  else:
    if (dt - (dx + dy)) % 2 != 0:
      print('No')
      break
else:
  print('Yes')

Submission status: Wrong Answer

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

for i in range(N):
  dt = txy[i+1][0] - txy[i][0]
  dx = txy[i+1][1] - txy[i][1]
  dy = txy[i+1][2] - txy[i][2]
  
  if dt < dx + dy:
    print('No')
    break
  else:
    if (dt - (dx + dy)) % 2 != 0:
      print('No')
      break
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
ans = 'Yes'
pre_t = 0
pre_d = 0

for _ in range(n):
  a,b,c = map(int,input().split())
  t = a - pre_t
  d = abs((b+c) - pre_d)
  if (t%2) == 0 and (d%2) == 0 and t >= d:
    continue
  elif (t%2) != 0 and (d%2) != 0 and t >= d:
    continue
  else:
    ans = 'No'
    break
  pre_t = t
  pre_d = d

print(ans)

Submission status: Wrong Answer

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

ans = "No"

if n == 1:
    if txy_list[0][1] + txy_list[0][2] <= txy_list[0][0]:
        if txy_list[0][0] % 2 == 0 and (txy_list[0][1] + txy_list[0][2]) % 2 == 0:
            ans = "Yes"
        elif txy_list[0][0] % 2 == 1 and (txy_list[0][1] + txy_list[0][2]) % 2 == 1:
            ans = "Yes"
else:
    for i in range(0, n - 1):
        if txy_list[i+1][1] + txy_list[i+1][2] - (txy_list[i][1] + txy_list[i][2]) <= txy_list[i+1][0] - txy_list[i][0]:
            if (txy_list[i+1][0] - txy_list[i][0]) % 2 == 0 and (abs(txy_list[i+1][1] + txy_list[i+1][2]) - abs((txy_list[i][1] + txy_list[i][2]))) % 2 == 0:
                ans = "Yes"
            elif (txy_list[i+1][0] - txy_list[i][0]) % 2 == 1 and (abs(txy_list[i+1][1] + txy_list[i+1][2]) - abs((txy_list[i][1] + txy_list[i][2]))) % 2 == 1:
                ans = "Yes"

print(ans)

Submission status: Wrong Answer

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

ans = "No"

if n == 1:
    if txy_list[0][1] + txy_list[0][2] <= txy_list[0][0]:
        if txy_list[0][0] % 2 == 0 and (txy_list[0][1] + txy_list[0][2]) % 2 == 0:
            ans = "Yes"
        elif txy_list[0][0] % 2 == 1 and (txy_list[0][1] + txy_list[0][2]) % 2 == 1:
            ans = "Yes"
else:
    for i in range(0, n - 1):
        if txy_list[i+1][1] + txy_list[i+1][2] - (txy_list[i][1] + txy_list[i][2]) <= txy_list[i+1][0] - txy_list[i][0]:
            if (txy_list[i+1][0] - txy_list[i][0]) % 2 == 0 and abs(txy_list[i+1][1] + txy_list[i+1][2] - (txy_list[i][1] + txy_list[i][2])) % 2 == 0:
                ans = "Yes"
            elif (txy_list[i+1][0] - txy_list[i][0]) % 2 == 1 and abs(txy_list[i+1][1] + txy_list[i+1][2] - (txy_list[i][1] + txy_list[i][2])) % 2 == 1:
                ans = "Yes"

print(ans)

Submission status: Wrong Answer

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

ans = "No"

if n == 1:
    if txy_list[0][1] + txy_list[0][2] <= txy_list[0][0]:
        if txy_list[0][0] % 2 == 0 and (txy_list[0][1] + txy_list[0][2]) % 2 == 0:
            ans = "Yes"
        elif txy_list[0][0] % 2 == 1 and (txy_list[0][1] + txy_list[0][2]) % 2 == 1:
            ans = "Yes"
else:
    for i in range(0, n - 1):
        if txy_list[i+1][1] + txy_list[i+1][2] - (txy_list[i][1] + txy_list[i][2]) < txy_list[i+1][0] - txy_list[i][0]:
            if (txy_list[i+1][0] - txy_list[i][0]) % 2 == 0 and abs(txy_list[i+1][1] + txy_list[i+1][2] - (txy_list[i][1] + txy_list[i][2])) % 2 == 0:
                ans = "Yes"
            elif (txy_list[i+1][0] - txy_list[i][0]) % 2 == 1 and abs(txy_list[i+1][1] + txy_list[i+1][2] - (txy_list[i][1] + txy_list[i][2])) % 2 == 1:
                ans = "Yes"

print(ans)

Submission status: Wrong Answer

Solution code:
print('YNeos'[any((t+x+y)%2+(t<x+y)for t,x,y in zip(*[map(int,[*open(0)][1].split())]*3))::2])

Submission status: Wrong Answer

Solution code:
print('YNeos'[any(t+x+y&1|(t<x+y)for t,x,y in zip(*[map(int,[*open(0)][1].split())]*3))::2])

Submission status: Wrong Answer

Solution code:
n = int(input())

prev_t, prev_x, prev_y = 0, 0, 0
for _ in range(n):
    t, x, y = map(int, input().split())
    print('#1', t, x, y)
    if (abs(x - prev_x) + abs(y - prev_y) <= t - prev_t and
        (abs(x - prev_x) + abs(y - prev_y)) % 2 == (t - prev_t) % 2):
        prev_t, prev_x, prev_y = t, x, y
        print(t, x, y)
        continue
    else:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
arr=[[0,0,0]]+[list(map(int,input().split())) for _ in range(n)]
for i in range(n):
  t1,x1,y1=arr[i]
  t2,x2,y2=arr[i+1]
  if abs(x1-x2)+abs(y1-y2)>t1+t2:
    print('No')
    exit()
  if (abs(x1-x2)+abs(y1-y2))%2!=(t1+t2)%2:
    print('No')
    exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n=int(input())
ans="Yes"
a,b,c=0,0,0
for i in range(n):
  t,x,y=map(int,input().split())
  if abs(b-x)+abs(y-c)>(t-a):
    ans="No"
    break
  elif (t-a-(abs(b-x)+abs(y-c)))%2!=0:
    ans="No"
    break
  else:
    a=t
    b=x
    y=c

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

for i in a:
    if (i[0] - i[1] - i[2])%2 != 0 or (i[0] - i[1] - i[2]) < 0:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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

x = y = t = 0
for i in range(n):
    dx, dy, dt = l[i][1], l[i][2], l[i][0]
    dist = abs((dx - x) + (dy - y))

    if abs(dt - t) < dist or (dt - dist) % 2:
        print("No")
        exit()

    x, y, t = dx, dy, dt
print("Yes")

Submission status: Wrong Answer

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

x = y = t = 0
for i in range(n):
    dx, dy, dt = l[i][1], l[i][2], l[i][0]
    dist = abs((dx - x) + (dy - y))

    if abs(dt - t) < dist or dt - dist % 2:
        print("No")
        exit()

    x, y, t = dx, dy, dt
print("Yes")

Submission status: Wrong Answer

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

x = y = t = 0
for i in range(n):
    dx, dy, dt = l[i][1], l[i][2], l[i][0]
    dist = abs((dx - x) + (dy - y))

    if abs(dt - t) < dist or dt - dist:
        print("No")
        exit()

    x, y, t = dx, dy, dt
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())

num,a,b=0,0,0

for i in range(n):
  t,x,y=map(int,input().split())
  num,a,b=abs(t-num),abs(x-a),abs(y-b)
  su=a+b
  if num<=su:
    ans="No"
    break
  elif su==0 and num%2==0:
    ans="Yes"
    break
  elif su==0 and num%2!=0:
    ans="No"
    break
  else:
    if num%2 != su%2:
      ans="No"
    else:
      ans="Yes"
      
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

num,a,b=0,0,0

for i in range(n):
  t,x,y=map(int,input().split())
  num,a,b=abs(t-num),abs(x-a),abs(y-b)
  su=a+b
  if num<su:
    ans="No"
    break
  elif su==0 and num%2==0:
    ans="Yes"
    break
  elif su==0 and num%2!=0:
    ans="No"
    break
  else:
    if num%2 != su%2:
      ans="No"
    elif num%su==0:
      ans="Yes"
    else:
      ans="Yes"
      
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

num,a,b=0,0,0

for i in range(n):
  t,x,y=map(int,input().split())
  num,a,b=abs(t-num),abs(x-a),abs(y-b)
  su=a+b
  if num<su:
    ans="No"
    break
  elif su==0 and num%2==0:
    ans="Yes"
    break
  elif su==0 and num%2!=0:
    ans="No"
    break
  else:
    if num%2 != su%2:
      ans="No"
    else:
      ans="Yes"
      
print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())

num,a,b=0,0,0

for i in range(n):
  t,x,y=map(int,input().split())
  num,a,b=abs(t-num),abs(x-a),abs(y-b)
  su=a+b
  if num<su:
    ans="No"
    break
  elif su==0 and num%2==0:
    ans="Yes"
    break
  elif su==0 and num%2!=0:
    ans="No"
    break
  else:
    if num%2==0 and su%2==0:
      ans="Yes"
    elif num%2!=0 and su%2!=0:
      ans="Yes"
    else:
      ans="No"
      
print(ans)

Submission status: Wrong Answer

Solution code:
print("Yes")

Submission status: Wrong Answer

Solution code:
n=int(input())

num,a,b=0,0,0

for i in range(n):
  t,x,y=map(int,input().split())
  num,a,b=abs(t-num),abs(x-a),abs(y-b)
  su=a+b
  if num<su:
    ans="No"
    break
  elif su==0 and num%2==0:
    ans="Yes"
    break
  elif su==0 and num%2!=0:
    ans="No"
    break
  else:
    if num%su==0:
      ans="Yes"
    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 t % 2 == 1:
    if (x + y) % 2 == 1 and 0 < x + y <= t:
      continue
    else:
      print('No')
      exit()
  else:
    if t % 4 == 0:
      if x == 0 and y == 0:
        continue
    elif (x + y) % 2 == 0 and 0 < 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 t % 2 == 1:
    if (x + y) % 2 == 1 and x + y <= t:
      continue
    else:
      print('No')
      exit()
  else:
    if t % 4 == 0:
      if x == 0 and y == 0:
        continue
    elif (x + y) % 2 == 0 and 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 t % 2 == 1:
    if (x + y) % 2 == 1 and x + y <= t:
      continue
    else:
      print('No')
      exit()
  else:
    if (x + y) % 2 == 0 and x + y <= t:
      continue
    else:
      print('No')
      exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
a = [[0,0,0]]*n
for x in range(n):
    a[x] = [int(y) for y in stdin.readline().rstrip().split()]
flag = 0

if a[0][0] % 2 == (a[0][1] + a[0][2]) % 2 and a[0][0] >= a[0][1] + a[0][2]:
    b = [[0,0,0]]*(n-1)
    for x in range(n - 1):
        b[x] = [a[x+1][y] - a[x][y] for y in range(3)]
    for x in range(n-1):
        if b[x][0] % 2 == (b[x][1] + b[x][2]) % 2 and b[x][0] >= b[x][1] + b[x][2]:
            continue
        else:
            flag = 1
            break
else:
    flag = 1

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

Submission status: Wrong Answer

Solution code:
#!/user/bin/env pypy3
import sys
from typing import NamedTuple, List


def fast_input():
    return sys.stdin.readline()[:-1]


class Position(NamedTuple):
    t: int
    x: int
    y: int

    def _calc_diff_move(self, position) -> int:
        diff_x = self.x - position.x
        diff_y = self.y - position.y
        return abs(diff_x) + abs(diff_y)

    def can_move_from(self, prev) -> bool:
        diff_t = self.t - prev.t
        diff_move = self._calc_diff_move(prev)
        # 奇数のときはその場禁止
        if diff_t % 2 == 1 and diff_move == 0:
            return False
        return diff_t >= diff_move


def result_format(b: bool) -> str:
    return "Yes" if b else "No"


def solve(positions: List[Position]) -> bool:
    positions = [Position(t=0, x=0, y=0)] + positions
    for p_ind in range(len(positions) - 1):
        p_curr = positions[p_ind]
        p_next = positions[p_ind + 1]
        if not p_next.can_move_from(p_curr):
            return False
    return True


def main():
    n = int(fast_input())
    positions = []
    for _ in range(n):
        t, x, y = list(map(int, fast_input().split()))
        positions.append(Position(t=t, x=x, y=y))
    result = solve(positions)
    print(result_format(result))


main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
x1 = 0
y1 = 0
pre_t = 0
ans_flag = 0

def judge(t, x1, y1, x2, y2):
  x = x2 - x1
  y = y2 - y1
  ans_flag = 'Yes'
  if (x + y) <= t:
    if ((x + y) % 2 == 0) and (t % 2 == 0):
      return x2, y2, ans_flag
    elif ((x + y) % 2 == 1) and (t % 2 == 1):
      return x2, y2, ans_flag
    else:
      ans_flag = 'No'
      return x2, y2, ans_flag
  else:
    ans_flag = 'No'
    return x2, y2, ans_flag

for i in range(N):
  num_list = list(map(int,input().split()))
  t = num_list[0] - pre_t
  x2 = num_list[1]
  y2 = num_list[2]
  pre_t = num_list[0]
  x1, y1, ans_flag = judge(t, x1, y1, x2, y2)
  if ans_flag == 'No':
    break
print(ans_flag)

Submission status: Wrong Answer

Solution code:
N = int(input())
x1 = 0
y1 = 0
pre_t = 0
ans_flag = 0

def judge(t, x1, y1, x2, y2):
  x = x2 - x1
  y = y2 - y1
  ans_flag = 'Yes'
  if (x + y) <= t:
    if ((x + y) % 2 == 0) and (t % 2 == 0):
      return t, x2, y2, ans_flag
    elif ((x + y) % 2 == 1) and (t % 2 == 1):
      return t, x2, y2, ans_flag
    else:
      ans_flag = 'No'
      return t, x2, y2, ans_flag
  else:
    ans_flag = 'No'
    return t, x2, y2, ans_flag

for i in range(N):
  num_list = list(map(int,input().split()))
  t = num_list[0] - pre_t
  x2 = num_list[1]
  y2 = num_list[2]
  pre_t = num_list[0]
  preee_t, x1, y1, ans_flag = judge(t, x1, y1, x2, y2)
  if ans_flag == 'No':
    break
print(ans_flag)

Submission status: Wrong Answer

Solution code:
N = int(input())
x1 = 0
y1 = 0
pre_t = 0
ans_flag = 0

def judge(t, x1, y1, x2, y2):
  x = x2 - x1
  y = y2 - y1
  ans_flag = 'Yes'
  if (x + y) <= t:
    if ((x + y) % 2 == 0) and (t % 2 == 0):
      return t, x2, y2, ans_flag
    elif ((x + y) % 2 == 1) and (t % 2 == 1):
      return t, x2, y2, ans_flag
    else:
      ans_flag = 'No'
      return t, x2, y2, ans_flag
  else:
    ans_flag = 'No'
    return t, x2, y2, ans_flag

for i in range(N):
  num_list = list(map(int,input().split()))
  t = num_list[0] - pre_t
  x2 = num_list[1]
  y2 = num_list[2]
  pre_t, x1, y1, ans_flag = judge(t, x1, y1, x2, y2)
  if ans_flag == 'No':
    break
print(ans_flag)

Submission status: Wrong Answer

Solution code:
N = int(input())
x1 = 0
y1 = 0
ans_flag = 0

def judge(t, x1, y1, x2, y2):
  x = x2 - x1
  y = y2 - y1
  ans_flag = 'Yes'
  if (x + y) <= t:
    if ((x + y) % 2 == 0) and (t % 2 == 0):
      return x2, y2, ans_flag
    elif ((x + y) % 2 == 1) and (t % 2 == 1):
      return x2, y2, ans_flag
    else:
      ans_flag = 'No'
      return x2, y2, ans_flag
  else:
    ans_flag = 'No'
    return x2, y2, ans_flag

for i in range(N):
  num_list = list(map(int,input().split()))
  t = num_list[0]
  x2 = num_list[1]
  y2 = num_list[2]
  x1, y1, ans_flag = judge(t, x1, y1, x2, y2)
  if ans_flag == 'No':
    break
print(ans_flag)

Submission status: Wrong Answer

Solution code:
n=int(input())
def judge(t_1,x_1,y_1,t_2,x_2,y_2):
    dt=t_2-t_1 
    dx=x_2-x_1 
    dy=y_2-y_1 
    if dx+dy>dt:
        return True 
    else: 
        if (dt-dx-dy)%2 == 0:
            return False 
        else: 
            return True 
        
data=[]
for _ in range(n):
    data.append(list(map(int,input().split())))
    
t_1,x_1,y_1=0,0,0 
for i in range(n):
    t_2,x_2,y_2=data[i]
    if judge(t_1,x_1,y_1,t_2,x_2,y_2): 
        print("No") 
        break 
    t_1,x_1,y_1=t_2,x_2,y_2 
else: 
    print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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(0-pos[i][1]) + abs(0-pos[i][2])
    if num <= pos[i][0] and pos[i][0] * (pos[i][0]%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")