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

#include<cstdio>

#include<cstring>

#include<algorithm>

const int Max = 1E5 + 10;

using namespace std;

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

int main()

{

    int T,X,Y,S,f=0;

    cin>>N;

    t[0]=0;

    x[0]=0;

    y[0]=0;

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

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

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

    {

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

    	X=x[i]-x[i-1];

    	Y=y[i]-y[i-1];

    	S=T-(X+Y);

    	if(S<0)

    	{

    		f=1;

		}

		else

		{

			if(S&1) 

			{

				f=1;

			}

			else

			    f=0;

		}

		if(f==1) break;

	}

	if(f==1) cout<<"No"<<endl;

	else if(f==0) cout<<"Yes"<<endl;

	return 0;

}


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

#include<stack>

#include<queue>

#include<string.h>

#include<algorithm>

#include<math.h>

#include<stdlib.h>

using namespace std;

int main()

{

	int n;

	scanf("%d",&n);

	int zuo=0;

	int bushu=0;

	int you=0;

	int f=1;

	int a,b,c;

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

	{

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

		if(f==0)

		continue;

		int g,h;

		g=abs(b-zuo);

		h=abs(c-you);

		bushu=a-bushu;

		if(b==zuo&&c==you&&bushu%2!=0)

	    {

		   f=0;

		}

		else if((g+h)>bushu)

		{

		   f=0;

	    }

		else if(bushu%2==0&&(g+h)%2!=0)

		{

		   f=0;

		}

		else if(bushu%2!=0&&(g+h)%2==0)

		{

			f=0;

		}

		else

		{

		   zuo=b;

		   you=c;

		   bushu=a;

		}

	}

	if(f==0)

	printf("No\n");

	else if(f==1)

	printf("Yes\n");

	return 0;

}

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

#include<cmath>

using namespace std;

struct Node{

	int x;

	int y;

	int t;

}N[100005];

int main()

{

 	int n,x,y,t,i,j;

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

	cin>>n;

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

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

	}

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

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

		if(x<0){

			x = (-1)*x;

		}

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

		if(y<0){

			y = (-1)*y;

		}

		if( (((N[i].t-N[i-1].t)-x-y)<0) || (((N[i].t-N[i-1].t)-x-y)%2 !=0)){

			cout<<"No";

			return 0;

		}

	}

	cout<<"Yes";

	return 0;

}

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

#include <cstdlib>

using namespace std;

int abs(int x) {

    return x > 0 ? x : -x;

}

int main() {

    int n;

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

    t = x = y = 0;

    scanf("%d", &n);

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

        scanf("%d%d%d", &nt, &nx, &ny);

        if ((abs(nx - x) + abs(ny - y) <= (nt - t)) &&

             ((nt - t - abs(nx - x) - abs(ny - y)) % 2 == 0)) {

            x = nx;

            y = ny;

            t = nt;

            continue;

        }

        // printf("%d\n", nt - t - abs(ny - y) - abs(nx - x));

        printf("No");

        return 0;

    }

    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,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 <cstdlib>

using namespace std;

int abs(int x) {

    return x > 0 ? x : -x;

}

int main() {

    int n;

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

    t = x = y = 0;

    scanf("%d", &n);

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

        scanf("%d%d%d", &nt, &nx, &ny);

        if ((abs(nx - x) + abs(ny - y) <= (nt - t)) &&

             ((nt - t - abs(nx - x) - abs(ny - y)) % 2 == 0)) {

            x = nx;

            y = ny;

            t = nt;

            continue;

        }

        // printf("%d\n", nt - t - abs(ny - y) - abs(nx - x));

        printf("No");

        return 0;

    }

    printf("Yes");

    return 0;

}


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

#include <cstdio>

#include <cstring>

#include <cmath>

using namespace std;

const int MAXN = 100010;

struct node{

    int x,y,t;

}plan[MAXN];



int main(){

    int n;

    int i;

    scanf("%d",&n);

    plan[0].t = 0;

    plan[0].x = 0;

    plan[0].y = 0;

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

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

    }

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

        int mint = abs(plan[i].x-plan[i-1].x)+abs(plan[i].y-plan[i-1].y);

        int realt = plan[i].t-plan[i-1].t;

        if(mint % 2 != realt % 2 || realt<mint)

            break;

    }

    if(i > n)

        printf("Yes\n");

    else

        printf("No\n");

    return 0;

}


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

#include <cstdlib>

using namespace std;

int abs(int x) {

    return x > 0 ? x : -x;

}

int main() {

    int n;

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

    t = x = y = 0;

    scanf("%d", &n);

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

        scanf("%d%d%d", &nt, &nx, &ny);

        if ((abs(nx - x) + abs(ny - y) <= (nt - t)) &&

             ((nt - t - abs(nx - x) - abs(ny - y)) % 2 == 0)) {

            x = nx;

            y = ny;

            t = nt;

            continue;

        }

        // printf("%d\n", nt - t - abs(ny - y) - abs(nx - x));

        printf("No");

        return 0;

    }

    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, lastt = 0, lastx = 0, lasty = 0;

	bool flag = true;

	cin >> n;

	while (n--) {

		int t, x, y;

		cin >> t >> x >> y;

		if (t - lastt < abs(lastx - x) + abs(lasty - y)) {

			flag = false;

		} else if ((t - lastt) % 2 != (abs(lastx - x) + abs(lasty - y)) % 2) {

			flag = false;

		}

		lastt = t, lastx = x, lasty = y;

	}

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

	return 0;

}

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

#include <cstdlib>

using namespace std;

int abs(int x) {

    return x > 0 ? x : -x;

}

int main() {

    int n;

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

    t = x = y = 0;

    scanf("%d", &n);

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

        scanf("%d%d%d", &nt, &nx, &ny);

        if ((abs(nx - x) + abs(ny - y) <= (nt - t)) &&

             ((nt - t - abs(nx - x) - abs(ny - y)) % 2 == 0)) {

            x = nx;

            y = ny;

            t = nt;

            continue;

        }

        // printf("%d\n", nt - t - abs(ny - y) - abs(nx - x));

        printf("No");

        return 0;

    }

    printf("Yes");

    return 0;

}


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

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <climits>

#include <cstring>

#include <string>

#include <vector>

#include <list>

#include <queue>

#include <stack>

#include <map>

#include <set>

#include <bitset>

#include <algorithm>

#include <functional>

#include <iomanip>

using namespace std;



#define LL long long

const int maxn = 100000 + 100;

int n;

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



int main() {

    #ifdef LOCAL

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

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

    #endif // LOCAL

    ios::sync_with_stdio(false);



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

        bool flag = true;

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

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

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

        }

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

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

            int tt = t[i] - t[i - 1];

            if(tmp > tt || tmp % 2 != tt % 2) {

                flag = false;

                break;

            }

        }

        if(flag) {

            printf("Yes\n");

        } else {

            printf("No\n");

        }

    }



    return 0;

}


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

#include <cstdlib>

using namespace std;

int abs(int x) {

    return x > 0 ? x : -x;

}

int main() {

    int n;

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

    t = x = y = 0;

    scanf("%d", &n);

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

        scanf("%d%d%d", &nt, &nx, &ny);

        if ((abs(nx - x) + abs(ny - y) <= (nt - t)) &&

             ((nt - t - abs(nx - x) - abs(ny - y)) % 2 == 0)) {

            x = nx;

            y = ny;

            t = nt;

            continue;

        }

        // printf("%d\n", nt - t - abs(ny - y) - abs(nx - x));

        printf("No");

        return 0;

    }

    printf("Yes");

    return 0;

}


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

#include <iostream>

#include <vector>

#include <queue>

#include <cstring>

#include <algorithm>

#include <set>

#include <string>

using namespace std;

int n,k,t,m,x,y,x1,y1,t1;

int main()

{

    scanf("%d",&n);

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

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

    {

        scanf("%d%d%d",&t1,&x1,&y1);

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

        if(t1-t<m||(t1-t-m)%2==1)

        {

            printf("No\n");

            return 0;

        }

        x=x1;

        y=y1;

        t=t1;

    }

    printf("Yes\n");

    return 0;

}


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

#include <cstdlib>

using namespace std;

int abs(int x) {

    return x > 0 ? x : -x;

}

int main() {

    int n;

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

    t = x = y = 0;

    scanf("%d", &n);

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

        scanf("%d%d%d", &nt, &nx, &ny);

        if ((abs(nx - x) + abs(ny - y) <= (nt - t)) &&

             ((nt - t - abs(nx - x) - abs(ny - y)) % 2 == 0)) {

            x = nx;

            y = ny;

            t = nt;

            continue;

        }

        // printf("%d\n", nt - t - abs(ny - y) - abs(nx - x));

        printf("No");

        return 0;

    }

    printf("Yes");

    return 0;

}


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

#include <algorithm>

#include <stdio.h>

#define max(x,y) (x)>(y)?(x):(y)

using namespace std;

const int maxn=1e5+10;

const int maxx=1e13+10;

int x[maxn];

int y[maxn];

int t[maxn];

int n;

int dis(int i)

{

    int disx=x[i]-x[i-1];

    int disy=y[i]-y[i-1];

    if(disx<=0) disx=-disx;

    if(disy<=0) disy=-disy;

    int diss=disx+disy;

    if(t[i]-t[i-1]<diss) return 0;

    else if(t[i]-t[i-1]==diss) return 1;

    else 

    {

        if((t[i]-t[i-1]-diss)%2==0) return 1;

        else return 0;

    }

}

int main()

{

	scanf("%d",&n);

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

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

    int flag=1; 

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

    {

        if(dis(i)==1) continue;

        else 

        {

            flag=0; break;

        }

    }

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

    else printf("No\n" );

}

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

#include <cstdlib>

using namespace std;

int abs(int x) {

    return x > 0 ? x : -x;

}

int main() {

    int n;

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

    t = x = y = 0;

    scanf("%d", &n);

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

        scanf("%d%d%d", &nt, &nx, &ny);

        if ((abs(nx - x) + abs(ny - y) <= (nt - t)) &&

             ((nt - t - abs(nx - x) - abs(ny - y)) % 2 == 0)) {

            x = nx;

            y = ny;

            t = nt;

            continue;

        }

        // printf("%d\n", nt - t - abs(ny - y) - abs(nx - x));

        printf("No");

        return 0;

    }

    printf("Yes");

    return 0;

}


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

using namespace std;

bool ans=true;

int y[100005],a[100005],b[100005],m[100005];

int main()

{

	int n;

	cin>>n;

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

	{

		cin>>m[i]>>a[i]>>b[i];

	}

	int p=0,q=0;

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

	{

		y[i]=m[i];

		if(i!=0)

		m[i]=m[i]-y[i-1];

		int c=abs(a[i]-p)+abs(b[i]-q)-m[i];

		if(abs(c)%2==0&&c<=0)

		{

			ans=true;

			p=a[i]; q=b[i];

		}

		else

		{

			ans=false;

			break;

		}

	}

	if(ans==true)

	cout<<"Yes"<<endl;

	else

	cout<<"No"<<endl;

	return 0;

}

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

#include <cstdlib>

using namespace std;

int abs(int x) {

    return x > 0 ? x : -x;

}

int main() {

    int n;

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

    t = x = y = 0;

    scanf("%d", &n);

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

        scanf("%d%d%d", &nt, &nx, &ny);

        if ((abs(nx - x) + abs(ny - y) <= (nt - t)) &&

             ((nt - t - abs(nx - x) - abs(ny - y)) % 2 == 0)) {

            x = nx;

            y = ny;

            t = nt;

            continue;

        }

        // printf("%d\n", nt - t - abs(ny - y) - abs(nx - x));

        printf("No");

        return 0;

    }

    printf("Yes");

    return 0;

}


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

#include<stdio.h>

#include<cstring>

#include<cmath>

#include<algorithm>

#include<vector>

#include<map>

#include<queue>

#define ll long long

int pos(int n)

{

    if(n<0)

        return 0;

    else

        return n;

}

using namespace std;

int main()

{

    int n,x=0,y=0,tx,ty,time=0,tptime=0,flag=0;

    cin>>n;

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

    {

        cin>>tptime>>tx>>ty;

        time=tptime-time;

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

        if(sum>time||(time-sum)%2!=0)

            flag=1;

        time=tptime,x=tx,y=ty;

    }

    if(flag==1)

        cout<<"No";

    else

        cout<<"Yes";

}


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

#include <cstdlib>

using namespace std;

int abs(int x) {

    return x > 0 ? x : -x;

}

int main() {

    int n;

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

    t = x = y = 0;

    scanf("%d", &n);

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

        scanf("%d%d%d", &nt, &nx, &ny);

        if ((abs(nx - x) + abs(ny - y) <= (nt - t)) &&

             ((nt - t - abs(nx - x) - abs(ny - y)) % 2 == 0)) {

            x = nx;

            y = ny;

            t = nt;

            continue;

        }

        // printf("%d\n", nt - t - abs(ny - y) - abs(nx - x));

        printf("No");

        return 0;

    }

    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 t[100005] = {};

  int x[100005] = {};

  int y[100005] = {};

  cin >> n;

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

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

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

    int tt = t[i] - t[i-1];

    if(dist > tt || (tt % 2 != dist % 2)){

      cout << "No" << endl;

      return 0;

    }

  }

  cout << "Yes" << endl;

  return 0;

}


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

using namespace std;



int main(){

    int n;

    cin >> n;

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

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

    int pt = 0, px = 0, py = 0;

    bool f = 1;

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

        int dx = abs(px - x[i]);

        int dy = abs(py - y[i]);

        int dt = t[i] - pt;

        if(dx + dy > dt || ((dx + dy) % 2 != dt % 2)) f = 0;

        px = x[i], py = y[i], pt = t[i];

    }

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

    return 0;

}


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

#include <vector>



using namespace std;



int n;

vector<int> t(100001);

vector<int> x(100001);

vector<int> y(100001);



int main(){

    cin >> n;

    t[0] = 0;

    x[0] = 0;

    y[0] = 0;

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

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

    }



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

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

        int B = t[i] - t[i-1];



        if(B < A){

            cout << "No" << endl;

            return 0;

        }

        else{

            if(B % 2 == 0){

                if(A % 2 == 0) continue;

                else{

                    cout << "No" << endl;

                    return 0;

                }

            }

            else{

                if(A % 2 != 0) continue;

                else{

                    cout << "No" << endl;

                    return 0;

                }

            }

        }

    }



    cout << "Yes" << endl;

    return 0;

}


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

#include <cstring>

#include <vector>

#include <algorithm>

#include <cmath>

#include <string>

#include <set>

#include <utility>

#include <cstdlib>

#include <queue>

#include <stack>

#include <iomanip>

#include <cstdio>

#include <map>



using namespace std;



using ll = long long;

using P = pair<ll,ll>;



#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)

#define rrep(i,x) for(ll i = ((ll)(x) - 1); i >= 0; i--)



#define all(x) (x).begin(), (x).end()

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define chmin(x,y) (x=min(x,y))

#define chmax(x,y) (x=max(x,y))



ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}

int dx[4] = {1,0,-1,0};

int dy[4] = {0,1,0,-1};



const ll mod = 1e9 + 7;

const ll IMF = 1LL<< 29;

const double PI = 3.14159265358979323846;





int main(){

        ll N;

        cin >> N;

        vector<ll> t(N), x(N), y(N);

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

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

        }



        int time = 0;

        int xxx = 0;

        int yyy = 0;



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

                if(t[i] - time >= (abs(x[i] - xxx) + abs(y[i] - yyy)) && (t[i] - time) % 2 == (abs(x[i] - xxx) + abs(y[i] - yyy)) % 2){

                        time = t[i];

                        xxx = x[i];

                        yyy = y[i];

                        continue;

                }

                cout << "No" << endl;

                return 0;

        }

        

        cout << "Yes" << endl;

        return 0;

}




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

#include <cstring>

#include <cstdlib>





int main()

{

    const uint N_MAX = 100000;



    int N = 1;

    // int t[N_MAX], x[N_MAX], y[N_MAX] = {0};

    int t, x, y = 0;

    bool possible = true;



    // Input number of stop

    std::cin >> N;

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

        // Input each time and stop

        std::cin >> t >> x >> y;



        // Judge

        // Max distance

        possible = x + y <= t;

        // Count

        if (possible) {

            possible = (x + y + t) % 2 == 0;

        }

        if (!possible) {

            break;

        }

    }



    // Output

    std::cout << (possible ? "Yes" : "No") << std::endl;

    return 0;

}


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





int main()

{

    const int N_MAX = 100000;



    int N = 1;

    // int t[N_MAX], x[N_MAX], y[N_MAX] = {0};

    int t, x, y = 0;

    bool possible = true;



    // Input number of stop

    scanf("%d", &N);

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

        // Input each time and stop

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



        // Judge

        // Max distance

        possible = x + y <= t;

        // Count

        if (possible) {

            possible = (x + y + t) % 2 == 0;

        }

        if (!possible) {

            break;

        }

    }



    // Output

    if (possible)

        puts("Yes");

    else

        puts("No");

    return 0;

}


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

#include<string>

#include<vector>

#include<list>

#include<stack>

#include<queue>

#include<map>

#include<algorithm>

#include<numeric>



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

#define REP(i, n) for (int i = 0; i < (n); i++)



using namespace std;



using ll = long long;

using pii = pair<int, int>;

using vi = vector<int>;



const int mod = 1e9 + 7;

const long double pi = 3.141592653589793238462643383279502884197;

const long double eps = 1e-7;



int main() {

	int N;

	cin >> N;



	int pre_t = 0, pre_x = 0, pre_y = 0;

	int t, x, y;

	REP(i, N) {

		cin >> t >> x >> y;



		int rest_t = t - pre_t;

		// まず最低限必要な時間

		rest_t -= abs(x - pre_x) + abs(y - pre_y);

		if (rest_t < 0) {

			cout << "No" << endl;

			return 0;

		}

		else if (rest_t % 2 == 1) {

			cout << "No" << endl;

			return 0;

		}



		// update

		pre_t = t;

		pre_x = x;

		pre_y = y;

	}



	cout << "Yes" << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#define _CRT_SECURE_NO_WARNINGS

#include<cstdio>

#include<cstdlib>



using namespace std;



template<class T> void gc(T &x)

{

	char c;

	int s = 0;

	x = 0;



	c = getchar_unlocked();



	if (c == '-') s = 1;

	else if ('0' <= c && c <= '9')  x = c - '0';



	while (true)

	{

		c = getchar_unlocked();



		if (c < '0' || c > '9') break;

		x = x * 10 + (c - '0');

	}



	if (s) x = -x;

}

int N;

// 現在の場所

int now_t, now_x, now_y;

// 次に行く場所

int t, x, y;



int main() {

	int N;

	gc(N);



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

		gc(t);

		gc(x);

		gc(y);



		// まず最低限必要な時間

		int rest_t = t - now_t - (abs(x - now_x) + abs(y - now_y));

		if (rest_t < 0 || rest_t % 2 == 1) {

			printf("No\n");

			return 0;

		}



		// 更新

		now_t = t;

		now_x = x;

		now_y = y;

	}



	printf("Yes\n");

	return 0;

}

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



#include<iostream>

#include<string>

#include<vector>

#include<list>

#include<stack>

#include<queue>

#include<map>

#include<algorithm>

#include<numeric>



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

#define REP(i, n) for (int i = 0; i < (n); i++)



using namespace std;



using ll = long long;

using pii = pair<int, int>;

using vi = vector<int>;



const int mod = 1e9 + 7;

const long double pi = 3.141592653589793238462643383279502884197;

const long double eps = 1e-7;



int main() {

	int N;

	scanf("%d", &N);



	// 現在の場所

	int now_t = 0, now_x = 0, now_y = 0;

	// 次に行く場所

	int t, x, y;



	REP(i, N) {

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



		// まず最低限必要な時間

		int rest_t = t - now_t - (abs(x - now_x) + abs(y - now_y));

		if (rest_t < 0 || rest_t % 2 == 1) {

			printf("No\n");

			return 0;

		}



		// 更新

		now_t = t;

		now_x = x;

		now_y = y;

	}



	cout << "Yes" << endl;

	return 0;

}

// Optimized solution to the same problem (faster):
#define _CRT_SECURE_NO_WARNINGS

#include<cstdio>

#include<cstdlib>



using namespace std;



template<class T> void gc(T &x)

{

	char c;

	int s = 0;

	x = 0;



	c = getchar_unlocked();



	if (c == '-') s = 1;

	else if ('0' <= c && c <= '9')  x = c - '0';



	while (true)

	{

		c = getchar_unlocked();



		if (c < '0' || c > '9') break;

		x = x * 10 + (c - '0');

	}



	if (s) x = -x;

}

int N;

// 現在の場所

int now_t, now_x, now_y;

// 次に行く場所

int t, x, y;



int main() {

	int N;

	gc(N);



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

		gc(t);

		gc(x);

		gc(y);



		// まず最低限必要な時間

		int rest_t = t - now_t - (abs(x - now_x) + abs(y - now_y));

		if (rest_t < 0 || rest_t % 2 == 1) {

			printf("No\n");

			return 0;

		}



		// 更新

		now_t = t;

		now_x = x;

		now_y = y;

	}



	printf("Yes\n");

	return 0;

}

// Fastest known solution for this problem: