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

using namespace std;

int main(){

int n,t,x,y;

cin>>n;

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

cin>>t>>x>>y;

if((x+y>t)||((x+y)%2==0&&t%2==1)||((x+y)%2==1&&t%2==0)){

cout<<"No"<<endl;

return 0;}

}

cout<<"Yes"<<endl;}

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



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:
// Original C++ solution (slower):
#include<bits/stdc++.h>



using namespace std;



int main(){

    int n;

    cin>>n;

    int x=0,y=0;

    int t=0;

    int a,b,c;

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

    {

        cin>>c>>a>>b;

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

        {

            cout<<"No";

            return 0;

        }

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

        {

            cout<<"No";

            return 0;

        }

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

        {

            cout<<"No";

            return 0;

        }

        x=a;y=b;t=c;

    }

    cout<<"Yes";

    return 0;

}

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



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:
// Original C++ solution (slower):
#include<bits/stdc++.h>

using namespace std;

int dis(int a,int b)

{

	return a+b;

}

int main()

{

	int n;

	scanf("%d",&n);

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

	{

		int t,x,y,d;

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

		d=dis(x,y);

		if((t<d)||(t&1)!=(d&1))

		{

			puts("No");

			return 0;

		}

	}

	puts("Yes");

	return 0;

}




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



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:
// Original C++ solution (slower):
#include<iostream>



using std::cin;

using std::cout;



inline int dis( int x , int y )

{

	return x + y;

}



int main( void )

{

	int T;

	cin >> T;

	int buf1 , buf2 , buf3;

	while( T-- )

	{

		cin >> buf1 >> buf2 >> buf3;

		if( buf1 < dis( buf2 , buf3 ) )

		{

			cout << "No\n";

			return 0;

		}

		if( ( buf1 - dis( buf2 , buf3 ) ) & 1 )

		{

			cout << "No\n";

			return 0;

		}

	} 

	cout << "Yes\n";

}

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



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:
// Original C++ solution (slower):
// luogu-judger-enable-o2

#include<iostream>

#include<algorithm>

#include<cstdio>

using namespace std;

int sabs(int a){

    if(a<0)return a*-1;

    return a;

}

int main(){

    int n,x=0,y=0,t=0;

    cin>>n;

    while(n--){

        int c,a,b;

        cin>>c>>a>>b;

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

            cout<<"No";

            return 0;

        }

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

            cout<<"No";

            return 0;

        }

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

            cout<<"No";

            return 0;

        }

        x=a;y=b;t=c;

    }

    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<map>

#include<cmath>

#include<stack>

#include<cstdio>

#include<queue>

#include<vector>

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

typedef long long ll;

int n,t,x,y,a,b,ans;

int main(){

	scanf("%d",&n);

	while(n--){

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

		if(abs(x-a)+abs(y-b)>t-ans||((abs(x-a)+abs(y-b))%2!=(t-ans)%2)){

			puts("No");

			return 0;

		}

		x=a,y=b,ans=t;

	}

	puts("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>

using namespace std;

int main()

{

	int n;

	cin>>n;

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

	{

		int t,x,y;

		cin>>t>>x>>y;

		t-=x+y;

		if(t<0||t%2)

			return!(cout<<"No\n");

	}

	return!(cout<<"Yes\n");

}

// 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<cstdio>

#include<iostream>

#include<algorithm>

#include<cmath>

#include<map>

#include<queue>

#include<stack>

#include<list>

#include<set>

#include<cstring>

#include<string>

using namespace std;

int main(){

    int n;

    scanf("%d",&n);

    int t=0,x=0,y=0,a,b,c;

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

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

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

            printf("No\n");

            return 0;

        }

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

            printf("No\n");

            return 0;

        }

        x=a;y=b;t=c;

    }

    printf("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):
// luogu-judger-enable-o2

#include<bits/stdc++.h>

using namespace std;

int main()

{

    int n,t,x,y;

    cin>>n;

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

    {

        cin>>t>>x>>y;

        if(t<x+y)

        {

            cout<<"No"<<endl;

            return 0;

        }

        if((!((x+y)%2)&&t%2)||((x+y)%2&&!(t%2)))

        {

            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 main(){

	int n,t,x,y,i;

	cin >> n;

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

	    cin >> t >> x >> y;

	    if(abs(-x)+abs(-y)>t || abs(-x)+abs(-y)<=t && (abs(-x)+abs(-y))%2!=t%2){

	        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 main(){

	int n,t,x,y,i;

	scanf("%d",&n);

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

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

		if(x+y>t||(x+y+t)%2==1){

			printf("No\n");

			return 0;

		}

	}

	printf("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>

using namespace std;

int main()

{

	int i,j,k=0,n;

	cin>>n;

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

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

	{

		j=0;

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

		j+=x[i];

		j+=y[i];

		//cout<<j<<" "<<a[i]<<endl;

		if((a[i]-j)%2!=0||j>a[i])

		{

			k=1;

		}

	}	

	if(k==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<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){//判断，如果不行直接输出“No”

        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>

using namespace std;

int main()

{

    int n,t,x,y;

    cin>>n;

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

    {

        cin>>t>>x>>y;

        if(x+y>t)

        {

            cout<<"No\n";

            return 0;

        }

        if( (x+y)%2==0&&t%2==1 )

        {

            cout<<"No\n";

            return 0;

        }

        if( (x+y)%2==1&&t%2==0 )

        {

            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<bits/stdc++.h>

using namespace std;

int main()

{

	int n;

	cin>>n;

	while(n--)

	{

		int t,x,y;

		cin>>t>>x>>y;

		if(t<x+y || (t-x-y)%2){cout<<"No\n";return 0;}

	}

	cout<<"Yes\n";

}

// 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";

}

// 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()

{

  int n,x,y,z,i;	

  cin>>n;

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

  {

    cin>>x>>y>>z;

    if(!(y+z<=x&&(x-y-z)%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 <iostream>

#include <string>

using namespace std;

int main()

{

    int n;

    cin >> n;

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

    {

        int a,b,c;

        cin >> a >> b >> c;

        b+=c;

        if(a < b||(a-b)%2 == 1){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 main()

{

	int n,t,x,y;

	cin>>n;

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

	{

		cin>>t>>x>>y;

		if(x+y>t)

		{

			cout<<"No"<<"\n";

			return 0;

		}

		if((x+y)%2==1 && t%2==0)

		{

			cout<<"No"<<"\n";

			return 0;

		}

		if((x+y)%2==0 && t%2==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<bits/stdc++.h>

using namespace std;

int a,b,x,y;

int main(){

    cin>>a;

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

        cin>>b>>x>>y;

        if(!(x+y<=b&&(b-x-y)%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<iostream>

#include<cmath>

using namespace std;

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

int main()

{

	cin>>n;

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

	{

		cin>>t>>x>>y;

        if((((int)abs(nx-x)+(int)abs(ny-y))%2==0 &&(t-nt)%2==1)||(((int)abs(nx-x)+(int)abs(ny-y))%2==1 &&(t-nt)%2==0)||(abs(nx-x)+abs(ny-y)>t-nt))

        {

            cout<<"No";

            return 0;

        }

        nx=x;ny=y;nt=t;

	}

	cout<<"Yes"<<endl;

}

// 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");

	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 x=0,y=0,t=0,a,b,c;

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

    {

        cin>>c>>a>>b;

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

        {

            cout<<"No"<<endl;

            return 0;

        }

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

        {

            cout<<"No"<<endl;

            return 0;

        }

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

        {

            cout<<"No"<<endl;

            return 0;

        }

        x=a;y=b;t=c;

    }

    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");

	return 0;

}

// Fastest known solution for this problem: