qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = input().replace(" ","")

print(['No','Yes'][is_square_num(n)])



def is_square_num(n):
    
    mod256 = [
        0, 1, 4, 9, 16, 17, 25, 33, 36, 41,
        49, 57, 64, 65, 68, 73, 81, 89, 97, 100,
        105, 113, 121, 129, 132, 137, 144, 145, 153, 161,
        164, 169, 177, 185, 193, 196, 201, 209, 217, 225,
        228, 233, 241, 249 ]

    mod100 = [
        0, 1, 4, 9, 16, 21, 24, 25, 29, 36, 41, 44, 49, 56, 61, 64, 69, 76, 81, 84, 89, 96
    ]
    if not n % 256 in mod256:
        return False
    
    if not n % 100 in mod100:
        return False

    import math
    x = math.sqrt(n)

    # import numpy
    # x = numpy.sqrt(n)
    
    return x.is_integer()



Fixed code:


def is_square_num(n):
    
    mod256 = [
        0, 1, 4, 9, 16, 17, 25, 33, 36, 41,
        49, 57, 64, 65, 68, 73, 81, 89, 97, 100,
        105, 113, 121, 129, 132, 137, 144, 145, 153, 161,
        164, 169, 177, 185, 193, 196, 201, 209, 217, 225,
        228, 233, 241, 249 ]

    mod100 = [
        0, 1, 4, 9, 16, 21, 24, 25, 29, 36, 41, 44, 49, 56, 61, 64, 69, 76, 81, 84, 89, 96
    ]
    if not n % 256 in mod256:
        return False
    
    if not n % 100 in mod100:
        return False

    import math
    x = math.sqrt(n)

    # import numpy
    # x = numpy.sqrt(n)
    
    return x.is_integer()


n = input().replace(" ","")

print(['No','Yes'][is_square_num(int(n))])
Buggy code:
a,b=map(str,input().split())
n=int(a+b)
if int(n**(1/2)**2==n:
    print("Yes")
else:
    print("No")

Fixed code:
a,b=map(str,input().split())
n=int(a+b)
if int(n**(1/2))**2==n:
    print("Yes")
else:
    print("No")
Buggy code:
import math
a,b = map(int , input().split())
i = len(b)
n= pow(10,i)*a+b
m=int(math.sqrt(n))
if m*m=n:
 print("Yes")
else:
 print("No")

Fixed code:
import math
a,b = map(str , input().split())
i = len(b)
a=int(a)
b=int(b)
n= pow(10,i)*a+b
m=int(math.sqrt(n))
if m*m==n:
 print("Yes")
else:
 print("No")
Buggy code:
a=int("".join(input().split()))
if a==int((a**0.5)**2):
	print("Yes")
else:
	print("No")

Fixed code:
a=int("".join(input().split()))
if a==int(a**0.5)**2:
	print("Yes")
else:
	print("No")
Buggy code:
import math

a,b = list(input().split())
c = int(a+b)

ans = False
for i in range(math.ceil(math.sqrt(c))):
  if i**2 == c:
    ans = True

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

Fixed code:
import math

a,b = list(input().split())
c = int(a+b)

ans = False
for i in range(math.ceil(math.sqrt(c)+1)):
  if i**2 == c:
    ans = True

if ans:
  print("Yes")
else:
  print("No")
Buggy code:
import math
a, b = input().split()
c = int(a + b)

if (int)math.sqrt(c) - math.sqrt(c) == 0:
    print('Yes')
else:
    print('No')

Fixed code:
import math
a, b = input().split()
c = int(a + b)

if int(math.sqrt(c)) - math.sqrt(c) == 0:
    print('Yes')
else:
    print('No')
Buggy code:
import math

a,b = map(int,input().split())

ans = ["Yes","No"]



print(ans[math.sqrt(int(a+b)).is_integer()])

Fixed code:
import math

a,b = input().split()

ans = ["No","Yes"]



print(ans[math.sqrt(int(a+b)).is_integer()])
Buggy code:
import math
a, b = map(str, input().split())
n = int(a + b)
if math.sqrt(n).is_integer:
  print('Yes')
else:
  print('No')


Fixed code:
import math
a, b = map(str, input().split())
n = int(a + b)
if math.sqrt(n).is_integer():
  print('Yes')
else:
  print('No')
Buggy code:
import math
a,b=[int(s) for s in input().split(" ")]

b2=b
count=0
for i in range(1,3):
    b2=b2//10
    count+=1
    if b2==0:
        break

Prob=(10**(count))*a+b

print(Prob)
Ans=math.sqrt(Prob)
print("Yes" if int(Ans)==Ans else "No")

Fixed code:
import math
a,b=[int(s) for s in input().split(" ")]

b2=b
count=0
for i in range(3):
    b2=b2//10
    count+=1
    if b2==0:
        break
Prob=(10**(count))*a+b
Ans=math.sqrt(Prob)
print("Yes" if int(Ans)==Ans else "No")
Buggy code:
n = int(input())

t_list = list()
x_list = list()
y_list = list()

for a in range(n):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)

for a in range(1, n):
    dt = t_list[a] - t_list[a-1]
    dx = x_list[a] - x_list[a-1]
    dy = y_list[a] - y_list[a-1]

    if abs(dx) + abs(dy) <= dt:
        if (dx + dy) % 2 == dt % 2:
            ans = True
        else:
            ans = False
            break
    else:
        ans = False
        break

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


Fixed code:
n = int(input())

t_list = [0]
x_list = [0]
y_list = [0]

for a in range(n):
    t, x, y = map(int, input().split())
    t_list.append(t)
    x_list.append(x)
    y_list.append(y)

for a in range(1, n+1):
    dt = t_list[a] - t_list[a-1]
    dx = x_list[a] - x_list[a-1]
    dy = y_list[a] - y_list[a-1]

    if abs(dx) + abs(dy) <= dt:
        if (dx + dy) % 2 == dt % 2:
            ans = True
        else:
            ans = False
            break
    else:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())

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

x0 = 0
y0 = 0
t0 = 0
res = "Yes"
for t, x, y in pairs:
    dx = x - x0
    dy = y - y0
    dt = t - t0

    if abs(dx) + abs(dy) != dt:
        tmp = dt - (abs(dx) + abs(dy))
        if tmp <= 0 or tmp % 2 != 0:
            print(", ".join(list(map(str, [t, x, y]))))
            res = "No"
            break
    x0 = x
    y0 = y
    t0 = t

print(res)


Fixed code:
N = int(input())

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

x0 = 0
y0 = 0
t0 = 0
res = "Yes"
for t, x, y in pairs:
    dx = x - x0
    dy = y - y0
    dt = t - t0

    if abs(dx) + abs(dy) != dt:
        tmp = dt - (abs(dx) + abs(dy))
        if tmp <= 0 or tmp % 2 != 0:
            res = "No"
            break
    x0 = x
    y0 = y
    t0 = t

print(res)
Buggy code:
N = int(input())
TS = [[0,0,0]] + [list(map(int, input().split())) for k in range(N)]
result = True
for k in range(N):
    length = [TS[k+1][i] - TS[k][i] for i in range(3)]
    if (length[1] + length[2] - length[0]) % 2 == 0:
        result = result and result
print("Yes") if result else print("No")

Fixed code:
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")
Buggy code:
N = int(input())
t=0
x=0
y=0
for i in range(N)
    nt, nx, ny = map(input().split())
    km = abs(nx-x) + abs(ny-y)
    if km > (nt-t) or (km - (nt-t)) % 2 = 1:
        print("No")
        exit(0)
    t, x, y = nt, nx, ny
print("Yes")


Fixed code:
N = int(input())
t, x, y = 0, 0, 0
for i in range(N):
    nt, nx, ny = map(int, input().split())
    km = abs(nx-x) + abs(ny-y)
    if km > (nt-t) or (km - (nt-t)) % 2 == 1:
        print("No")
        exit(0)
    t, x, y = nt, nx, ny
print("Yes")
Buggy code:
N = int(input())
z_t = []*N
t0 = 0
x0 = 0
y0 = 0
ans = 'NO'
for i in range(N):
    s = input().rstrip().split()
    z_t.append(s)
print(z_t)

for i in range(N):
    dt = int(z_t[i][0]) - t0
    dx = abs(int(z_t[i][1]) - x0)
    dy = abs(int(z_t[i][2]) - y0)
    extra_t = dt - (dx+dy)

    if extra_t >=  0 and extra_t%2 == 0:
        t0 = int(z_t[i][0])
        x0 = int(z_t[i][1])
        y0 = int(z_t[i][2])
        if i == N-1:
            ans = 'YES'
    else:
        break


print(ans)

Fixed code:
N = int(input())
z_t = []*N
t0 = 0
x0 = 0
y0 = 0
ans = 'No'
for i in range(N):
    s = input().rstrip().split()
    z_t.append(s)

for i in range(N):
    dt = int(z_t[i][0]) - t0
    dx = abs(int(z_t[i][1]) - x0)
    dy = abs(int(z_t[i][2]) - y0)
    extra_t = dt - (dx+dy)
    if extra_t >=  0 and extra_t%2 == 0:
        t0 = int(z_t[i][0])
        x0 = int(z_t[i][1])
        y0 = int(z_t[i][2])
        if i == N-1:
            ans = 'Yes'
    else:
        break
print(ans)
Buggy code:
N = int(input())
t0, x0, y0 = (0, 0, 0)

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

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

for _ in range(N):
	t1, x1, y1 = map(int, input().split())
	if abs(x1-x0)+abs(y1-y0) > t1-t0 or (abs(x1-x0)+abs(y1-y0))%2 != (t1-t0)%2:
		print('No')
		break
	t0, x0, y0 = t1, x1, y1
else:
	print('Yes')
Buggy code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

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


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

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

    if (t - prev_time) % 2 != dist % 2:
        print('No')
        sys.exit(0)
    prev_time = t
    prev_point = (x, y)
print('Yes')
Buggy code:
N = int(input())
pnt = [[0]*3]
for i in range(N):
  pnt.append(list(map(int, input().split())))
cnt = 0
for i in range(1, N+1):
  t = pnt[i][0] - pnt[i-1][0]
  x = abs(pnt[i][1] - pnt[i-1][1])
  y = abs(pnt[i][2] - pnt[i-1][2])
  if t >= x+y and t-(x+y) % 2 == 0:
    cnt += 1
if cnt == N: print("Yes")
else: print("No")

Fixed code:
N = int(input())
pnt = [[0]*3]
for i in range(N):
  pnt.append(list(map(int, input().split())))
cnt = 0
for i in range(1, N+1):
  t = pnt[i][0] - pnt[i-1][0]
  x = abs(pnt[i][1] - pnt[i-1][1])
  y = abs(pnt[i][2] - pnt[i-1][2])
  if t >= x+y and (t-(x+y)) % 2 == 0:
    cnt += 1
if cnt == N: print("Yes")
else: print("No")
Buggy code:
N = int(input())
T = [[0,0,0]]+[map(int, input().split()) for _ in range(N)]
# for i in range(len(T)-1):
flag = 'Yes'
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = (x2-x1)+(y2-y1)
    _t = t2-t1
    if dis > _t or (_t-dis)%2 != 0:
        flag = 'No'
    i += 1        
print(flag)
    

Fixed code:
N = int(input())
T = [[0,0,0]]+[ [int(x) for x in input().split()] for _ in range(N)]

flag = 'Yes'
i = 0
while flag=='Yes' and i<len(T)-1:
    t1,x1,y1 = T[i] 
    t2,x2,y2 = T[i+1]
    dis = abs(x2-x1)+abs(y2-y1)
    _t = t2-t1
    if dis > _t or _t%2 != dis%2:
        flag = 'No'
    i += 1        
print(flag)
Buggy code:
N = int(input())
TXY = [list(map(int, input().split())) for _ in range(N)]

pre_t, pre_x, pre_y = 0, 0, 0
for t, x, y in TXY:
  diff_t = t - pre_t
  diff_pos = abs(x-pre_x) + abs(y-pre_y)
  if diff_t > diff_pos or diff_pos-diff_t % 2 == 1:
    print('No')
    exit()
  else:
    pre_t, pre_x, pre_y = t, x, y
print('Yes')

Fixed code:
N = int(input())
TXY = [list(map(int, input().split())) for _ in range(N)]
 
pre_t, pre_x, pre_y = 0, 0, 0
for t, x, y in TXY:
  diff_t = t - pre_t
  diff_pos = abs(x-pre_x) + abs(y-pre_y)
  if diff_t < diff_pos or (diff_t-diff_pos) % 2 == 1:
    print('No')
    exit()
  else:
    pre_t, pre_x, pre_y = t, x, y
print('Yes')
Buggy code:
import sys
n = int(input())
pret = 0
prex = 0
prey = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 2 == 0:
            pret = t
            prex = x
            prey = y
        else:
            print('No')
            sys.exit()
print('Yes')

Fixed code:
import sys
n = int(input())
pret = 0
prex = 0
prey = 0
for i in range(n):
    t,x,y = map(int,input().split())
    tmp = t - pret - abs(x - prex) - abs(y - prey)
    #print(t, x, y, tmp)
    if tmp >= 0 and tmp % 2 == 0:
        pret = t
        prex = x
        prey = y
    else:
        print('No')
        sys.exit()
print('Yes')
Buggy code:
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 4 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')


Fixed code:
n = int(input())
pret = 0
prex = 0
prey = 0
flag = True
for i in range(n):
    t,x,y = map(int,input().split())
    if flag:
        tmp = t - pret - abs(x - prex) - abs(y - prey)
        #print(t, x, y, tmp)
        if tmp >= 0 and tmp % 2 == 0:
            pret = t
            prex = x
            prey = y
        else:
            flag = False
if flag:
    print('Yes')
else:
    print('No')
Buggy code:
# solution

import io

array = [1]

def tommy(numbers):
  t, x, y = map(int, numbers.split())
  time_x = t - x
  time_y = time_x - y
  if time_y%2 == 0 and time_y >=0:
    array.append(1)
  else:
    array.append(-1)

data = int(input())

counter = 0

while counter < data:
  tommy(input())
  counter += 1

if array.counter(1) == data+1:
  print('Yes')
else:
  print('No')

Fixed code:
# solution

import io

array = [1]

def tommy(numbers):
  t, x, y = map(int, numbers.split())
  time_x = t - x
  time_y = time_x - y
  if time_y%2 == 0 and time_y >=0:
    array.append(1)
  else:
    array.append(-1)

data = int(input())

counter = 0

while counter < data:
  tommy(input())
  counter += 1

if array.count(1) == data+1:
  print('Yes')
else:
  print('No')
Buggy 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)
cnt=0
for i in range(0,N):
    d=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    print(d)
    t=txy[i+1][0]-txy[i][0]
    print(t)
    if d <= t and (t-d)%2==0:
        cnt+=1
    else:
        break
if cnt==N:
    print('Yes')
else:
    print('No')

Fixed 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)
cnt=0
for i in range(0,N):
    d=abs(txy[i][1]-txy[i+1][1])+abs(txy[i][2]-txy[i+1][2])
    t=txy[i+1][0]-txy[i][0]
    if d <= t and (t-d)%2==0:
        cnt+=1
    else:
        break
if cnt==N:
    print('Yes')
else:
    print('No')
Buggy code:
N = int(input())

nx = 0
ny = 0
nt = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    k = abs(nx-x)+abs(ny-y)
    if k > t:
        print("No")
        break
    if (k-t)%2 != 0:
        print("No")
        break
    nx = x
    ny = y
    nt = t
else:
    print("Yes")

Fixed code:
N = int(input())

nx = 0
ny = 0
nt = 0
for _ in range(N):
    t, x, y = map(int, input().split())
    k = abs(nx-x)+abs(ny-y)
    if k > t-nt:
        print("No")
        break
    if (k-(t-nt))%2 != 0:
        print("No")
        break
    nx = x
    ny = y
    nt = t
else:
    print("Yes")
Buggy code:
N = int(input())
TXY = []
for n in range(N):
    TXY.append([int(i) for i in input().split()])
temp = [0,0,0]
ans = True
for txy in TXY:
    dist = (txy[1]-temp[1]) + (txy[2]-temp[2])
    if (txy[0]-temp[0]) % 2 == dist % 2:
        temp = txy
    else:
        ans = False
print("Yes") if ans else print("No")

Fixed code:
N = int(input())
TXY = []
for n in range(N):
    TXY.append([int(i) for i in input().split()])
temp = [0,0,0]
ans = True
for txy in TXY:
    dist = (txy[1]-temp[1]) + (txy[2]-temp[2])
    if (txy[0]-temp[0]) % 2 == dist % 2 and (txy[0]-temp[0]) >= dist:
        temp = txy
    else:
        ans = False
print("Yes") if ans else print("No")
Buggy code:
n = int(input())

p = [None]*n

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

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if (abs(diff[1])+abs(diff[2]))>diff[0] or (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        exit()

print('YES')

Fixed code:
n = int(input())

p = [None]*n

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

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if (abs(diff[1])+abs(diff[2]))>diff[0] or (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        exit()

print('Yes')
Buggy code:
# coding: utf-8
n = int(input())
points = []
for i in range(n):
    points.append(list(map(int, input().split())))

def can_exist(before_point, after_point):
    def_t = after_point[0] - before_point[0]
    def_x = after_point[1] - before_point[1]
    def_y = after_point[2] - before_point[2]
    def_total = abs(def_x) + abs(def_y)
    if def_total <= def_t and def_total % 2 == def_t % 2:
        return True
    else:
        return False

out = 'Yes'
for i in range(n-1):
    if can_exist(points[i], points[i+1]):
        continue
    else:
        out = 'No'
        break

print(out)

Fixed code:
# coding: utf-8
n = int(input())
points = [[0, 0, 0]]
for i in range(n):
    points.append(list(map(int, input().split())))

def can_exist(before_point, after_point):
    def_t = after_point[0] - before_point[0]
    def_x = after_point[1] - before_point[1]
    def_y = after_point[2] - before_point[2]
    def_total = abs(def_x) + abs(def_y)
    if def_total <= def_t and def_total % 2 == def_t % 2:
        return True
    else:
        return False

out = 'Yes'
for i in range(n):
    if can_exist(points[i], points[i+1]):
        continue
    else:
        out = 'No'
        break

print(out)
Buggy code:
import sys

N = int(input())
T = [[0 for i in range(3)] for j in range(N)]
for i in range(3):
    T = [[0,0,0]]
for i in range(1,N+1):
    row = input().split()
    for j in range(len(row)):
        row[j] = int(row[j])
    T.append(row)

for i in range(N):
    dist = abs(T[i+1][1]-T[i][1]) + abs(T[i+1][2]-T[i][2])
    time = T[i+1][0]- T[i][0]

    if dist > time or (dist - time) % 2 == 1:
        print("NO")
        sys.exit()

print("YES")


Fixed code:
import sys

N = int(input())
T = [[0 for i in range(3)] for j in range(N)]
for i in range(3):
    T = [[0,0,0]]
for i in range(1,N+1):
    row = input().split()
    for j in range(len(row)):
        row[j] = int(row[j])
    T.append(row)

for i in range(N):
    dist = abs(T[i+1][1]-T[i][1]) + abs(T[i+1][2]-T[i][2])
    time = T[i+1][0]- T[i][0]

    if dist > time or (dist - time) % 2 == 1:
        print("No")
        sys.exit()

print("Yes")
Buggy code:
n = int(input())
T = [0] + [None] * n
X = [0] + [None] * n
Y = [0] + [None] * n
for i in range(1, n + 1):
  T[i], X[i], Y[i] = map(int, input().split())

for i in range(len(T) - 1):
  dt = T[i + 1] - T[i]
  dx = abs(X[i + 1] - X[i])
  dy = abs(Y[i + 1] - Y[i])
  if (dt % 2 != (dx + dy) % 2 and (dx + dy) > dt):
    print('No')
    exit()

print('Yes')


Fixed code:
n = int(input())
T = [0] + [None] * n
X = [0] + [None] * n
Y = [0] + [None] * n
for i in range(1, n + 1):
  T[i], X[i], Y[i] = map(int, input().split())

for i in range(len(T) - 1):
  dt = T[i + 1] - T[i]
  dx = abs(X[i + 1] - X[i])
  dy = abs(Y[i + 1] - Y[i])
  if (not (dt % 2 == (dx + dy) % 2 and (dx + dy) <= dt)):
    print('No')
    exit()

print('Yes')
Buggy code:
n = int(input())
T = [0] + [None] * n
X = [0] + [None] * n
Y = [0] + [None] * n
for i in range(1, n + 1):
  T[i], X[i], Y[i] = map(int, input().split())

for i in range(len(T) - 1):
  dt = T[i + 1] - T[i]
  dx = X[i + 1] - X[i]
  dy = Y[i + 1] - Y[i]
  if (dt % 2 == (dx + dy) % 2 and (dx + dy) <= dt):
    res = res and True
  else:
    res = False

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


Fixed code:
n = int(input())
T = [0] + [None] * n
X = [0] + [None] * n
Y = [0] + [None] * n
for i in range(1, n + 1):
  T[i], X[i], Y[i] = map(int, input().split())

for i in range(len(T) - 1):
  dt = T[i + 1] - T[i]
  dx = abs(X[i + 1] - X[i])
  dy = abs(Y[i + 1] - Y[i])
  if (dt % 2 == (dx + dy) % 2 and (dx + dy) <= dt):
    res = True
  else:
    print('No')
    exit()

print('Yes')
Buggy code:
N=int(input())
pos=[0,0]
now=0
flag=True
for i in range(N):
  t,x,y=map(int,input().split())
  d = abs(x-pos[0])+abs(y-pos[0])
  if d>t:
    flag=False
    break
  else:
    if d%2==0:
      now=t
      pos[0],pos[1]=x,y
    else:
      flag=False
      break
if flag:
  print("Yes")
else:
  print("No")

Fixed code:
N=int(input())
pos=[0,0]
now=0
flag=True
for i in range(N):
  t,x,y=map(int,input().split())
  d = abs(x-pos[0])+abs(y-pos[1])
  if d>t-now:
    flag=False
    break
  else:
    if d%2==(t-now)%2:
      now=t
      pos[0],pos[1]=x,y
    else:
      flag=False
      break
if flag:
  print("Yes")
else:
  print("No")
Buggy code:
N=int(input())
prev=[0,0,0]
for i in range(N):
  x,y,t=map(int,input().split())
  dis = abs(x-prev[0]) + abs(y -prev[1])
  time= t-prev[2]
  if dis <= time and (time-dis)%2==0:
    prev=[x,y,t]
  else:
    print("No")
    exit(0)
print("Yes")
  

Fixed code:
N=int(input())
prev=[0,0,0]
for i in range(N):
  t,x,y=map(int,input().split())
  dis = abs(x-prev[0]) + abs(y -prev[1])
  time= t-prev[2]
  if dis <= time and (time-dis)%2==0:
    prev=[x,y,t]
  else:
    print("No")
    exit(0)
print("Yes")
Buggy code:
n = int(input())
bx = 0
by = 0
bt = 0
def p(t,x,y):
  if abs(x)+abs(y) > t:
    return True
  elif (t-abs(x)-abs(y))%2 == 1:
    return True
  else:
    return False
for _ in range(n):
  at,ax,ay = map(int,input().split())
  if p(at-bt,bx-ax,by-ay):
    print(p(t,bx-ax,by-ay))
    print("No")
    exit()
  bx = ax
  by = ay
  bt = at
print("Yes")  

Fixed code:
n = int(input())
bx = 0
by = 0
bt = 0
def p(t,x,y):
  if abs(x)+abs(y) > t:
    return True
  elif (t-abs(x)-abs(y))%2 == 1:
    return True
  else:
    return False
for _ in range(n):
  at,ax,ay = map(int,input().split())
  if p(at-bt,bx-ax,by-ay):
    print("No")
    exit()
  bx = ax
  by = ay
  bt = at
print("Yes")
Buggy 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')

Fixed 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 = abs(int(dst[i][1])-int(dst[i-1][1]))+abs(int(dst[i][2])-int(dst[i-1][2]))
    if (time_diff>=dst_diff and (time_diff+2)%2 == (dst_diff+2)%2):
        flg = True
    else:
        flg = False
        break

if flg == True:
    print('Yes')
else:
    print('No')
Buggy code:
N=int(input())

t0=0
x0=0
y0=0

ans="Yes"

for i in range(N):
    t,x,y=map(int,input().split())
    d=abs(x-x0)+abs(y-y0)
    dt=t-t0
    if not d<=dt and (dt-d)%2==0:
        ans="No"
    t0=t
    x0=x
    y0=y

print(ans)

Fixed code:
N=int(input())

t0=0
x0=0
y0=0

ans="Yes"

for i in range(N):
    t,x,y=map(int,input().split())
    d=abs(x-x0)+abs(y-y0)
    dt=t-t0
    if not (d<=dt and (dt-d)%2==0):
        ans="No"
    t0=t
    x0=x
    y0=y

print(ans)
Buggy code:
N = int(input())
t = 0
x = 0
y = 0
for ti, xi, yi in [map(int, input().split(' ')) for n in range(N)]:
    if not (xi-x+yi-y <= ti-t or (ti-t)%2 == (xi-x+yi-y)%2):
        print('No')
        exit()
    else:
        t = ti
        x = xi
        y = yi
print('Yes')


Fixed code:
N = int(input())
t = 0
x = 0
y = 0
for ti, xi, yi in [map(int, input().split(' ')) for n in range(N)]:
    if not (abs(xi-x)+abs(yi-y) <= ti-t and ti%2 == (xi+yi)%2):
        print('No')
        exit()
    else:
        t = ti
        x = xi
        y = yi
print('Yes')