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, x, y = [0]*N, [0]*N, [0]*N
t[0], x[0], y[0] = map(int, input().split())
if t[0] == x[0]+y[0] or ((-x[0]-y[0] + t[0]) > 0 and  (-x[0]-y[0] + t[0]) % 2 == 0):
    check = True
else:
    check = False
for i in range(1, N):
    tt, xx, yy = map(int, input().split())
    t[i], x[i], y[i] = tt-t[i-1] ,abs(xx-x[i-1]) , abs(yy-y[i-1])
    judge = -x[i]-y[i]+t[0]
    if judge < 0 or ( judge % 2 !=0 and judge > 0) or (x[i]==y[i]==0 and t[i]%2 !=0) :
        if t[i] != x[i]+y[i]:
            check = False
            break

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

Submission status: Wrong Answer

Solution code:
N = int(input())

t, x, y = [0]*N, [0]*N, [0]*N
t[0], x[0], y[0] = map(int, input().split())
if t[0] == x[0]+y[0] or ((-x[0]-y[0] + t[0]) > 0 and  (-x[0]-y[0] + t[0]) % 2 == 0):
    check = True
else:
    check = False
for i in range(1, N):
    tt, xx, yy = map(int, input().split())
    t[i], x[i], y[i] = tt-t[i-1] ,abs(xx-x[i-1]) , abs(yy-y[i-1])
    judge = -x[i]-y[i]+t[0]
    if judge < 0 or ( judge % 2 !=0 and judge > 0) or (x[i]==y[i]==0 and t[i]%2 !=0) :
        check = False
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())

t, x, y = [0]*N, [0]*N, [0]*N
t[0], x[0], y[0] = map(int, input().split())
if t[0] == x[0]+y[0] or ((-x[0]-y[0] + t[0]) > 0 and  (-x[0]-y[0] + t[0]) % 2 == 0):
    check = True
else:
    check = False
for i in range(1, N):
    tt, xx, yy = map(int, input().split())
    t[i], x[i], y[i] = tt-t[i-1] ,abs(xx-x[i-1]) , abs(yy-y[i-1])
    if -x[i]-y[i]+t[0] < 0 or ((-x[i]-y[i]+t[0])%2!=0 and (-x[0]-y[0] + t[0]) > 0) :
        check = False
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
T,X,Y = [],[],[]
for i in range(N):
  t,x,y = map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
if N == 1:
  trans_count = X[0] + Y[0]
  time = T[0]
  if (time - trans_count) % 2 == 0 and time - trans_count >= 0:
    print("Yes")
  else:
    print("No")
  exit()
for i in range(N-1):
  trans_count = abs(X[i+1] - X[i]) + abs(Y[i+1] - Y[i])
  time = T[i+1] - T[i]
  if (time - trans_count) % 2 != 0 and time - trans_count >= 0:
    print("No")
    break
  elif i == N-2:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
T,X,Y = [],[],[]
for i in range(N):
  t,x,y = map(int,input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
if N == 1:
  trans_count = X[0] + Y[0]
  time = T[0]
  if (time - trans_count) % 2 == 0 and time - trans_count > 0:
    print("Yes")
  else:
    print("No")
  exit()
for i in range(N-1):
  trans_count = abs(X[i+1] - X[i]) + abs(Y[i+1] - Y[i])
  time = T[i+1]-T[i]
  if (time - trans_count) % 2 != 0 and time - trans_count > 0:
    print("No")
    break
  elif i == N-2:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import collections


def solve(N, ts, ps):
    for i in range(N-1):
        dt = ts[i+1] - ts[i]
        d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)

        if d > dt or dt % 2 != d % 2:
            return "No"
    return "Yes"


N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = []
ps = []
for i in range(N):
    t, x, y = list(map(int, input().split()))
    ts.append(t)
    ps.append(point(x, y))

if N == 1:
    print("Yes") if ps[0].x == 0 and ps[0].y == 0 else print("No")
else:
    print(solve(N, ts, ps))

Submission status: Wrong Answer

Solution code:
import collections


def solve(N, ts, ps):
    for i in range(N-1):
        dt = ts[i+1] - ts[i]
        d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)

        if d > dt or dt % 2 != d % 2:
            return "No"
    return "Yes"


N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = []
ps = []
for i in range(0, N):
    t, x, y = list(map(int, input().split()))
    ts.append(t)
    ps.append(point(x, y))

print(solve(N, ts, ps))

Submission status: Wrong Answer

Solution code:
import collections


def solve(N, ts, ps):
    for i in range(N-1):
        dt = ts[i+1] - ts[i]
        d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)

        if d > dt or dt % 2 != d % 2:
            return "No"
    return "Yes"


N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = []
ps = []
for i in range(0, N):
    t, x, y = list(map(int, input().split()))
    ts.append(t)
    ps.append(point(x, y))

if N == 1:
    print("Yes") if ps[0].x == 0 and ps[0].y == 0 else print("No")
else:
    print(solve(N, ts, ps))

Submission status: Wrong Answer

Solution code:
import collections


def solve(N, ts, ps):
    for i in range(N-1):
        dt = ts[i+1] - ts[i]
        d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)

        print(dt, d)
        if d > dt or dt % 2 != d % 2:
            return "No"
    return "Yes"


N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = []
ps = []
for i in range(0, N):
    t, x, y = list(map(int, input().split()))
    ts.append(t)
    ps.append(point(x, y))

if N == 1:
    print("Yes") if ps[0].x == 0 and ps[0].y == 0 else print("No")
else:
    print(solve(N, ts, ps))

Submission status: Wrong Answer

Solution code:
import collections


def solve(N, ts, ps):
    for i in range(N-1):
        dt = ts[i+1] - ts[i]
        d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)

        if d > dt or dt % 2 != d % 2:
            return "No"
    return "Yes"


N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = []
ps = []
for i in range(N):
    t, x, y = list(map(int, input().split()))
    ts.append(t)
    ps.append(point(x, y))

print(solve(N, ts, ps))

Submission status: Wrong Answer

Solution code:
import collections


def solve(N, ts, ps):

    for i in range(N-1):
        dt = ts[i+1] - ts[i]
        d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)

        if d > dt or dt % 2 != d % 2:
            return "NO"
    return "YES"


N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = []
ps = []
for i in range(N):
    t, x, y = list(map(int, input().split()))
    ts.append(t)
    ps.append(point(x, y))

print(solve(N, ts, ps))

Submission status: Wrong Answer

Solution code:
import collections


def solve(N, ts, ps):
    for i in range(N-1):
        dt = ts[i+1] - ts[i]
        d = abs(ps[i+1].x - ps[i].x) + abs(ps[i+1].y - ps[i].y)

        if d <= dt and dt % 2 == d % 2:
            return "YES"
    return "NO"


N = int(input())
point = collections.namedtuple('point', ['x', 'y'])
ts = []
ps = []
for i in range(N):
    t, x, y = list(map(int, input().split()))
    ts.append(t)
    ps.append(point(x, y))

print(solve(N, ts, ps))

Submission status: Wrong Answer

Solution code:
N = int(input())
m, w, v = 0, 0, 0
for _ in range(N):
    t, x, y = map(int, input().split())
    if (t-m < x+y) or (w == x and v == y):
        print('No')
        exit()
    else:
        m, w, v = t-m, x, y
print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input().rstrip())
t = [0 for _ in range(N+1)]
x = [0 for _ in range(N+1)]
y = [0 for _ in range(N+1)]

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

judge = []
for i in range(N):
    diff_t = t[i+1] - t[i]
    diff_x = x[i+1] - x[i]
    if diff_t >= diff_x and (diff_t - diff_x ) % 2 == 0:
        judge.append(True)
    else:
        judge.append(False)

if all(judge):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
## ABC086C
## C - Traveling
import sys

n = int(input())
pos = [[int(_) for _ in input().split()] for _ in range(n)]

x = 0
y = 0
t = 0

for i in pos:
    ti, xi, yi = map(int,i)
    # print(t,x,y)
    dl = abs(xi-x)+abs(yi-y)
    dt = ti-t
    if (dl > dt or (dl-dt)%2 == 1):
        print('No')
        sys.exit()
    else:
        x = xi
        y = yi
        t = t

print('Yes')

Submission status: Wrong Answer

Solution code:
## ABC086C
## C - Traveling
import sys

n = int(input())
pos = [[int(_) for _ in input().split()] for _ in range(n)]

x = 0
y = 0
t = 0

for i in pos:
    ti, xi, yi = map(int,i)
    # print(t,x,y)
    dl = abs(xi-x)+abs(yi-y)
    dt = ti-t
    if (dl > dt or (dl-dt)%2 == 1):
        print('No')
        sys.exit()
    else:
        x = xi
        y = yi
        t = ti-t

print('Yes')

Submission status: Wrong Answer

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

import math

n = int(input())
a = [input().split() for i in range(n)]

# n時間での座標(x_n,y_n)と、(n+t)時間の座標(x_(n+t), y_(n+t))との、x座標同士、y座標同士の差の絶対値の合計 S = (|x_(n+t) - x_n| + |y_(n+t) - y_n|)が、
# (1) Sがt以下
# (2) tが奇数の時Sも奇数、tが偶数の時tも偶数
# の条件を満たして入れば、可能。

def travelCheck(alpha, beta):
    timeDiff = int(beta[0]) - int(alpha[0])
    positionDiff = abs(int(beta[1]) - int(alpha[1])) + abs(int(beta[2]) - int(alpha[2]))
    flag = False
    if timeDiff >= positionDiff and (timeDiff%2 == positionDiff%2):
        flag = True
    return flag

start = ['0', '0', '0']

# positionList = []
# positionList.append(start)
# positionList.append(a)

for i in a:
    flag = travelCheck(start, i)
    start = i

if flag:
    print("YES")
if not flag:
    print("NO")

Submission status: Wrong Answer

Solution code:
import sys

N=int(input())
TXY=[list(map(int,input().split()))]

TXY=[[0,0,0]]+TXY

n=0
nx=0
ny=0

for t,x,y in TXY:
    if abs(x-nx)+abs(y-ny)<=t-n and (abs(x-nx)+abs(y-ny))%2==(t-n)%2:
        n,nx,ny=t,x,y
    else:
        print("No")
        sys.exit()


print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
TXY=[list(map(int,input().split()))]

TXY=[[0,0,0]]+TXY

n=0
nx=0
ny=0

for t,x,y in TXY:
    if abs(x-nx)+abs(y-ny)<=t-n and (abs(x-nx)+abs(y-ny))%2==(t-n)%2:
        n,nx,ny=t,x,y
    else:
        print("No")
        break

else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N=int(input())
TXY=[list(map(int,input().split()))]

TXY=[[0,0,0]]+TXY

n=0
nx=0
ny=0

for t,x,y in TXY:
    if abs(x-nx)+abs(y-ny)>=t-n and (abs(x-nx)+abs(y-ny))//2==(t-n)//2:
        n,nx,ny=t,x,y
    else:
        print("No")
        break

else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

n = int(input())

now = [0,0]
time = 0

flag = True

for i in range(n):
    t,x,y = map(int,input().split())
    if t-time >= (now[0]-x)+(now[1]-y) and (t-time)%2==((now[0]-x)+(now[1]-y))%2:
        now = [x,y]
        time = t
    else:
        flag = False
        break
    
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:

N = int(input())
t = [0]
x = [0]
y = [0]

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

flag = True
for j in range(1,N):
    c = abs(x[j]-x[j-1])+abs(y[j]-y[j-1])
    tm = t[j]-t[j-1]
    if tm-c < 0 or (tm-c) % 2 != 0:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

n = int(input())

now = [0,0]
time = 0

flag = True

for i in range(n):
    t,x,y = map(int,input().split())
    if t-time >= abs((now[0]-x)*(now[1]-y)) and (t-time)%2==((now[0]-x)*(now[1]-y))%2:
        now = [x,y]
        time = t
    else:
        flag = False
        break
    
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
t, x, y = 0, 0, 0
flag = True
for nt, nx, ny in txy:
    dt = nt - t
    dx = nx - x
    dy = ny - y
    if (dt < dx + dy) or ((dx + dy) % 2 != dt % 2):
        flag = False
        break
    else:
        t = nx
        x = nx
        y = ny
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n = int(input())
txy = [list(map(int, input().split())) for _ in range(n)]
t, x, y = 0, 0, 0
flag = True
for nt, nx, ny in txy:
    dt = nt - t
    dx = nx - x
    dy = ny - y
    if (dt < dx + dy) or ((dx + dy) % 2 != dt % 2):
        flag = False
        break
    else:
        t = nx
        x = nx
        y = ny
if flag:
    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==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:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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

ans = 'Yes'
t_cur, x_cur, y_cur = 0, 0, 0
for t, x, y in txy:
    d = abs(x-x_cur) + abs(y-y_cur)
    if t-t_cur >= d and ((t-t_cur)-d)%2 == 0:
        t_cur += t
        x_cur = x
        y_cur = y
    else:
        ans = 'No'
        break
    
print(ans)

Submission status: Wrong Answer

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

N = int(input())

now_txy = [0, 0, 0]

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

for i in range(N):
    next_txy = plan[i]
    diff = (abs(next_txy[1] - now_txy[1]) + abs(next_txy[2] + now_txy[2])) - (next_txy[0] - now_txy[0])
    if (diff <= 0) & (diff % 2 == 0):
        now_txy = next_txy
    else:
        print('No')
        break
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
t = []
x = []
y = []
for i in range(N):
    n = list(map(int, input().split()))
    t.append(n[0])
    x.append(n[1])
    y.append(n[2])
    n.clear()

answer = "YES"

for i in range(N-1):
    if  (t[i+1]-t[i])%2 != (abs(x[i+1]-x[i])+abs(y[i+1]-y[i]))%2:
        answer = "NO"
    if t[i+1]-t[i] < abs(x[i+1]-x[i])+abs(y[i+1]-y[i]):
        answer = "NO"
print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
t = []
x = []
y = []
for i in range(N):
    n = list(map(int, input().split()))
    t.append(n[0])
    x.append(n[1])
    y.append(n[2])
    n.clear()

answer = "YES"

for i in range(N):
    if i == 0:
        if t[i] > x[i]+y[i] and x[i]+y[i]%2 == 0:
            answer = "NO"
        if t[i] < x[i]+y[i]:
            answer = "NO"
    else:
        if t[i]-t[i-1] > abs(x[i]-x[i-1])+abs(y[i]-y[i-1]) and (abs(x[i]-x[i-1])+abs(y[i]-y[i-1]))%2 == 0:
            answer = "NO"
        if t[i]-t[i-1] < abs(x[i]-x[i-1])+abs(y[i]-y[i-1]):
            answer = "NO"
print(answer)

Submission status: Wrong Answer

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

diffs = []  
for i in range(1,n+1,1):
  diff = [ x - y for (x,y) in zip(lists[i], lists[i-1])]
  diffs.append(diff) 
  
for diff in diffs:
  if diff[0] < abs(diff[1]) + abs(diff[2]):
    print('No')
    exit()
  elif diff[0] % 2 != (abs(diff[1]) + abs(diff[2])) % 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 t % 2 == 0:
		if x + y <= t and (x + y) % 2 == 0:
			print('Yes')
		else:
			print('No')
	else:
		if x + y <= t and (x + y) % 2 == 1:
			print('ok')
		else:
			print('no')
	i += 1

Submission status: Wrong Answer

Solution code:
N = int(input())

for i in range(N):
	t, x, y = map(int, input().split())
	if t % 2 == 0:
		if x + y <= t and (x + y) % 2 == 0:
			print('ok')
		else:
			print('no')
	else:
		if x + y <= t and (x + y) % 2 == 1:
			print('ok')
		else:
			print('no')
	i += 1

Submission status: Wrong Answer

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

for _ in range(N):
	t1, x1, y1 = map(int, input().split())
	if abs(x1-x0)+abs(y1-y0) > t1-t0 or (abs(x1-x0)+abs(y1-y0)) % (t1-t0):
		print('No')
		break
else:
	print('Yes')

Submission status: Wrong Answer

Solution code:
(lambda ft: print(ft.reduce(lambda p, c: (lambda t, d: (d > t or d % 2 != t % 2) and [-1, -1, -1] or c)(c[0] - p[0], abs(c[1] - p[1]) + abs(c[2] - p[2])), [list(map(int, input().split())) for _ in range(int(input()))], [0, 0, 0])[0] < 0 and "No" or "Yes"))(__import__("functools"))

Submission status: Wrong Answer

Solution code:
'''input
2
5 1 1
100 1 1
'''
n = input()
arr = []
for i in range(n):
	t,x,y = map(int,raw_input().split())
	arr.append((t,x,y))
arr.sort()
cx,cy = 0,0
ct = 0
flag = False
for i in range(n):
	td = arr[i][0]-ct
	if abs(cx-arr[i][1])+abs(cy-arr[i][1]) > td or (td%2 != (abs(cx-arr[i][1])+abs(cy-arr[i][1]))%2):
		flag = True
		break
	else:
		cx,cy = arr[i][1],arr[i][2]
		ct = arr[i][0]
print "No" if flag else "Yes"

Submission status: Wrong Answer

Solution code:
'''input
2
5 1 1
100 1 1
'''
n = input()
arr = []
for i in range(n):
	t,x,y = map(int,raw_input().split())
	arr.append((t,x,y))
arr.sort()
cx,cy = 0,0
ct = 0
flag = False
for i in range(n):
	td = arr[i][0]-ct
	if abs(cx-arr[i][1])+abs(cy-arr[i][1]) > t or (td%2 != (abs(cx-arr[i][1])+abs(cy-arr[i][1]))%2):
		flag = True
		break
	else:
		cx,cy = arr[i][1],arr[i][2]
		ct = arr[i][0]
print "No" if flag else "Yes"

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
t = [0 for i in range(N)]
x = [0 for i in range(N)]
y = [0 for i in range(N)]

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

for i in range(N-1):
    time = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if (time - dist) >= 0 and (time - dist) % 2 == 0:
        pass
    else:
        print("No")
        sys.exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

N = int(input())
t = [0 for i in range(N)]
x = [0 for i in range(N)]
y = [0 for i in range(N)]

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

for i in range(N-1):
    time = t[i+1] - t[i]
    dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
    if (time - dist) >= 0 and (time - dist) % 2 == 0:
        pass
    else:
        print("No")
        sys.exit()

Submission status: Wrong Answer

Solution code:
N = int(input())
current_t, current_x, current_y = 0, 0, 0
re = 'Yes'
for i in range(N):
    t, x, y = list(map(int, input().split()))
    dist = abs(current_x - x) + abs(current_y - y) # 距離計算
    dist_t = t - current_t
    if dist==0 and dist_t % 2 == 1:
        re = 'No'
    elif dist > dist_t and dist != 0:
        re = 'No'
    current_t , current_x, current_y = t, x, y
        
print(re)

Submission status: Wrong Answer

Solution code:
n = int(input())

feasible = True
x = 0
y = 0
t = 0

for i in range(n):
    cp_t, cp_x, cp_y = map(int, input().split())
    if not feasible:
        continue

    step = abs(x - cp_x) + abs(y - cp_y)
    dt = cp_t - t
    if (dt - step) % 2 != 0:
        feasible = False
    x = cp_x
    y = cp_y
    t = cp_t

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

Submission status: Wrong Answer

Solution code:
print("YES");

Submission status: Wrong Answer

Solution code:
n = int(input())
t = [0 for _ in range(n+1)]
x = [0 for _ in range(n+1)]
y = [0 for _ in range(n+1)]
for i in range(n):
    t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
    if t[i+1] - t[i] < abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]) or (t[i] % 2 == (abs(x[i]) + abs(y[i])) % 2):
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t = [0 for _ in range(n+1)]
x = [0 for _ in range(n+1)]
y = [0 for _ in range(n+1)]
for i in range(n):
    t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
    dt = t[i+1] - t[i]
    dist = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    if not dt > dist and (t[i] % 2 != (abs(x[i]) + abs(y[i])) % 2):
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

Solution code:
def test():
    n = int(input())
    t = [0 for _ in range(n+1)]
    x = [0 for _ in range(n+1)]
    y = [0 for _ in range(n+1)]
    for i in range(n):
        t[i+1], x[i+1], y[i+1] = [int(z) for z in input().split()]
        print(t,x,y)
    dt = [t[i+1] - t[i] for i in range(n)]
    dist = [abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]) for i in range(n)]
    print(dt, dist)
    result = "Yes"

    for i in range(len(t)):
        if not t[i] % 2 == (abs(x[i])+abs(y[i])) % 2:
            result = "No"

    for i in range(len(dt)):
        if dt < dist:
            result = "No"

    print(result)


test()

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = []
for i in range(N):
    p = list(map(int, input().split()))
    plan.append(p)
x = 0
y = 0
t = 0
for p in plan:
    t = p[0] - t
    if (abs(p[1] - x) + abs(p[2] - y)) > t:
        print("No")
        exit()
    if (abs(p[1] - x) + abs(p[2] - y)) % 2 != t % 2:
        print("No")
        exit()
    x = p[1]
    y = p[2]
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
plan = []
for i in range(N):
    p = list(map(int, input().split()))
    plan.append(p)
x = 0
y = 0
t = 0
for p in plan:
    t = p[0] - t
    if abs(p[1] - x) > t or abs(p[2] - y) > t:
        print("No")
        exit()
    if (abs(p[1] - x) + abs(p[2] - y)) % 2 != t % 2:
        print("No")
        exit()
    x = p[1]
    y = p[2]
print("Yes")

Submission status: Wrong Answer

Solution code:
N = int(input())
t=x=y=[0 for i in range(N+1)]
for i in range(N):
    t[i + 1], x[i + 1], y[i + 1] = map(int, input().split())
flag = 1
for i in range(N):
    dl = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
    dt = t[i + 1] - t[i]
    if dl > dt or (dl - dt) % 2 == 1:
        flag = 0
        break
if flag == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
ti=0
xi=0
yi=0
for i in range(n):
    t, x, y = map(int, input().split())
    if abs(x-xi) + abs(y-yi) < abs(t-ti) or (abs(x-xi) + abs(y-yi) + abs(t-ti)) % 2!=0:
        print("No")
        exit()
    ti=t
    xi=x
    yi=y
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
ti=0
xi=0
yi=0
for i in range(n):
    t, x, y = map(int, input().split())
    if abs(x-xi) + abs(y-yi) < abs(t-ti) or abs(x-xi + y-yi + t-ti) % 2!=0:
        print("No")
        exit()
    ti=t
    xi=x
    yi=y
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
ti=0
xi=0
yi=0
for i in range(n):
    t, x, y = map(int, input().split())
    if (x-xi) + (y-yi) < (t-ti) or (x-xi + y-yi + t-ti) % 2!=0:
        print("No")
        exit()
    ti=t
    xi=x
    yi=y
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:


N = int(input())
plans = [[0, 0, 0]]
for i in range(N):
    plans.append([int(ii) for ii in input().split()])

Yes_flag = True
# 移動距離が遠すぎないかのチェック
for i in range(N):
    if (abs(plans[i+1][1] - plans[i][1]) + abs(plans[i+1][2] - plans[i][2])) <= (plans[i+1][0] - plans[i][0]):
        Yes_flag = False
        break
for i in range(1, N+1):
    if plans[i][0] % 2 == 0:
        if (plans[i][1] + plans[i][2]) % 2 != 0:
            Yes_flag = False
            break
    else:
        if (plans[i][1] + plans[i][2]) % 2 == 0:
            Yes_flag = False
            break
if Yes_flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
N=int(input())
flag=True
for _ in range(N):
    t,x,y=map(int,input().split())
    if x+y>t or (t+x+y)%2!=0:
        print("NO")
        quit()
print("YES")

Submission status: Wrong Answer

Solution code:
N=int(input())
flag=True
for i in range(N):
    t,x,y=map(int,input().split())
    if x+y>t or (x+y+t)%2:
        flag=False
if flag==False:
    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:
n = int(input())
for i in range(n):
    t, x, y = map(int, input().split()) # input() when you access each trial
    if x + y < t or (x + y) % 2 != 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()) # input() when you access each trial
    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()) # input() when you access each trial
    if x + y < t or (x + y + t) % 2:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
a = []
for i in range(N):
  t = list(map(int,input().split()))
  a.append(t)
ans = True
for i in range(N):
  if a[i][1] + a[i][2] > a[i][0]:
    ans = False
if ans == True:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
lt = []
lx = []
ly = []
for i in range(n):
    t, x, y = map(int, input().split())
    lt.append(t)
    lx.append(x)
    ly.append(y)
#print(lt)
p = []
for j in range(n):
    if lt[i] == abs(lx[i]) +abs(ly[i]):
        p.append('t')
        #print('TRUE')
    elif lt[i] == abs(lx[i]) +abs(ly[i]):
        r = lt[i] - abs(lx[i]) - abs(ly[i])
        if r % 2 != 0:
            p.append('t')
        else:
            p.append('f')
    else:
        p.append('f')
if 'f' in p:
    print('No')
else:
    print('Yes')
#print(p)

Submission status: Wrong Answer

Solution code:
#UVA1585
t = int(input())

s = [0] * t
for i in range(t):
    a = list(input().split('X'))
    for j in a:
        for k in range(len(j)):
            s[i] += k+1
    print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
t = 0
for i in range(n):
    
    a, b, c = map(int, input().split())
    if abs(b) + abs(c) > a:
        t += 1
if t != 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())
t = 0
for i in range(n):
    
    a, b, c = map(int, input().split())
    if abs(a) + abs(b) > c:
        t += 1
if t != 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())

for i in range(n):
    
    a, b, c = map(int, input().split())
    if abs(a) + abs(b) > c:
        print('No')
        break
    else:
        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) % 2 != t % 2:                                                                         
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
n = int(input())
f = True
for i in range(n):
    t, x, y = map(int, input().split())
    if t < x + y:
        f = False
        break
if f == True:
    print('Yes')
else:
    print('No')

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())
    d_t = t-pre_t
    d_x = abs(x-pre_x)
    d_y = abs(y-pre_y)
    if d_x + d_y < d_t or (d_x + d_y + d_t) % 2:
        print("No")
        quit()
    pre_t,pre_x,pre_y=t, x, y
print("Yes")

Submission status: Wrong Answer

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

for i in range(N-1):
    if (abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2]))<=a[i+1][0]-a[i][0] and (a[i+1][0]-a[i][0])%2==abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])%2:
    	pass
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

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

for i in range(N):
    if (abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2]))<=a[i+1][0]-a[i][0] and (a[i+1][0]-a[i][0])%2==abs(a[i+1][1]-a[i][1])+abs(a[i+1][2]-a[i][2])%2:
    	pass
    else:
        print('No')
        exit()
print('Yes')

Submission status: Wrong Answer

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

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