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

#include<iostream>

#include<cstdlib>

#include<cmath>

#include<vector>

#include<map>

#include<algorithm>



using namespace std;



typedef struct {

    int x;

    int y;

    long long h;

} XYH;



int main()

{

    int N;

    cin >> N;



    XYH xyh_ref;

    vector<XYH> xyh;

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

        int x, y;

        long long h;

        cin >> x >> y >> h;

        XYH xyh_i = {x, y, h};

        xyh.push_back(xyh_i);

        if (h > 0) {

            xyh_ref = xyh_i;

        }

    }



    int Cx, Cy;

    long long H;

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

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

            H = abs(xyh_ref.x - Cx) + abs(xyh_ref.y - Cy) + xyh_ref.h;

            bool flag = true;



            for (int i = 0; i < xyh.size(); i++) {

                long long h = max(H - abs(xyh[i].x - Cx) - abs(xyh[i].y - Cy), 0LL);

                

                if (h != xyh[i].h) {

                    flag = false;

                }

            }



            if (flag) {

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

            }

        }

    }





    return 0;

}


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

#include<iostream>

#include<cstdlib>

#include<cmath>

#include<vector>

#include<map>

#include<algorithm>



using namespace std;



typedef struct {

    int x;

    int y;

    long long h;

} XYH;



int main()

{

    int N;

    cin >> N;



    XYH xyh_ref;

    vector<XYH> xyh;

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

        int x, y;

        long long h;

        cin >> x >> y >> h;

        XYH xyh_i = {x, y, h};

        xyh.push_back(xyh_i);

        if (h > 0) {

            xyh_ref = xyh_i;

        }

    }



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

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

            long long H = abs(xyh_ref.x - Cx) + abs(xyh_ref.y - Cy) + xyh_ref.h;

            bool flag = true;



            for (int i = 0; i < xyh.size(); i++) {

                long long h = max(H - abs(xyh[i].x - Cx) - abs(xyh[i].y - Cy), 0LL);

                if (h != xyh[i].h) {

                    flag = false;

                    break;

                }

            }



            if (flag) {

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

                return 0;

            }

        }

    }



    return 0;

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



#define fr first

#define sc second

#define pb push_back

#define mk make_pair

#define mt make_tuple

#define int long long

#define OK puts("OK")

#define sz(s) (int)s.size()

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



using namespace std;





int N, X[1009], Y[1009], H[1009];

vector< tuple < int , int , int > > v;



 main() {

	cin >> N;

	tuple < int , int , int > G = mt ( -1 , -1 , -1 ) ;

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

    {

		cin >> X[i] >> Y[i] >> H[i];

		if ( H[i] >= 1)

		G = mt (X[i], Y[i], H[i]);

	}

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

	 {

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

        {

			int V = get<2> (G) + abs ( get<0> (G) - i) + abs(get<1>(G) - j);

            V = max(V, 0LL);

            bool f = true;



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

            {

				int VV = V - abs( X[k] - i) - abs ( Y[k] - j );

                VV = max(VV, 0LL);

				if (H[k] != VV)

                    f = false;

			}

			if (f == true)

                v.push_back(make_tuple(i, j, V));

		}

	}



    cout << get<0> ( v[0] ) << " " << get<1> ( v[0] ) << " " << get<2> (v[0]) << endl;



}




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

#include<cmath>

#include<cstdlib>

using namespace std;

struct coo{

	int x;

	int y;

	int h;

}c[110];

int main()

{

	int n;

	cin>>n;

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

	{

		cin>>c[i].x;

		cin>>c[i].y;

		cin>>c[i].h;

	}

	int ch;

	int p=0;

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

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

	{

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

		{

			int ch=c[p].h+abs(i-c[p].x)+abs(j-c[p].y);

			int f=0;

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

			{

				int hh=ch-abs(i-c[k].x)-abs(j-c[k].y);

				if(hh<0) hh=0;

				if(hh!=c[k].h)

				{

					f=1;

					break;

				}

			}

			if(!f)

			{

				cout<<i<<' '<<j<<' '<<ch<<endl; return 0;

			} 

		}

	}

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



#define fr first

#define sc second

#define pb push_back

#define mk make_pair

#define mt make_tuple

#define int long long

#define OK puts("OK")

#define sz(s) (int)s.size()

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



using namespace std;





int N, X[1009], Y[1009], H[1009];

vector< tuple < int , int , int > > v;



 main() {

	cin >> N;

	tuple < int , int , int > G = mt ( -1 , -1 , -1 ) ;

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

    {

		cin >> X[i] >> Y[i] >> H[i];

		if ( H[i] >= 1)

		G = mt (X[i], Y[i], H[i]);

	}

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

	 {

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

        {

			int V = get<2> (G) + abs ( get<0> (G) - i) + abs(get<1>(G) - j);

            V = max(V, 0LL);

            bool f = true;



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

            {

				int VV = V - abs( X[k] - i) - abs ( Y[k] - j );

                VV = max(VV, 0LL);

				if (H[k] != VV)

                    f = false;

			}

			if (f == true)

                v.push_back(make_tuple(i, j, V));

		}

	}



    cout << get<0> ( v[0] ) << " " << get<1> ( v[0] ) << " " << get<2> (v[0]) << endl;



}




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

using namespace std;

int main()

{

	int x[100]={0},y[100]={0};

	long long h[100]={0};

	int n;

	cin>>n;

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

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

	if(n==1)

	{

		cout<<x[0]<<" "<<y[0]<<" "<<h[0];

		return 0;

	}

	int cx,cy;

	long long H,temp;

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

	{

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

		{

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

			{

				if(h[i]==0)

					continue;

				else

				{

					H=h[i]+((x[i]-cx)>0?x[i]-cx:cx-x[i])+((y[i]-cy)>0?y[i]-cy:cy-y[i]);

					break;

				}

			}

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

			{

				temp=H-((x[i]-cx)>0?x[i]-cx:cx-x[i])-((y[i]-cy)>0?y[i]-cy:cy-y[i]);

				if(temp<0)

					temp=0;

				if(h[i]!=temp)

					break;

				if(i==n-1)

				{

					cout<<cx<<" "<<cy<<" "<<H;

					return 0;

				}

			}

		}

	}

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



#define fr first

#define sc second

#define pb push_back

#define mk make_pair

#define mt make_tuple

#define int long long

#define OK puts("OK")

#define sz(s) (int)s.size()

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



using namespace std;





int N, X[1009], Y[1009], H[1009];

vector< tuple < int , int , int > > v;



 main() {

	cin >> N;

	tuple < int , int , int > G = mt ( -1 , -1 , -1 ) ;

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

    {

		cin >> X[i] >> Y[i] >> H[i];

		if ( H[i] >= 1)

		G = mt (X[i], Y[i], H[i]);

	}

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

	 {

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

        {

			int V = get<2> (G) + abs ( get<0> (G) - i) + abs(get<1>(G) - j);

            V = max(V, 0LL);

            bool f = true;



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

            {

				int VV = V - abs( X[k] - i) - abs ( Y[k] - j );

                VV = max(VV, 0LL);

				if (H[k] != VV)

                    f = false;

			}

			if (f == true)

                v.push_back(make_tuple(i, j, V));

		}

	}



    cout << get<0> ( v[0] ) << " " << get<1> ( v[0] ) << " " << get<2> (v[0]) << endl;



}




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

#include<string>

#include<cstdio>

#include<algorithm>

using namespace std;



int main()

{

    int C_X,C_Y,H,k;

    int N,x[101],y[101],h[101],flat=0;

    cin>>N;

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

    {

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

        if(h[i]!=0)

            k=i;

    }

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

    {

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

        {

            H=h[k]+abs(x[k]-C_X)+abs(y[k]-C_Y);

            if(h[0]==max(H-abs(x[0]-C_X)-abs(y[0]-C_Y),0))

            {

                int j;

                for(j=1; j<N; j++)

                {

                    if(h[j]!=max(H-abs(x[j]-C_X)-abs(y[j]-C_Y),0))

                        break;

                }

                if(j==N)

                {

                    flat=1;

                    printf("%d %d %d\n",C_X,C_Y,H);

                    break;

                }

            }

        }

        if(flat==1)

            break;

    }

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



#define fr first

#define sc second

#define pb push_back

#define mk make_pair

#define mt make_tuple

#define int long long

#define OK puts("OK")

#define sz(s) (int)s.size()

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



using namespace std;





int N, X[1009], Y[1009], H[1009];

vector< tuple < int , int , int > > v;



 main() {

	cin >> N;

	tuple < int , int , int > G = mt ( -1 , -1 , -1 ) ;

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

    {

		cin >> X[i] >> Y[i] >> H[i];

		if ( H[i] >= 1)

		G = mt (X[i], Y[i], H[i]);

	}

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

	 {

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

        {

			int V = get<2> (G) + abs ( get<0> (G) - i) + abs(get<1>(G) - j);

            V = max(V, 0LL);

            bool f = true;



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

            {

				int VV = V - abs( X[k] - i) - abs ( Y[k] - j );

                VV = max(VV, 0LL);

				if (H[k] != VV)

                    f = false;

			}

			if (f == true)

                v.push_back(make_tuple(i, j, V));

		}

	}



    cout << get<0> ( v[0] ) << " " << get<1> ( v[0] ) << " " << get<2> (v[0]) << endl;



}




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

using namespace std;

#include<vector>

int max(int a, int b=0){

    if (a > b)

        return a;

    return b;

}

int f(int a){

    if (a < 0)

        return -a;

    return a;

}

int main(){

    int n;

    cin >> n;

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

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

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

    int Hi = 1;

    //for (int Hi=1; Hi < __INT32_MAX__;Hi++)

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

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

                bool find = true;

                vector<int> zero;

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

                    if (h[i] == 0)

                        zero.push_back(i);

                    

                    if ((m==0) && h[i] != 0)

                        if(h[i] != max(Hi - f(x[i] - c_x) - f(y[i] - c_y))){

                            find = false;

                            break;

                        }

                    if (m && h[i] != 0){

                        Hi = h[i] + f(x[i] - c_x) + f(y[i] - c_y);

                        m = false;

                    }

                }

                if (find) {

                    for(auto i:zero)

                        if(h[i] != max(Hi - f(x[i] - c_x) - f(y[i] - c_y))){

                            find = false;

                            break;

                    }

                }

                if (find){

                    cout << c_x << ' ' << c_y << ' ' << Hi;

                    return 0;

                }

            }

    return 0; 

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



#define fr first

#define sc second

#define pb push_back

#define mk make_pair

#define mt make_tuple

#define int long long

#define OK puts("OK")

#define sz(s) (int)s.size()

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



using namespace std;





int N, X[1009], Y[1009], H[1009];

vector< tuple < int , int , int > > v;



 main() {

	cin >> N;

	tuple < int , int , int > G = mt ( -1 , -1 , -1 ) ;

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

    {

		cin >> X[i] >> Y[i] >> H[i];

		if ( H[i] >= 1)

		G = mt (X[i], Y[i], H[i]);

	}

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

	 {

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

        {

			int V = get<2> (G) + abs ( get<0> (G) - i) + abs(get<1>(G) - j);

            V = max(V, 0LL);

            bool f = true;



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

            {

				int VV = V - abs( X[k] - i) - abs ( Y[k] - j );

                VV = max(VV, 0LL);

				if (H[k] != VV)

                    f = false;

			}

			if (f == true)

                v.push_back(make_tuple(i, j, V));

		}

	}



    cout << get<0> ( v[0] ) << " " << get<1> ( v[0] ) << " " << get<2> (v[0]) << endl;



}




// Faster C++ solution for the same problem (measured speedup: 1.1374010447756473x):


#include<iostream>

#include<cmath>

using namespace std;

int main(){ 

	int N;

	cin>>N;

	int Cx;

	int Cy;

	int H;

	int flag=0;

	int u;

	

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

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

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

		if(h[i]!=0)

			u=i;

	}



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

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

			flag=0;

			int zeta=abs(x[u]-Cx)+abs(y[u]-Cy)+h[u];

			

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

				if(h[k]==0)

					continue;	

				if(zeta!=abs(x[k]-Cx)+abs(y[k]-Cy)+h[k])

					flag=1;



			}

			if(flag==0){

				int flag2=1;

				H=max(abs(x[u]-Cx)+abs(y[u]-Cy)+h[u],1);

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

					if(h[k]==0)

						if(H>abs(x[k]-Cx)+abs(y[k]-Cy))

							flag2=0;

				if(flag2){

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

					return 0;

				}

			}

		}



	return 0;		

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

#include <math.h>

using namespace std;

struct pyrimid

{

	int h,x,y;

	inline int center(int& H,int& a,int& b)

	{

		int o = H - abs(x - a) - abs(y - b);

		return h ==( o > 0 ? o : 0);

	}

};

int main()

{

	int n,i,j,k;

	cin >> n;

	pyrimid *p = new pyrimid[n];

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

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

	for(i = p[0].h,k = 1;k < n;k ++)

	{

		i = i > p[k].h ? i : p[k].h;

	}

	for(;;i ++)

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

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

			{	

				int f = 0;

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

					if(p[g].center(i,j,k) == 1)

						f ++;

				if(f == n)

				{

					cout << j << ' ' << k << ' ' << i << endl;

					return 0;

				}

			}

}

// Faster C++ solution for the same problem (measured speedup: 2.20129946370612x):


#include<iostream>

#include<cmath>

using namespace std;

int main(){ 

	int N;

	cin>>N;

	int Cx;

	int Cy;

	int H;

	int flag=0;

	int u;

	

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

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

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

		if(h[i]!=0)

			u=i;

	}



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

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

			flag=0;

			int zeta=abs(x[u]-Cx)+abs(y[u]-Cy)+h[u];

			

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

				if(h[k]==0)

					continue;	

				if(zeta!=abs(x[k]-Cx)+abs(y[k]-Cy)+h[k])

					flag=1;



			}

			if(flag==0){

				int flag2=1;

				H=max(abs(x[u]-Cx)+abs(y[u]-Cy)+h[u],1);

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

					if(h[k]==0)

						if(H>abs(x[k]-Cx)+abs(y[k]-Cy))

							flag2=0;

				if(flag2){

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

					return 0;

				}

			}

		}



	return 0;		

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



#define fr first

#define sc second

#define pb push_back

#define mk make_pair

#define mt make_tuple

#define int long long

#define OK puts("OK")

#define sz(s) (int)s.size()

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



using namespace std;





int N, X[1009], Y[1009], H[1009];

vector< tuple < int , int , int > > v;



 main() {

	cin >> N;

	tuple < int , int , int > G = mt ( -1 , -1 , -1 ) ;

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

    {

		cin >> X[i] >> Y[i] >> H[i];

		if ( H[i] >= 1)

		G = mt (X[i], Y[i], H[i]);

	}

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

	 {

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

        {

			int V = get<2> (G) + abs ( get<0> (G) - i) + abs(get<1>(G) - j);

            V = max(V, 0LL);

            bool f = true;



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

            {

				int VV = V - abs( X[k] - i) - abs ( Y[k] - j );

                VV = max(VV, 0LL);

				if (H[k] != VV)

                    f = false;

			}

			if (f == true)

                v.push_back(make_tuple(i, j, V));

		}

	}



    cout << get<0> ( v[0] ) << " " << get<1> ( v[0] ) << " " << get<2> (v[0]) << endl;



}




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

#include <cmath>

using namespace std;





int n, c;

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



int max(int x, int y) {

    if (x > y)return x;

    else return y;

}



int kkk(int a, int b) {

    int h0 = abs(a-x[c])+abs(b-y[c])+ h[c];



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

        if (max(0, h0-(abs(a - x[i]) + abs(b - y[i]))) != h[i])

            return 0;

    return 1;

}



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) c = i;



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

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

            if (kkk(i, j)) {

                cout << i << " " << j << " " << abs(i - x[c]) + abs(j - y[c]) + h[c] << endl;

                return 0;

            }

        }

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

#include <math.h>

using namespace std;

struct pyrimid

{

	int h,x,y;

	inline int center(int& H,int& a,int& b)

	{

		int o = H - abs(x - a) - abs(y - b);

		return h ==( o > 0 ? o : 0);

	}

};

int main()

{

	int n,i,j,k;

	cin >> n;

	pyrimid *p = new pyrimid[n];

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

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

	for(i = p[0].h,k = 1;k < n;k ++)

	{

		i = i > p[k].h ? i : p[k].h;

	}

	for(;;i ++)

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

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

			{	

				int f = 0;

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

					if(p[g].center(i,j,k) == 1)

						f ++;

				if(f == n)

				{

					cout << j << ' ' << k << ' ' << i << endl;

					return 0;

				}

			}

}

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

#include <cmath>

using namespace std;





int n, c;

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



int max(int x, int y) {

    if (x > y)return x;

    else return y;

}



int kkk(int a, int b) {

    int h0 = abs(a-x[c])+abs(b-y[c])+ h[c];



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

        if (max(0, h0-(abs(a - x[i]) + abs(b - y[i]))) != h[i])

            return 0;

    return 1;

}



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) c = i;



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

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

            if (kkk(i, j)) {

                cout << i << " " << j << " " << abs(i - x[c]) + abs(j - y[c]) + h[c] << endl;

                return 0;

            }

        }

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



#define fr first

#define sc second

#define pb push_back

#define mk make_pair

#define mt make_tuple

#define int long long

#define OK puts("OK")

#define sz(s) (int)s.size()

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



using namespace std;





int N, X[1009], Y[1009], H[1009];

vector< tuple < int , int , int > > v;



 main() {

	cin >> N;

	tuple < int , int , int > G = mt ( -1 , -1 , -1 ) ;

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

    {

		cin >> X[i] >> Y[i] >> H[i];

		if ( H[i] >= 1)

		G = mt (X[i], Y[i], H[i]);

	}

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

	 {

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

        {

			int V = get<2> (G) + abs ( get<0> (G) - i) + abs(get<1>(G) - j);

            V = max(V, 0LL);

            bool f = true;



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

            {

				int VV = V - abs( X[k] - i) - abs ( Y[k] - j );

                VV = max(VV, 0LL);

				if (H[k] != VV)

                    f = false;

			}

			if (f == true)

                v.push_back(make_tuple(i, j, V));

		}

	}



    cout << get<0> ( v[0] ) << " " << get<1> ( v[0] ) << " " << get<2> (v[0]) << endl;



}




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

#include<cmath>

using namespace std;

struct infor

{

 int x;

 int y;

 int h;

};



infor in[101], in1[101], in2[101];

int main()

{

 int N;

 int i,j=0,k=0;

 int Xc, Yc;

 cin >> N;

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

 {

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

     if(in[i].h>0)

         in1[j++] = in[i];

     else

         in2[k++] = in[i];

 }

    

 int m;//m遍历数

    for(Xc = 0; Xc < 101; Xc++ )

    {

        for (Yc = 0; Yc < 101; Yc++ )

        {

            int H ;

            H = in1[0].h + abs(Xc - in1[0].x) + abs(Yc - in1[0].y);

            int flag1, flag2;

            flag1 = flag2 = 1;

            for (m = 1; m < j; m ++)

            {

                if (H == in1[m].h + abs(Xc - in1[m].x) + abs(Yc - in1[m].y));

                else

                {

                    flag1 = 0;

                    break;

                }

            }

            

            if(flag1)

            {

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

                    if( H - abs( in2[m].x - Xc ) - abs( in2[m].y - Yc ) > 0)

                    {

                        flag2 = 0;

                        break;

                    }

                if (flag2)

                {

                    cout << Xc << ' ' << Yc << ' ' << H;

                    return 0;

                }

            }

            else continue;

        }

    }

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

#include <math.h>

using namespace std;

struct pyrimid

{

	int h,x,y;

	inline int center(int& H,int& a,int& b)

	{

		int o = H - abs(x - a) - abs(y - b);

		return h ==( o > 0 ? o : 0);

	}

};

int main()

{

	int n,i,j,k;

	cin >> n;

	pyrimid *p = new pyrimid[n];

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

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

	for(i = p[0].h,k = 1;k < n;k ++)

	{

		i = i > p[k].h ? i : p[k].h;

	}

	for(;;i ++)

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

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

			{	

				int f = 0;

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

					if(p[g].center(i,j,k) == 1)

						f ++;

				if(f == n)

				{

					cout << j << ' ' << k << ' ' << i << endl;

					return 0;

				}

			}

}

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

#include<cmath>

using namespace std;

struct infor

{

 int x;

 int y;

 int h;

};



infor in[101], in1[101], in2[101];

int main()

{

 int N;

 int i,j=0,k=0;

 int Xc, Yc;

 cin >> N;

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

 {

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

     if(in[i].h>0)

         in1[j++] = in[i];

     else

         in2[k++] = in[i];

 }

    

 int m;//m遍历数

    for(Xc = 0; Xc < 101; Xc++ )

    {

        for (Yc = 0; Yc < 101; Yc++ )

        {

            int H ;

            H = in1[0].h + abs(Xc - in1[0].x) + abs(Yc - in1[0].y);

            int flag1, flag2;

            flag1 = flag2 = 1;

            for (m = 1; m < j; m ++)

            {

                if (H == in1[m].h + abs(Xc - in1[m].x) + abs(Yc - in1[m].y));

                else

                {

                    flag1 = 0;

                    break;

                }

            }

            

            if(flag1)

            {

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

                    if( H - abs( in2[m].x - Xc ) - abs( in2[m].y - Yc ) > 0)

                    {

                        flag2 = 0;

                        break;

                    }

                if (flag2)

                {

                    cout << Xc << ' ' << Yc << ' ' << H;

                    return 0;

                }

            }

            else continue;

        }

    }

 }