stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<iostream>

#include<cmath>

using namespace std;

long long N,T,A,ans,a_ans=1,b_ans=1,ratio;

int main(){

	cin>>N;

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

		cin>>T>>A;

		ratio=max(a_ans/T,b_ans/A);

		while(ratio*T<a_ans || ratio*A<b_ans)

			ratio++;

		a_ans=ratio*T;

		b_ans=ratio*A;

		/*

		if(ratio<T*1.0/A){

			while(ratio!=T*1.0/A) {

				++T;

				ans=

			}

		}

		else if(ratio>T*1.0/A){

			while(ratio!=T*1.0/A) {

				++T;

				ans=T+A;

			}

		}

		ratio=T*1.0/A;

		*/

	}

	cout<<a_ans+b_ans<<endl;

	return 0;

}

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

#include<algorithm>

using namespace std;

typedef long long LL;

inline LL gcd(LL a,LL b)

{

	return !b?a:gcd(b,a%b);

}



int main()

{

	int n;

	scanf("%d",&n);

	

	LL a,b,A=1,B=1;

	LL G;

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

	{

		scanf("%lld %lld",&a,&b);

		if(a>A && b>B) A=a,B=b;

		else

		{

			G=max((A/a)+(A%a?1:0),B/b+(B%b?1:0));

			A=a*G,B=b*G;

		}

	}

	

	printf("%lld\n",A+B);

}
// Slower C++ solution:
#include <iostream>

#include <cmath>



typedef long long LL;



LL ceil(LL a, LL b) {

    if (a % b == 0) return a / b;

    return 1 + (a / b);

}



int main() {

    LL A = 1, B = 1;

    int t; std::cin >> t;

    while (t--) {

        LL a, b; std::cin >> a >> b;

        LL c = ceil(A, a);

        LL d = ceil(B, b);

        LL e = std::max(c, d);

        A = a * e;

        B = b * e;

    }

    std::cout << A + B << std::endl;

}


// Faster C++ solution for the same problem (measured speedup: 5.242793310002816x):
#include<stdio.h>

#include<string.h>

#include<math.h>

#include<algorithm>

#define N 100010

using namespace std;

int main()

{

    int a,b,n;

    long long x1,x2,sum,ans,m;

    scanf("%d",&n);

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

    x1=a,x2=b;

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

    {

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

        sum=x1/a;

        if(x1%a!=0)

            sum++;

        ans=x2/b;

        if(x2%b!=0)

            ans++;

        m=max(sum,ans);

        x1=a*m,x2=b*m;

    }

    printf("%lld",x1+x2);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long

using namespace std;

const ll inf=1e18;

ll a[1010],t[1010],ans1,ans2,ans,l,r,mid;

int n;

int main()

{

	ios::sync_with_stdio(0);

	cin>>n;

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

		cin>>t[i]>>a[i];

	ans1=t[1],ans2=a[1];

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

	{

		if(ans1*a[i]==ans2*t[i])continue;

		else 

		{

			l=1;r=inf/max(a[i],t[i])+1;

			ans=r;

			while(l<=r)

			{

				mid=(l+r)>>1;

				if(mid*t[i]>=ans1&&mid*a[i]>=ans2)ans=mid,r=mid-1;

				else l=mid+1;

			}

			ans1=ans*t[i],ans2=ans*a[i];

		}

	}

	cout<<ans1+ans2<<endl;	

}

// Faster C++ solution for the same problem (measured speedup: 5.308931566531386x):
#include<stdio.h>

#include<string.h>

#include<math.h>

#include<algorithm>

#define N 100010

using namespace std;

int main()

{

    int a,b,n;

    long long x1,x2,sum,ans,m;

    scanf("%d",&n);

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

    x1=a,x2=b;

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

    {

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

        sum=x1/a;

        if(x1%a!=0)

            sum++;

        ans=x2/b;

        if(x2%b!=0)

            ans++;

        m=max(sum,ans);

        x1=a*m,x2=b*m;

    }

    printf("%lld",x1+x2);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long



using namespace std;



ll n,a,b,p,q;



int main()

{

	scanf("%lld%lld%lld",&n,&a,&b);

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

	{

		scanf("%lld%lld",&p,&q);

		a=(a/p+(a%p!=0))*p;

		if(b<=a/p*q)b=a/p*q;

		else

		{

			b=(b/q+(b%q!=0))*q;

			a=b/q*p;

		}

	}

	printf("%lld",a+b);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.164394050385414x):
#include<stdio.h>

#include<string.h>

#include<math.h>

#include<algorithm>

#define N 100010

using namespace std;

int main()

{

    int a,b,n;

    long long x1,x2,sum,ans,m;

    scanf("%d",&n);

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

    x1=a,x2=b;

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

    {

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

        sum=x1/a;

        if(x1%a!=0)

            sum++;

        ans=x2/b;

        if(x2%b!=0)

            ans++;

        m=max(sum,ans);

        x1=a*m,x2=b*m;

    }

    printf("%lld",x1+x2);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cmath>



typedef long long LL;



LL ceil(LL a, LL b) {

    if (a % b == 0) return a / b;

    return 1 + (a / b);

}



int main() {

    LL A = 1, B = 1;

    int t; std::cin >> t;

    while (t--) {

        LL a, b; std::cin >> a >> b;

        LL c = ceil(A, a);

        LL d = ceil(B, b);

        LL e = std::max(c, d);

        A = a * e;

        B = b * e;

    }

    std::cout << A + B << std::endl;

}


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

#include<algorithm>

using namespace std;

#define ll long long

int main()

{

    int N;

    scanf("%d",&N);

    ll t,a;

    ll anst,ansa;

    anst=ansa=1;

    ll m,n;

    while(N--)

    {

        scanf("%lld%lld",&t,&a);

        m=anst/t;

        n=ansa/a;

        if(m*t!=anst)

            m++;

        if(n*a!=ansa)

            n++;

        n=max(n,m);

        anst=t*n;

        ansa=a*n;

    }

    printf("%lld\n",anst+ansa);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long

using namespace std;

const ll inf=1e18;

ll a[1010],t[1010],ans1,ans2,ans,l,r,mid;

int n;

int main()

{

	ios::sync_with_stdio(0);

	cin>>n;

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

		cin>>t[i]>>a[i];

	ans1=t[1],ans2=a[1];

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

	{

		if(ans1*a[i]==ans2*t[i])continue;

		else 

		{

			l=1;r=inf/max(a[i],t[i])+1;

			ans=r;

			while(l<=r)

			{

				mid=(l+r)>>1;

				if(mid*t[i]>=ans1&&mid*a[i]>=ans2)ans=mid,r=mid-1;

				else l=mid+1;

			}

			ans1=ans*t[i],ans2=ans*a[i];

		}

	}

	cout<<ans1+ans2<<endl;	

}

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

#include<algorithm>

using namespace std;

#define ll long long

int main()

{

    int N;

    scanf("%d",&N);

    ll t,a;

    ll anst,ansa;

    anst=ansa=1;

    ll m,n;

    while(N--)

    {

        scanf("%lld%lld",&t,&a);

        m=anst/t;

        n=ansa/a;

        if(m*t!=anst)

            m++;

        if(n*a!=ansa)

            n++;

        n=max(n,m);

        anst=t*n;

        ansa=a*n;

    }

    printf("%lld\n",anst+ansa);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long



using namespace std;



ll n,a,b,p,q;



int main()

{

	scanf("%lld%lld%lld",&n,&a,&b);

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

	{

		scanf("%lld%lld",&p,&q);

		a=(a/p+(a%p!=0))*p;

		if(b<=a/p*q)b=a/p*q;

		else

		{

			b=(b/q+(b%q!=0))*q;

			a=b/q*p;

		}

	}

	printf("%lld",a+b);

	return 0;

}

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

#include<algorithm>

using namespace std;

#define ll long long

int main()

{

    int N;

    scanf("%d",&N);

    ll t,a;

    ll anst,ansa;

    anst=ansa=1;

    ll m,n;

    while(N--)

    {

        scanf("%lld%lld",&t,&a);

        m=anst/t;

        n=ansa/a;

        if(m*t!=anst)

            m++;

        if(n*a!=ansa)

            n++;

        n=max(n,m);

        anst=t*n;

        ansa=a*n;

    }

    printf("%lld\n",anst+ansa);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define pb push_back

typedef long long goo;

using namespace std;

goo read(){

    char ch;

    goo input = 0, num = 1;

    do{

        ch = getchar();

        if(ch == '-') num=-1;

    }

    while(ch < '0' or ch > '9');

    while(ch >= '0' and ch <= '9'){

        input = input * 10 + ch - '0';

        ch = getchar();

    }

    return input * num;

}

goo gcd(goo x,goo y)

{

	if(x%y==0) return y;

	else return (gcd(y,x%y));

}

int main()

{

    goo n=read(),T=1,A=1;

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

        goo t=read(),a=read();

        goo num=max((T+t-1)/t,(A+a-1)/a);

        T=t*num,A=a*num;

    }

    goo res=T+A;

    cout<<res;

    return 0;

}


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

#include<algorithm>

using namespace std;

#define ll long long

int main()

{

    int N;

    scanf("%d",&N);

    ll t,a;

    ll anst,ansa;

    anst=ansa=1;

    ll m,n;

    while(N--)

    {

        scanf("%lld%lld",&t,&a);

        m=anst/t;

        n=ansa/a;

        if(m*t!=anst)

            m++;

        if(n*a!=ansa)

            n++;

        n=max(n,m);

        anst=t*n;

        ansa=a*n;

    }

    printf("%lld\n",anst+ansa);

    return 0;

}
// Slower C++ solution:
#include <iostream>

#include <cmath>



typedef long long LL;



LL ceil(LL a, LL b) {

    if (a % b == 0) return a / b;

    return 1 + (a / b);

}



int main() {

    LL A = 1, B = 1;

    int t; std::cin >> t;

    while (t--) {

        LL a, b; std::cin >> a >> b;

        LL c = ceil(A, a);

        LL d = ceil(B, b);

        LL e = std::max(c, d);

        A = a * e;

        B = b * e;

    }

    std::cout << A + B << std::endl;

}


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

#include<algorithm>

using namespace std;



int main(){

    int n;

    scanf("%d",&n);

    long long t = 1, a = 1;

    int T, A;

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

        scanf("%d%d",&T,&A);

        long long tmp = max(max(t%T?t/T+1:t/T,a%A?a/A+1:a/A),1ll);

        t = tmp*T;

        a = tmp*A;

    }

    printf("%lld\n",t+a);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long

using namespace std;

const ll inf=1e18;

ll a[1010],t[1010],ans1,ans2,ans,l,r,mid;

int n;

int main()

{

	ios::sync_with_stdio(0);

	cin>>n;

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

		cin>>t[i]>>a[i];

	ans1=t[1],ans2=a[1];

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

	{

		if(ans1*a[i]==ans2*t[i])continue;

		else 

		{

			l=1;r=inf/max(a[i],t[i])+1;

			ans=r;

			while(l<=r)

			{

				mid=(l+r)>>1;

				if(mid*t[i]>=ans1&&mid*a[i]>=ans2)ans=mid,r=mid-1;

				else l=mid+1;

			}

			ans1=ans*t[i],ans2=ans*a[i];

		}

	}

	cout<<ans1+ans2<<endl;	

}

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

#include<algorithm>

using namespace std;



int main(){

    int n;

    scanf("%d",&n);

    long long t = 1, a = 1;

    int T, A;

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

        scanf("%d%d",&T,&A);

        long long tmp = max(max(t%T?t/T+1:t/T,a%A?a/A+1:a/A),1ll);

        t = tmp*T;

        a = tmp*A;

    }

    printf("%lld\n",t+a);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define ll long long



using namespace std;



ll n,a,b,p,q;



int main()

{

	scanf("%lld%lld%lld",&n,&a,&b);

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

	{

		scanf("%lld%lld",&p,&q);

		a=(a/p+(a%p!=0))*p;

		if(b<=a/p*q)b=a/p*q;

		else

		{

			b=(b/q+(b%q!=0))*q;

			a=b/q*p;

		}

	}

	printf("%lld",a+b);

	return 0;

}

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

#include<algorithm>

using namespace std;



int main(){

    int n;

    scanf("%d",&n);

    long long t = 1, a = 1;

    int T, A;

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

        scanf("%d%d",&T,&A);

        long long tmp = max(max(t%T?t/T+1:t/T,a%A?a/A+1:a/A),1ll);

        t = tmp*T;

        a = tmp*A;

    }

    printf("%lld\n",t+a);

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

#define pb push_back

typedef long long goo;

using namespace std;

goo read(){

    char ch;

    goo input = 0, num = 1;

    do{

        ch = getchar();

        if(ch == '-') num=-1;

    }

    while(ch < '0' or ch > '9');

    while(ch >= '0' and ch <= '9'){

        input = input * 10 + ch - '0';

        ch = getchar();

    }

    return input * num;

}

goo gcd(goo x,goo y)

{

	if(x%y==0) return y;

	else return (gcd(y,x%y));

}

int main()

{

    goo n=read(),T=1,A=1;

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

        goo t=read(),a=read();

        goo num=max((T+t-1)/t,(A+a-1)/a);

        T=t*num,A=a*num;

    }

    goo res=T+A;

    cout<<res;

    return 0;

}


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

#include<algorithm>

using namespace std;



int main(){

    int n;

    scanf("%d",&n);

    long long t = 1, a = 1;

    int T, A;

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

        scanf("%d%d",&T,&A);

        long long tmp = max(max(t%T?t/T+1:t/T,a%A?a/A+1:a/A),1ll);

        t = tmp*T;

        a = tmp*A;

    }

    printf("%lld\n",t+a);

    return 0;

}
// Slower C++ solution:
#include<iostream>



using namespace std;



const long long MAXN = 1e4+10;

long long Ti[MAXN],Ai[MAXN];



int main()

{

    ios::sync_with_stdio(false);

    long long N;

    cin >> N;

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

    {

        cin >> Ti[i] >> Ai[i];

    }

    long long A,B;

    A = 1,B=1;

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

    {

        long long beiA = A/Ti[i];

        if(A%Ti[i] != 0){beiA++;};

        long long beiB = B/Ai[i];

        if(B%Ai[i] != 0){beiB++;};

        long long L = min(beiA,beiB);

        long long R = max(beiA,beiB);

        long long bei= L;

        while( L <= R)   //如果查找区间不为空就继续查找

        {

            long long mid = L+(R-L)/2; //取查找区间正中元素的下标

            //cout<<" L = "<<L<<" R = "<<R<<" mid = "<<mid<<endl;

            if(Ti[i]*mid>=A && Ai[i]*mid>=B) {//如果成立就再小一点

                bei = mid;

                R = mid - 1;

            }

            else{

                L = mid+1;

            }

        }

        A = bei*Ti[i];

        B = bei*Ai[i];

    }

    cout<<A+B<<endl;

    return 0;

}




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

#include<algorithm>

using namespace std;



int main(){

    int n;

    scanf("%d",&n);

    long long t = 1, a = 1;

    int T, A;

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

        scanf("%d%d",&T,&A);

        long long tmp = max(max(t%T?t/T+1:t/T,a%A?a/A+1:a/A),1ll);

        t = tmp*T;

        a = tmp*A;

    }

    printf("%lld\n",t+a);

    return 0;

}
// Slower C++ solution:
//#include <bits/stdc++.h>

#include <iostream>

#include <algorithm>

#include <iomanip>

#include <cmath>

#include <string>

#include <string.h>

#include <cstdlib>

#include <climits>

#include <cstdio>

#include <vector>

#include <bitset>

#include <set>

#include <map>

#include <queue>

#include <stack>

#define PI 3.14159265

#define base 27

#define  fi first

#define  se second



#define TASK "Traveling"



using namespace std;

typedef long long lli;

typedef long double lb;

typedef unsigned long long ull;

typedef pair<int,int> pa;

const long long mod =1e9+7;

const long long oo=1e15+7;

const int maxn=1e6+1;

const int maxN=1e3+1;



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

 *                                                                            *

 *                       Be a warrior not a worrier!! =)))                    *

 *                                                                            *

 *                                                                            *

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

 int n;

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







void in()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    freopen(TASK".inp","r",stdin);

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

}



void solve()

{

      cin>>n;

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

      {

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

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

            {

                  cout<<"No";

                  exit(0);

            }

            else

            {

                  if(abs(x[i]-y[i])%2!=(t[i]%2))

                  {

                        cout<<"No";

                        exit(0);

                  }

            }

      }

      cout<<"Yes";





}



int main()

{

    //in();

    solve();



}


// Faster C++ solution for the same problem (measured speedup: 5.269686193459748x):
#include<stdio.h>

#include<math.h>

#include<stdlib.h>

#include<cmath>

int xx,yy,tt;



bool judge(int x,int y,int t)

{

    int time=abs(x-xx)+abs(y-yy);

    //printf("t-tt=%d time=%d\n",t-tt,time);

    if(t-tt<time)

        return false;

    if(((t-tt)-time)%2==0)

        return true;

    return false;

}



int main()

{

    int n;

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

    {

        xx=0,yy=0,tt=0;

        int x,y,t;

        int answer=true;

        while(n--)

        {

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

            if(answer==false)

                continue;

            answer=judge(x,y,t);

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

        }

        if(answer)

            printf("Yes\n");

        else

            printf("No\n");

    }

    return 0;

}
// Slower C++ solution:
//27/8

#include<bits/stdc++.h>

using namespace std;



int n,x,y,t,sx,sy,tp;



int main()

{

    cin>>n;



    sx=0;sy=0;tp=0;



    int chk=0;



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

    {

        cin>>t>>x>>y;



        if(chk)continue;



        int bc=t-tp;



        if((abs(x-sx)>bc) || abs(y-sy)>bc || abs(x-sx+y-sy)>bc || ((abs(x-sx+y-sy))%2 != bc%2))chk=1;



        sx=x;

        sy=y;

        tp=t;

    }



    if(chk)cout<<"No";



    else cout<<"Yes";

}


// Faster C++ solution for the same problem (measured speedup: 5.2762936599116435x):
#include<stdio.h>

#include<math.h>

#include<stdlib.h>

#include<cmath>

int xx,yy,tt;



bool judge(int x,int y,int t)

{

    int time=abs(x-xx)+abs(y-yy);

    //printf("t-tt=%d time=%d\n",t-tt,time);

    if(t-tt<time)

        return false;

    if(((t-tt)-time)%2==0)

        return true;

    return false;

}



int main()

{

    int n;

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

    {

        xx=0,yy=0,tt=0;

        int x,y,t;

        int answer=true;

        while(n--)

        {

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

            if(answer==false)

                continue;

            answer=judge(x,y,t);

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

        }

        if(answer)

            printf("Yes\n");

        else

            printf("No\n");

    }

    return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

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

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

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

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

#define CL(x) (x<<1)

#define CR(x) (x<<1)+1

#define pb push_back

#define bit1(x) __builtin_popcount(x)



using namespace std;



typedef long long ll;

typedef pair<int,int> pii;



template<typename T> inline void _read(T &x){

    char ch; x=0; bool neg=false;

    for(ch=getchar();ch<'0'||ch>'9';ch=getchar())

        if(ch=='-') neg=true;

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

    if(neg) x=-x;

}

#define read(a) _read(a)

#define Read(a,b) _read(a),_read(b)



const int maxn=1e5+7;

const int maxS=(1<<6);

const ll mod=1e9;

const int inf=1e9+7;

const ll linf=1e16+9;



int n,t[maxn],kq;

struct Neko{

    int x,y;

}a[maxn];



inline void Enter(){

    cin>>n;

    up(i,1,n) cin>>t[i]>>a[i].x>>a[i].y;

}



inline int dis(Neko x,Neko y){

    return abs(x.x-y.x)+abs(x.y-y.y);

}



inline void Solve(){

    up(i,1,n){

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

        if(dis(a[i],a[i-1])%2 == Time%2 && dis(a[i],a[i-1])<=Time) kq++;

    }

    if(kq!=n) cout<<"No";

    else cout<<"Yes";

}



int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL),cout.tie(NULL);

    //freopen("TEST.INP","r",stdin);

    //freopen("TEST.OUT","w",stdout);



    Enter();

    Solve();



    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.3443966078809915x):
#include<stdio.h>

#include<math.h>

#include<stdlib.h>

#include<cmath>

int xx,yy,tt;



bool judge(int x,int y,int t)

{

    int time=abs(x-xx)+abs(y-yy);

    //printf("t-tt=%d time=%d\n",t-tt,time);

    if(t-tt<time)

        return false;

    if(((t-tt)-time)%2==0)

        return true;

    return false;

}



int main()

{

    int n;

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

    {

        xx=0,yy=0,tt=0;

        int x,y,t;

        int answer=true;

        while(n--)

        {

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

            if(answer==false)

                continue;

            answer=judge(x,y,t);

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

        }

        if(answer)

            printf("Yes\n");

        else

            printf("No\n");

    }

    return 0;

}
// Slower C++ solution:
//#include <bits/stdc++.h>

#include <iostream>

#include <algorithm>

#include <iomanip>

#include <cmath>

#include <string>

#include <string.h>

#include <cstdlib>

#include <climits>

#include <cstdio>

#include <vector>

#include <bitset>

#include <set>

#include <map>

#include <queue>

#include <stack>

#define PI 3.14159265

#define base 27

#define  fi first

#define  se second



#define TASK "Traveling"



using namespace std;

typedef long long lli;

typedef long double lb;

typedef unsigned long long ull;

typedef pair<int,int> pa;

const long long mod =1e9+7;

const long long oo=1e15+7;

const int maxn=1e6+1;

const int maxN=1e3+1;



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

 *                                                                            *

 *                       Be a warrior not a worrier!! =)))                    *

 *                                                                            *

 *                                                                            *

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

 int n;

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







void in()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    freopen(TASK".inp","r",stdin);

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

}



void solve()

{

      cin>>n;

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

      {

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

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

            {

                  cout<<"No";

                  exit(0);

            }

            else

            {

                  if(abs(x[i]-y[i])%2!=(t[i]%2))

                  {

                        cout<<"No";

                        exit(0);

                  }

            }

      }

      cout<<"Yes";





}



int main()

{

    //in();

    solve();



}


// Faster C++ solution for the same problem (measured speedup: 5.2714031408650115x):
#include<stdio.h>

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

int main()

{

    int n,sum=0;

    scanf("%d",&n);

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

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

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

    {

        sum=x[i]+y[i]-x[i-1]-y[i-1];

        if((t[i]-t[i-1])<sum)

        {

            printf("No\n");

            return 0;

        }

        if((sum-(t[i]-t[i-1]))%2)

        {

            printf("No\n");

            return 0;

        }

    }

    printf("Yes\n");

    return 0;

}
// Slower C++ solution:
//27/8

#include<bits/stdc++.h>

using namespace std;



int n,x,y,t,sx,sy,tp;



int main()

{

    cin>>n;



    sx=0;sy=0;tp=0;



    int chk=0;



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

    {

        cin>>t>>x>>y;



        if(chk)continue;



        int bc=t-tp;



        if((abs(x-sx)>bc) || abs(y-sy)>bc || abs(x-sx+y-sy)>bc || ((abs(x-sx+y-sy))%2 != bc%2))chk=1;



        sx=x;

        sy=y;

        tp=t;

    }



    if(chk)cout<<"No";



    else cout<<"Yes";

}


// Faster C++ solution for the same problem (measured speedup: 5.278012760134355x):
#include<stdio.h>

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

int main()

{

    int n,sum=0;

    scanf("%d",&n);

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

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

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

    {

        sum=x[i]+y[i]-x[i-1]-y[i-1];

        if((t[i]-t[i-1])<sum)

        {

            printf("No\n");

            return 0;

        }

        if((sum-(t[i]-t[i-1]))%2)

        {

            printf("No\n");

            return 0;

        }

    }

    printf("Yes\n");

    return 0;

}