Problem:


Score : 300 points

Problem Statement

AtCoDeer the deer is going on a trip in a two-dimensional plane.
In his plan, he will depart from point (0, 0) at time 0, then for each i between 1 and N (inclusive), he will visit point (x_i,y_i) at time t_i.

If AtCoDeer is at point (x, y) at time t, he can be at one of the following points at time t+1: (x+1,y), (x-1,y), (x,y+1) and (x,y-1).
Note that he cannot stay at his place.
Determine whether he can carry out his plan.

Constraints

1 ≤ N ≤ 10^5

0 ≤ x_i ≤ 10^5

0 ≤ y_i ≤ 10^5

1 ≤ t_i ≤ 10^5

t_i < t_{i+1} (1 ≤ i ≤ N-1)

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
t_1 x_1 y_1
t_2 x_2 y_2
:
t_N x_N y_N

Output

If AtCoDeer can carry out his plan, print Yes; if he cannot, print No.

Sample Input 1

2
3 1 2
6 1 1

Sample Output 1

Yes

For example, he can travel as follows: (0,0), (0,1), (1,1), (1,2), (1,1), (1,0), then (1,1).

Sample Input 2

1
2 100 100

Sample Output 2

No

It is impossible to be at (100,100) two seconds after being at (0,0).

Sample Input 3

2
5 1 1
100 1 1

Sample Output 3

No



Sample input:
2
3 1 2
6 1 1


Sample output:
Yes

Submission status: Runtime Error

Solution code:
def canMove(l1: list, l2: list):
    dt = l2[0] - l1[0]
    dr = abs(l1[1] - l2[1]) + abs(l1[2] - l2[2])

    if dr <= dt:
        if dr % 2 != dt % 2:
            print("No")
            exit()
        else:
            return

    else:
        print("No")
        exit()


n = int(input())
travel = [list(map(int, input().split(" "))) for i in range(n)]
travel.insert(0, [0, 0, 0])

for i in range(len(travel)):
    canMove(travel[i], travel[i + 1])

print("Yes")

Submission status: Runtime Error

Solution code:
manhattan = lambda x,y: abs(x[0] - y[0]) + abs(x[1] - y[1])

def solve():
    n = int(input())
    table = [[0, 0, 0]] + list(map(int, input().rstrip("\n").split()) for i in range(n))

    for i in range(1, len(table)):
        t = (table[i][0] - table[i - 1][0] - manhattan(table[i - 1][1:], table[i][1:]))
        if t < 0 or t % 2 != 0:
            return "No"
    return "Yes"

print(solve())

Submission status: Runtime Error

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

t0,x0,y0 = 0,0,0

for i in range(N):
    print(t0,x0,y0," ",t,x,y)
    if t-t0 >= abs(x-x0)+abs(y-y0) and (t-t0)%2 == abs(x-x0+y-y0)%2:
        t0,x0,y0 = t,x,y
        continue
    else:
        print("No")
        sys.exit()

print("Yes")

Submission status: Runtime Error

Solution code:
n = int(input())
a = [input().split() for l in range(n)]
b = 0
t = [0]
x = [0]
y = [0]
for i in range(n):
    t.append(a[i][0])
    x.append(a[i][1])
    y.append(a[i][2])

for k in range(n+1):
    o = int(t[k+1])-int(t[k])
    p = int(x[k+1])-int(x[k])
    q = int(y[k+1])-int(y[k])
    if (o >= p+q) and ((o - (p+q))%2 == 0):
        b += 1
    else:
        b = b

if b == n:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
import sys
lis =list()
lis.append([0, 0, 0])
sys.stdin.readline()
for e in sys.stdin:
  lis.append(list(map(int, input().split())))
for i in range(len(lis) - 1):
  d_t = lis[i + 1][0] - lis[i][0]
  man_dis = abs(lis[i + 1][1] - lis[i][1]) + abs(lis[i + 1][2] - lis[i][2])
  if d_t < man_dis or d_t % 2 - man_dis % 2 != 0:
    print("No")
    sys.exit()
print("Yes")

Submission status: Runtime Error

Solution code:
import sys
lis =list()
lis.append([0, 0, 0])
for e in sys.stdin:
  lis.append(list(map(int, input().split())))
for i in range(len(lis) - 1):
  d_t = lis[i + 1][0] - lis[i][0]
  man_dis = abs(lis[i + 1][1] - lis[i][1]) + abs(lis[i + 1][2] - lis[i][2])
  if d_t < man_dis or d_t % 2 - man_dis % 2 != 0:
    print("No")
    sys.exit()
print("Yes")

Submission status: Runtime Error

Solution code:
import math
import sys
row=int(input())
lis=[list(map(int,input().split())) for i in range(row)]
for i in range(len(lis) - 1):
  d_t = lis[i + 1, 0] - lis[i, 0]
  man_dis = math.abs(lis[i + 1, 1] - lis[i, 1]) + math.abs(lis[i + 1, 2] - lis[i, 2])
  if d_t < man_dis or d_t % 2 - man_dis % 2 != 0:
    print("No")
    sys.exit()
print("Yes")

Submission status: Runtime Error

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

for i in range(N):
    x,y,z = map(int,input().split())
    #t = int(next[0])
    #x = int(next[1])
    #y = int(next[2])
    time = t - t0
    range = abs(x - x0) + abs(y - y0)

    if time < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    t0 = t
    y0 = y
    x0 = x



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

Submission status: Runtime Error

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

for i in range(N):
    x,y,z = map(input().split())
    #t = int(next[0])
    #x = int(next[1])
    #y = int(next[2])
    time = t - t0
    range = abs(x - x0) + abs(y - y0)

    if time < range:
        ans = False
        break

    if time % 2 == 0:
       if range % 2 != 0:
          ans = False
          break
    else:
       if range % 2 == 0 or range == 0:
          ans = False
          break

    t0 = t
    y0 = y
    x0 = x



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

Submission status: Runtime Error

Solution code:
2
3 1 2
5 100 7

Submission status: Runtime Error

Solution code:
n = int(input())
a = [input().split() for l in range(n)]
b = 0
t = [0]
x = [0]
y = [0]
for i in range(n):
    t.append(a[i][0])
    x.append(a[i][1])
    y.append(a[i][2])


for p in range(1,n+1):
    o = int(t[i])-int(t[i-1])
    p = int(x[i])-int(x[i-1])
    q = int(y[i])-int(y[i-1])
    if o >= p+q and (o - (p+q))%2 == 0:
        b += 1

if b == n:
    print('Yes')
else:

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(len(li)):
    if li[i][0] >= li[i][1] + li[i][2]:
        if (li[i][0] - (li[i][1] + li[i][2]))%2 == 0:
        flag = True
    else:
        flag = False
        break
if flag == True:
    print("Yes")
elif flag == False:
    print("No")

Submission status: Runtime Error

Solution code:
_ = int(input())
bef_time = 0
bef_x = 0
bef_y = 0
ans = True

for i in range(_):
    next = input().split()
    next_time = int(next[0])
    next_x = int(next[1])
    next_y = int(next[2])
    time = next_time - bef_time
    range = abs((next_x - bef_x)) + abs(next_y - bef_y))

    if (next_time - bef_time) < range:
        ans = False
        break

    if time % 2 == 0:
       if  range % 2 != 0:
           ans = False
           break
       else:
           if range % 2 == 0:
              ans = False
              break

    bef_time = next_time
    bef_y = next_y
    bef_x = next_x



if ans == True:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
x_state = 0
y_state = 0
for i in range(n):
    t, x, y = map(int, input().split())
    if abs(x + y - x_state - y_state) != 1:
        print("No")
        exit()
    x_state = x.copy()
    y_state = y.copy()
print("Yes")

Submission status: Runtime Error

Solution code:
N=int(input())
txy=[[0,0,0]]
for i in range(0,N):
    tmp=input().split()
    tmp=[int(s) for s in tmp]
    txy.append(tmp)
for i in range(0,N):
    t1=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    t2=txy[i+1][0]-txy[i][0]
    if t1 <= t2 and (t2-t1)%2=0:
    else:
        print('NG')
        break
print('OK')

Submission status: Runtime Error

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: Runtime Error

Solution code:
N_input = int(input())
t_input = []
x_input = []
y_input = []

for _ in range(N_input):
    t, x, y = map(int, input().split())
    t_input.append(t)
    x_input.append(x)
    y_input.append(y)

def can_reach(t_now, n_now, x_now, y_now): # 残り時間で到達可能かチェック
    distance = abs(x_input[n_now] - x_now) + abs(y_input[n_now] - y_now)
    if distance <= t_input[n_now] - t_now and (distance + (t_input[n_now] - t_now))%2 == 0: # 到達可能圏内かつ距離と残り時間の偶奇が一致
        return True
    else:
        return False

def rest_travel(t_now, n_now, x_now, y_now): # 現在時刻t、通過済チェックポイント数n、現在位置x, y
    if t_now == max(t_input): # ゴール
        print("Yes")
        exit()
    elif can_reach(t_now, n_now, x_now, y_now):
        rest_travel(t_input[n_now+1], n_now+1, x_input[n_now+1], y_input[n_now+1])
    else: # 到達不可
        print("No")
        exit()

rest_travel(0,0,0,0)

Submission status: Runtime Error

Solution code:
N_input = int(input())
t_input = []
x_input = []
y_input = []

for _ in range(N_input):
    t, x, y = map(int, input().split())
    t_input.append(t)
    x_input.append(x)
    y_input.append(y)

def can_reach(t_now, n_now, x_now, y_now): # 残り時間で到達可能かチェック
    distance = abs(x_input[n_now] - x_now) + abs(y_input[n_now] - y_now)
    if distance <= t_input[n_now] - t_now and (distance + (t_input[n_now] - t_now))%2 == 0: # 到達可能圏内かつ距離と残り時間の偶奇が一致
        return True
    else:
        return False

def rest_travel(t_now, n_now, x_now, y_now): # 現在時刻t、通過済チェックポイント数n、現在位置x, y
    if t_now == max(t_input): # ゴール
        print("Yes")
        exit()
    elif can_reach(t_now, n_now, x_now, y_now):
        rest_travel(t_input[n_now+1], n_now+1, x_input[n_now+1], y_input[n_now+1])
    else: # 到達不可
        return

rest_travel(0,0,0,0)
print("No")

Submission status: Runtime Error

Solution code:
N_input = int(input())
t_input = []
x_input = []
y_input = []

for _ in range(N_input):
    t, x, y = map(int, input().split())
    t_input.append(t)
    x_input.append(x)
    y_input.append(y)


def can_reach(t_now, n_now, x_now, y_now): # 残り時間で到達不可能な距離でないかチェック
    distance = abs(x_input[n_now] - x_now) + abs(y_input[n_now] - y_now)
    if distance <= t_input[n_now] - t_now and (distance + (t_input[n_now] - t_now))%2 == 0: # 到達可能圏内かつ距離と残り時間の偶奇が一致
        return True
    else:
        return False

def rest_travel(t_now, n_now, x_now, y_now): # 現在時刻t、通過済チェックポイント数n、現在位置x, y
    if t_now == max(t_input): # ゴール
        print("Yes")
        exit()
    elif can_reach(t_now, n_now, x_now, y_now):
        if t_input[n_now] == t_now+1: # 次の移動で目標地点に到着している必要あり
            rest_travel(t_now+1, n_now+1, x_input[n_now], y_input[n_now])
        else: # ゴールしておらず、次の移動で目標地点に到着している必要がない
            rest_travel(t_now+1, n_now, x_now+1, y_now)
            rest_travel(t_now+1, n_now, x_now, y_now+1)
            rest_travel(t_now+1, n_now, x_now-1, y_now)
            rest_travel(t_now+1, n_now, x_now, y_now-1)
    else: # 到達不可
        return

rest_travel(0,0,0,0)
print("No")

Submission status: Runtime Error

Solution code:
N_input = int(input())
t_input = []
x_input = []
y_input = []

for _ in range(N_input):
    t, x, y = map(int, input().split())
    t_input.append(t)
    x_input.append(x)
    y_input.append(y)

def rest_travel(t_now, n_now, x_now, y_now): # 現在時刻t、通過済チェックポイント数n、現在位置x, y
    if t_now == max(t_input): # ゴール
        print("Yes")
        exit()
    elif t_input[n_now] == t_now+1:  # 次の移動で目標地点に到着している必要あり
        if abs(x_input[n_now] - x_now) + abs(y_input[n_now] - y_now) == 1:  # 次の地点との距離が1なら到達可能
            rest_travel(t_now+1, n_now+1, x_input[n_now], y_input[n_now])
        else: # 到達不可。探索終了
            return
    else: # ゴールしておらず、次の移動で目標地点に到着している必要がない
        rest_travel(t_now+1, n_now, x_now+1, y_now)
        rest_travel(t_now+1, n_now, x_now, y_now+1)
        rest_travel(t_now+1, n_now, x_now-1, y_now)
        rest_travel(t_now+1, n_now, x_now, y_now-1)

rest_travel(0,0,0,0)
print("No")

Submission status: Runtime Error

Solution code:
n = input()

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

Submission status: Runtime Error

Solution code:
t, x, y = 0, 0, 0
tn, xn, yn = 0, 0, 0

for i in list_plan:
    tn, xn, yn = int(i[0]) - t, int(i[1]) - x, int(i[2]) - y
    tn, xn, yn = abs(tn), abs(xn), abs(yn)
    if xn + yn < tn and (tn - xn - yn)%2 == 0:
        t, x, y = i[0], i[1], i[2]
    else:
        print("No")
        exit()
        
print("Yes")

Submission status: Runtime Error

Solution code:
import math
import sys

n = int(input())

X = 0
Y = 0
T = 0

for i in range(n):
	t,x,y = map(int, sys.stdin.readline().split())

	d = abs(X-x)+abs(Y-y)
	if ((sum)<(T-t)) and ((d - (T-t)) % 2 == 0):
		X = x
		Y = y
		T = t
	else:
		print('No')

print('Yes')

Submission status: Runtime Error

Solution code:
class AtCoDeer:
    def __init__(self):
        self.pos = {"x": 0, "y": 0}
        self.time = 0

    def move(self, to_x, to_y):
        self.pos = {"x": to_x, "y": to_y}
        return self.pos

    def can_move(self, t, to_x, to_y):
        dx = abs(to_x-self.pos.get("x"))
        dy = abs(to_y-self.pos.get("y"))
        total_move = dx + dy
        dt = t - self.time

        if dt < total_move:
            return False
        elif (dt-total_move) % 2 != 0:
            return False
        else:
            self.move(to_x, to_y)
            self.time = t
            return True


def main():
    n = int(input()) - 1
    at_co_deer = AtCoDeer()

    while(at_co_deer.can_move(*[int(x) for x in input().split()])):
        if n =< 0:
            break
        elif n > 0:
            n -= 1
    
    # 計画破綻判明後のデータ読み捨て
    for i in range(n):
        input()

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

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
for _ in range(n):
  t, dx, dy = list(map(int, input().split()))
  if( (dx + dy) > dt ):
    print("No")
    exit()
  if((dx + dy) % 2 != dt % 2):
    print("No")
    exit()
print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())

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

if n==1:
    if x+y>t or (x+y)%2!=t%2:
        print("No")
    else:
        print("Yes")
    exit()


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

    if dx+dy>dt or (dx+dy)%2!=dt%2:
        print("No")
        exit()


print("Yes")

Submission status: Runtime Error

Solution code:
n=int(input())

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

if n==1 and (x+y>t or (x+y)%2!=t%2):
    print("No")
    exit()

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

    if dx+dy>dt or (dx+dy)%2!=dt%2:
        print("No")
        exit()


print("Yes")

Submission status: Runtime Error

Solution code:
N = int(input())
T=[]
X=[]
Y=[]
for n in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)
def position(t,x,y,n):#
    for m in range(10**4):
        if T[n] - t - 2*m == abs(X[n] - x) + abs(Y[n] - y):
            if n == N-1:
                return 'Yes'
            else:
                return position(T[n],X[n],Y[n],n+1)
        if T[n] - t - 2*m < abs(X[n] - x) + abs(Y[n] - y):
            return 'No'
print(position(0,0,0,0))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def main(N, moves):
  N = int(input())
  moves = [] 
  for i in range(N):
      moves.append([int(j) for j in input().split()]) #与えられた途中地点を代入
  pre_t = 0
  pre_x = 0
  pre_y = 0 #スタート
  for move in moves: #それぞれの途中地点での各座標
    new_t, new_x, new_y = move[0], move[1], move[2]
    delta_t = new_t - pre_t #各途中地点間の時間差
    delta_x = abs(new_x - pre_x)
    delta_y = abs(new_y - pre_y)
    delta_sum = delta_x + delta_y #各途中地点間の経路差
    remain_time = delta_t - delta_sum #時間と経路差
    if remain_time == 0: #時間差=経路差 ⇒ OK
      pre_t, pre_x, pre_y = new_t, new_x, new_y #次のステップ(途中地点)へ
    elif remain_time > 0: #時間差＞経路差の場合：場合分けが必要
      if remain_time % 2 == 0: #残り時間が偶数 ⇒ 行ったり来たりの往復で時間を潰せばOK
        pre_t, pre_x, pre_y = new_t, new_x, new_y #次のステップへ
      else: 
        return "No" #残り時間が奇数 ⇒ ダメ
    else:
      return "No" #時間差＞経路差の場合 ⇒ 何やってもダメ
  return "Yes"

print(*main(*map(int, input().split())))

Submission status: Runtime Error

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

dt = [0] * n
dx = [0] * n
dy = [0] * n

for i in range(n):
    dt[i] = _[i + 1][0] - _[i][0]
    dx[i] = _[i + 1][1] - _[i][1]
    dy[i] = _[i + 1][2] - _[i][2]

ans = "Yes"

for i in range(n):
    man_d = abs(dx[i]) + abs(dy[i])
    if not (dt[i] >= man_d and (dt [i]- man_d) % 2 == 0):
        ans = "No"

print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

plist = [(0,0,0)]
for _ in range(N):
	plist.append(tuple(map(int, input().split())))

judge = True
for i in range(N):
	mae = plist[i]
	usi = plist[i+1]

	time_diff = usi[0] - mae[0]
	road = abs(usi[1] - mae[1]) + abs(usi[2] - mae[2])

	amari = time_diff % road

	if amari % 2 != 0:
		judge =False

print(judge)

Submission status: Runtime Error

Solution code:
N = int(input())

plist = [(0,0,0)]
for _ in range(N):
	plist.append(tuple(map(int, input().suplit())))

judge = True
for i in range(N):
	mae = plist[i]
	usi = plist[i+1]

	time_diff = usi[0] - mae[0]
	road = abs(usi[1] - mae[1]) + abs(usi[2] - mae[2])

	amari = time_diff % road

	if amari % 2 != 0:
		judge =False

print(judge)

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    N = int(input())
    t = [None]*N
    x = [None]*N
    y = [None]*N
    for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())
    flag=True
    # check first step
    if (t[0] - max(x[0], -x[0]) - max(y[0], -y[0])) %2 != 0 or t[0] < max(x[0], -x[0]) + max(y[0], -y[0]):
        print('No')
        flag = False
    
    for i in range(N):
        delta_t = t[i+1] - t[i]
        delta_x = x[i+1] - x[i]
        if delta_x < 0:
            delta_x = -delta_x
        delta_y = y[i+1] - y[i]
        if delta_y < 0:
            delta_y = -delta_y
        delta = delta_x + delta_y
        if (delta_t - delta) % 2 == 0 and delta_t >= delta:
            continue
        else:
            print('No')
            flag = False
            break
    if flag:
        print('Yes')

Submission status: Runtime Error

Solution code:
i=0

flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  #print(afterTxy)
  unk=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
  unk2=afterTxy[0]-beforeTxy[0]-abs(afterTxy[1]-beforeTxy[1])

  if unk>=0 and unk%2!=0 and unk2%2!=0:
    flag=1
  beforeTxy=afterTxy
  i=i+1

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

Submission status: Runtime Error

Solution code:
N=int(input())
dst = [[0, 0, 0]]
for i in range(N):
    dst.append(input().split())
    
flag = True

for i in range(1, N+1):
    time_diff = int(dst[i][0])-int(dst[i-1][0])
    dst_diff = int(dst[i][1])-int(dst[i-1][1])+int(dst[i][2])-int(dst[i-1][2])
    if (time_diff>=dst_diff and time_diff%2 == dst_diff%2):
        continue
    else:
        flg = False
        break

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

Submission status: Runtime Error

Solution code:
n = int(iput())
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: Runtime Error

Solution code:
n = int(input())
t = []
x = []
y = []
ans = "Yes"
tmpx = 0
tmpy = 0
for i in range(n):
    v1,v2,v3 = map(int,input().split())
    t.append(v1)
    x.append(v2)
    y.append(v3)
for i in range(n):
    if abs(tmpx-x[i]) + abs(tmpy-y[i]) <= t[i]:
        tmpx = x[i]
        tmpy = y[i]
        continue
    else:
        flg = "No"
        break
print(flg)

Submission status: Runtime Error

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

ans = "Yes"
for n in range(N):
    dt = t[n+1] - t[n]
    dist = abs(x[n+1] - x[n]) + abs(y[n+1] - y[n])
    if (dt < dist) or ((dt - dist) % 2 == 1):
        ans = "No"

print(ans)

Submission status: Runtime Error

Solution code:
/// ローカル環境なら _in.txt から入力を受ける
fn read_input() -> String {
    use std::fs::File;
    use std::io::Read;
    let mut s = String::new();
    match option_env!("LOCAL") {
        Some(_) => File::open("src/_in.txt")
            .expect("File not found")
            .read_to_string(&mut s)
            .unwrap(),
        None => std::io::stdin().read_to_string(&mut s).unwrap(),
    };
    s
}

fn main() {
    let s = read_input();
    let mut ws = s.split_whitespace();
    let in_n: i32 = ws.next().unwrap().parse().unwrap();
    let mut txy: Vec<(i32, i32, i32)> = (0..in_n)
        .map(|_| {
            let t: i32 = ws.next().unwrap().parse().unwrap();
            let x: i32 = ws.next().unwrap().parse().unwrap();
            let y: i32 = ws.next().unwrap().parse().unwrap();
            (t, x, y)
        })
        .collect();
    txy.insert(0, (0, 0, 0));

    let mut ok = true;
    for window in txy.windows(2) {
        let ((t1, x1, y1), (t2, x2, y2)) = (window[0], window[1]);
        let dt = t2 - t1;
        let d = (x1 - x2).abs() + (y1 - y2).abs();
        ok &= dt >= d && (dt - d) % 2 == 0
    }
    println!("{}", if ok { "Yes" } else { "No" });
}

Submission status: Runtime Error

Solution code:
N = int(input())
t_old, x_old, y_old = 0, 0, 0

for i in range(N):
  t, x, y = map(int, input().split())
  dt = t - t_old
  dx = x - x_old
  dy = y - y_old
  t_old = t
  x_old = x
  y_old = y
  if abs(dx) + abs(dy) =< dt and (dt - (abs(dx) + abs(dy))) % 2 == 0:
    if i == N - 1:
      print('Yes')
    pass
  else:
    print('No')
    break

Submission status: Runtime Error

Solution code:
N = int(input())
t_old, x_old, y_old = 0

for i in range(N):
  t, x, y = map(int, input().split())
  dt = t - t_old
  dx = x - x_old
  dy = y - y_old
  t_old = t
  x_old = x
  y_old = y
  if abs(dx) + abs(dy) =< dt and (dt - (abs(dx) + abs(dy))) % 2 == 0:
    if i == N - 1:
      print('Yes')
  else:
    print('No')
    break

Submission status: Runtime Error

Solution code:
n = int(input())
txy = [list(map(int, input().split())) for x in range(n)]
flag = True
for i in range(n):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1] + txy[i + 1][2] - txy[i][2])
    if dt < dist:
        flag = False
        break
    elif dist % 2 != dt % 2:
        flag = False
        break
if flag:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
import sys
n = int(input())
past_t = past_x = past_y = 0
i = 0
while(i <= n-1):
    t, x, y = map(int,input().split())
    i += 1 
for j in range(n):
    if t - past_t < x + y or ((t-past_t)-(x+y)) % 2 != 0:
        sys.exit('No')
print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())
table = [[int(t) for i in input().split()] for n in range(N)]
can = True
for i in range(N):
    if(i != 0):
        dt = table[i][0] - table[i-1][0]
        dist = abs(table[i][1]-table[i-1][1]) +abs(table[i][2]-table[i-1][2])
    else:
        dt = table[i][0]
        dist = abs(table[0][1]) + abs(table[0][2])
    if(dist > dt):
        can = False
        break
    elif((dt-dist)%2 != 0):
        can = False
        break
if(can == True):
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
n = input()
n = int(n)

points = []
points.append(("0", "0", "0"))
for i in range(n):
  points.append(input().split())

for i in range(len(points)-1):
  dt = int(points[i+1][0]) - int(points[i][0])
  dx = inat(points[i+1][1]) - int(points[i][1])
  dy = int(points[i+1][2]) - int(points[i][2])
  
  if dt < abs(dx)+abs(dy):
    print("No")
    exit()
  elif (dt - ( abs(dx)+abs(dy) ) ) % 2 == 1:
    print("No")
    exit()

print("Yes")

Submission status: Runtime Error

Solution code:
# 少ないやつを変えたほうが少なくてすむので嬉しい
n, k = map(int, input().split())
arr = list(map(int, input().split()))
hash = dict()
for ai in arr:
    if ai in hash:
        hash[ai] += 1
    else:
        hash[ai] = 1
hash = list(sorted(hash.items(), key=lambda x: x[1]))
ans = 0
for i in range(len(hash) - k):
    ans += hash[i][1]
print(ans)

Submission status: Runtime Error

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

for i in range(N):
    dxdy = coo[i+1][0] - coo[i][0] + coo[i+1][1] - coo[i][1]
    if dxdy <= t[i+1] - t[i]:
        pass
    else:
        print('No')
        exit()
print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())
# t, x, y = 0, 0, 0
for __ 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: Runtime Error

Solution code:
    N = int(input())
    # t, x, y = 0, 0, 0
    for __ 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: Runtime Error

Solution code:
N = int(input())
t, x, y = 0, 0, 0

for _ in range(N):
    next_t, next_x, next_y = [int(__) for __ in input().split()]

    delta_t = next_t - t
    distance = abs(next_x - x) + abs(next_y - y)

    if distance > delta_t:
        print("No")
        sys.exit()

    if (delta_t - distance) % 2 != 0:
        print("No")
        sys.exit()

    t, x, y = next_t, next_x, next_y

print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
s = [[0,0,0]]*(N+1)
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
for i in range(1,N+1):
  s[i] = input().split()
  t[i] = int(s[i][0])
  x[i] = int(s[i][1])
  y[i] = int(s[i][2])
k = 0
for i in range(N):
  T = t[i+1]-t[i]
  p = 0
  if T%2 == 0:
    for u in range((T/2)+1):
      for l in range(-2*u,2*u+1):
        if x[i]+l == x[i+1] and y[i]+2*u - max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        elif x[i]+l == x[i+1] and y[i]-2*u + max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        else:
          p = p + 1
      if (x[i]+w == x[i+1] and y[i]+2*u - max(w,-w) == y[i+1]) or (x[i]+w == x[i+1] and y[i]-2*u + max(w,-w) == y[i+1]):
        break
    if p == ((T/2)+1)(T+1):
      print('No')
      break
  
  else:
    for u in range(int((T+1)/2)):
      for l in range(-2*u-1,2*u+2):
        if x[i]+l == x[i+1] and y[i]+2*u+1 - max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        elif x[i]+l == x[i+1] and y[i]-2*u-1 + max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        else:
          w = 10000000000
          p = p + 1
      if (x[i]+w == x[i+1] and y[i]+2*u+1 - max(w,-w) == y[i+1]) or (x[i]+w == x[i+1] and y[i]-2*u-1 + max(w,-w) == y[i+1]):
        break
    if p == ((T**2)+(3*T)+2)/2:
      print('No')
      break
    
if k == N:
  print('Yes')

Submission status: Runtime Error

Solution code:
N = int(input())
s = [[0,0,0]]*(N+1)
t = [0]*(N+1)
x = [0]*(N+1)
y = [0]*(N+1)
for i in range(1,N+1):
  s[i] = input().split()
  t[i] = int(s[i][0])
  x[i] = int(s[i][1])
  y[i] = int(s[i][2])
k = 0
for i in range(N):
  T = t[i+1]-t[i]
  p = 0
  if T%2 == 0:
    for u in range((T/2)+1):
      for l in range(-2*u,2*u+1):
        if x[i]+l == x[i+1] and y[i]+2*u - max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        elif x[i]+l == x[i+1] and y[i]-2*u + max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        else:
          p = p + 1
      if (x[i]+w == x[i+1] and y[i]+2*u - max(w,-w) == y[i+1]) or (x[i]+w == x[i+1] and y[i]-2*u + max(w,-w) == y[i+1]):
        break
    if p == ((T/2)+1)(T+1):
      print('No')
      break
  
  else:
    for u in range(int((T+1)/2)):
      for l in range(-2*u-1,2*u+2):
        if x[i]+l == x[i+1] and y[i]+2*u+1 - max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        elif x[i]+l == x[i+1] and y[i]-2*u-1 + max(l,-l) == y[i+1]:
          w = l
          k = k + 1
          break
        else:
          w = float('inf')
          p = p + 1
      if (x[i]+w == x[i+1] and y[i]+2*u+1 - max(w,-w) == y[i+1]) or (x[i]+w == x[i+1] and y[i]-2*u-1 + max(w,-w) == y[i+1]):
        break
    if p == ((T**2)+(3*T)+2)/2:
      print('No')
      break
    
if k == N:
  print('Yes')

Submission status: Runtime Error

Solution code:
N=input()
t,x,y=0,0,0
s=0
for i in range(N):
  a,b,c=map(int,input().split())
  if a-t!=abs(b-x)+abs(c-y):
    s=1
    break
  t,x,y=a,b,c
print("No" if s else "Yes")