stablegradients/pie-gem5-pairs huggingface dataset:
// 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 flag = 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)

                    flag = false;

			}

			if (flag == true)

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

		}

	}

//	if (vec.size() == 1)

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



}




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

#include<algorithm>

#include<queue>

#include<cmath>

using namespace std;

typedef long long ll;

struct node

{

    int cx,cy;

    ll h;

}pl[105];

ll map[105][105];

ll map2[105][105];

int main()

{

    int n;

    scanf("%d",&n);

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

    {

        scanf("%d%d%lld",&pl[i].cx,&pl[i].cy,&pl[i].h);

        map[pl[i].cx][pl[i].cy]=pl[i].h;

    }

    int k=0;

    while(pl[k].h==0)

        k++;

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

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

    {

        ll mh=pl[k].h+abs(i-pl[k].cx)+abs(j-pl[k].cy);

        int flag=0;

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

        {

            ll ch=mh-abs(i-pl[p].cx)-abs(j-pl[p].cy);

            if(ch<0)

                ch=0;

            if(ch!=pl[p].h)

            {

                flag=1;

                break;

            }

        }

        if(flag==0)

        {

            printf("%d %d %lld\n",i,j,mh);

            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 flag = 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)

                    flag = false;

			}

			if (flag == true)

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

		}

	}

//	if (vec.size() == 1)

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



}




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

#include <cstdlib>

#include <iostream>

#include <vector>



struct Point {

    Point() : x(0), y(0), h(0) {}

    Point(int _x, int _y, int _h) : x(_x), y(_y), h(_h) {}

    int x, y, h;

};



int main() {

    size_t n;

    std::cin >> n;

    std::vector<Point> points(n);

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

        std::cin >> points[i].x >> points[i].y >> points[i].h;

    }

    Point c;

    for (c.x = 0; c.x <= 100; ++c.x) {

        for (c.y = 0; c.y <= 100; ++c.y) {

            for (auto&& p : points) {

                if (p.h == 0) continue;

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

                size_t i = 0;

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

                    int h = std::max(c.h - abs(c.x - points[i].x) -

                                         abs(c.y - points[i].y),

                                     0);

                    if (points[i].h != h) break;

                }

                if (i == n) {

                    std::cout << c.x << ' ' << c.y << ' ' << c.h << '\n';

                    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 flag = 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)

                    flag = false;

			}

			if (flag == true)

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

		}

	}

//	if (vec.size() == 1)

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



}




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

#include<cstdlib>

#include<algorithm>

using namespace std;

#define Maxn 110



int ax[Maxn],ay[Maxn],ah[Maxn];



int mymax(int x,int y) {return x>y?x:y;}



int main()

{

	int n,id;

	scanf("%d",&n);

	for(int i=1;i<=n;i++) scanf("%d%d%d",&ax[i],&ay[i],&ah[i]);

	for(int i=0;i<=100;i++) if(ah[i]!=0) {id=i;break;}

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

	{

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

		{

			int H=ah[id]+abs(ax[id]-i)+abs(ay[id]-j);

			bool p=1;

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

			{

				if(mymax(H-abs(ax[k]-i)-abs(ay[k]-j),0)!=ah[k])

				{

					p=0;

					break;

				}

			}

			if(p) printf("%d %d %d\n",i,j,H);

		}

	}

	return 0;

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

#include <cstdlib>

#include <iostream>

#include <vector>



struct Point {

    Point() : x(0), y(0), h(0) {}

    Point(int _x, int _y, int _h) : x(_x), y(_y), h(_h) {}

    int x, y, h;

};



int main() {

    size_t n;

    std::cin >> n;

    std::vector<Point> points(n);

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

        std::cin >> points[i].x >> points[i].y >> points[i].h;

    }

    Point c;

    for (c.x = 0; c.x <= 100; ++c.x) {

        for (c.y = 0; c.y <= 100; ++c.y) {

            for (auto&& p : points) {

                if (p.h == 0) continue;

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

                size_t i = 0;

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

                    int h = std::max(c.h - abs(c.x - points[i].x) -

                                         abs(c.y - points[i].y),

                                     0);

                    if (points[i].h != h) break;

                }

                if (i == n) {

                    std::cout << c.x << ' ' << c.y << ' ' << c.h << '\n';

                    return 0;

                }

            }

        }

    }

    return 0;

}


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

#include<cstdlib>

#include<algorithm>

using namespace std;

#define Maxn 110



int ax[Maxn],ay[Maxn],ah[Maxn];



int mymax(int x,int y) {return x>y?x:y;}



int main()

{

	int n,id;

	scanf("%d",&n);

	for(int i=1;i<=n;i++) scanf("%d%d%d",&ax[i],&ay[i],&ah[i]);

	for(int i=0;i<=100;i++) if(ah[i]!=0) {id=i;break;}

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

	{

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

		{

			int H=ah[id]+abs(ax[id]-i)+abs(ay[id]-j);

			bool p=1;

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

			{

				if(mymax(H-abs(ax[k]-i)-abs(ay[k]-j),0)!=ah[k])

				{

					p=0;

					break;

				}

			}

			if(p) printf("%d %d %d\n",i,j,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 flag = 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)

                    flag = false;

			}

			if (flag == true)

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

		}

	}

//	if (vec.size() == 1)

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



}




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

#include<string>

#include<vector>

using namespace std;

class Coor{

public:

    Coor(int xx=0,int yy=0,int hh=0){x=xx;y=yy;h=hh;}

    ~Coor(){}

    int x;

    int y;

    int h;

};

int main()

{

    int n;

    cin>>n;

    vector<Coor> input(n);

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

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

    }

    Coor center;

    for(center.x=0;center.x<=100;center.x++){

    	for(center.y=0;center.y<=100;center.y++){

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

    			if(input[i].h>0){

    				center.h=input[i].h+(input[i].x-center.x>=0?input[i].x-center.x:center.x-input[i].x)+(input[i].y-center.y>=0?input[i].y-center.y:center.y-input[i].y);

    				int j=0;

					for(;j<n;j++){

    					if(input[j].h!=max(0,center.h-(input[j].x-center.x>=0?input[j].x-center.x:center.x-input[j].x)-(input[j].y-center.y>=0?input[j].y-center.y:center.y-input[j].y))) break;         

    				}

    				if(j==n){

    					cout<<center.x<<" "<<center.y<<" "<<center.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 flag = 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)

                    flag = false;

			}

			if (flag == true)

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

		}

	}

//	if (vec.size() == 1)

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



}




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

#include <algorithm>

#include <cstdlib>



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

using std::min;



const int MAXN=105;



int N,cx,cy,ch=0,c_point,min_abs;                     //c_point: calculable point

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



int main()

{

    scanf("%d",&N);

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

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

    for (cx=0;cx<=100&&ch<=0;++cx)

    {

        for (cy=0;cy<=100&&ch<=0;++cy)

        {

            min_abs=MAXN<<1;

            for (c_point=1;c_point<=N&&h[c_point]==0;++c_point);

            if (c_point==N+1)

            {

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

                    min_abs=min(min_abs,abs(x[i]-cx)+abs(y[i]-cy));

                if (min_abs==1) ch=1;

            }

            else

            {

                ch=h[c_point]+abs(x[c_point]-cx)+abs(y[c_point]-cy);

                int i;

                for (i=1;i<=N&&h[i]==max(ch-abs(x[i]-cx)-abs(y[i]-cy),0);++i);

                if (i<=N) ch=0;

            }

        }

    }

    printf("%d %d %d",--cx,--cy,ch);



    return 0;

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

#include <cstdlib>

#include <iostream>

#include <vector>



struct Point {

    Point() : x(0), y(0), h(0) {}

    Point(int _x, int _y, int _h) : x(_x), y(_y), h(_h) {}

    int x, y, h;

};



int main() {

    size_t n;

    std::cin >> n;

    std::vector<Point> points(n);

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

        std::cin >> points[i].x >> points[i].y >> points[i].h;

    }

    Point c;

    for (c.x = 0; c.x <= 100; ++c.x) {

        for (c.y = 0; c.y <= 100; ++c.y) {

            for (auto&& p : points) {

                if (p.h == 0) continue;

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

                size_t i = 0;

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

                    int h = std::max(c.h - abs(c.x - points[i].x) -

                                         abs(c.y - points[i].y),

                                     0);

                    if (points[i].h != h) break;

                }

                if (i == n) {

                    std::cout << c.x << ' ' << c.y << ' ' << c.h << '\n';

                    return 0;

                }

            }

        }

    }

    return 0;

}


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

#include <algorithm>

#include <cstdlib>



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

using std::min;



const int MAXN=105;



int N,cx,cy,ch=0,c_point,min_abs;                     //c_point: calculable point

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



int main()

{

    scanf("%d",&N);

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

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

    for (cx=0;cx<=100&&ch<=0;++cx)

    {

        for (cy=0;cy<=100&&ch<=0;++cy)

        {

            min_abs=MAXN<<1;

            for (c_point=1;c_point<=N&&h[c_point]==0;++c_point);

            if (c_point==N+1)

            {

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

                    min_abs=min(min_abs,abs(x[i]-cx)+abs(y[i]-cy));

                if (min_abs==1) ch=1;

            }

            else

            {

                ch=h[c_point]+abs(x[c_point]-cx)+abs(y[c_point]-cy);

                int i;

                for (i=1;i<=N&&h[i]==max(ch-abs(x[i]-cx)-abs(y[i]-cy),0);++i);

                if (i<=N) ch=0;

            }

        }

    }

    printf("%d %d %d",--cx,--cy,ch);



    return 0;

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

#include<cstdlib>

#include<algorithm>

using namespace std;

#define Maxn 110



int ax[Maxn],ay[Maxn],ah[Maxn];



int mymax(int x,int y) {return x>y?x:y;}



int main()

{

	int n,id;

	scanf("%d",&n);

	for(int i=1;i<=n;i++) scanf("%d%d%d",&ax[i],&ay[i],&ah[i]);

	for(int i=0;i<=100;i++) if(ah[i]!=0) {id=i;break;}

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

	{

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

		{

			int H=ah[id]+abs(ax[id]-i)+abs(ay[id]-j);

			bool p=1;

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

			{

				if(mymax(H-abs(ax[k]-i)-abs(ay[k]-j),0)!=ah[k])

				{

					p=0;

					break;

				}

			}

			if(p) printf("%d %d %d\n",i,j,H);

		}

	}

	return 0;

}

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

#include <algorithm>

#include <cstdlib>



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

using std::min;



const int MAXN=105;



int N,cx,cy,ch=0,c_point,min_abs;                     //c_point: calculable point

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



int main()

{

    scanf("%d",&N);

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

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

    for (cx=0;cx<=100&&ch<=0;++cx)

    {

        for (cy=0;cy<=100&&ch<=0;++cy)

        {

            min_abs=MAXN<<1;

            for (c_point=1;c_point<=N&&h[c_point]==0;++c_point);

            if (c_point==N+1)

            {

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

                    min_abs=min(min_abs,abs(x[i]-cx)+abs(y[i]-cy));

                if (min_abs==1) ch=1;

            }

            else

            {

                ch=h[c_point]+abs(x[c_point]-cx)+abs(y[c_point]-cy);

                int i;

                for (i=1;i<=N&&h[i]==max(ch-abs(x[i]-cx)-abs(y[i]-cy),0);++i);

                if (i<=N) ch=0;

            }

        }

    }

    printf("%d %d %d",--cx,--cy,ch);



    return 0;

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

#include<string>

#include<vector>

using namespace std;

class Coor{

public:

    Coor(int xx=0,int yy=0,int hh=0){x=xx;y=yy;h=hh;}

    ~Coor(){}

    int x;

    int y;

    int h;

};

int main()

{

    int n;

    cin>>n;

    vector<Coor> input(n);

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

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

    }

    Coor center;

    for(center.x=0;center.x<=100;center.x++){

    	for(center.y=0;center.y<=100;center.y++){

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

    			if(input[i].h>0){

    				center.h=input[i].h+(input[i].x-center.x>=0?input[i].x-center.x:center.x-input[i].x)+(input[i].y-center.y>=0?input[i].y-center.y:center.y-input[i].y);

    				int j=0;

					for(;j<n;j++){

    					if(input[j].h!=max(0,center.h-(input[j].x-center.x>=0?input[j].x-center.x:center.x-input[j].x)-(input[j].y-center.y>=0?input[j].y-center.y:center.y-input[j].y))) break;         

    				}

    				if(j==n){

    					cout<<center.x<<" "<<center.y<<" "<<center.h;

    					return 0;

					} 

    			}

			}

    	}

    }

}

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

#include <algorithm>

#include <cstdlib>



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

using std::min;



const int MAXN=105;



int N,cx,cy,ch=0,c_point,min_abs;                     //c_point: calculable point

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



int main()

{

    scanf("%d",&N);

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

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

    for (cx=0;cx<=100&&ch<=0;++cx)

    {

        for (cy=0;cy<=100&&ch<=0;++cy)

        {

            min_abs=MAXN<<1;

            for (c_point=1;c_point<=N&&h[c_point]==0;++c_point);

            if (c_point==N+1)

            {

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

                    min_abs=min(min_abs,abs(x[i]-cx)+abs(y[i]-cy));

                if (min_abs==1) ch=1;

            }

            else

            {

                ch=h[c_point]+abs(x[c_point]-cx)+abs(y[c_point]-cy);

                int i;

                for (i=1;i<=N&&h[i]==max(ch-abs(x[i]-cx)-abs(y[i]-cy),0);++i);

                if (i<=N) ch=0;

            }

        }

    }

    printf("%d %d %d",--cx,--cy,ch);



    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 flag = 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)

                    flag = false;

			}

			if (flag == true)

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

		}

	}

//	if (vec.size() == 1)

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



}




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



using namespace std;



const int N=200;



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

int H,flag,mx,mn,n;



int main(){

	scanf("%d",&n);

	for (int i=1;i<=n;++i) scanf("%d%d%d",&x[i],&y[i],&h[i]);

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

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

			H=-1;flag=1;mx=0;mn=abs(x[1]-i)+abs(y[1]-j);

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

//				printf("	%d %d %d:",k,h[k],H);

				if (h[k]!=0){

					if (H==-1) H=h[k]+abs(x[k]-i)+abs(y[k]-j);

					else if (h[k]!=H-abs(x[k]-i)-abs(y[k]-j)){

						flag=0;break;

					}

				}

				

				mn=min(mn,abs(x[k]-i)+abs(y[k]-j));

				mx=max(mx,abs(x[k]-i)+abs(y[k]-j));

//				printf("%d %d %d\n",mn,mx,H);

			}

			if (flag){

				if (H==-1)

					if (mn!=mx) continue;else H=mx;

//				printf("%d %d %d\n",i,j,H);

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

					if (h[k]!=max(H-abs(x[k]-i)-abs(y[k]-j),0)){

						flag=0;

//						printf("%d\n",k);

						break;

					}

				if (flag){

					printf("%d %d %d\n",i,j,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 flag = 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)

                    flag = false;

			}

			if (flag == true)

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

		}

	}

//	if (vec.size() == 1)

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



}




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

#include<algorithm>

using namespace std;

int main()

{

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

	long h[100] = {0};//存放方程

	int n;

	cin >> n;

	int i, j;//工具人

	for (i = 0;i < n;i++)//输入方程

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

	int p = 0;

	while (h[p] == 0)p++;//应付0

	int h_ans, h_t, k, judge;

	for(i=0;i<=100;i++)//使用（i,j）来测中心坐标

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

		{

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

			judge = 1;

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

			{

				h_t = max(h_ans - abs(i - x[k]) - abs(j - y[k]), 0);

				if (h_t!=h[k])

				{

					judge = 0;

					break;

				}

			}

			if (judge)

			{

				cout << i << ' ' << j << ' ' << h_ans << endl;

				return 0;

			}

		}

}