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

}


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

#include<cmath>

#include<malloc.h>

#include<stdlib.h>

#include<cstring>

#include<algorithm>

int main()

{

	int n;

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

	{

		int t,x,y;

		int a=0,b=0;

		while(n--)

		{

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

			if(((t%2)==(x+y)%2)&&t>=x+y)

			a=1;

			else

			b=1;

		}

		if(b==1)

		puts("No");

		else puts("Yes");

	}

	return 0;

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

}


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

#include<cmath>

#include<malloc.h>

#include<stdlib.h>

#include<cstring>

#include<algorithm>

int main()

{

	int n;

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

	{

		int t,x,y;

		int a=0,b=0;

		while(n--)

		{

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

			if(((t%2)==(x+y)%2)&&t>=x+y)

			a=1;

			else

			b=1;

		}

		if(b==1)

		puts("No");

		else puts("Yes");

	}

	return 0;

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

}

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

#include<cmath>

#include<malloc.h>

#include<stdlib.h>

#include<cstring>

#include<algorithm>

int main()

{

	int n;

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

	{

		int t,x,y;

		int a=0,b=0;

		while(n--)

		{

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

			if(((t%2)==(x+y)%2)&&t>=x+y)

			a=1;

			else

			b=1;

		}

		if(b==1)

		puts("No");

		else puts("Yes");

	}

	return 0;

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

}

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

#include<cmath>

#include<malloc.h>

#include<stdlib.h>

#include<cstring>

#include<algorithm>

int main()

{

	int n;

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

	{

		int t,x,y;

		int a=0,b=0;

		while(n--)

		{

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

			if(((t%2)==(x+y)%2)&&t>=x+y)

			a=1;

			else

			b=1;

		}

		if(b==1)

		puts("No");

		else puts("Yes");

	}

	return 0;

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

}

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

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

}

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

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

}


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

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

}

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

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

}


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

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

}


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

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

}

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

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

}

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

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

}


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

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

}


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

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

}


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

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

}


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

}