ZhenlongDai/ACPR huggingface dataset:
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
 
for i in range(n):
    t, x, y = map(int, input().split())
    if t < x + y or (x + y + t) % 2 != 0:
        print('No')
        break
print('Yes')


Failing test case input:
2
-2 4 8
101 4 2

Expected output:
No


Actual output:
No
Yes


Fixed submission (verdict: Accepted):
n = int(input())
 
for i in range(n):
    t, x, y = map(int, input().split())
    if t < x + y or (x + y + t) % 2 != 0:
        print('No')
        exit()
print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
pre_t=0
pre_x=0
pre_y=0
flg=0
for i in range(N-1):
    t,x,y=map(int,input().split())
    t_tmp = t
    t=t-pre_t
    dist=abs(x-pre_x) + abs(y - pre_y)
    pre_t=t_tmp
    pre_x=x
    pre_y=y
    if(dist >= t ):
        flg=1
        break
    if((dist)%2 != t%2):
        flg=1
        break
if(flg == 0):
    print("Yes")
else:
    print("No")    

Failing test case input:
1
4 011 000

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N=int(input())
pre_t=0
pre_x=0
pre_y=0
flg="Yes"
for i in range(N):
    t,x,y=map(int,input().split())
    dt=t-pre_t
    dist=abs(x-pre_x) + abs(y-pre_y)
    pre_t=t
    pre_x=x
    pre_y=y
    if(dist > dt ):
        flg="No"
        break
    if((dist)%2 != dt%2):
        flg="No"
        break
print(flg)

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n = int(input())
t, x, y = [0], [0], [0]
for i in range(n):
  t_i, x_i, y_i = map(int, input().strip().split())
  t.append(t_i)
  x.append(x_i)
  y.append(y_i)
  
can = "YES"
for i in range(n):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  can = "NO" if dt < dist else "YES"
  can = "NO" if dist % 2 != dt % 2 else "YES"
print(can)

Failing test case input:
1
1 100 110

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):


n = int(input())
t, x, y = [0], [0], [0]
for i in range(n):
  t_i, x_i, y_i = map(int, input().strip().split())
  t.append(t_i)
  x.append(x_i)
  y.append(y_i)

  
can = "Yes"
for i in range(n):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if (dt < dist):
    can = "No"
  if(dist % 2 != dt % 2):
    can = "No"
print(can)
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
txy = []
for i in range(N):
    txy.append(list(map(int,input().split())))
ans = "YES"
t = 0
x = 0
y = 0
for i in range(N):
    deft = txy[i][0] - t
    defx = abs(txy[i][1] - x)
    defy = abs(txy[i][2] - y)
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    if (defx + defy) > deft:
        ans = "NO"
        break
    elif (deft - defx - defy)%2 != 0:
        ans = "NO"
        break
print(ans)

Failing test case input:
1
4 001 100

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
N = int(input())
txy = []
for i in range(N):
    txy.append(list(map(int,input().split())))
ans = "Yes"
t = 0
x = 0
y = 0
for i in range(N):
    deft = txy[i][0] - t
    defx = abs(txy[i][1] - x)
    defy = abs(txy[i][2] - y)
    t = txy[i][0]
    x = txy[i][1]
    y = txy[i][2]
    if (defx + defy) > deft:
        ans = "No"
        break
    elif (deft - defx - defy)%2 != 0:
        ans = "No"
        break
print(ans)

Problem: p03457
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
N = int(input())
T = []
for _ in range(N):
	T.append(list(map(int,input().split())))


now = [0,0]
now_time = 0
for i in range(N):
  left_time = T[i][0] - now_time
  target = [T[i][1],T[i][2]]
  distance = abs(T[i][1]-now[0]) + abs(T[i][2]-now[1])
  if distance <= left_time and distance % 2 == left_time % 2:
    now_time = T[i][0]
    now = target
    
  else:
    print("NO")
    sys.exit()

print("YES")


Failing test case input:
1
5 110 111

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
import sys
N = int(input())
T = []
for _ in range(N):
	T.append(list(map(int,input().split())))


now = [0,0]
now_time = 0
for i in range(N):
  left_time = T[i][0] - now_time
  target = [T[i][1],T[i][2]]
  distance = abs(T[i][1]-now[0]) + abs(T[i][2]-now[1])
  if distance <= left_time and distance % 2 == left_time % 2:
    now_time = T[i][0]
    now = target
    
  else:
    print("No")
    sys.exit()

print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
lst = [list(map(int, input().split())) for _ in range(n)]

ans = 'No'

for line in lst:
    t, x, y = line
    if t < x + y:
        break
    if t % 2 == 0 and x + y % 2 != 0:
        break
    if t % 2 != 0 and x + y % 2 == 0:
        break

    ans = 'Yes'

print(ans)

Failing test case input:
2
3 2 1
111 1 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
lst = [list(map(int, input().split())) for _ in range(n)]

ans = 'Yes'

for line in lst:
    t, x, y = line
    c1 = t < x + y
    c2 = t % 2 == 0 and (x + y) % 2 != 0
    c3 = t % 2 != 0 and (x + y) % 2 == 0
    
    if c1 or c2 or c3:
        ans = 'No'
        break

print(ans)
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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")

Failing test case input:
2
5 2 1
000 1 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys

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

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")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

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

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



ox = 0 
oy = 0
ot =0

for i in range(N):
    dt=t[i] - ot 

    d = abs(x[i] - ox) + abs(y[i] - oy)
    if d > abs(dt):
        print('No')
        exit()

    if d%2!= dt%2:
        print('No')
        exit()

    ox=x[i]
    oy=y[i]
    ot=t[i]

print('OK')

Failing test case input:
2
5 2 1
111 1 0

Expected output:
Yes


Actual output:
OK


Fixed submission (verdict: Accepted):

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

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



ox = 0 
oy = 0
ot =0

for i in range(N):
    dt=t[i] - ot 

    d = abs(ox - x[i]) + abs(oy - y[i])
    if dt - d < 0:
        print('No')
        exit()

    if (dt-d)%2 > 0:
        print('No')
        exit()

    ox=x[i]
    oy=y[i]
    ot=t[i]

print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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")

Failing test case input:
1
0 010 011

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
T, X, Y = ([] for i in range(3))
ans = True
T.append(0)
X.append(0)
Y.append(0)
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):
  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")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import sys

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

for i in range(N - 1):
	d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
	dt = t[i + 1] - t[i]
	if dt < d or dt % 2 != d % 2:
		print("No")
		sys.exit()
	
print("Yes")

Failing test case input:
1
3 110 111

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):


import sys

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

for i in range(N):
	d = abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])
	dt = t[i + 1] - t[i]
	if dt < d or dt % 2 != d % 2:
		print("No")
		sys.exit()
	
print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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])




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
    

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

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


Failing test case input:
2
3 2 1
111 1 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
nums = [[0,0,0]]
ans = []

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




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
    

    for w in range(p+1):
        pp = w
        mp = p - pp
        
        if pp-mp==ps:
            ans.append(1)
        else:
            ans.append(0)

    
sum = 0 
for num in ans:
    sum = sum + num


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

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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")

Failing test case input:
1
1 111 110

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
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")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

f = True
for i in range(n):
  t,x,y = map(int,input().split())
  et = t
  exy = x+y
  et-=exy
  
  if(et>=0):
    if(et%2==0):
      continue
    else:
      f = False
      break
  else:
    f = False
    break

if (f):
  print('YES')
else:
  print('NO')

Failing test case input:
1
3 100 001

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
n = int(input())
 
f = True
for i in range(n):
  t,x,y = map(int,input().split())
  et = t
  exy = x+y
  et-=exy
  
  if(et>=0):
    if(et%2==0):
      continue
    else:
      f = False
      break
  else:
    f = False
    break
 
if (f):
  print('Yes')
else:
  print('No')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
list_A = [ list(map(int,input().split(" "))) for i in range(n)]
list_A.insert(0, [0, 0, 0])
ans = "Yes"
for i in range(1, n+1):
    l = list_A[i]
    k = list_A[i-1]
    distance = abs(l[1]-k[1]) + abs(l[2]-k[2])
    if distance > l[0] - k[0]:
        ans = "No"
        break
    else:
        if distance - (l[0]-k[0]) % 2 == 1:
            ans = "No"

print(ans)

Failing test case input:
2
5 2 3
100 1 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
list_A = [ list(map(int,input().split(" "))) for i in range(n)]
list_A.insert(0, [0, 0, 0])
ans = "Yes"
for i in range(1, n+1):
    l = list_A[i]
    k = list_A[i-1]
    distance = abs(l[1]-k[1]) + abs(l[2]-k[2])
    if distance > l[0] - k[0]:
        ans = "No"
        break
    else:
        if (distance - (l[0]-k[0])) % 2 == 1:
            ans = "No"

print(ans)

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
num_list=int(input())
a=[1,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  print("i=",i,"a=",a,"b=",b)
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and d != 0 and dt%2==d%2:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break

Failing test case input:
2
-2 4 8
111 4 0

Expected output:
No


Actual output:
i= 0 a= [1, 0, 0] b= [-2, 4, 8]
No


Fixed submission (verdict: Accepted):
num_list=int(input())
a=[0,0,0]
for i in range(num_list):
  b=[int(x) for x in input().split()]
  dt=(b[0]-a[0])
  d=(abs(b[1]-a[1])+abs(b[2]-a[2]))
  if d<=dt and dt%2==d%2:
    if i == num_list-1:
      print("Yes")
      break
    a=b
  else:
    print("No")
    break
Problem: p03457
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('NO')
        exit()
    elif (x2-x1 + y2-y1)%2 == (t2-t1)%2:
        continue
    else:
        print('NO')
        exit()

print('YES')


Failing test case input:
2
5 1 1
100 1 0

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
t1 = x1 = y1 = 0

num = int(input())

for i in range(num):
    t2,x2,y2 = map(int, input().split())

    if (x2-x1 + y2-y1) > (t2-t1):
        print('No')
        exit()
    elif ((t2-t1)-(x2-x1 + y2-y1) ) % 2 == 0:
        t1=t2
        x1=x2
        y1=y2
    else:
        print('No')
        exit()

print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


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)
    
    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')

Failing test case input:
2
3 2 1
011 1 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):


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)
    
    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

print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
List = [list(map(int, input().split())) for _ in range(N)]
Sorted = sorted(List)
Sorted.insert(0, [0, 0, 0])

for i in range(N):
  if abs(Sorted[i+1][1] - Sorted[i][1]) + abs(Sorted[i+1][2] - Sorted[i][2]) > Sorted[i+1][0] - Sorted[i][0]:
    print("No")
    break
else:
  print("Yes")

Failing test case input:
2
3 1 2
6 0 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
Sorted = [list(map(int, input().split())) for _ in range(N)]
Sorted.insert(0, [0, 0, 0])

for i in range(N):
  d = abs(Sorted[i+1][1] - Sorted[i][1]) + abs(Sorted[i+1][2] - Sorted[i][2])
  t = Sorted[i+1][0] - Sorted[i][0]
  if  d > t or d % 2 != t % 2:
    print("No")
    break
else:
  print("Yes")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
prev_t = 0
prev_x = 0
prev_y = 0

n = int(input())
ans = True
for _ in range(n):
    t, x, y = map(int, input().split())
    dist = (x - prev_x) + (y - prev_y)
    time = t - prev_t
    if dist <= time and dist % 2 == time % 2:
        ans = False
        break

    prev_x = x
    prev_y = y
    prev_t = t

if not ans:
    print('No')
else:
    print('Yes')

Failing test case input:
2
2 1 1
101 2 1

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
prev_t = 0
prev_x = 0
prev_y = 0

n = int(input())
ans = True
for _ in range(n):
    t, x, y = map(int, input().split())
    dist = (x - prev_x) + (y - prev_y)
    time = t - prev_t
    if dist > time or dist % 2 != time % 2:
        ans = False
        break

    prev_x = x
    prev_y = y
    prev_t = t

if not ans:
    print('No')
else:
    print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
N = int(input())
txy2 = [list(map(int,input().split())) for _ in range(N)]
txy = [[0,0,0]]
for i in range(N):
    txy.append(txy2[i])
for i in range(N):
    if abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2]) > txy[i+1][0]-txy[i][0]:
        print("No")
        sys.exit()
print("Yes")

Failing test case input:
2
2 1 1
100 2 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
import sys
N = int(input())
txy2 = [list(map(int,input().split())) for _ in range(N)]
txy = [[0,0,0]]
for i in range(N):
    txy.append(txy2[i])
for i in range(N):
    if abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2]) > txy[i+1][0]-txy[i][0]:
        print("No")
        sys.exit()
    elif ((txy[i+1][0]-txy[i][0]) - (abs(txy[i+1][1]-txy[i][1])+abs(txy[i+1][2]-txy[i][2])))%2 != 0:
        print("No")
        sys.exit()
print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if x + y < t or (x + y + t) % 2 == 1:
        print("No")
        exit()
print("Yes")


Failing test case input:
1
3 100 001

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
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")
Problem: p03457
Buggy submission (Python (3.8.2), verdict: Wrong Answer):

import math

lastT, lastX, lastY = 0, 0, 0
flag = True

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

    

    if ( t - lastT < math.fabs(x - lastX) + math.fabs(y - lastY)
        or ( (t - lastT) - math.fabs(x - lastX) - math.fabs(y - lastY) ) % 2 == 1 ):
        flag = False

    lastT = t
    lastX = x
    lastY = y

print(flag)


Failing test case input:
1
0 011 001

Expected output:
No


Actual output:
False


Fixed submission (verdict: Accepted):

import math

lastT, lastX, lastY = 0, 0, 0
flag = "Yes"

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

    

    if ( t - lastT < math.fabs(x - lastX) + math.fabs(y - lastY)
        or ( (t - lastT) - math.fabs(x - lastX) - math.fabs(y - lastY) ) % 2 == 1 ):
        flag = "No"

    lastT = t
    lastX = x
    lastY = y

print(flag)

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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):
    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
    else:
        b = b

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

Failing test case input:
2
5 2 3
100 0 0

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
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):
    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')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

bt, bx, by = 0, 0, 0
flg = True

for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time<dist and time%2!=dist%2:
        flg = False
        break
    else:
        bt, bx, xy = t, x, y

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

Failing test case input:
2
6 2 1
011 1 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())

bt, bx, by = 0, 0, 0

for _ in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time<dist or time%2!=dist%2:
        print('No')
        break
    bt, bx, by = t, x, y
else:
    print('Yes')
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

bt, bx, by = 0, 0, 0
flg = True
for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    if t<bt:
        flg = False
        break
    time = t-bt
    if time>=dist and (time-dist)%2==0:
        bt, bx, xy = t, x, y
    else:
        flg = False
        break

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

Failing test case input:
2
3 2 1
011 1 1

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())

bt, bx, by = 0, 0, 0

for _ in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x-bx)+abs(y-by)
    time = t-bt
    if time<dist or time%2!=dist%2:
        print('No')
        break
    bt, bx, by = t, x, y
else:
    print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
i=0
 
flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  
  
  
  dt=afterTxy[0]-beforeTxy[0]
  dist=abs(afterTxy[1]-beforeTxy[1])-abs(afterTxy[2]-beforeTxy[2])
 
  if dt>=dist and dt%2==dist%2:
    flag=1
  beforeTxy=afterTxy
  i=i+1

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

Failing test case input:
1
0 010 000

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N=int(input())
i=0
 
flag=0
beforeTxy=[0,0,0]
while i<N:
  afterTxy=list(map(int,input().split()))
  
  
  
  dt=afterTxy[0]-beforeTxy[0]
  dist=abs(afterTxy[1]-beforeTxy[1])+abs(afterTxy[2]-beforeTxy[2])
  
  if dt < dist or dt%2!=dist%2:
    flag=1
  beforeTxy=afterTxy
  i=i+1
 
if flag==0:
  print("Yes")
else:
  print("No")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

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

Failing test case input:
2
-2 4 4
101 4 2

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())

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

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
for _ 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")


Failing test case input:
1
3 110 001

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
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")
Problem: p03457
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())

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

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

print("Yes")


Failing test case input:
2
5 2 3
100 1 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())

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

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

print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

ans = 0
for q in range(n):
    limit, x, y = map(int, input().split())
    if (limit < x + y) or (limit - x - y) % 2 != 0:
        ans += 1


print("NO" if ans else "YES")



Failing test case input:
1
0 110 001

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
from sys import exit

n = int(input())

ans = 0
for q in range(n):
    limit, x, y = map(int, input().split())
    if (limit < x + y) or (limit - x - y) % 2:
        print("No")
        exit(0)


print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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]=list(map(int,input().split(" ")))
t.insert(0,0)
x.insert(0,0)
y.insert(0,0)
for i in range(n-1):
    abx=abs(x[i]-x[i+1])
    aby=abs(y[i]-y[i+1])
    if abx+aby>t[i+1]-t[i] or (abs(x[i+1])+abs(y[i+1]))%2!=t[i+1]%2:
        print("No")
        exit(0)
print("Yes")

Failing test case input:
1
1 110 000

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
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]=list(map(int,input().split(" ")))
t.insert(0,0)
x.insert(0,0)
y.insert(0,0)
for i in range(n):
    abx=abs(x[i]-x[i+1])
    aby=abs(y[i]-y[i+1])
    if abx+aby>t[i+1]-t[i] or (abs(x[i+1])+abs(y[i+1]))%2!=t[i+1]%2:
        print("No")
        exit(0)
print("Yes")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(N):
  t[i+1], x[i+1], y[i+1] = map(int, input().split())
is_able = True
 
for i in range(N):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if dt < dist:
    is_able = False
  if dt % 2 != dist % 2:
    is_able = False
  
if is_able:
  print("YES")
else:
  print("NO")

Failing test case input:
2
5 2 4
000 1 0

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
N = int(input())
t = [0] * (N+1)
x = [0] * (N+1)
y = [0] * (N+1)
for i in range(N):
  t[i+1], x[i+1], y[i+1] = map(int, input().split())
is_able = True
 
for i in range(N):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if dt < dist:
    is_able = False
  if dt % 2 != dist % 2:
    is_able = False
  
if is_able:
  print("Yes")
else:
  print("No")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
txy = [[0,0,0]]
for i in range(N):
    txy.append(list(map(int,input().split())))

for i in range(1,N+1):
    if abs(txy[i][1] - txy[i-1][1]) + abs(txy[i][2] - txy[i-1][2]) > abs(txy[i][0] - txy[i-1][0]):
        print("No")
        exit()
    elif txy[i][1] == txy[i-1][1] and txy[i][2] == txy[i-1][2]:
        if (txy[i][0] - txy[i-1][0]) % 2 != 0:
            print("No")
            exit()
print("Yes")


Failing test case input:
2
5 1 1
111 1 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
txy = [list(map(int,input().split())) for i in range(N)]
txy.insert(0,[0,0,0])

for i in range(N):
    d = abs(txy[i+1][1] - txy[i][1]) + abs(txy[i+1][2] - txy[i][2])
    td = txy[i+1][0] - txy[i][0]
    if d > td:
        print("No")
        exit()
    if d % 2 == 0 and td % 2 == 1:
        print("No")
        exit()
    elif d % 2 == 1 and td % 2 == 0:
        print("No")
        exit()
print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
t=0
x=0
y=0
for i in range(n):
  g,h,j=map(int,input().split())
  if (g-t)%2==(abs(h-x)+abs(j-y))%2:
    t=g
    x=h
    j=y
  else:
    print("No")
    exit()

print("Yes")

Failing test case input:
2
-2 2 2
101 4 3

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n=int(input())
t=0
x=0
y=0
for i in range(n):
  g,h,j=map(int,input().split())
  if (g-t)%2==(abs(h-x)+abs(j-y))%2 and (abs(h-x)+abs(j-y))<=(g-t):
    t=g
    x=h
    y=j
  else:
    print("No")
    exit()

print("Yes")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

import sys
N = int(input())
for _ in range(N):
    t, x, y = map(int, input().split())
    if ((x + y) % 2) != (t % 2):
        print('NO')
        sys.exit()
    if t < x + y:
        print('NO')
        sys.exit()
print('YES')


Failing test case input:
1
3 100 101

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):

import sys
N = int(input())
for _ in range(N):
    t, x, y = map(int, input().split())
    if ((x + y) % 2) != (t % 2):
        print('No')
        sys.exit()
    if t < x + y:
        print('No')
        sys.exit()
print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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')

Failing test case input:
1
1 110 101

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
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 or t-t0<(abs(x-x0)+abs(y-y0)):
    print('No')
    break
  t0,x0,y0=t,x,y
else:
  print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
(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"))

Failing test case input:
2
5 1 1
100 1 0

Expected output:
No


Actual output:
Yes


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

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())

for i in range(n):
  t,x,y=map(int,input().split())
  if (x+y)<=t or (t+x+y)%2==0:
    print("yes")
    exit()
  else:
    print("NO")

Failing test case input:
2
-2 1 2
001 2 2

Expected output:
No


Actual output:
NO
NO


Fixed submission (verdict: Accepted):
N=int(input())
count=0
for i in range(N):
    t,x,y=map(int,input().split())
    if x+y<=t and t%2==(x+y)%2:count+=1
print("Yes" if count==N else "No")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
X = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
print('Yes' if all((X[i + 1][0] - X[i][0] - abs(X[i + 1][1] - X[i][1]) + abs(X[i + 1][2] - X[i][2])) % 2 == 0 for i in range(N)) else 'No')

Failing test case input:
1
3 001 100

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
X = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
ans = []
for i in range(N):
  tme = X[i + 1][0] - X[i][0]
  cor = abs(X[i + 1][1] - X[i][1]) + abs(X[i + 1][2] - X[i][2])
  ans.append(max(tme - cor, -1) % 2 == 0)
print('Yes' if all(ans) else 'No')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
cordinates = [list(map(int, input().split())) for i in range(N)]

for t, x, y in cordinates:
    
    if (x+y) > t or (x+y+t):
        print('No')
        exit()
print('Yes')

Failing test case input:
2
2 1 1
101 2 1

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N = int(input())
cordinates = [list(map(int, input().split())) for i in range(N)]

for t, x, y in cordinates:
    
    if (x+y) > t or (x+y+t)%2:
        print('No')
        exit()
print('Yes')

Problem: p03457
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def check(x0, y0, x1, y1, s):
  dist = abs(x1 - x0) + abs(y1 - y0)
  if dist > s:
    return False
  if (dist + s) % 2 == 0:
    return True
  return False

N = int(input())
s0, x0, y0 = 0, 0, 0
ret = True
for i in range(N):
  s1, x1, y1 = map(int, input().split())
  if not check(x0, y0, x1, y1, s1 - s0):
    ret = False
    break
  s0, x0, y0 = x1, x1, y1
if ret:
  print('Yes')
else:
  print('No')

Failing test case input:
2
5 2 1
111 1 0

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
def check(x0, y0, x1, y1, s):
  dist = abs(x1 - x0) + abs(y1 - y0)
  if dist > s:
    return False
  if (dist + s) % 2 == 0:
    return True
  return False

N = int(input())
s0, x0, y0 = 0, 0, 0
ret = True
for i in range(N):
  s1, x1, y1 = map(int, input().split())
  if not check(x0, y0, x1, y1, s1 - s0):
    ret = False
    break
  s0, x0, y0 = s1, x1, y1
if ret:
  print('Yes')
else:
  print('No')
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
t = []
x = []
y = []

for i in range(N):
    a,b,c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)
i = 0
flag = True
while i < N:
    time = t[i]-t[i-1]
    dis = (x[i]-x[i-1])+(y[i]-y[i-1])
    if time>=dis:
        if (time%2+ dis%2) == 1:
            flag = False
            break
    i += 1

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


Failing test case input:
1
0 011 001

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
t = [0]
x = [0]
y = [0]

for i in range(N):
    a,b,c = map(int, input().split())
    t.append(a)
    x.append(b)
    y.append(c)
i = 0
flag = True
while i < N:
    time = t[i+1]-t[i]
    dis = abs(x[i+1]-x[i])+abs(y[i+1]-y[i])
    if time<dis:
        flag = False
        break
    elif (time%2 + dis%2) == 1:
            flag = False
            break
    i += 1

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

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if (x + y) > n or (x + y + t) % 2:
        print("NO")
        exit()
print("YES")

Failing test case input:
1
7 111 101

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
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")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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")


Failing test case input:
1
3 001 100

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
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(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")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

t = 0
n = int(input())
x, y = 0, 0
for _ in range(n):
    t_i, x_i, y_i = map(int, input().split(' '))
    t_d = t_i - t
    x_d = abs(x_i - x)
    y_d = abs(y_i - y)
    
    t, x, y = t_i, x_i, y_i
    if x_d + y_d <= t_d and (x_d + y_d) % 2 == t_d % 2:
        continue
    else:
        break
else:
    print('Yes')

Failing test case input:
1
0 011 001

Expected output:
No


Actual output:

Fixed submission (verdict: Accepted):

t = 0
n = int(input())
x, y = 0, 0
for _ in range(n):
    t_i, x_i, y_i = map(int, input().split(' '))
    t_d = t_i - t
    x_d = abs(x_i - x)
    y_d = abs(y_i - y)
    
    t, x, y = t_i, x_i, y_i
    if x_d + y_d <= t_d and (x_d + y_d) % 2 == t_d % 2:
        continue
    else:
        print('No')
        break
else:
    print('Yes')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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")


Failing test case input:
2
2 1 1
100 2 1

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
N=int(input())
for i 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')

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
txy = [list(map(int, input().split())) for _ in range(N)]
result = True

for i in range(N - 1):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    
    if(dist > dt): result = False
    if(dist % 2 != dt % 2): result = False

print(("No", "Yes")[result])

Failing test case input:
1
3 111 001

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
txy = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
result = True

for i in range(N):
    dt = txy[i + 1][0] - txy[i][0]
    dist = abs(txy[i + 1][1] - txy[i][1]) + abs(txy[i + 1][2] - txy[i][2])
    
    if(dist > dt): result = False
    if(dist % 2 != dt % 2): result = False

print(("No", "Yes")[result])

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
a=[list(map(int,input().split())) for _ in range(N)]
dp=[[0,0] for _ in range(N)]
for i in range(N):
  t=a[i][0]-dp[i-1][1]
  x=a[i][1]
  y=a[i][2]
  if t>=x+y and t%2==(x+y+dp[i-1][1])%2 and dp[i-1][0]==1:
    dp[i][0]=1
    dp[i][1]=a[i][0]
if dp[N-1][0]==1:print("Yes")
else:print("No")

Failing test case input:
2
5 2 1
111 1 0

Expected output:
Yes


Actual output:
No


Fixed submission (verdict: Accepted):
N=int(input())
a=[list(map(int,input().split())) for _ in range(N)]
dp=[[0,0] for _ in range(N+1)]
dp[0][0]=1
f=True
for i in range(1,N+1):
  t=a[i-1][0]-dp[i-1][1]
  x=a[i-1][1]
  y=a[i-1][2]
  if t>=x+y-dp[i-1][0] and t%2==(x+y+dp[i-1][1])%2:
    dp[i][0]=x+y
    dp[i][1]=a[i-1][0]
  else:
    f=False
    break
if f:print("Yes")
else:print("No")
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

N = int(input())

T = []
m = []
for _ in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    m.append([x,y])

for n in range(N-1):
    dl = abs(m[n][0]-m[n+1][0])+abs(m[n][1]-m[n+1][1])
    dt = T[n+1]-T[n]
    if dl>dt:
        print("No")
        sys.exit()
    if dl%2!=dt%2:
        print("No")
        sys.exit()

print("Yes")

Failing test case input:
1
1 000 010

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())

T = []
X = []
Y = []
T.append(0)
X.append(0)
Y.append(0)

for _ in range(N):
    t,x,y = map(int, input().split())
    T.append(t)
    X.append(x)
    Y.append(y)

for i in range(1, N+1, 1):
    dt = T[i]-T[i-1]
    dl = abs((X[i]+Y[i])-(X[i-1]+Y[i-1]))
    if dt<dl:
        print("No")
        exit()
    if dt%2!=dl%2:
        print("No")
        exit()
print("Yes")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def check(x, y, new_x, new_y, dt):
  diff = abs(new_x - x) + abs(new_y - y)
  if dt%2 == diff%2 and diff <= dt:
    return True
  return False

n = int(input())
t, x, y, count = 0, 0, 0, 0
canReach = True
while(count < n):
  new_t, new_x, new_y = map(int, input().split())
  if not check(x, y, new_x, new_y, new_t-t):
    canReach = False
    break
  t, x, y = new_t, new_x, new_y
  count += 1
if canReach:
  print("YES")
else:
  print("NO")

Failing test case input:
1
3 110 001

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
def check(x, y, new_x, new_y, dt):
  diff = abs(new_x - x) + abs(new_y - y)
  if dt%2 == diff%2 and diff <= dt:
    return True
  return False

n = int(input())
t, x, y, count = 0, 0, 0, 0
canReach = True
while(count < n):
  new_t, new_x, new_y = map(int, input().split())
  if not check(x, y, new_x, new_y, new_t-t):
    canReach = False
    break
  t, x, y = new_t, new_x, new_y
  count += 1
if canReach:
  print("Yes")
else:
  print("No")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


n = int(input())
t, x, y = [0], [0], [0]
for i in range(n):
  t_i, x_i, y_i = map(int, input().strip().split())
  t.append(t_i)
  x.append(x_i)
  y.append(y_i)
  
can = "YES"
for i in range(n):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if (dt < dist):
    can = "NO"
  if(dist % 2 != dt % 2):
    can = "NO"
print(can)

Failing test case input:
2
-2 1 2
101 4 2

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):


n = int(input())
t, x, y = [0], [0], [0]
for i in range(n):
  t_i, x_i, y_i = map(int, input().strip().split())
  t.append(t_i)
  x.append(x_i)
  y.append(y_i)

  
can = "Yes"
for i in range(n):
  dt = t[i+1] - t[i]
  dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
  if (dt < dist):
    can = "No"
  if(dist % 2 != dt % 2):
    can = "No"
print(can)
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

tprev = 0
xprev = 0
yprev = 0

result = 'YES'

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

    xlen = abs(x - xprev)
    ylen = abs(y - yprev)
    
    time = t - tprev

    length = xlen + ylen

    if time%2 == length%2 and time >= length:
        tprev = t
        xprev = x
        yprev = y

    else:
        result = 'NO'
        break
print(result)


Failing test case input:
2
-2 4 4
101 4 2

Expected output:
No


Actual output:
NO


Fixed submission (verdict: Accepted):
N = int(input())

tprev = 0
xprev = 0
yprev = 0

result = 'Yes'

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

    xlen = abs(x - xprev)
    ylen = abs(y - yprev)
    
    time = t - tprev

    length = xlen + ylen

    if time%2 == length%2 and time >= length:
        tprev = t
        xprev = x
        yprev = y

    else:
        result = 'No'
        break
print(result)

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
TS = [[0,0,0]] + [list(map(int, input().split())) for k in range(N)]
TS = sorted(TS)
result = True
for k in range(N):
    length = [TS[k+1][i] - TS[k][i] for i in range(3)]
    reminder = length[0] - (abs(length[1]) - abs(length[2]))
    result = result and (reminder >= 0) and (reminder % 2 == 0)
print("Yes") if result else print("No")

Failing test case input:
1
1 101 110

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
N = int(input())
TS = sorted([[0,0,0]] + [list(map(int, input().split())) for k in range(N)])
result = True
for k in range(N):
    length = [abs(TS[k+1][i] - TS[k][i]) for i in range(3)]
    reminder = length[0] - length[1] - length[2]
    result = result and (reminder >= 0) and (reminder % 2 == 0)
print("Yes") if result else print("No")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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')

Failing test case input:
2
5 2 1
100 1 0

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
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')
Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
li = [list(map(lambda x:int(x),input().split())) for i in range(n)]
ok = False
for i in range(n-1):
    mo = (li[i+1][2] - li[i][2]) + (li[i+1][1] - li[i][1])
    ti = li[i+1][0] - li[i][0]
    if (mo%2)==(ti%2) and mo<=ti and ((mo==0 and ti == 0) or (mo!=0 and ti != 0)):
        ok = True
if ok :
    print("Yes")
else :
    print("No")

Failing test case input:
2
-2 1 2
001 4 2

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
li = [list(map(lambda x:int(x),input().split())) for i in range(n)]
ok = True
for i in range(n-1):
    mo = (li[i+1][2] - li[i][2]) + (li[i+1][1] - li[i][1])
    ti = li[i+1][0] - li[i][0]
    if (mo%2)!=(ti%2) or mo>ti or (mo != 0 and ti == 0):
        ok = False
mo = (li[0][2] - 0) + (li[0][1] - 0)
ti = li[0][0] -0
if (mo%2)!=(ti%2) or mo>ti or (mo != 0 and ti == 0):
    ok = False
if ok :
    print("Yes")
else :
    print("No")

Problem: p03457
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
points = []
for i in range(n):
    points.append(list(map(int, input().split(" "))))

t_pre, x_pre, y_pre = 0, 0, 0
reachable = False
for point in points:
    t, x, y = map(int, point)
    diff_t = t - t_pre
    p = x + y
    p_pre = x_pre + y_pre
    move = 0
    for _ in range(diff_t):
        move += 1 if p > (p_pre + move) else -1

    reachable = True if p - p_pre == move else False

    t_pre, x_pre, y_pre = t, x, y

print("Yes" if reachable == True else "No")


Failing test case input:
2
-2 1 2
001 2 2

Expected output:
No


Actual output:
Yes


Fixed submission (verdict: Accepted):
n = int(input())
points = []
for i in range(n):
    points.append(list(map(int, input().split(" "))))

t_pre, x_pre, y_pre = 0, 0, 0
reachable = True
for point in points:
    t, x, y = map(int, point)
    diff_t = t - t_pre
    p = x + y
    p_pre = x_pre + y_pre
    move = 0
    for _ in range(diff_t):
        move += 1 if p > (p_pre + move) else -1

    if p - p_pre != move:
        reachable = False
        break

    t_pre, x_pre, y_pre = t, x, y

print("Yes" if reachable == True else "No")