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

#include <cmath>

using namespace std;

int x[102],y[102],h[102];

int c_x,c_y,c_h;

int max_h;

int main()

{

	int n;

	scanf("%d",&n);

	max_h = -1;

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

	{

		scanf("%d%d%d",x + i,y + i,h + i);

		max_h = max(max_h,h[i]);

	}

	int sign = 1;

	for(c_h = max_h;sign;c_h ++)

		for(c_x = 0;sign && c_x <= 100;c_x ++)

			for(c_y = 0;sign && c_y <= 100;c_y ++)

			{

				int i = 1;

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

					if(h[i] != max(0,(c_h - abs(c_x - x[i]) - abs(c_y - y[i]))))

						break;

				if(i > n)

					sign = 0;

			}

	printf("%d %d %d\n",c_x - 1,c_y - 1,c_h - 1);

	return 0;

}

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

#include<algorithm>

#include<cmath>

#define ll long long

#define N 105

#define inf 0x3fffffff

#define rep(i, l, r) for(int i=l; i<=r; ++i)

using namespace std;

int n;

struct node{

    int x, y;

    ll h;

    void read(){scanf("%d%d%lld", &x, &y, &h);}

}a[N];

int main(){

    scanf("%d", &n);

    int pos=1;

    rep(i, 1, n){

        a[i].read();

        if(a[i].h) pos=i;

    }

    rep(cx, 0, 100){

        rep(cy, 0, 100){

            ll h=a[pos].h+abs(cx-a[pos].x)+abs(cy-a[pos].y);

            bool f=true;

            rep(i, 1, n){

                if(a[i].h!=max(h-abs(cx-a[i].x)-abs(cy-a[i].y), 0ll)) f=false;

            }

            if(f){

                printf("%d %d %d", cx, cy, h);

                return 0;

            }

        }

    }

    return 0;

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

#include <cmath>

using namespace std;

int x[102],y[102],h[102];

int c_x,c_y,c_h;

int max_h;

int main()

{

	int n;

	scanf("%d",&n);

	max_h = -1;

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

	{

		scanf("%d%d%d",x + i,y + i,h + i);

		max_h = max(max_h,h[i]);

	}

	int sign = 1;

	for(c_h = max_h;sign;c_h ++)

		for(c_x = 0;sign && c_x <= 100;c_x ++)

			for(c_y = 0;sign && c_y <= 100;c_y ++)

			{

				int i = 1;

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

					if(h[i] != max(0,(c_h - abs(c_x - x[i]) - abs(c_y - y[i]))))

						break;

				if(i > n)

					sign = 0;

			}

	printf("%d %d %d\n",c_x - 1,c_y - 1,c_h - 1);

	return 0;

}

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

#include <string.h>

#include <algorithm>

#include <cmath>





using namespace std;



struct point{

    int x,y;

    long h;

}points[100];



long height;



bool check_validity(int x, int y, int p, int n){

    int i,j,len;

    long h,cur_h;

    h = points[p].h + abs(points[p].x - x) + abs(points[p].y - y);

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

        cur_h = h - abs(points[i].x - x) - abs(points[i].y - y);

        cur_h = max(cur_h,long(0));

        if(cur_h != points[i].h) return false;

    }

    points[p].h = h;

    return true;

}



int main(){

    int i,j,k,n,x,y,p,break_flag;

    long h;

    while(cin >> n){

        memset(points,-1,sizeof(points));

        break_flag = 0;

        p = -1;

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

            cin >> x >> y >> h;

            points[i].x = x;

            points[i].y = y;

            points[i].h = h;

            if(p == -1 && h > 0) p = i;

        }

        for(j = 0; j < 101; j++){

            for(k = 0; k < 101; k++){

                if(check_validity(j,k,p,n)){

                    break_flag = 1;

                    break;

                }

            }

            if(break_flag) break;

        }

        cout << j << " " << k << " " << points[p].h << endl;

    }

    return 0;

}
// Slower C++ solution:
///By Stephan Ramirez dsramirezc@unal.edu.co

#include<bits/stdc++.h>

#define ms(a,v) memset(a,v,sizeof a)

#define ll long long

#define N 101

using namespace std;

int n;

ll s[N][3];

int main(){

	#ifdef LOCAL

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

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

	#endif

    scanf("%d",&n);

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

        scanf("%lld %lld %lld",&s[i][0],&s[i][1],&s[i][2]);

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

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

            set<ll> st;

            ll mx=1e10;

            bool flag=true;

            int ind=-1;

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

                if(s[k][2]>0){

                    ll h=s[k][2]+abs(i-s[k][0])+abs(j-s[k][1]);

                    ind=k;

                    st.insert(h);

                }else{

                    mx=min(mx,abs(i-s[k][0])+abs(j-s[k][1]));

                }

            }

            if(st.size()==1 && s[ind][2]+abs(i-s[ind][0])+abs(j-s[ind][1])>0 && s[ind][2]+abs(i-s[ind][0])+abs(j-s[ind][1])<=mx){

                cout<<i<<" "<<j<<" "<<s[ind][2]+abs(i-s[ind][0])+abs(j-s[ind][1])<<endl;

                return 0;

            }

        }

    }



	return 0;

}




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

#include<algorithm>

using namespace std;

int a[105],b[105],c[105];

int main(){

	int n,ans1,ans2,k,q,u;

	scanf("%d",&n);

    for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);

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

    	for(int j=0;j<=100;j++){

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

    			if(c[q]!=0){

    				ans1=abs(i-a[q])+abs(j-b[q])+c[q];

    				break;

				}

			}

			if(q==n){

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

					if(i==a[u]&&j==b[u]) break;

				}

				if(u==n) printf("%d %d %d",i,j,1);

				return 0;

			}

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

				ans2=abs(i-a[k])+abs(j-b[k])+c[k];

    			if(c[k]!=0){

    				if(ans1!=ans2) break;

    				ans1=ans2;

				}

    			else{

    				if(ans1>ans2) break;

				}

			}

			if(k==n){

				printf("%d %d %d",i,j,ans1);

				return 0;

			}

		}

	}

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

#include <algorithm>

#include <string>

using namespace std;

const int M=100;

int A[M+5][M+5];

int x[M+5],y[M+5],h[M+5];

bool check_h(int wh,int n,int a,int b)

{

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

	{

		if(h[i]&&(abs(x[i]-a)+abs(y[i]-b)+h[i]!=wh)) return 0;

		if(!h[i]&&(abs(x[i]-a)+abs(y[i]-b)<wh)) return 0;

	}

	return 1;

}

int main()

{

	int n;

	cin>>n;

	int f=0;

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

	{

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

		if(h[i]!=0) f=i;

	}

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

	{

		for(int j=0;j<101;j++)

		{

			int new_h=h[f]+abs(x[f]-i)+abs(y[f]-j);

			if(check_h(new_h,n,i,j))

			{

				cout<<i<<' '<<j<<' '<<new_h<<endl;

				return 0;

			}

		}

	}

	return 0;

}


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

#include<algorithm>

using namespace std;

int a[105],b[105],c[105];

int main(){

	int n,ans1,ans2,k,q,u;

	scanf("%d",&n);

    for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);

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

    	for(int j=0;j<=100;j++){

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

    			if(c[q]!=0){

    				ans1=abs(i-a[q])+abs(j-b[q])+c[q];

    				break;

				}

			}

			if(q==n){

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

					if(i==a[u]&&j==b[u]) break;

				}

				if(u==n) printf("%d %d %d",i,j,1);

				return 0;

			}

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

				ans2=abs(i-a[k])+abs(j-b[k])+c[k];

    			if(c[k]!=0){

    				if(ans1!=ans2) break;

    				ans1=ans2;

				}

    			else{

    				if(ans1>ans2) break;

				}

			}

			if(k==n){

				printf("%d %d %d",i,j,ans1);

				return 0;

			}

		}

	}

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

#include <cstring>

#include <cstdio>

#include <cmath>

#include <algorithm>

#include <vector>

using namespace std;

#define fir first

#define sec second

#define pb push_back

#define lowbit(x) ((x)&(-(x))) 



const int maxn = 106; 



int n, o; 

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



int Abs(int x) {

	return x>0?x:-x; 

}



int D(int x1, int y1, int x2, int y2) {

	return Abs(x1-x2)+Abs(y1-y2); 

}



bool check(int X, int Y) {

	int H = D(X,Y,x[o],y[o])+h[o];

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

		if (max(0,H-D(X,Y,x[i],y[i])) != h[i]) return false; 

	return true; 

} 



int main() {

	cin>>n; 

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

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

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

		if (h[i] != 0) o = i; 

	for (int X = 0; X <= 100; ++X) 

		for (int Y = 0; Y <= 100; ++Y) 

			if (check(X, Y)) {

				cout<<X<<' '<<Y<<' '<<D(X,Y,x[o],y[o])+h[o]<<endl; 

				return 0; 

			}

}


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

#include<algorithm>

using namespace std;

int a[105],b[105],c[105];

int main(){

	int n,ans1,ans2,k,q,u;

	scanf("%d",&n);

    for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);

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

    	for(int j=0;j<=100;j++){

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

    			if(c[q]!=0){

    				ans1=abs(i-a[q])+abs(j-b[q])+c[q];

    				break;

				}

			}

			if(q==n){

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

					if(i==a[u]&&j==b[u]) break;

				}

				if(u==n) printf("%d %d %d",i,j,1);

				return 0;

			}

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

				ans2=abs(i-a[k])+abs(j-b[k])+c[k];

    			if(c[k]!=0){

    				if(ans1!=ans2) break;

    				ans1=ans2;

				}

    			else{

    				if(ans1>ans2) break;

				}

			}

			if(k==n){

				printf("%d %d %d",i,j,ans1);

				return 0;

			}

		}

	}

}
// Slower C++ solution:
//wrong answer

#include<iostream>

#include<algorithm>



using namespace std;



int abs(int m, int n)

{

	return m - n > 0 ? m - n : n - m;

}



struct data {

	int x;

	int y;

	int h;

}d[105];



int main()

{

	int N, p=0;

	cin >> N;

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

	{

		cin >> d[i].x >> d[i].y >> d[i].h;

	}

	while(d[p].h==0) p++;

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

		for (int j = 0;j < 101;j++)

		{

			int H = d[p].h + abs(d[p].x, i) + abs(d[p].y, j);

			int l = 0;

			for (int k = 0;k < N;k++)

			{

				if (max(0, H - abs(d[k].x, i) - abs(d[k].y, j)) == d[k].h) l++;

			}

			//		cout<<i<<" "<<j<<" "<<H;

			//	cout<<"  *  "<<l<<"   &  "<<N<<endl;

			if (l == N) {

				cout << i << " " << j << " " << H << endl;

				return 0;

			}

		}

	return 0;

}

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

#include<algorithm>

using namespace std;

int a[105],b[105],c[105];

int main(){

	int n,ans1,ans2,k,q,u;

	scanf("%d",&n);

    for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);

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

    	for(int j=0;j<=100;j++){

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

    			if(c[q]!=0){

    				ans1=abs(i-a[q])+abs(j-b[q])+c[q];

    				break;

				}

			}

			if(q==n){

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

					if(i==a[u]&&j==b[u]) break;

				}

				if(u==n) printf("%d %d %d",i,j,1);

				return 0;

			}

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

				ans2=abs(i-a[k])+abs(j-b[k])+c[k];

    			if(c[k]!=0){

    				if(ans1!=ans2) break;

    				ans1=ans2;

				}

    			else{

    				if(ans1>ans2) break;

				}

			}

			if(k==n){

				printf("%d %d %d",i,j,ans1);

				return 0;

			}

		}

	}

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

#include <cmath>



using namespace std;



int main()

{

    int N;

    cin >> N;

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



    int i;

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

    {

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

    }



    int j,k,H1,H2,p=0;

    while(h[p]==0) p++;

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

    {

        for(j=0;j<=100;j++)

    {

        H1 = abs(x[p]-i) + abs(y[p]-j) + h[p];

        for(k=0;k<N;k++)

        {

            H2 = H1 - abs(x[k]-i) - abs(y[k]-j);

            if(H2 < 0) H2=0;

            if(H2!=h[k]) break;

        }

        if(k==N) {cout << i << ' ' << j << ' ' << H1;return 0;}

    }

    }



    return 0;

}

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

#include<algorithm>

using namespace std;

int a[105],b[105],c[105];

int main(){

	int n,ans1,ans2,k,q,u;

	scanf("%d",&n);

    for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);

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

    	for(int j=0;j<=100;j++){

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

    			if(c[q]!=0){

    				ans1=abs(i-a[q])+abs(j-b[q])+c[q];

    				break;

				}

			}

			if(q==n){

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

					if(i==a[u]&&j==b[u]) break;

				}

				if(u==n) printf("%d %d %d",i,j,1);

				return 0;

			}

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

				ans2=abs(i-a[k])+abs(j-b[k])+c[k];

    			if(c[k]!=0){

    				if(ans1!=ans2) break;

    				ans1=ans2;

				}

    			else{

    				if(ans1>ans2) break;

				}

			}

			if(k==n){

				printf("%d %d %d",i,j,ans1);

				return 0;

			}

		}

	}

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

#include<string>

#include<cmath>

using namespace std;

int main(){

	int N;

	cin>>N;

	int a[3][N];

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

		cin>>a[0][n]>>a[1][n]>>a[2][n];

	}

	int q,w,e;

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

		if(a[2][m]!=0){

			q=a[0][m];

			w=a[1][m];

			e=a[2][m];

			break;

		}

	}

	int i,j,H,f,r;

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

		for(j=0;j<=100;j++){

			H=e+abs(i-q)+abs(j-w);

			r=0;

			for(f=0;f<N;f++){

				int h=H-abs(i-a[0][f])-abs(j-a[1][f]);

				if (h<0){

					h=0;	

				}

				if(a[2][f]!= h){

					r=1;

					break;

				}

			}

			if(r == 0){

				cout<<i<<' '<<j<<' '<<H<<endl;

			}

		}

	}

	return 0;

 } 

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

#include<algorithm>

using namespace std;

int a[105],b[105],c[105];

int main(){

	int n,ans1,ans2,k,q,u;

	scanf("%d",&n);

    for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);

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

    	for(int j=0;j<=100;j++){

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

    			if(c[q]!=0){

    				ans1=abs(i-a[q])+abs(j-b[q])+c[q];

    				break;

				}

			}

			if(q==n){

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

					if(i==a[u]&&j==b[u]) break;

				}

				if(u==n) printf("%d %d %d",i,j,1);

				return 0;

			}

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

				ans2=abs(i-a[k])+abs(j-b[k])+c[k];

    			if(c[k]!=0){

    				if(ans1!=ans2) break;

    				ans1=ans2;

				}

    			else{

    				if(ans1>ans2) break;

				}

			}

			if(k==n){

				printf("%d %d %d",i,j,ans1);

				return 0;

			}

		}

	}

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

#include <cmath>

using namespace std;

int x[102],y[102],h[102];

int c_x,c_y,c_h;

int max_h;

int main()

{

	int n;

	scanf("%d",&n);

	max_h = -1;

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

	{

		scanf("%d%d%d",x + i,y + i,h + i);

		max_h = max(max_h,h[i]);

	}

	int sign = 1;

	for(c_h = max_h;sign;c_h ++)

		for(c_x = 0;sign && c_x <= 100;c_x ++)

			for(c_y = 0;sign && c_y <= 100;c_y ++)

			{

				int i = 1;

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

					if(h[i] != max(0,(c_h - abs(c_x - x[i]) - abs(c_y - y[i]))))

						break;

				if(i > n)

					sign = 0;

			}

	printf("%d %d %d\n",c_x - 1,c_y - 1,c_h - 1);

	return 0;

}

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

#include<algorithm>

using namespace std;

int a[105],b[105],c[105];

int main(){

	int n,ans1,ans2,k,q,u;

	scanf("%d",&n);

    for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);

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

    	for(int j=0;j<=100;j++){

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

    			if(c[q]!=0){

    				ans1=abs(i-a[q])+abs(j-b[q])+c[q];

    				break;

				}

			}

			if(q==n){

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

					if(i==a[u]&&j==b[u]) break;

				}

				if(u==n) printf("%d %d %d",i,j,1);

				return 0;

			}

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

				ans2=abs(i-a[k])+abs(j-b[k])+c[k];

    			if(c[k]!=0){

    				if(ans1!=ans2) break;

    				ans1=ans2;

				}

    			else{

    				if(ans1>ans2) break;

				}

			}

			if(k==n){

				printf("%d %d %d",i,j,ans1);

				return 0;

			}

		}

	}

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

#include <string.h>

#include <algorithm>

#include <cmath>





using namespace std;



struct point{

    int x,y;

    long h;

}points[100];



long height;



bool check_validity(int x, int y, int p, int n){

    int i,j,len;

    long h,cur_h;

    h = points[p].h + abs(points[p].x - x) + abs(points[p].y - y);

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

        cur_h = h - abs(points[i].x - x) - abs(points[i].y - y);

        cur_h = max(cur_h,long(0));

        if(cur_h != points[i].h) return false;

    }

    points[p].h = h;

    return true;

}



int main(){

    int i,j,k,n,x,y,p,break_flag;

    long h;

    while(cin >> n){

        memset(points,-1,sizeof(points));

        break_flag = 0;

        p = -1;

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

            cin >> x >> y >> h;

            points[i].x = x;

            points[i].y = y;

            points[i].h = h;

            if(p == -1 && h > 0) p = i;

        }

        for(j = 0; j < 101; j++){

            for(k = 0; k < 101; k++){

                if(check_validity(j,k,p,n)){

                    break_flag = 1;

                    break;

                }

            }

            if(break_flag) break;

        }

        cout << j << " " << k << " " << points[p].h << endl;

    }

    return 0;

}

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

#include<algorithm>

using namespace std;

int a[105],b[105],c[105];

int main(){

	int n,ans1,ans2,k,q,u;

	scanf("%d",&n);

    for(int i=0;i<n;i++) scanf("%d%d%d",&a[i],&b[i],&c[i]);

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

    	for(int j=0;j<=100;j++){

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

    			if(c[q]!=0){

    				ans1=abs(i-a[q])+abs(j-b[q])+c[q];

    				break;

				}

			}

			if(q==n){

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

					if(i==a[u]&&j==b[u]) break;

				}

				if(u==n) printf("%d %d %d",i,j,1);

				return 0;

			}

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

				ans2=abs(i-a[k])+abs(j-b[k])+c[k];

    			if(c[k]!=0){

    				if(ans1!=ans2) break;

    				ans1=ans2;

				}

    			else{

    				if(ans1>ans2) break;

				}

			}

			if(k==n){

				printf("%d %d %d",i,j,ans1);

				return 0;

			}

		}

	}

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

#include <cmath>

using namespace std;

int x[102],y[102],h[102];

int c_x,c_y,c_h;

int max_h;

int main()

{

	int n;

	scanf("%d",&n);

	max_h = -1;

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

	{

		scanf("%d%d%d",x + i,y + i,h + i);

		max_h = max(max_h,h[i]);

	}

	int sign = 1;

	for(c_h = max_h;sign;c_h ++)

		for(c_x = 0;sign && c_x <= 100;c_x ++)

			for(c_y = 0;sign && c_y <= 100;c_y ++)

			{

				int i = 1;

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

					if(h[i] != max(0,(c_h - abs(c_x - x[i]) - abs(c_y - y[i]))))

						break;

				if(i > n)

					sign = 0;

			}

	printf("%d %d %d\n",c_x - 1,c_y - 1,c_h - 1);

	return 0;

}

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

#include<cstring>

#include<iostream>

#include<algorithm>

using namespace std;

#define ll long long

#define ge getchar 

#define pun putchar('\n')

#define pu putchar

#define puk putchar(' ')

char c;

int n,i,a,b,l,r,e,z,rr,x[120],y[120],d[120],h[120];

bool o,w;

ll g[50];

int sri(){c=ge();int x=0;while(c<'0')c=ge();while(c>='0')x=(x<<3)+(x<<1)+c-'0',c=ge();return x;}

void sc(ll x){int l=0;if(x==0)g[l=1]=0;while(x)g[++l]=x%10,x/=10;for(;l;l--)putchar(g[l]+'0');}

int main(){

	n=sri();rr=1000001000;w=1;

	for(i=1;i<=n;i++)x[i]=sri(),y[i]=sri(),h[i]=sri();

	for(a=0;a<=100&&w;a++){

		for(i=1;i<=n;i++)if(x[i]>a)d[i]=x[i]-a;else d[i]=a-x[i];

		for(b=0;b<=100&&w;b++){l=0;r=rr;o=1;

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

				if(y[i]>b)e=y[i]-b;else e=b-y[i];

				if(h[i]){

					z=h[i]+e+d[i];

					if(l<=z&&r>=z)l=r=z;else{o=0;break;}

				}else{

					z=e+d[i];

					if(r>z){

						r=z;if(l>r){o=0;break;}

					}

				}

			}

			if(o){w=0;

				sc(a);puk;sc(b);puk;sc(r);pun;

			}

		}

	}

    return 0;

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

#include <cmath>

using namespace std;

int x[102],y[102],h[102];

int c_x,c_y,c_h;

int max_h;

int main()

{

	int n;

	scanf("%d",&n);

	max_h = -1;

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

	{

		scanf("%d%d%d",x + i,y + i,h + i);

		max_h = max(max_h,h[i]);

	}

	int sign = 1;

	for(c_h = max_h;sign;c_h ++)

		for(c_x = 0;sign && c_x <= 100;c_x ++)

			for(c_y = 0;sign && c_y <= 100;c_y ++)

			{

				int i = 1;

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

					if(h[i] != max(0,(c_h - abs(c_x - x[i]) - abs(c_y - y[i]))))

						break;

				if(i > n)

					sign = 0;

			}

	printf("%d %d %d\n",c_x - 1,c_y - 1,c_h - 1);

	return 0;

}

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

#include <vector>

#include <algorithm>



using std::cout;    using std::cin;

using std::endl;    using std::vector;

using std::max;     using std::abs;



int main() {



    int n;

    cin >> n;



    vector<int> vx, vy, vh;

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



        int x, y, h;

        cin >> x >> y >> h;



        vx.push_back(x);

        vy.push_back(y);

        vh.push_back(h);

    }



    typedef vector<int>::size_type size;



    size count = 0;



    while (vh[count] == 0)

        ++count;



    for (size i = 0; i != 101; ++i) {



        for (size j = 0; j != 101; ++j) {



            int H, Cx = i, Cy = j;

            H = vh[count] + abs(vx[count] - Cx) + abs(vy[count] - Cy);



            size k = 0;

            while (k != n) {



                if (vh[k] != max(H - abs(vx[k] - Cx) - abs(vy[k] - Cy), 0))

                    break;



                ++k;

            }



            if (k == n) {



                cout << Cx << " " << Cy << " " << H << endl;



                return 0;

            }

        }

    }



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

#include <vector>

#include <tuple>

using namespace std;



vector<tuple<int, int, int>> pyramid;

vector<tuple<int, int, int>> measure;



void init_pyramid()

{

  for (auto y = 0; y <= 100; y++) {

    for (auto x = 0; x <= 100; x++) {

      pyramid.emplace_back(make_tuple(x, y, 0));

    }

  }

}



void read_measure_data()

{

  int n;

  cin >> n;

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

    int a, b, c;

    cin >> a >> b >> c;

    measure.emplace_back(make_tuple(a, b, c));

  }

}



void check1()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

      if (get<2>(p) < 0) continue;

      if (get<2>(m) == 0) continue;

      int guess = get<2>(m) + abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));

      if (get<2>(p) == 0) {

	get<2>(p) = guess;

      } else if (get<2>(p) != guess) {

	get<2>(p) = -1;

      }

    }

  }

}



void check2()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

      if (get<2>(p) < 0) continue;

      if (get<2>(m) != 0) continue;

      int guess = abs(get<0>(p) - get<0>(m)) + abs(get<1>(p) - get<1>(m));

      if (guess - get<2>(p) < 0) {

	get<2>(p) = -1;

      }

    }

  }

}



void print_ans()

{

  for (auto&& p : pyramid) {

    if (get<2>(p) > 0) {

      cout << get<0>(p) << " " << get<1>(p) << " " << get<2>(p) << endl;

    }

  }

}



int main()

{

  init_pyramid();

  read_measure_data();

  check1();

  check2();

  print_ans();

}


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

using namespace std;



struct xyh {

  int x, y, h;

};



int main()

{

  int n;

  cin >> n;

  vector<xyh> survey(n);



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

    cin >> survey[i].x >> survey[i].y >> survey[i].h;

  }



  vector<xyh> pyramid(101 * 101);



  for (int y = 0; y <= 100; y++) {

    for (int x = 0; x <= 100; x++) {

      pyramid[101 * y + x] = {x, y, 0};

    }

  }



  for (auto&& p : pyramid) {

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h == 0) continue;

      if (p.h == 0) {

        p.h = abs(p.x - s.x) + abs(p.y - s.y) + s.h;

      } else {

        if (p.h != abs(p.x - s.x) + abs(p.y - s.y) + s.h) {

          p.h = -1;

          break;

        }

      }

    }

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h != 0) continue;

      if (p.h > abs(p.x - s.x) + abs(p.y - s.y)) {

        p.h = -1;

        break;

      }

    }

  }

  for (auto&& p : pyramid) {

    if (p.h > 0) {

      cout << p.x << " " << p.y << " " << p.h << endl;

      break;

    }

  }

}