stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include<cstdio>

#include<iostream>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<string>

using namespace std;

int n,a,b,c; 

int main()

{

	scanf("%d",&n);

	for(int i=1; i<=n; i++)

	{

		scanf("%d%d%d",&a,&b,&c);

		if(a<b+c){printf("No\n");return 0;}

		if(a%2==1 and (b+c)%2==0){printf("No\n");return 0;}

		if(a%2==0 and (b+c)%2==1){printf("No\n");return 0;}

	}

	printf("Yes\n");

	return 0;

}


// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int n,t,x,y,i;

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {

        scanf("%d%d%d",&t,&x,&y);

        if(x+y>t)

        {

            printf("No\n");

            return 0;

        }

        if((x+y)%2==0&&t%2==1)

        {

            printf("No\n");

            return 0;

        }

        if((x+y)%2==1&&t%2==0)

        {

            printf("No\n");

            return 0;

        }

    }

    printf("Yes\n");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

#define ll long long

#define ull unsigned long long

#define reg register

#define in cin>>

#define out cout<<

using namespace std;

int main(){

	reg int n;

	in n;

	while(n--){

		reg int t,x,y;

		in t>>x>>y;

		if(t<x+y){

			out "No\n";

			return 0;

		}

		if(t%2!=(x+y)%2){

			out "No\n";

			return 0;

		}

	}

	out "Yes\n";

}

// Optimized solution to the same problem (faster):
#include<stdio.h>



int main()

{

    int n,t,x,y,i;

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {

        scanf("%d%d%d",&t,&x,&y);

        if(x+y>t)

        {

            printf("No\n");

            return 0;

        }

        if((x+y)%2==0&&t%2==1)

        {

            printf("No\n");

            return 0;

        }

        if((x+y)%2==1&&t%2==0)

        {

            printf("No\n");

            return 0;

        }

    }

    printf("Yes\n");

    return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <string>

#include <algorithm>

#include <map>

#include <math.h>

#include <iomanip>

#include <vector>

#include <queue>

#include <functional>

#include <random>

#include <time.h>

using namespace std;

typedef long long int ll;

typedef pair<ll, ll> P;

int main() {

	ll n, t[100010] = {}, x[100010] = {}, y[100010] = {};

	cin >> n;

	for (int i = 1; i <= n; i++) cin >> t[i] >> x[i] >> y[i];

	for (int i = 1; i <= n; i++) {

		ll X, Y, T;

		X = abs(x[i - 1] - x[i]);

		Y = abs(y[i - 1] - y[i]);

		T = t[i] - t[i - 1];

		if (X + Y > T) {

			cout << "No" << endl;

			return 0;

		}

		T -= X;

		if (T < Y) {

			cout << "No" << endl;

			return 0;

		}

		else {

			if (Y % 2 != T % 2) {

				cout << "No" << endl;

				return 0;

			}

		}

	}

	cout << "Yes" << endl;

	return 0;

}


// Optimized solution to the same problem (faster):
#include <iostream>

#include <list>

#include <stack>

#include <set>

#include <iomanip>

#include <random>

#include <time.h>

#include <vector>

#include <queue>

#include <functional>

#include <map>

#include <string>

#include <cstdlib>

#include <typeinfo>

#include <math.h>

#include <algorithm>

using namespace std;

typedef long long int ll;

typedef pair<ll, ll> P;



ll n, t, x, y;

int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);

	cin >> n;

	ll nt, nx, ny;

	nt = nx = ny = 0;

	bool f = 0;

	for (int i = 0; i < n; i++) {

		cin >> t >> x >> y;

		ll T = t - nt, X = abs(x - nx), Y = abs(y - ny);

		if (T < X + Y) {

			f = 1;

			break;

		}

		T -= X;

		if (T % 2 != Y % 2) {

			f = 1;

			break;

		}

		nt = t, nx = x, ny = y;

	}

	cout << (f ? "No" : "Yes") << endl;

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

using namespace std;



int n,x[100005],y[100005],t[100005];

int dis,tim;

bool f;



int abs(int a,int b) {

	return a>b?a-b:b-a;

}



int main() {

//	freopen("c.in","r",stdin);

//	freopen("c.out","w",stdout);

	scanf("%d",&n);

	for (int i=1;i<=n;i++) scanf("%d%d%d",&t[i],&x[i],&y[i]);

	x[0]=0; y[0]=0; t[0]=0;

	int j=1; f=true;

	while (f && j<=n) {

		dis=abs(x[j],x[j-1])+abs(y[j],y[j-1]);

		tim=t[j]-t[j-1];

		if (dis>tim) f=false;

		if ((abs(dis,tim))%2!=0) f=false;

		j++;

	}

	if (f) printf("Yes\n"); else printf("No\n");

	fclose(stdin);

	fclose(stdout);

	return 0;

}


// Optimized solution to the same problem (faster):
#include <cstdio>

#include <cstdlib>

#include <cmath>

#define maxn 100005



bool solve(int tx,int ty,int x,int y,int t)

{

    int quick=abs(tx-x)+abs(ty-y);

    if(t<quick) return false;

    else if((t-quick)%2==0) return true;

    else return false;

}



int main()

{

//    freopen("Traveling.in","r",stdin);

//    freopen("Traveling.out","w",stdout);

    

    int n;

    scanf("%d",&n);

    int t,x,y,tt=0,tx=0,ty=0;

    bool key=true;

    for(int i=1;i<=n;i++)

    {

        scanf("%d%d%d",&t,&x,&y);

        if(!solve(tx,ty,x,y,t-tt)) {key=false; break;}

        tt=t;tx=x;ty=y;

    }

    

    if(key) printf("Yes");

    else printf("No");

    return 0;

} 


// Fastest known solution for this problem:
// Original C++ solution (slower):
/*Lucky_Glass*/

#include<cstdio>

#include<iostream>

#include<cmath>

#include<queue>

using namespace std;

int main()

{

	int n,dx=0,dy=0,dt=0;

	scanf("%d",&n);

	bool T=true;

	for(int i=0;i<n;i++)

	{

		int t,x,y;

		scanf("%d%d%d",&t,&x,&y);

		if(abs(x-dx)+abs(y-dy)+dt<=t)

			if((t-abs(x-dx)+abs(y-dy)-dt)%2)

				T=false;

			else

				dx=x,dy=y,dt=t;

		else

			T=false;

	}

	if(T) puts("Yes");

	else puts("No");

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main(){

	int n;

	scanf("%d",&n);

	int nowt=0,nowx=0,nowy=0;

	for(int i=1;i<=n;i++){

		int t,a,b;

		scanf("%d%d%d",&t,&a,&b);

		int pst=t-nowt;

		int psx=a-nowx,psy=b-nowy;

		int dis=abs(psx)+abs(psy);

		//printf("%d %d %d %d\n",t,a,b,dis);

		if(((dis&1)==(pst&1))&&(dis<=pst));

		else{

			printf("No");

			return 0;

		}

		nowt=t;

		nowx=a,nowy=b;

	}

	printf("Yes");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<iostream>

#include<algorithm>

using namespace std;



int main()

{

    int n,t=0,x=0,y=0,f=0;

    cin>>n;

    for(int i=0,tt,tx,ty;i<n;i++)

    {

        cin>>tt>>tx>>ty;

        if((abs(tx-x)+abs(ty-y))%2!=(tt-t)%2||abs(tx-x)+abs(ty-y)>(tt-t))

            f=1;

        t=tt,x=tx,y=ty;

    }

    if(!f)cout<<"Yes";

    else cout<<"No";

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main(){

	int n;

	scanf("%d",&n);

	int nowt=0,nowx=0,nowy=0;

	for(int i=1;i<=n;i++){

		int t,a,b;

		scanf("%d%d%d",&t,&a,&b);

		int pst=t-nowt;

		int psx=a-nowx,psy=b-nowy;

		int dis=abs(psx)+abs(psy);

		//printf("%d %d %d %d\n",t,a,b,dis);

		if(((dis&1)==(pst&1))&&(dis<=pst));

		else{

			printf("No");

			return 0;

		}

		nowt=t;

		nowx=a,nowy=b;

	}

	printf("Yes");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <cmath>

using namespace std;

int N;

const int maxn = 100001;

int x[maxn],y[maxn],t[maxn];



int main(){

    int min_time,time;

    bool flag = true;

    cin>>N;

    for(int i=1;i<=N;i++)

    {

        cin>>t[i]>>x[i]>>y[i];

    }

    for(int i=1;i<=N;i++)

    {

        time = abs(t[i]-t[i-1]);

        min_time = abs(x[i]+y[i]-x[i-1]-y[i-1]);

        if(time<min_time)

        {

            flag = false;

            break;

        }

        else if(time>min_time)

        {

            if(min_time%2!=time%2)

            {

                flag = false;

                break;

            }

        }

    }

    if(flag)

        cout<<"Yes"<<endl;

    else

        cout<<"No"<<endl;

    return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main(){

	int n;

	scanf("%d",&n);

	int nowt=0,nowx=0,nowy=0;

	for(int i=1;i<=n;i++){

		int t,a,b;

		scanf("%d%d%d",&t,&a,&b);

		int pst=t-nowt;

		int psx=a-nowx,psy=b-nowy;

		int dis=abs(psx)+abs(psy);

		//printf("%d %d %d %d\n",t,a,b,dis);

		if(((dis&1)==(pst&1))&&(dis<=pst));

		else{

			printf("No");

			return 0;

		}

		nowt=t;

		nowx=a,nowy=b;

	}

	printf("Yes");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



int n, t, x, y;



int main() {

	scanf("%d", &n);

	while (n--) {

		int tt, tx, ty;

		scanf("%d %d %d", &tt, &tx, &ty);

        if ((abs(tx - x) + abs(ty - y)) % 2 != (tt - t) % 2 || abs(tx - x) + abs(ty - y) > (tt - t)) {

            puts("No");

            return 0;

        }

        t = tt, x = tx, y = ty;

	}

	puts("Yes");

    return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main(){

	int n;

	scanf("%d",&n);

	int nowt=0,nowx=0,nowy=0;

	for(int i=1;i<=n;i++){

		int t,a,b;

		scanf("%d%d%d",&t,&a,&b);

		int pst=t-nowt;

		int psx=a-nowx,psy=b-nowy;

		int dis=abs(psx)+abs(psy);

		//printf("%d %d %d %d\n",t,a,b,dis);

		if(((dis&1)==(pst&1))&&(dis<=pst));

		else{

			printf("No");

			return 0;

		}

		nowt=t;

		nowx=a,nowy=b;

	}

	printf("Yes");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



using namespace std;



int main()

{

	int N;//特定时间个数 

	int x=0,y=0,t=0,flag=0;

	int tt,tx,ty;

	cin>>N;

	

	int i;

	for(i=0;i<N;i++)

	{

		//依次输入特点坐标并判断该坐标是否能在指定时间到达 

		cin>>tt>>tx>>ty;

		if((abs(tx-x)+abs(ty-y))%2!=abs(tt-t)%2||abs(tx-x)+abs(ty-y)>abs(tt-t))

			//两点需要的步数与实际走的步数奇偶性不同或者实际走的步数比需要走的步数多(超时) 

			flag=1;

		t=tt,x=tx,y=ty;//进行下一个点的判断 

	}

	

	if(!flag)cout<<"Yes";

	else cout<<"No";

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;



int main(){

	int n;

	scanf("%d",&n);

	int nowt=0,nowx=0,nowy=0;

	for(int i=1;i<=n;i++){

		int t,a,b;

		scanf("%d%d%d",&t,&a,&b);

		int pst=t-nowt;

		int psx=a-nowx,psy=b-nowy;

		int dis=abs(psx)+abs(psy);

		//printf("%d %d %d %d\n",t,a,b,dis);

		if(((dis&1)==(pst&1))&&(dis<=pst));

		else{

			printf("No");

			return 0;

		}

		nowt=t;

		nowx=a,nowy=b;

	}

	printf("Yes");

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

struct node{

	int t,x,y;

}N[100010];

int n,s=0;

bool cmp(node x,node y){

	return x.t<y.t;

}

int main(){

	scanf("%d",&n);

	N[0].x=0;N[0].y=0;N[0].t=0;

	for(int i=1;i<=n;i++){

		scanf("%d%d%d",&N[i].t,&N[i].x,&N[i].y);

	}

	sort(N+1,N+n+1,cmp);

	for(int i=1;i<=n;i++){

		int t,X,Y;

		X=abs(N[i].x-N[i-1].x);

		Y=abs(N[i].y-N[i-1].y);

		t=N[i].t-N[i-1].t;

		t-=(X+Y);

		if(t%2!=0||t<0){

			puts("No");

			return 0;

		}

	}

	puts("Yes");

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;



int a[100005];



int fun(int x, int y)

{

	if (x - y < 0) return y - x;

	else return x - y;

}



int main()

{

	int n, t, x, y, xx, yy, s, e, tt, q;

	while (~scanf("%d", &n))

	{

		e = 0;

		int i;

		x = y = t = q = 0;

		for (i = 0; i < n; i++)

		{

			scanf("%d%d%d", &tt, &xx, &yy);

			t = tt - q;

			q = tt;

			if (e == 0)

			{

				s = fun(xx, x) + fun(yy, y);

				if (t < s)

				{

					e++;

				}

				else

				if ((t - s) % 2 != 0)

				{

				    e++;

				}

				x = xx, y = yy;

			}

		}

		if (e == 0)

		printf("Yes\n");

		else printf("No\n");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int T,t,x,y,b,u,v,w;

int main() {

	scanf("%d",&T);

    while(T--) {

    	scanf("%d%d%d",&u,&v,&w); 

        if(abs(v-x)+abs(w-y)>abs(u-t)||(abs(u-t)-abs(v-x)-abs(w-y))%2) b=1;

        t=u; x=v; y=w;

    }

    puts(b?"No":"Yes");

    return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;



int a[100005];



int fun(int x, int y)

{

	if (x - y < 0) return y - x;

	else return x - y;

}



int main()

{

	int n, t, x, y, xx, yy, s, e, tt, q;

	while (~scanf("%d", &n))

	{

		e = 0;

		int i;

		x = y = t = q = 0;

		for (i = 0; i < n; i++)

		{

			scanf("%d%d%d", &tt, &xx, &yy);

			t = tt - q;

			q = tt;

			if (e == 0)

			{

				s = fun(xx, x) + fun(yy, y);

				if (t < s)

				{

					e++;

				}

				else

				if ((t - s) % 2 != 0)

				{

				    e++;

				}

				x = xx, y = yy;

			}

		}

		if (e == 0)

		printf("Yes\n");

		else printf("No\n");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>



#define For( i, a, b)	for(int i=a;i<=b;i++)

#define Rep( i, a, b)	for(int i=a;i>=b;i--)

#define n	100005



int N,t[n],x[n],y[n],a=0,b=0,ans=0,F[n];



int main()

{

	scanf("%d",&N);

	

	For( i, 1, N)

	{

		scanf("%d%d%d",&t[i],&x[i],&y[i]);

	}

	

	For( i, 1, N)

	{

		if(i!=1)	F[i]=t[i]-t[i-1];

		else

		F[i]=t[i];

		if(abs(x[i]-a)+abs(y[i]-b)<=F[i] && (F[i]-abs(x[i]-a)-abs(y[i]-b))%2==0)	ans++;

		a=x[i];

		b=y[i];

	}

	

	if(ans==N)		printf("Yes");

	else

	{

		if(ans!=N)		printf("No");

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;



int a[100005];



int fun(int x, int y)

{

	if (x - y < 0) return y - x;

	else return x - y;

}



int main()

{

	int n, t, x, y, xx, yy, s, e, tt, q;

	while (~scanf("%d", &n))

	{

		e = 0;

		int i;

		x = y = t = q = 0;

		for (i = 0; i < n; i++)

		{

			scanf("%d%d%d", &tt, &xx, &yy);

			t = tt - q;

			q = tt;

			if (e == 0)

			{

				s = fun(xx, x) + fun(yy, y);

				if (t < s)

				{

					e++;

				}

				else

				if ((t - s) % 2 != 0)

				{

				    e++;

				}

				x = xx, y = yy;

			}

		}

		if (e == 0)

		printf("Yes\n");

		else printf("No\n");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstring>

#define INF 1e9+7

int main()

{

    int m;

    int a[100004][3];

    while(scanf("%d",&m)!=EOF)

    {

    	a[0][0]=a[0][1]=a[0][2]=0;

    	for(int i=1;i<=m;i++)

    	{

    		int x,y,z;

    		scanf("%d%d%d",&x,&y,&z);

    		a[i][0]=x;a[i][1]=y;a[i][2]=z;

		}

		int ans=0;

		for(int i=1;i<=m;i++)

		{

			int ant=a[i][1]+a[i][2]-a[i-1][1]-a[i-1][2];

			int ant1=a[i][0]-a[i-1][0];

			if(ant1==ant)

			ans++;

			else if(ant1>ant)

			{

				ant1=ant1-ant;

				if(ant1%2==0)

			    ans++;

			}	

		}

//		printf("%d\n",ans);

		if(ans==m)

		printf("Yes\n");

		else

		printf("No\n");

	}

return 0;

}

// Optimized solution to the same problem (faster):
#include<stdio.h>

#include<string.h>

#include<algorithm>

using namespace std;



int a[100005];



int fun(int x, int y)

{

	if (x - y < 0) return y - x;

	else return x - y;

}



int main()

{

	int n, t, x, y, xx, yy, s, e, tt, q;

	while (~scanf("%d", &n))

	{

		e = 0;

		int i;

		x = y = t = q = 0;

		for (i = 0; i < n; i++)

		{

			scanf("%d%d%d", &tt, &xx, &yy);

			t = tt - q;

			q = tt;

			if (e == 0)

			{

				s = fun(xx, x) + fun(yy, y);

				if (t < s)

				{

					e++;

				}

				else

				if ((t - s) % 2 != 0)

				{

				    e++;

				}

				x = xx, y = yy;

			}

		}

		if (e == 0)

		printf("Yes\n");

		else printf("No\n");

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int main(){

	int n,x[100020],y[100020],t[100020],ans=0;

	cin>>n;

	for(int i=1;i<=n;i++){

		cin>>t[i]>>x[i]>>y[i];

	}

	for(int i=1;i<=n;i++){

		if((x[i]+y[i])%2!=t[i]%2){

			cout<<"No";

			return 0;

		}

		if(x[i]+y[i]<=t[i]){

			ans=ans+1;

		}

	}

	if(ans==n){

		cout<<"Yes";

	}

	else cout<<"No";

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

	int n;

	while(scanf("%d",&n)!=EOF){

		int T1=0,x1=0,y1=0,flag=true,T2,x2,y2;

		for(int i = 0; i < n; i++){

			scanf("%d %d %d",&T2,&x2,&y2);

			int c = max(x2,x1) - min(x2,x1);

			int d = max(y2,y1) - min(y2,y1);

			c = c + d;

			int e = T2-T1-c;

			if(e%2!=0||e<0){

				flag = false;

			}

			x1 = x2;	y1 = y2;	T1 = T2;

		}

		if(flag)	printf("Yes\n");

		else	printf("No\n");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;



#define DB	double

#define lf	else if

#define	I64	long long

#define Rd()	(rand() << 15 | rand())

#define For(i,a,b)	for(int i=a;i<=b;i++)

#define Rep(i,a,b)	for(int i=a;i>=b;i--)

	

#define fi	first

#define se	second

#define MK	make_pair

#define PA	pair<int, int>



#define CH	(ch=getchar())

int		IN()	{

		int x= 0, f= 0, ch;

		for (; CH < '0' || ch > '9';)	f= (ch == '-');

		for (; ch >= '0' && ch <= '9'; CH)	(x*= 10)+= ch - '0';

		return	f ? -x : x;

}



#define n	100005



int		N, X[n], Y[n], t[n];



int		main()	{

		N= IN();

		For(i, 1, N)	t[i]= IN(), X[i]= IN(), Y[i]= IN();

		

		For(i, 1, N)	{

			if	(abs(X[i] - X[i-1]) + abs(Y[i] - Y[i-1]) > t[i] - t[i-1] || (t[i] - t[i-1] - abs(X[i] - X[i-1]) + abs(Y[i] - Y[i-1])) % 2)	return	puts("No"), 0;

		}

		

		puts("Yes");

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

	int n;

	while(scanf("%d",&n)!=EOF){

		int T1=0,x1=0,y1=0,flag=true,T2,x2,y2;

		for(int i = 0; i < n; i++){

			scanf("%d %d %d",&T2,&x2,&y2);

			int c = max(x2,x1) - min(x2,x1);

			int d = max(y2,y1) - min(y2,y1);

			c = c + d;

			int e = T2-T1-c;

			if(e%2!=0||e<0){

				flag = false;

			}

			x1 = x2;	y1 = y2;	T1 = T2;

		}

		if(flag)	printf("Yes\n");

		else	printf("No\n");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <iostream>

#include <set>

#include <algorithm>

#include <string>

#include <cstring>

#include <map>

#include <cmath>

#include <queue>

using namespace std;

const int maxn = 1e5 + 100;

struct p{

    int x,y,t;

}a[maxn];

bool cmp(p a,p b){

     return a.t < b.t;

}

int main(){

    int N;

    scanf("%d",&N);

    for (int i = 0; i < N; i++){

        scanf("%d%d%d",&a[i].t,&a[i].x,&a[i].y);

    }

    a[N].t = 0;

    a[N].x = 0;

    a[N].y = 0;

    sort(a,a + N + 1, cmp);

    for (int i = 1; i <= N; i++){

        if (a[i].t == a[i - 1].t)

        {

             printf("No\n");

             return 0;

        }

        int dis = abs(a[i].x - a[i - 1].x)  + abs(a[i].y - a[i - 1].y);

        int t = abs(a[i].t - a[i - 1].t);

        if (dis > t)

        {

             printf("No\n");

             return 0;

        }else 

        {

            if (dis < t)

            {

                if ((t - dis) & 1)

                {

                    printf("No\n");

                    return 0;

                }

            }

        }

    }

    printf("Yes\n");

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

	int n;

	while(scanf("%d",&n)!=EOF){

		int T1=0,x1=0,y1=0,flag=true,T2,x2,y2;

		for(int i = 0; i < n; i++){

			scanf("%d %d %d",&T2,&x2,&y2);

			int c = max(x2,x1) - min(x2,x1);

			int d = max(y2,y1) - min(y2,y1);

			c = c + d;

			int e = T2-T1-c;

			if(e%2!=0||e<0){

				flag = false;

			}

			x1 = x2;	y1 = y2;	T1 = T2;

		}

		if(flag)	printf("Yes\n");

		else	printf("No\n");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
/*********************************

Date: Fri Mar  9 13:03:20 CST 2018

Author: ycl

*********************************/

#include <iostream>

#include <cstdio>

#include <string>

#include <cstring>

#include <cmath>

#include <cctype>

#include <cstdlib>

#include <algorithm>

#include <queue>

#include <stack>

#include <map>

#include <vector>

#include <list>

#include <set>

#include <sstream>

using namespace std;

#define CL(a) memset(a,0,sizeof(a))

#define Cl(a,b) memset(a,b,sizeof(a))

#define MP(a,b) make_pair(a,b)

#define INF 0x7fffffff

#define LL long long

const int MOD = 1e9 + 7;

const int maxn = 1e6 + 100;

struct Node

{

	int x,y,t;

	friend bool operator <(Node a,Node b)

	{

		return a.t<b.t;

	}

}node[maxn];

bool check(int v,int u)

{

	int d=abs(node[v].x-node[u].x) + abs(node[u].y-node[v].y) ;

	int t = node[u].t-node[v].t ;

	if (d<=t && (t-d)%2==0)

		return true;

	else

		return false;

}

int main()

{

	int n;

	scanf("%d",&n);

	for (int i=1;i<=n;++i){

		scanf("%d%d%d",&node[i].t,&node[i].x,&node[i].y);

	}

	sort(node,node+n);

	bool f=1;

	for (int i=0;i<n;++i){

		if (!check(i,i+1)){

			f=0;

			break;

		}

	}

	if (f)

		printf("Yes\n");

	else

		printf("No\n");

	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

	int n;

	while(scanf("%d",&n)!=EOF){

		int T1=0,x1=0,y1=0,flag=true,T2,x2,y2;

		for(int i = 0; i < n; i++){

			scanf("%d %d %d",&T2,&x2,&y2);

			int c = max(x2,x1) - min(x2,x1);

			int d = max(y2,y1) - min(y2,y1);

			c = c + d;

			int e = T2-T1-c;

			if(e%2!=0||e<0){

				flag = false;

			}

			x1 = x2;	y1 = y2;	T1 = T2;

		}

		if(flag)	printf("Yes\n");

		else	printf("No\n");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int t[100005],x[100005],y[100005];

int main()

{

	int n;

	cin>>n;

	for(int i=1;i<=n;i++)

		scanf("%d %d %d",&t[i],&x[i],&y[i]);

	int flag=0;

	for(int i=1;i<=n;i++)

	{

		int k=abs(x[i]-x[i-1])+abs(y[i]-y[i-1])-abs(t[i]-t[i-1]);

		if(abs(k)%2==1||k>0)

		{

			flag=1;

			break;

		}

	}

	if(flag)

		puts("No");

	else

		puts("Yes");

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

	int n;

	while(scanf("%d",&n)!=EOF){

		int T1=0,x1=0,y1=0,flag=true,T2,x2,y2;

		for(int i = 0; i < n; i++){

			scanf("%d %d %d",&T2,&x2,&y2);

			int c = max(x2,x1) - min(x2,x1);

			int d = max(y2,y1) - min(y2,y1);

			c = c + d;

			int e = T2-T1-c;

			if(e%2!=0||e<0){

				flag = false;

			}

			x1 = x2;	y1 = y2;	T1 = T2;

		}

		if(flag)	printf("Yes\n");

		else	printf("No\n");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstring>

#include<iostream>

#include<cmath>

#include<algorithm>

using namespace std;



int main()

{

	int n;

	while(~scanf("%d",&n)){

		int x1=0,y1=0,t1=0,x2,y2,t2;

		int flag=1;

		for(int i=1;i<=n;i++){

			scanf("%d%d%d",&t2,&x2,&y2);

			int s=abs(x2-x1)+abs(y2-y1);

			if(abs(s)>abs(t2-t1)) flag=0;

			s=abs(abs(s)-abs(t1-t2));

			if(s%2!=0){

				flag=0;

			}

			t1=t2;

			x1=x2;

			y1=y2;

			

		}

		if(flag==0){

			printf("No\n");

		}else{

			printf("Yes\n");

		}

		

	}

	

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<algorithm>

using namespace std;

int main()

{

	int n;

	while(scanf("%d",&n)!=EOF){

		int T1=0,x1=0,y1=0,flag=true,T2,x2,y2;

		for(int i = 0; i < n; i++){

			scanf("%d %d %d",&T2,&x2,&y2);

			int c = max(x2,x1) - min(x2,x1);

			int d = max(y2,y1) - min(y2,y1);

			c = c + d;

			int e = T2-T1-c;

			if(e%2!=0||e<0){

				flag = false;

			}

			x1 = x2;	y1 = y2;	T1 = T2;

		}

		if(flag)	printf("Yes\n");

		else	printf("No\n");

	}

	return 0;

}

// Fastest known solution for this problem: