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

using namespace std;

int main()

{

	int N,t,x,y;

	cin>>N;

	int flag=0;

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

	{

	   cin>>t>>x>>y;

	   int tmp=x+y;

	   if(tmp>t) flag=1;

	   else

	   	   if((t-tmp)%2==1) flag=1;

	}

	if(flag==0) cout<<"Yes"<<endl;

	else cout<<"No"<<endl;

	return 0;

}

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

using namespace std;

int main()

{

    int n,t,x,y;

    scanf("%d",&n);

    for(int 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");//因为如果No就都return 0了，所以剩下一定是Yes。

    return 0;

}


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

using namespace std;

int main() {

    int n,a,b,c,f=1;

    scanf("%d",&n);

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

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

        if(a<b+c||(a-b-c)&1){f=0;break;}

    }

    if(f)printf("Yes");

    else printf("No");

}

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

using namespace std;

int main()

{

    int n,t,x,y;

    scanf("%d",&n);

    for(int 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");//因为如果No就都return 0了，所以剩下一定是Yes。

    return 0;

}


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

using namespace std;



int main(){

	int n;

	cin>>n;

	int t[n+10],x[n+10],y[n+10];

	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]>t[i]||(t[i]-x[i]-y[i])%2!=0){

			cout<<"No"<<endl;

			return 0;

		}

	}

	cout<<"Yes"<<endl;

	return 0;

} 


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

using namespace std;

int main()

{

    int n,t,x,y;

    scanf("%d",&n);

    for(int 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");//因为如果No就都return 0了，所以剩下一定是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() {

	ios::sync_with_stdio(false);

	cin >> n;

	while(n--) {

		cin >> t >> x >> y;

		if(x + y > t || t - x - y & 1) {

			cout << "No\n";

			return 0;

		}

	}

	cout << "Yes\n";

	return 0;

}

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

using namespace std;

int main()

{

    int n,t,x,y;

    scanf("%d",&n);

    for(int 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");//因为如果No就都return 0了，所以剩下一定是Yes。

    return 0;

}


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

const int N=100001;

using namespace std;

int main(){

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

    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]>t[i]||(t[i]-x[i]-y[i])%2!=0)

        {

            cout<<"No";

            return 0;   

        }

    cout<<"Yes";

    return 0;

}

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

using namespace std;

int main()

{

    int n,t,x,y;

    scanf("%d",&n);

    for(int 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");//因为如果No就都return 0了，所以剩下一定是Yes。

    return 0;

}


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

#include <algorithm>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <cmath>

#include <iomanip>

using namespace std;

int sx,sy,x,y,n,sm,m,flag = 1;



int main()

{

    cin>>n;

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

    {

        cin>>m>>x>>y;

        if(x == sx && y == sy)

        {

            if((m - sm) % 2)flag = 0;

        }

        else

        {

            int d = abs(x - sx) + abs(y - sy);

            if(!((m - sm) && (m - sm) % d == 0 && ((m - sm) / d) % 2))flag = 0;

        }

        sx = x,sy = y,sm = m;

    }

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

    else cout<<"No"<<endl;

}


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

#include<string.h>

#include<math.h>

#include<algorithm>

using namespace std;



int n,x,y,t,ti,xi,yi;



int main()

{

    scanf("%d",&n);

    x = 0, y = 0, t = 0;

    bool ans = 1;

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

    {

        scanf("%d %d %d",&ti,&xi,&yi);



        int ned = abs(x-xi)+abs(y-yi);

        if (ned > ti-t) ans = 0;



        int tag = (ti-t)-ned;

        if (tag % 2) ans = 0;



        x = xi, y = yi, t = ti;

    }

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

    else

        printf("No\n");

    return 0;

}


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

#include <cmath>



using namespace std;

int main(){

	int n, t = 0, x = 0, y = 0, flag = 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))

			flag = 1;

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

	}

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

	else cout << "No" << endl;



	return 0;

}

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

#include<string.h>

#include<math.h>

#include<algorithm>

using namespace std;



int n,x,y,t,ti,xi,yi;



int main()

{

    scanf("%d",&n);

    x = 0, y = 0, t = 0;

    bool ans = 1;

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

    {

        scanf("%d %d %d",&ti,&xi,&yi);



        int ned = abs(x-xi)+abs(y-yi);

        if (ned > ti-t) ans = 0;



        int tag = (ti-t)-ned;

        if (tag % 2) ans = 0;



        x = xi, y = yi, t = ti;

    }

    if (ans) 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,dis,x,y;

    scanf("%d",&n);

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

    {

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

        if(dis<(x+y))

        {

            printf("No");

            return 0;

        }

        else

        {

            if((x+y)%2==0)

            {

                if(dis%2==0)

                    continue;

                else

                {

                    printf("No");

                    return 0;

                }

            }

            else

            {

                if(dis%2==0)

                {

                    printf("No");

                    return 0;

                }

                else

                    continue;

            }

        }



    }

    printf("Yes");

    return 0;

}


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

#include<string.h>

#include<math.h>

#include<algorithm>

using namespace std;



int n,x,y,t,ti,xi,yi;



int main()

{

    scanf("%d",&n);

    x = 0, y = 0, t = 0;

    bool ans = 1;

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

    {

        scanf("%d %d %d",&ti,&xi,&yi);



        int ned = abs(x-xi)+abs(y-yi);

        if (ned > ti-t) ans = 0;



        int tag = (ti-t)-ned;

        if (tag % 2) ans = 0;



        x = xi, y = yi, t = ti;

    }

    if (ans) 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 <algorithm>

#define MAXN 100005

using namespace std ;



int n,x,y,t;



struct DATA{

	int x,y,t;

	bool operator <(const DATA v)const{return t<v.t;}

} A[MAXN];



inline int red(){

	int Res; char ch; bool flg; Res=flg=0;

	while (ch=getchar(),ch<48||57<ch) flg^=!(ch^'-'); Res=(ch&15);

	while (ch=getchar(),47<ch&&ch<58) Res=(Res<<1)+(Res<<3)+(ch&15);

	if (flg) return -Res; return Res;

}



int abs_(int x){

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

}



int get(int x,int y,int x_,int y_){

	return abs_(x-x_)+abs_(y-y_);

}



int main(){

	n=red();

	for (int i=1;i<=n;i++) A[i].t=red(),A[i].x=red(),A[i].y=red();

	sort(A+1,A+1+n);

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

		int len=get(x,y,A[i].x,A[i].y);

		if (!(len<=A[i].t-t&&(len&1)==((A[i].t-t)&1))){

			puts("No");

			return 0;

		}

	}

	puts("Yes");

	return 0 ;

}

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

#include<string.h>

#include<math.h>

#include<algorithm>

using namespace std;



int n,x,y,t,ti,xi,yi;



int main()

{

    scanf("%d",&n);

    x = 0, y = 0, t = 0;

    bool ans = 1;

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

    {

        scanf("%d %d %d",&ti,&xi,&yi);



        int ned = abs(x-xi)+abs(y-yi);

        if (ned > ti-t) ans = 0;



        int tag = (ti-t)-ned;

        if (tag % 2) ans = 0;



        x = xi, y = yi, t = ti;

    }

    if (ans) 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 n, t, x, y, px, py, pt;



int main() {

	scanf("%d", &n);

	while (n--) {

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

		int md = abs(px - x) + abs(py - y);

		if (md > t - pt) {

			puts("No");

			return 0;

		}

		if (md % 2 != (t - pt) % 2) {

			puts("No");

			return 0;

		}

		px = x; py = y; pt = t;

	}

	puts("Yes");

}

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

#include<string.h>

#include<math.h>

#include<algorithm>

using namespace std;



int n,x,y,t,ti,xi,yi;



int main()

{

    scanf("%d",&n);

    x = 0, y = 0, t = 0;

    bool ans = 1;

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

    {

        scanf("%d %d %d",&ti,&xi,&yi);



        int ned = abs(x-xi)+abs(y-yi);

        if (ned > ti-t) ans = 0;



        int tag = (ti-t)-ned;

        if (tag % 2) ans = 0;



        x = xi, y = yi, t = ti;

    }

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

    else

        printf("No\n");

    return 0;

}


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

#include <iostream>

using namespace std;

const int mod = 1000000007;

const int N = 100005;

int abs(int x){

	if (x < 0) return -x;

	return x;

}

int main(){

	int n;

	cin>>n;

	int flag = 1; int t,x,y,tx,ty,a;

	t = tx = ty = 0;

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

		cin>>a>>x>>y;

		//printf("%d %d %d\n",a-t,abs(x - tx + y - ty),a - t - abs(x-tx + y - ty));

		if (a - t < abs(x-tx + y - ty)) flag = 0;

		else if (a - t > abs(x- tx + y- ty) && ((a - t - abs(x-tx + y - ty))%2 != 0)) flag = 0;

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

	}

	if (flag) puts("Yes");

	else puts("No");

	return 0;

}

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

int s[100005][5];

int main()

{

    int n,first=0;

    scanf("%d",&n);

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

        for(int j = 1;j <= 3;j++)

        scanf("%d",&s[i][j]);

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

    {

        int a,b;

        a = (s[i][2]+s[i][3])-(s[i-1][2]+s[i-1][3]);

        if(a<0) a=-a;

        b = s[i][1]-s[i-1][1];

        if(a>b||(a-b)%2||a==0&&(b-4)%2)  {first = 1;break;}

    }

    if(first)  printf("No");

    else printf("Yes");

    return 0;

}

   


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

using namespace std;

#define LL long long 

#define ULL unsigned long long 



const int N = 2e5+11;

const int M = 1e6+11;

const int mod = 1e9+7;

const int inf = 0x3f3f3f3f;

const LL inff = 0x3f3f3f3f3f3f3f3f;





/*-----------------------------------------*/





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

int main(){

  	int n;scanf("%d",&n);

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

	int X,Y; X=Y=0; 

	int flag=1;

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

		int step=abs(x[i]-X)+abs(y[i]-Y); 

		int cha;

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

		if(i==1) cha=t[i]-step;  

		else cha=(t[i]-t[i-1])-step; 

		

		if(cha<0) {

			flag=0;break;

		}

		if(cha%2==0){

			X=x[i]; Y=y[i];continue;

		}else {

			flag=0;

			break;

		}

	}

	

	if(flag) puts("Yes");

	else puts("No");

return 0;

}


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

int s[100005][5];

int main()

{

    int n,first=0;

    scanf("%d",&n);

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

        for(int j = 1;j <= 3;j++)

        scanf("%d",&s[i][j]);

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

    {

        int a,b;

        a = (s[i][2]+s[i][3])-(s[i-1][2]+s[i-1][3]);

        if(a<0) a=-a;

        b = s[i][1]-s[i-1][1];

        if(a>b||(a-b)%2||a==0&&(b-4)%2)  {first = 1;break;}

    }

    if(first)  printf("No");

    else printf("Yes");

    return 0;

}

   


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

#include<cstring>

#include<algorithm>

#include<iostream>

#include<cmath>

using namespace std;

int a[100005];

int main()

{

	int n;

	int t,x,y,k,m=0,x1=0,y1=0,t1=0;

	cin>>n;

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

	{

		cin>>t>>x>>y;

		k=abs(x-x1)+abs(y-y1);

		if(((t-t1)-k)%2==0&&(t-t1)-k>=0)

		a[i]=1;

		else

		a[i]=0;

		x1=x;

		y1=y;

		t1=t;

    }

    int i;

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

    {

    	if(a[i]==0)

    	{

    		printf("No\n");

    		break;

		}

	}

	if(i>n)

	printf("Yes\n");

return 0;

}

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

int s[100005][5];

int main()

{

    int n,first=0;

    scanf("%d",&n);

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

        for(int j = 1;j <= 3;j++)

        scanf("%d",&s[i][j]);

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

    {

        int a,b;

        a = (s[i][2]+s[i][3])-(s[i-1][2]+s[i-1][3]);

        if(a<0) a=-a;

        b = s[i][1]-s[i-1][1];

        if(a>b||(a-b)%2||a==0&&(b-4)%2)  {first = 1;break;}

    }

    if(first)  printf("No");

    else printf("Yes");

    return 0;

}

   


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

int main(){

	int n;

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

	{

		int jin=0;

		int ti[100050]={0};

		int xi[100050]={0};

		int yi[100050]={0};

		int i;

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

		{

			scanf("%d%d%d",&ti[i],&xi[i],&yi[i]);

			int sum=xi[i]+yi[i]-xi[i-1]-yi[i-1];

			if(jin!=0)continue;

			if(sum<0){

				sum=-sum;

			}

			if(ti[i]>=sum){

				int l1=(ti[i]-ti[i-1])%2;

				int l2=sum%2;

				if(l1!=l2){

					jin=5;

				}

			}else {

				jin=5;

			}

		}

		if(jin){

			printf("No\n");

		}else {

			printf("Yes\n");

		}

		

	}

	return 0;

}

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

int s[100005][5];

int main()

{

    int n,first=0;

    scanf("%d",&n);

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

        for(int j = 1;j <= 3;j++)

        scanf("%d",&s[i][j]);

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

    {

        int a,b;

        a = (s[i][2]+s[i][3])-(s[i-1][2]+s[i-1][3]);

        if(a<0) a=-a;

        b = s[i][1]-s[i-1][1];

        if(a>b||(a-b)%2||a==0&&(b-4)%2)  {first = 1;break;}

    }

    if(first)  printf("No");

    else printf("Yes");

    return 0;

}

   


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

#include<cstdio>

#include<cmath>

using namespace std;

int main()

{

	int n,t,x,y,tt,xx,yy;

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

	{

		t=0,x=0,y=0;

		int flag=0;

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

		{

			cin>>tt>>xx>>yy;

			if(flag)

				continue;

			int te=tt-t-(abs(yy-y)+abs(xx-x));

			if(te<0)

				flag=1; 

			else

			{

				if(te&1)

					flag=1;			

			} 

			t=tt,x=xx,y=yy;

		}

		if(flag)

			cout<<"No";

		else

			cout<<"Yes";

	}

	return 0;

}

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

int s[100005][5];

int main()

{

    int n,first=0;

    scanf("%d",&n);

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

        for(int j = 1;j <= 3;j++)

        scanf("%d",&s[i][j]);

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

    {

        int a,b;

        a = (s[i][2]+s[i][3])-(s[i-1][2]+s[i-1][3]);

        if(a<0) a=-a;

        b = s[i][1]-s[i-1][1];

        if(a>b||(a-b)%2||a==0&&(b-4)%2)  {first = 1;break;}

    }

    if(first)  printf("No");

    else printf("Yes");

    return 0;

}

   


// Fastest known solution for this problem:
// Original C++ solution (slower):
#define _CRT_SECURE_NO_WARNINGS





#include<iostream>

#include<cstdio>

#include<algorithm>

#include<cmath>

#include<string>

#include<climits>

#include<vector>

#include<cstring>

#include<queue>







using std::cout;

using std::endl;

using std::cin;

using std::sort;

using std::strcmp;

using std::vector;

using std::queue;



#define SIZE 200

#define MINE -1

int map[SIZE][SIZE];







int main(int argc, char** argv)

{



	if (argc == 2 && strcmp(argv[1], "-debug") == 0)

	{

		freopen("in.txt", "r", stdin);

		freopen("out.txt", "w", stdout);

	}



	int n;

	cin >> n;

	int t, x, y;

	int t1 = 0, x1 = 0, y1 = 0;//上一步的数据

	int dt;

	int step = 0;

	bool success = true;

	while (n--)

	{

		cin >> t >> x >> y;

		dt = t - t1;

		step = std::abs(x - x1) + std::abs(y - y1);



		if (step > dt || (dt - step) % 2 == 1)

		{

			success = false;

			break;

		}



		t1 = t;

		x1 = x;

		y1 = y;

	}



	if (success)

		cout << "Yes";

	else

		cout << "No";





	return 0;

}




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

int s[100005][5];

int main()

{

    int n,first=0;

    scanf("%d",&n);

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

        for(int j = 1;j <= 3;j++)

        scanf("%d",&s[i][j]);

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

    {

        int a,b;

        a = (s[i][2]+s[i][3])-(s[i-1][2]+s[i-1][3]);

        if(a<0) a=-a;

        b = s[i][1]-s[i-1][1];

        if(a>b||(a-b)%2||a==0&&(b-4)%2)  {first = 1;break;}

    }

    if(first)  printf("No");

    else printf("Yes");

    return 0;

}

   


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

#include<stdio.h>

#include<string.h>

#include<cmath>

using namespace std;



struct _point

{

    int x;

    int y;

    int t;

}p[100010];



int main()

{

    int n;

    scanf("%d",&n);

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

    {

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

    }

    int ret=1;

    p[0].x=0;

    p[0].y=0;

    p[0].t=0;

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

    {

        int len=abs(p[i].x-p[i-1].x)+abs(p[i].y-p[i-1].y);

        int now=p[i].t-p[i-1].t;

        int x=now-len;

        if(x<0||x%2!=0)

        {

            ret=0;

            break;

        }

    }



    if(ret)

    printf("Yes\n");

    else

    printf("No\n");

    return 0;

}


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

int s[100005][5];

int main()

{

    int n,first=0;

    scanf("%d",&n);

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

        for(int j = 1;j <= 3;j++)

        scanf("%d",&s[i][j]);

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

    {

        int a,b;

        a = (s[i][2]+s[i][3])-(s[i-1][2]+s[i-1][3]);

        if(a<0) a=-a;

        b = s[i][1]-s[i-1][1];

        if(a>b||(a-b)%2||a==0&&(b-4)%2)  {first = 1;break;}

    }

    if(first)  printf("No");

    else printf("Yes");

    return 0;

}

   


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

#include <cstdlib>

#include <iomanip>

#include <cmath>

#include <string>

#include <cstring>

#include <algorithm>

#include <vector>

#include <sstream>

#include <set>

#include <queue>

#include <stack>

#include <cctype>

#include <map>

#include <climits>

#include <bitset>

using namespace std;

#define MATH_PI 3.14159265358979323846

int main(){

	ios::sync_with_stdio(false);

	int n;

	cin >> n;

	int x = 0, y = 0;

	int t = 0;

	int a, b, c;

	register int i;

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

		cin >> c >> a >> b;

		if (abs(x - a) + abs(y - b)>c - t){

			cout << "No\n";

			goto endapp;

		}

		if ((abs(x - a) + abs(y - b)) % 2 == 0 && (c - t) % 2 == 1){

			cout << "No\n";

			goto endapp;

		}

		if ((abs(x - a) + abs(y - b)) % 2 == 1 && (c - t) % 2 == 0){

			cout << "No\n";

			goto endapp;

		}

		x = a;

		y = b;

		t = c;

	}

	cout << "Yes\n";

endapp:

	//system("pause > nul");

	return 0;

}

// Optimized solution to the same problem (faster):
// luogu-judger-enable-o2

#include<cstdio>

using namespace std;

int main()

{

    int n,t,x,y;

    scanf("%d",&n);

    for(int 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: