stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 4.487523816915566x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 4.486112814263796x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 4.48609348887844x):
#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;

}
// Slower C++ solution:
/*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;

}

// Faster C++ solution for the same problem (measured speedup: 5.222367023825066x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.281895171979509x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 5.29619379993129x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.221306714596782x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.28179654532086x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.2261576699989485x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.22451442026217x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.224491913972504x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.1645971995288644x):
#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;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.400384351819448x):
#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <cstring>

#include <cctype>

#include <ctime>

#include <algorithm>

#include <vector>

#include <stack>

#include <queue>

#include <set>

#include <map>



using namespace std;



typedef long long ll;

#ifdef __linux

#define LLD "%lld"

#else

#define LLD "%I64d"

#endif



#define NMAX 100000



struct p{

	int x,y,t;

};



int n;

p ps[NMAX+1000];



inline int dis(int x1,int y1,int x2,int y2){

	return abs(x2-x1)+abs(y2-y1);

}



inline bool check(){

	int i;



	p last=(p){0,0,0};

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

		int dd=dis(last.x,last.y,ps[i].x,ps[i].y);

		int dt=ps[i].t-last.t;

		if(dt<dd)return false;

		int lt=dt-dd;

		if(lt%2)return false;

		last=ps[i];

	}

	return true;

}





int main(){

	int i;



	scanf("%d",&n);

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

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

	}



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

	else printf("No\n");

	return 0;

}
// Slower C++ solution:
#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");

}


// Faster C++ solution for the same problem (measured speedup: 5.201696655127451x):
#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <cstring>

#include <cctype>

#include <ctime>

#include <algorithm>

#include <vector>

#include <stack>

#include <queue>

#include <set>

#include <map>



using namespace std;



typedef long long ll;

#ifdef __linux

#define LLD "%lld"

#else

#define LLD "%I64d"

#endif



#define NMAX 100000



struct p{

	int x,y,t;

};



int n;

p ps[NMAX+1000];



inline int dis(int x1,int y1,int x2,int y2){

	return abs(x2-x1)+abs(y2-y1);

}



inline bool check(){

	int i;



	p last=(p){0,0,0};

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

		int dd=dis(last.x,last.y,ps[i].x,ps[i].y);

		int dt=ps[i].t-last.t;

		if(dt<dd)return false;

		int lt=dt-dd;

		if(lt%2)return false;

		last=ps[i];

	}

	return true;

}





int main(){

	int i;



	scanf("%d",&n);

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

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

	}



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

	else printf("No\n");

	return 0;

}
// Slower C++ solution:
#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");

}

// Faster C++ solution for the same problem (measured speedup: 5.220732789772372x):
#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <cstring>

#include <cctype>

#include <ctime>

#include <algorithm>

#include <vector>

#include <stack>

#include <queue>

#include <set>

#include <map>



using namespace std;



typedef long long ll;

#ifdef __linux

#define LLD "%lld"

#else

#define LLD "%I64d"

#endif



#define NMAX 100000



struct p{

	int x,y,t;

};



int n;

p ps[NMAX+1000];



inline int dis(int x1,int y1,int x2,int y2){

	return abs(x2-x1)+abs(y2-y1);

}



inline bool check(){

	int i;



	p last=(p){0,0,0};

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

		int dd=dis(last.x,last.y,ps[i].x,ps[i].y);

		int dt=ps[i].t-last.t;

		if(dt<dd)return false;

		int lt=dt-dd;

		if(lt%2)return false;

		last=ps[i];

	}

	return true;

}





int main(){

	int i;



	scanf("%d",&n);

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

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

	}



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

	else printf("No\n");

	return 0;

}
// Slower C++ solution:
/*********************************

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;

}


// Faster C++ solution for the same problem (measured speedup: 5.220116366617551x):
#include <cstdio>

#include <cmath>

#include <cstdlib>

#include <cstring>

#include <cctype>

#include <ctime>

#include <algorithm>

#include <vector>

#include <stack>

#include <queue>

#include <set>

#include <map>



using namespace std;



typedef long long ll;

#ifdef __linux

#define LLD "%lld"

#else

#define LLD "%I64d"

#endif



#define NMAX 100000



struct p{

	int x,y,t;

};



int n;

p ps[NMAX+1000];



inline int dis(int x1,int y1,int x2,int y2){

	return abs(x2-x1)+abs(y2-y1);

}



inline bool check(){

	int i;



	p last=(p){0,0,0};

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

		int dd=dis(last.x,last.y,ps[i].x,ps[i].y);

		int dt=ps[i].t-last.t;

		if(dt<dd)return false;

		int lt=dt-dd;

		if(lt%2)return false;

		last=ps[i];

	}

	return true;

}





int main(){

	int i;



	scanf("%d",&n);

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

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

	}



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

	else printf("No\n");

	return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 5.401556748656534x):
#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;

}