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

#include<string>

#include<algorithm>

#include<vector>

#include<iomanip>

#include<math.h>

#include<complex>

#include<queue>

#include<deque>

#include<stack>

#include<map>

#include<set>

#include<bitset>

#include<functional>

using namespace std;

#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )

#define rep(i,n) REP(i,0,n)

typedef long long ll;

typedef pair<int,int> pint;

typedef pair<ll,int> pli;

const int inf=1e9+7;

const ll longinf=1LL<<60 ;

const ll mod=1e9+7 ;



int main(){

    int n;

    cin>>n;

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

    rep(i,n)cin>>x[i]>>y[i]>>h[i];

    rep(i,101)rep(j,101){

        int ok=true;

        int H=0;

        rep(k,n){

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

        }

        rep(k,n){

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

        }

        if(ok)cout<<i<<" "<<j<<" "<<H<<endl;

    }

    return 0;

}


// Optimized solution to the same problem (faster):
#include<iostream>

#include<string>

#include<algorithm>

#include<vector>

#include<iomanip>

#include<math.h>

#include<complex>

#include<queue>

#include<deque>

#include<stack>

#include<map>

#include<set>

#include<bitset>

#include<functional>

using namespace std;

#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )

#define rep(i,n) REP(i,0,n)

typedef long long ll;

typedef pair<int,int> pint;

typedef pair<ll,int> pli;

const int inf=1e9+7;

const ll longinf=1LL<<60 ;

const ll mod=1e9+7 ;



int main(){

    int n;

    cin>>n;

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

    rep(i,n)cin>>x[i]>>y[i]>>h[i];

    rep(i,101)rep(j,101){

        int ok=true;

        int H=0;

        rep(k,n){

            if(h[k]!=0){

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

              break;

            }

        }

        rep(k,n){

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

              ok=false;

              break;

            }

        }

        if(ok){

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

          return 0;

        }

    }

    return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;



}




// Optimized solution to the same problem (faster):
#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;

        }

    }

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

					} 

    			}

			}

    	}

    }

}

// Optimized solution to the same problem (faster):
#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;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#define rep(i,n)for(long long i=0;i<(n);i++)

using namespace std;

typedef long long ll;



int main() {

  cin.tie(0);

  int n;

  cin >> n;

  vector<int>x(n);

  vector<int>y(n);

  vector<ll>h(n);

  rep(i,n) cin >> x[i] >> y[i] >> h[i];

  

  vector<int>ans_x;

  vector<int>ans_y;

  vector<ll>ans_h;

  rep(cx,101){

    rep(cy,101){

      set<ll>st;

      ll H;

      rep(i,n){

        if(h[i]==0)continue;

        int X = abs(cx-x[i]);

        int Y = abs(cy-y[i]);

        H = X + Y + h[i];

        st.insert(H);

      }

      if(st.size()==1){

        ans_x.push_back(cx);

        ans_y.push_back(cy);

        ans_h.push_back(H);

      }

    }

  }

  

  rep(i,ans_x.size()){

    bool can = true;

    rep(j,n){

      if(h[j]!=max((ll)0,ans_h[i]-abs(x[j]-ans_x[i])-abs(y[j]-ans_y[i]))){

        can = false;

        break;

      }

    }

    if(can){

      cout << ans_x[i] << " "<< ans_y[i] << " "<< ans_h[i] << endl;

      return 0;

    }

  }

  return 0;

}

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

#define rep(i,n)for(long long i=0;i<(n);i++)

using namespace std;

typedef long long ll;

const int MOD=1e9+7;

const int MAX = 1000000;

const ll INF = (1LL << 31) - 1;

const double pi=acos(-1);



ll n,x[101],y[101],h[101]; 

vector<tuple<ll,ll,ll>>vec;



int main(){

  cin >> n;

  tuple<ll,ll,ll>G;

  rep(i,n){

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

    if(h[i])G=make_tuple(x[i],y[i],h[i]);

  }

  rep(i,101){

    rep(j,101){

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

      bool flag = true;

      rep(k,n){

        ll H=v-abs(x[k]-i)-abs(y[k]-j);

        H=max(H,0ll);

        if(H!=h[k]) flag=false;

      }

      if(flag)vec.push_back(make_tuple(i,j,v));

    }

  }

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

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

#include <algorithm>

using namespace std;

int main() {

int N; 

cin >> N; 

int X[110], Y[110], H[110]; 

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

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

}



int minheight = H[0]; 

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

minheight = min(minheight, H[i]); 

}



int A[110][110][110] = {}, M[110][110] = {}, m[110][110] = {}; 



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

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

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

A[x][y][i] = H[i] + abs(x - X[i]) + abs(y - Y[i]); 

}

}

}



int ansx = 0, ansy = 0, ansh = 0; 



if(minheight > 0){

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

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

M[x][y] = A[x][y][0], m[x][y] = A[x][y][0]; 

}

}



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

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

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

M[x][y] = max(M[x][y], A[x][y][i]); 

m[x][y] = min(m[x][y], A[x][y][i]); 

}

}

}

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

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

    if(M[x][y] == m[x][y]){

ansx = x, ansy = y, ansh = M[x][y]; 

}

}

}

cout  << ansx << " " << ansy << " " << ansh << endl; 

}



else if(minheight == 0){

int ansx = 0, ansy = 0, ansh = 0; 

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

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

for(int h = 1; h <= 200; h++){

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

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

break; 

}

if(i == N-1 && max(h - abs(x-X[i]) - abs(y-Y[i]), 0) == H[i]){

ansx = x, ansy = y, ansh = h; 

}

}

}

}

}



cout  << ansx << " " << ansy << " " << ansh << endl; 

}

}

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

using namespace std;

int main(){

	int N; cin >> N; 

	int X[110], Y[110], H[110];

	int pos = -1;  

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

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

		if(H[i]) pos = i; 

	}

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

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

			int height = H[pos] + abs(i - X[pos]) + abs(j - Y[pos]); 

			bool ok = true; 

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

				if(H[k] != max(0, height - abs(i - X[k]) - abs(j - Y[k]))){

					ok = false; break; 

				}

			}

			if(ok){

				cout << i << " " << j << " " << height << endl; 

				return 0; 

			}

		}

	}

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<stdio.h>

#include<cmath>

#include<algorithm>

using namespace std;



int main()

{

	int N, x[110], y[110], H, count = 0, k = 0;

	long long int h[110];

	scanf("%d", &N);

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

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

	}

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

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

			for (long long  l = max(h[0] - 200,1LL); l <= h[0] + 200; l++) {

				count = 0;

				k = 0;

				while (k < N) {

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

						count++;

					}

					k++;

				}

				if (count == N) {

					printf("%d %d %lld", i, j, l);

					return 0;

				}

			}

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<iostream>

#include<algorithm>

#include<functional>

#include<cmath>

#include<string>

#include<vector>

#include<stack>

#include<queue>

#include<map>

#include<set>

#include<deque>

using namespace std;

#define ll long long

const int mod = 1000000007;

const ll INF = 1000000000000000000;



ll x[110], y[110], h[110];

int main()

{

	int N; cin >> N;

	int point = 0;

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

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

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

	}

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

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

			ll H = h[point] + abs(x[point] - X) + abs(y[point] - Y);

			bool ok = true;

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

				if (h[i] != max(H - abs(x[i] - X) - abs(y[i] - Y), 0ll)) {

					ok = false;

						break;

				}

			}

			if (ok) {

				cout << X << " " << Y << " " << H << endl;

				return 0;

			}

		}

	}

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

/* clang-format off */

#define MOD 1000000007

#define INF 1000000000

#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)

#define ALL(a) (a).begin(), (a).end()

#define __DEBUG__

#ifdef __DEBUG__

#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";

#define DEBUG(x) cout<<#x<<":"<<x<<"\n"

#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"

#endif

#ifndef __DEBUG__

#define CH_P(a) 

#define DEBUG(x) 

#define DEBUGS(v) 

#endif

/* clang-format on */

ll n;

vector<ll> x, y, h;



int main() {

  ll n;

  cin >> n;

  bool all0 = true;

  set<ll> x0, y0;

  ll inot0;

  REP(i, n) {

    ll tx, ty, th;

    cin >> tx >> ty >> th;

    x.push_back(tx);

    y.push_back(ty);

    h.push_back(th);

    if (th == 0) {

      x0.insert(tx);

      y0.insert(ty);

    }

    if (th != 0) {

      all0 = false;

      inot0 = i;

    }

  }



  if (all0) {

    REP(i, 101) {

      REP(j, 101) {

        if (!x0.count(i) && !y0.count(j)) {

          cout << i << j << 1 << endl;

        }

      }

    }

  }



  REP(cx, 101) {

    REP(cy, 101) {

      ll h_pre = h[inot0] + abs(x[inot0] - cx) + abs(y[inot0] - cy);

      bool f = true;

      REP(i, n) {

        if (h[i] != max(0ll, h_pre - abs(x[i] - cx) - abs(y[i] - cy)))

          f = false;

      }

      if (f) {

        cout << cx << ' ' << cy << ' ' << h_pre << endl;

      }

    }

  }



  return 0;

}


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

using namespace std;

typedef long long ll;

/* clang-format off */

#define MOD 1000000007

#define INF 1000000000

#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)

#define ALL(a) (a).begin(), (a).end()

#define __DEBUG__

#ifdef __DEBUG__

#define CH_P(a) cout <<"check_point("<<#a<<")" << "\n";

#define DEBUG(x) cout<<#x<<":"<<x<<"\n"

#define DEBUGS(v) cout << #v << ":";for(auto x:v){cout<<x<<" ";}cout<<"\n"

#endif

#ifndef __DEBUG__

#define CH_P(a) 

#define DEBUG(x) 

#define DEBUGS(v) 

#endif

/* clang-format on */



int main() {

  ll n;

  cin >> n;

  vector<ll> x(n), y(n), h(n);

  ll inot0;

  REP(i, n) {

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

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

  }



  REP(cx, 101) {

    REP(cy, 101) {

      ll h_pre = h[inot0] + abs(x[inot0] - cx) + abs(y[inot0] - cy);

      bool f = true;

      REP(i, n) {

        if (h[i] != max(0ll, h_pre - abs(x[i] - cx) - abs(y[i] - cy)))

          f = false;

      }

      if (f) {

        cout << cx << ' ' << cy << ' ' << h_pre << endl;

        return 0;

      }

    }

  }



  return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

#define INF (1<<30)

#define INFLL (1ll<<60)

typedef pair<ll, ll> P;

typedef pair<ll, P> E;

#define MOD (1000000007ll)

#define l_ength size

void mul_mod(ll& a, ll b){

	a *= b;

	a %= MOD;

}



void add_mod(ll& a, ll b){

	b += MOD;

	a += b;

	a %= MOD;

}



int main(void){

	int n,i;

	ll cx,cy,x[123],y[123],h[123],p;

	bool flag = true;

	cin >> n;

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

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

	}

	for(cx=0ll; cx<=100ll; ++cx){

		for(cy=0ll; cy<=100ll; ++cy){

			p=INFLL;

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

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

			}

			flag = true;

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

				if(max(p-abs(x[i]-cx)-abs(y[i]-cy),0ll)!=h[i]){

					flag = false;

					break;

				}

			}

			if(flag){

				cout << cx << " " << cy << " " << p << endl;

			}

		}

	}

	return 0;

}


// Optimized solution to the same problem (faster):
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

const int INF = (1<<30);

const ll INFLL = (1ll<<60);

const ll MOD = (ll)(1e9+7);



#define l_ength size



void mul_mod(ll& a, ll b){

	a *= b;

	a %= MOD;

}



void add_mod(ll& a, ll b){

	a = (a<MOD)?a:(a-MOD);

	b = (b<MOD)?b:(b-MOD);

	a += b;

	a = (a<MOD)?a:(a-MOD);

}



ll x[110],y[110],h[110];



int main(void){

	int n,k,b;

	ll i,j,p;

	bool flag;

	cin >> n;

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

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

		if(h[k]){

			b = k;

		}

	}

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

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

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

			flag = true;

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

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

					flag = false;

				}

			}

			if(flag){

				cout << i << " " << j << " " << p << endl;

				return 0;

			}

		}

	}

	return 0;

}


// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstdlib>

#include<vector>

#include<set>





using namespace std;

using vi=vector<int>;

using seti=set<int>;

using vseti=vector<seti>;

using vvseti=vector<vseti>;



#define F_SIZE 100



void marge(seti&a, seti&b)

{

	seti result;



	for(int ma:a)

	{

		if(b.find(ma)!=b.end()) result.insert(ma);

	}

	a=result;

}





void calc(vi&x, vi&y, vi&h, int&cx, int&cy, int&ch)

{

	int n=x.size();



	for(cx=0;cx<=F_SIZE;cx++)

	{

		for(cy=0;cy<=F_SIZE;cy++)

		{

			int is_ok=1;



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

			{

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

				if(h[i]>0) break;

			}

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

			{

				if(max(ch-abs(cx-x[i])-abs(cy-y[i]), 0)!=h[i]) is_ok=0;

			}

			if(is_ok) return;

		}

	}

}





int main(void)

{

	int n;



	while(scanf("%d", &n)==1)

	{

		vi x(n), y(n), h(n);

		vvseti f(F_SIZE+1);



		for(auto&mf:f) mf.resize(F_SIZE+1);



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

		{

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

		}



		int cx=-1, cy=-1, ch=-1;

		calc(x, y, h, cx, cy, ch);



		printf("%d %d %d\n", cx, cy, ch);

	}



	return 0;

}


// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstdlib>

#include<vector>





using namespace std;

using vi=vector<int>;



#define F_SIZE 100





void calc(vi&x, vi&y, vi&h, int&cx, int&cy, int&ch)

{

	int n=x.size();

	int b;



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

	{

		if(h[b]>0) break;

	}



	for(cx=0;cx<=F_SIZE;cx++)

	{

		for(cy=0;cy<=F_SIZE;cy++)

		{

			int is_ok=1;



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

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

			{

				if(max(ch-abs(cx-x[i])-abs(cy-y[i]), 0)!=h[i]) is_ok=0;

			}

			if(is_ok) return;

		}

	}

}





int main(void)

{

	int n;



	while(scanf("%d", &n)==1)

	{

		vi x(n), y(n), h(n);



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

		{

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

		}



		int cx=-1, cy=-1, ch=-1;

		calc(x, y, h, cx, cy, ch);



		printf("%d %d %d\n", cx, cy, ch);

	}



	return 0;

}


// Fastest known solution for this problem: