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:
if __name__ == "__main__":
    n = int(input())
    cur_x = 0
    cur_y = 0
    cur_t = 0
    can_travel = True
    for _ in range(n):
        next_t, next_x, next_y = list(map(int, input().split(" ")))
        time_diff = abs(next_t - cur_t)
        x_diff = abs(next_x - cur_x)
        y_diff = abs(next_y - cur_y)

        print("time_diff:{}, shortest_diff:{}".format(time_diff, (x_diff + y_diff)))
        if time_diff < (x_diff + y_diff):
            can_travel = False
        elif time_diff > (x_diff + y_diff):
            can_travel = ((time_diff - (x_diff + y_diff)) % 2 == 0)

        cur_t, cur_x, cur_y = next_t, next_x, next_y
        if not can_travel:
            break

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

Submission status: Wrong Answer

Solution code:
n=int(input())
t0=0
x0=0
y0=0
for i in range(n):
  t,x,y=[int(i) for i in input().split()]
  if (t-t0-(abs(x-x0)+abs(y-y0)))%2 == 1 and t-t0>=(abs(x-x0)+abs(y-y0)):
    print('No')
    break
  t0,x0,y0=t,x,y
else:
  print('Yes')

Submission status: Wrong Answer

Solution code:
N = int(input())
T, X, Y = ([] for i in range(3))
ans = True
for i in range(N):
  t, x, y = map(int, input().split())
  T.append(t)
  X.append(x)
  Y.append(y)
for i in range(N - 1):
  dt = T[i + 1] - T[i]
  dx = X[i + 1] - X[i]
  dy = Y[i + 1] - Y[i]
  if dt >= abs(dx) + abs(dy) and dt % 2 == (abs(dx) + abs(dy)) % 2:
    continue
  else:
    ans = False
    break
if ans:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    for i in range(N):
        t,x,y = list(map(int,input().split()))
        if ((t%(abs(x)+abs(y)))==0) and ((abs(x)+abs(y))<=t):

            flag = True
        else:
            flag = False
            break
    if flag == True:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    for i in range(N):
        t,x,y = list(map(int,input().split()))
        if ((t%abs(x+y))==0) and (abs(x+y)<=t):

            flag = True
        else:
            flag = False
            break
    if flag == True:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    for i in range(N):
        t,x,y = list(map(int,input().split()))
        if ((t%(x+y))==0) and ((x+y)<=t):
            flag = True
        else:
            flag = False
            break
    if flag == True:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
t = [0 for i in range(N + 1)]
x = [0 for i in range(N + 1)]
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(x[i] - 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:
# -*- coding: utf-8 -*-
import numpy as np
N = input()
t, x, y = [0], [0], [0]
for _ in range(N):
    _t, _x, _y = map(float, raw_input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

txy = np.array([[_t, _x, _y] for _t, _x, _y in zip(t, x, y)], dtype=np.int64)

dm = np.diff(txy, axis=0)
for d in dm:
    total = np.abs(d[1]) + np.abs(d[2])
    if d[0] >= total and (d[0] - total) % 2 == 0:
        print 'Yes'
        exit()

print 'No'

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
N = input()
t, x, y = [0], [0], [0]
for _ in range(N):
    _t, _x, _y = map(int, raw_input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

txy = np.array([[_t, _x, _y] for _t, _x, _y in zip(t, x, y)], dtype=np.int64)

dm = np.diff(txy, axis=0)
for d in dm:
    total = np.abs(d[1]) + np.abs(d[2])
    if d[0] >= total and (d[0] - total) % 2 == 0:
        print 'Yes'
        exit()

print 'No'

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
N = input()
t, x, y = [0], [0], [0]
for _ in range(N):
    _t, _x, _y = map(float, raw_input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

txy = np.array([[_t, _x, _y] for _t, _x, _y in zip(t, x, y)], dtype=np.int64)

dm = np.diff(txy, axis=0)
for d in dm:
    total = np.abs(d[1]) + np.abs(d[2])
    # if d[0] >= total and (d[0] - total) % 2 == 0:
    if d[0] >= total and d[0] % 2 == total % 2:
        print 'Yes'
        exit()

print 'No'

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
N = input()
t, x, y = [0], [0], [0]
for _ in range(N):
    _t, _x, _y = map(float, raw_input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

txy = np.array([[_t, _x, _y] for _t, _x, _y in zip(t, x, y)], dtype=np.int64)

dm = np.diff(txy, axis=0)
for d in dm:
    total = np.abs(d[1]) + np.abs(d[2])
    if d[0] >= total and (d[0] - total) % 2 == 0:
        print 'Yes'
        exit()

print 'No'

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
N = input()
t, x, y = [0], [0], [0]
for _ in range(N):
    _t, _x, _y = map(float, raw_input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

# /w1 = w[0]


txy = np.array([[_t, _x, _y] for _t, _x, _y in zip(t, x, y)], dtype=np.int32)

dm = np.diff(txy, axis=0)
for d in dm:
    total = np.abs(d[1]) + np.abs(d[2])
    if d[0] >= total  and (d[0] - total) % 2 == 0:
        print 'Yes'
        exit()

print 'No'

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
N = input()
t, x, y = [0], [0], [0]
for _ in range(N):
    _t, _x, _y = map(float, raw_input().split())
    t.append(_t)
    x.append(_x)
    y.append(_y)

# /w1 = w[0]


txy = np.array([[_t, _x, _y] for _t, _x, _y in zip(t, x, y)], dtype=np.int32)

dm = np.diff(txy, axis=0)
for d in dm:
    total = np.abs(d[1]) + np.abs(d[2])
    if d[0] > total  and (d[0] - total) % 2 == 0:
        print 'Yes'
        exit()

print 'No'

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
import math
def euclideanDistance(a, b, c, d):
    return math.sqrt((a-b)**2+(c-d)**2)
if __name__ == "__main__":
    N = int(input())
    dic = {}
    queue = [(0,0)]
    time = 0
    maxTime = float('-inf')
    flag = True
    for tmp in range(N):
        t, x, y = map(int, input().split())
        dic[t] = (x, y)
        maxTime = max(maxTime, t)
    timeList = list(dic.keys())
    timeListIndex = 0
    while time < maxTime and flag:
        time += 1
        factor = []
        for tmp in queue:
            x = tmp[0]
            y = tmp[1]
            if time in dic:
                if dic[time] == (x+1,y) or dic[time] == (x-1,y) or dic[time] == (x,y+1) or dic[time] == (x,y-1):
                    factor.append(dic[time])
            else:
                if timeList[timeListIndex] < time:
                    timeListIndex += 1
                nearTime = timeList[timeListIndex]
                coordinate = dic[nearTime]
                num1 = euclideanDistance(x-1, coordinate[0], y, coordinate[1])
                num2 = euclideanDistance(x+1, coordinate[0], y, coordinate[1])
                num3 = euclideanDistance(x, coordinate[0], y-1, coordinate[1])
                num4 = euclideanDistance(x, coordinate[0], y+1, coordinate[1])
                minimumNum = min(min(num1, num2), min(num3, num4))
                if minimumNum == num1:
                    factor.append((x-1,y))
                elif minimumNum == num2:
                    factor.append((x+1,y))
                elif minimumNum == num3:
                    factor.append((x,y-1))
                else:
                    factor.append((x,y+1))
        else:
            factor = list(set(factor))

        if time in dic and len(factor) == 0:
            flag = False

        queue = factor
    else:
        if flag:
            print("Yes")
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding:utf-8 -*-
import math
def euclideanDistance(a, b, c, d):
    return math.sqrt((a-b)**2+(c-d)**2)
if __name__ == "__main__":
    N = int(input())
    dic = {}
    queue = [(0,0)]
    time = 0
    maxTime = float('-inf')
    flag = True
    for tmp in range(N):
        t, x, y = map(int, input().split())
        dic[t] = (x, y)
        maxTime = max(maxTime, t)
    timeList = list(dic.keys())
    timeListIndex = 0
    while time < maxTime and flag:
        time += 1
        factor = []
        for tmp in queue:
            x = tmp[0]
            y = tmp[1]
            if time in dic:
                if dic[time] == (x+1,y) or dic[time] == (x-1,y) or dic[time] == (x,y+1) or dic[time] == (x,y-1):
                    factor.append(dic[time])
            else:
                if timeList[timeListIndex] < time:
                    timeListIndex += 1
                nearTime = timeList[timeListIndex]
                coordinate = dic[nearTime]
                num1 = euclideanDistance(x-1, coordinate[0], y, coordinate[1])
                num2 = euclideanDistance(x+1, coordinate[0], y, coordinate[1])
                num3 = euclideanDistance(x, coordinate[0], y-1, coordinate[1])
                num4 = euclideanDistance(x, coordinate[0], y+1, coordinate[1])
                minimumNum1 = min(num1, num2)
                minimumNum2 = min(num3, num4)
                if minimumNum1 == num1:
                    factor.append((x-1,y))
                else:
                    factor.append((x+1,y))

                if minimumNum2 == num3:
                    factor.append((x,y-1))
                else:
                    factor.append((x,y+1))
        else:
            factor = list(set(factor))

        if time in dic and len(factor) == 0:
            flag = False

        queue = factor
    else:
        if flag:
            print("Yes")
        else:
            print("No")

Submission status: Wrong Answer

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

option = {(0, 0)}


def main():
    global option
    last_list = [0, 0, 0]
    N = int(input())
    for i in range(N):
        this_list = list(map(int, input().split()))
        add_option(this_list[0] - last_list[0], (this_list[1], this_list[2]))
        if (this_list[1], this_list[2]) not in option:
            print('No')
            return
        option = {(this_list[1], this_list[2])}
        last_list = this_list
    print('Yes')


def add_option(step, this_position):
    global option
    for i in range(step):
        temp_option = set()
        for position in option:
            x, y = position
            temp_option.add((x + 1, y))
            temp_option.add((x, y + 1))
            if x > 0:
                temp_option.add((x - 1, y))
            if y > 0:
                temp_option.add((x, y - 1))
            if this_position in temp_option:
                option = temp_option
                return
        option = temp_option


main()

Submission status: Wrong Answer

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

(relative_x, relative_y, relative_t) = (0, 0, 0)
for (t, x, y) in trvl_pts:
    point = x - relative_x + y - relative_y
    t -= relative_t
    if ((point != 0 and t % point == 0) or (point == 0 and t % 2 == 0)):
        relative_x = x
        relative_y = y
        relative_t = t
    else:
        print('No')
        break  
else:
    print('Yes')

Submission status: Wrong Answer

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

(relative_x, relative_y) = (0, 0)
for (t, x, y) in trvl_pts:
    if (t % (x - relative_x + y - relative_y) != 0):
        print('No')
        break
    else:
        relative_x = x
        relative_y = y
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n = int(input())


def get_taxicab_metric(x1, y1, x2, y2):
    a = abs(x1 - x2)
    b = abs(y1 - y2)
    return a + b


t_prev, x_prev, y_prev = 0, 0, 0
is_failed = False

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

    if x == x_prev and y == y_prev:
        is_failed = True
        break

    distance = get_taxicab_metric(x, y, x_prev, y_prev)
    time_distance = t - t_prev

    if distance > time_distance:
        is_failed = True
        break

    t_prev, x_prev, y_prev = t, x, y

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

Submission status: Wrong Answer

Solution code:
abs = lambda x:x if x > 0 else -x

N = int(input())
txt = "Yes"

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

for x in range(N):
  T,X,Y = map(int,input().split())
  d = abs(X-x) + abs(Y-y)
  if not((T - t >= d) and (d - T + t)%2 == 0):
    txt = "No"
    break
  t,x,y = [T,X,Y]
print(txt)

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
a=[]
a=[list(map(int,input().split())) for _ in range(N)]
c=a[0]
if (c[0]-(c[1]+c[2]))%2==0:
    for i in range(1,(N-1)):
        c=np.array(a[i])-np.array(a[i-1])
        if (c[0]-(c[1]+c[2]))%2==0:
            print('Yes')
        else:
            print('No')
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)

flag=0
for i in range(N):
    if i==0:
        if T[i]<X[i]+Y[i] or (X[i]!=0 and Y[i]!=0 and T[i]%(X[i]+Y[i])!=0):
            flag=1
            break
        if (X[i]==Y[i]==0 and T[i]%2!=0) or (((X[i]==1 and Y[i]==0) or (X[i]==0 and Y[i]==1)) and T[i]%2!=1):
            flag=1
            break
    else:
        if T[i]-T[i-1]<(X[i]-X[i-1])+(Y[i]-Y[i-1]) or (X[i]-X[i-1]!=0 and Y[i]-Y[i-1]!=0 and T[i]-T[i-1]%((X[i]-X[i-1])+(Y[i]-Y[i-1]))!=0):
            flag=1
            break
        if (X[i]-X[i-1]==Y[i]-Y[i-1]==0 and T[i]%2!=0) or (((X[i]-X[i-1]==1 and Y[i]-Y[i-1]==0) or (X[i]-X[i-1]==0 and Y[i]-Y[i-1]==1)) and T[i]-T[i-1]%2!=1):
            flag=1
            break

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

Submission status: Wrong Answer

Solution code:
n = int(input())
data = []
for i in range(n):
    data.append(input().split())

x, y = 0, 0
t = 0
ans = "Yes"

for i in data:
    add = (abs(((int(i[2])-y)) + abs(int(i[1])-x)))
    tt = (int(i[0])-t)

    if tt % add == 0 :
        t = int(i[0])
        x,y = int(i[1]), int(i[2])

    else:
        ans = 'No'
        break

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
data = []
for i in range(n):
    data.append(input().split())

x, y = 0, 0
t = 0
ans = "Yes"

for i in data:
    add = (abs(((int(i[2])-y)) + abs(int(i[1])-x)))
    tt = (int(i[0])-t)

    if tt % add == 0 or (add <= tt and add+tt % 2 == 0):
        t = int(i[0])
        x,y = int(i[1]), int(i[2])

    else:
        ans = 'No'
        break

print(ans)

Submission status: Wrong Answer

Solution code:
# from abs import math
n = int(input())
tmpt = 0
tmpx, tmpy = 0, 0
c = 0

def check(t, x, y):
    if t>=x+y and (t%2==0 and (x+y)%2==0) or (t%2==1 and (x+y)%2==1):
        return True
    else:
        return False

for i in range(n):
    t, x, y = map(int, input().split())
    if x==tmpx and y==tmpy:
        break   

    target = t-tmpt
    tmpt = t
    t_x, t_y = abs(x-tmpx), abs(y-tmpy)
    tmpx = x
    tmpy = y
    if check(target, t_x, t_y):
        c+=1
    else:
        break

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

Submission status: Wrong Answer

Solution code:
n = int(input())
data = []
for i in range(n):
    data.append(input().split())

x, y = 0, 0
t = 0
ans = "Yes"

for i in data:
    add = (abs(((int(i[2])-y)) + abs(int(i[1])-x)))
    tt = (int(i[0])-t)

    if tt % add == 0 or (add < tt and add+tt %2 ==0):
        t = int(i[0])
        x,y = int(i[1]), int(i[2])

    else:
        ans = 'No'
        break

print(ans)

Submission status: Wrong Answer

Solution code:
# from abs import math
n = int(input())
tmpt = 0
tmpx, tmpy = 0, 0
c = 0

def check(t, x, y):
    if t>=x+y or (t%2==0 and (x+y)%2==0) or (t%2==1 and (x+y)%2==1):
        return True
    else:
        return False

for i in range(n):
    t, x, y = map(int, input().split())
    if x==tmpx and y==tmpy:
        break   

    target = t-tmpt
    tmpt = t
    t_x, t_y = abs(x-tmpx), abs(y-tmpy)
    tmpx = x
    tmpy = y
    if check(target, t_x, t_y):
        c+=1
    else:
        break

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

Submission status: Wrong Answer

Solution code:
n = int(input())

goals = []

for goal in range(n):
    goals.append(list(map(int,input().split())))

for goal in goals:
    t = goal[0]
    x = goal[1]
    y = goal[2]
    if x + y > t:
        print('No')
        exit(0)
    else:
        print('Yes')
        exit(0)

Submission status: Wrong Answer

Solution code:
N = input()
N = int(N)
t_list = [0]
x_list = [0]
y_list = [0]
for i in range(N):
    txy = input()
    t, x, y = txy.split()
    t = int(t)
    x = int(x)
    y = int(y)
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)



for i in range(1, N+1):
    t = t_list[i] - t_list[i-1]
    x = x_list[i] - x_list[i-1]
    y = y_list[i] - y_list[i-1]
    xy = x+y
    if t%2 == xy%2:
        res = 'Yes'
    elif not t%2 == xy%2:
        res = 'No'
    if t < xy:
        res = 'No'

print(res)

Submission status: Wrong Answer

Solution code:
import sys
arr=[]
for _ in range(int(raw_input())):
	arr.append(map(int,raw_input().split(' ')))
temp_a=[]
for x in range(len(arr)):
	temp_a.append(tuple([arr[x][1]+1,arr[x][2]]))
	temp_a.append(tuple([arr[x][1]-1,arr[x][2]]))
	temp_a.append(tuple([arr[x][1],arr[x][2]+1]))
	temp_a.append(tuple([arr[x][1],arr[x][2]-1]))
ans = False
for x in range(len(arr)):
	if tuple([arr[x][1],arr[x][2]]) in temp_a:
		ans = True
	else:
		print "No"
		sys.exit()
print "Yes"

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())
ans = ""
time = 0
for i in sys.stdin.readlines():
    case = [int(j) for j in i.split()]
    if time + case[0] < case[1] + case[2]:
        ans = 'No'
        break
    elif case[0] % (case[1] + case[2]) != 0:
        ans = 'No'
        break
    else:
        ans = 'Yes'
        time += case[0]
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())

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

for i in range(N):
    t_, x_, y_ = map(int, input().split())
    t.append(t_)
    x.append(x_)
    y.append(y_)

ans = "Yes"
for i in range(N):
    if x[i] + y[i] > t[i]:
        ans = "No"
        break
    if t[i] % 2 == 0 and (x[i] + y[i]) % 2 == 1:
        ans = "No"
        break
    elif t[i] & 2 == 1 and (x[i] + y[i]) % 2 == 0:
        ans = "No"
        break

print(ans)

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)

flag=0
for i in range(N):
    if i ==0:
        if T[i]<X[i]+Y[i] or T[i]%(X[i]+Y[i])!=0 or (T[i]%(X[i]+Y[i])==0 and X[i]==Y[i]):
            flag=1
            break
    elif T[i]-T[i-1]<(X[i]-X[i-1])+(Y[i]-Y[i-1]) or (T[i])%(X[i]+Y[i])!=0 or ((T[i])%(X[i]+Y[i])==0 and (X[i]==X[i-1] and Y[i]==Y[i-1])):
        flag=1
        break



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

Submission status: Wrong Answer

Solution code:
n = int(input())
nums = [[0,0,0]]
ans = False

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

# print(nums)
# print(nums[1][1])

for x in range(n):
    p = nums[x+1][0] - nums[x][0]
    px = nums[x+1][1] - nums[x][1]
    py = nums[x+1][2] - nums[x][2]
    ps = px + py
    # print(p,px,py,ps)

    for w in range(p+1):
        pp = w
        mp = p - pp
        # print(pp,mp)
        if pp-mp==ps:
            ans = True

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

Submission status: Wrong Answer

Solution code:
a = int(raw_input())
curr_x = 0
curr_y = 0
for i in range(a):
    t, x, y = map(int, raw_input().split())
    diff_x = x - curr_x
    diff_y = y - curr_y
    diff_xy = diff_x + diff_y
    result = 0
    if diff_xy > t:
        result += 1
    elif diff_xy == t:
        #print "Yes"
        result += 0
        curr_x = x
        curr_y = y
    elif (t - diff_xy) % 2 == 1:
        #print "Yes"
        result += 0
        curr_x = x
        curr_y = y
    else:
        result += 1

if result == 0:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
import sys

n = int(input())
ans = ""

for i in sys.stdin.readlines():
    case = [int(j) for j in i.split()]
    if case[0] < case[1] + case[2]:
        ans = 'No'
        break
    elif case[0] % (case[1] + case[2]) != 0:
        ans = 'No'
        break
    else:
        ans = 'Yes'
print(ans)

Submission status: Wrong Answer

Solution code:
a = int(raw_input())
curr_x = 0
curr_y = 0
for i in range(a):
    t, x, y = map(int, raw_input().split())
    diff_x = x - curr_x
    diff_y = y - curr_y
    diff_xy = diff_x + diff_y
    if diff_xy > t:
        result = 1
    elif diff_xy == t:
        #print "Yes"
        result = 0
        curr_x = x
        curr_y = y
    elif (t - diff_xy) % 2 == 1:
        #print "Yes"
        result = 0
        curr_x = x
        curr_y = y
    else:
        result = 1

if result == 0:
    print "Yes"
else:
    print "No"

Submission status: Wrong Answer

Solution code:
# from abs import math
n = int(input())
tmpt = 0
tmpx, tmpy = 0, 0
c = 0

def check(t, x, y):
    if t>=x+y and (t%2==0 and (x+y)%2==0) or t%2==1 and (x+y)%2==1:
        return True
    else:
        return False

for i in range(n):
    t, x, y = map(int, input().split())
    if x==tmpx and y==tmpy:
        break   

    target = t-tmpt
    tmpt = t
    t_x, t_y = abs(x-tmpx), abs(y-tmpy)
    tmpx = x
    tmpy = y
    if check(target, t_x, t_y):
        c+=1
    else:
        break

if n==c:
    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)

flag=0
for i in range(N):
    if i ==0:
        if T[i]<X[i]+Y[i] or T[i]%(X[i]+Y[i])!=0:
            flag=1
            break
    elif T[i]-T[i-1]<(X[i]-X[i-1])+(Y[i]-Y[i-1]) or (T[i])%(X[i]+Y[i])!=0:
        flag=1
        break

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

Submission status: Wrong Answer

Solution code:
N=int(input())
x=0
y=0
c=0
j=0
k=0

for i in range(N):
    p=list(map(int,input().split(" ")))
    t=p[0]
    p[0]-=j
    for j in range(1,p[0]+1):
        k+=1
        if x < p[1]:
            x+=1
        elif y < p[2]:
            y+=1
        elif x > p[1]:
            x-=1
        elif y > p[2]:
            y-=1
        else:
            x-=1
        if (k == t) and (x == p[1]) and (y == p[2]):
            c+=1

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

Submission status: Wrong Answer

Solution code:
# from abs import math
n = int(input())
tmpt = 0
tmpx, tmpy = 0, 0
c = 0

def check(t, x, y):
    if t>=x+y and (t%2==0 and (x+y)%2==0) or t%2==1 and (x+y)%2==1:
        return True
    else:
        return False

for i in range(n):
    t, x, y = map(int, input().split())
    target = t-tmpt
    tmpt = t
    t_x, t_y = abs(x-tmpx), abs(y-tmpy)
    if check(target, t_x, t_y):
        c+=1
    else:
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
points_list = [list(map(int,input().split())) for _ in range(N)]
flag = True
for i in range(N):
    if i == 0:
        dis = points_list[i][1] + points_list[i][2]
        if points_list[i][0] % dis == 0:
            p = dis
        else:
            flag = False
            break
    else:
        dis = (points_list[i][1] + points_list[i][2]) - p
        if dis == 0:
            if (points_list[i][0] - points_list[i-1][0]) % 2 == 0:
                p = points_list[i][1] + points_list[i][2]
            else:
                flag = False
                break
        elif (points_list[i][0] - points_list[i-1][0]) % dis == 0:
            p = points_list[i][1] + points_list[i][2]
            if abs(points_list[i][1] - points_list[i-1][1]) <= (points_list[i][0] - points_list[i-1][0]) and abs(points_list[i][2] - points_list[i-1][2]) <= (points_list[i][0] - points_list[i-1][0]):
                continue
            else:
                flag = False
                break
        else:
            flag = False
            break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N = int(input())
points_list = [list(map(int,input().split())) for _ in range(N)]
flag = True
for i in range(N):
    if i == 0:
        dis = points_list[i][1] + points_list[i][2]
        if points_list[i][0] % dis == 0:
            p = dis
        else:
            flag = False
            break
    else:
        dis = (points_list[i][1] + points_list[i][2]) - p
        if dis == 0:
            if (points_list[i][0] - points_list[i-1][0]) % 2 == 0:
                p = points_list[i][1] + points_list[i][2]
            else:
                flag = False
                break
        elif (points_list[i][0] - points_list[i-1][0]) % dis == 0:
            p = points_list[i][1] + points_list[i][2]
            if abs(points_list[i][1] - points_list[i-1][1]) <= (points_list[i][0] - points_list[i-1][0]) and abs(points_list[i][2] - points_list[i-1][2]) <= (points_list[i][0] - points_list[i-1][0]):
                continue
            else:
                print(i)
                flag = False
                break
        else:
            flag = False
            break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n = int(input())
cp = [0,0]
t1 = 0

for i in range(n):
    t,x,y = map(int,input().split())
    l = abs(x-cp[0])+abs(y-cp[1])
    t1 = t -t1
    s = t1 - l
    if s < 0 or s % 2 == 1:
        print('No')
        break
    cp = [x,y]
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
ot, ox, oy = 0, 0, 0
flg = True

for i in range(n):
    t, x, y = map(int, (input().split()))
    t, d = t - ot, abs(x - ox) + abs(y - oy)

    if t < d or (t + d) % 2 != 0:
        flg = False

    ot, ox, oy = t, x, y

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

Submission status: Wrong Answer

Solution code:
# from abs import math
n = int(input())
tmpt = 0
tmpx, tmpy = 0, 0
c = 0

def check(t, x, y):
    if t>=abs(x)+abs(y) and (t%2==0 and (x+y)%2==0) or t%2==1 and (x+y)%2==1:
        return True
    else:
        return False

for i in range(n):
    t, x, y = map(int, input().split())
    target = t-tmpt
    t_x, t_y = abs(x-tmpx), abs(y-tmpy)
    if check(target, t_x, t_y):
        c+=1
    else:
        break

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

Submission status: Wrong Answer

Solution code:
N = int(input())
point = [0, 0]
current = 0
flag = False
for _ in range(N):
    t, x, y = map(int, input().split())
    tmp = abs(point[0]-x)+abs(point[1]-y)
    if tmp % 2 and t-current % 2 == 0:
        flag = True
    elif tmp % 2 == 0 and t-current % 2:
        flag = True
    elif t >= tmp:
        flag = False
    else:
        flag = True
    if flag:
        print("No")
        break
    point = [x, y]
    current = t
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N = input()
list=[]
flg = 0 
for i in range(N):
    list.append(map(int, raw_input().split()))
if N == 1:
	rem = abs(list[0][1]) + abs(list[0][2])
	if rem == 1:
		print("Yes")
	else:
		print("No")
else:
	for i in range(N-1):
		rem = abs(list[i][1]-list[i+1][1]) + abs(list[i][2]-list[i+1][2])
		time = list[i+1][0]-list[i][0]
		if (time-rem) <= 0:
			    flg = 1
		            break
		elif (time-rem) % 2 ==1:
			    flg = 1
		            break
		            
	if flg == 0:
		print("Yes")
	else:
		print("No")

Submission status: Wrong Answer

Solution code:
num = int(input())
n_now = 0
x_now = 0
y_now = 0
Flag = True

n_next, x_next, y_next = [int(i) for i in input().split()]

for i in range(num):
    time = n_next - n_now
    move = abs(x_next - x_now) + abs(y_next - y_now)
    if time < move:
        Flag = False
        break
    elif (time - move) % 2 != 0:
        Flag = False
        break
    else:
        x_now = x_next
        y_now = y_next
        n_now = n_next

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

Submission status: Wrong Answer

Solution code:
N = int(input())
points_list = [list(map(int,input().split())) for _ in range(N)]
flag = True
for i in range(N):
    if i == 0:
        dis = points_list[i][1] + points_list[i][2]
        if points_list[i][0] % dis == 0:
            p = dis
        else:
            flag = False
            break
    else:
        dis = (points_list[i][1] + points_list[i][2]) - p
        if dis == 0:
            if (points_list[i][0] - points_list[i-1][0]) % 2 == 0:
                p = points_list[i][1] + points_list[i][2]
            else:
                flag = False
                break
        elif (points_list[i][0] - points_list[i-1][0]) % dis == 0:
            p = points_list[i][1] + points_list[i][2]
            if points_list[i][1] - points_list[i-1][1] <= dis and points_list[i][2] - points_list[i-1][2] <= dis:
                continue
            else:
                flag = False
                break
        else:
            flag = False
            break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
t = []
x = []
y = []
for i in range(N):
    ti, xi, yi = list(map(int, input().split()))
    t.append(ti)
    x.append(xi)
    y.append(yi)

canBePlanned = 'Yes'
xprev = 0
yprev = 0
tprev = 0
for i in range(N):
    xdiff = abs(x[i] - xprev)
    ydiff = abs(y[i] - yprev)
    tdiff = t[i] - tprev
    if (t[i] - (x[i] + y[i])) % 2 != 0 or tdiff != (xdiff + ydiff):
        canBePlanned = 'No'
        break
    xprev, yprev, tprev = x[i], y[i], t[i]

print(canBePlanned)