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: 1.1353291238901628x):
#include <iostream>

#include <cmath>

#include <algorithm>



using namespace std;



int main()

{

    int n, i, j, k;

    int H, X, Y;

    cin >> n;

    int val[n][3];

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

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

            cin >> val[i][j];



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

    {

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

        {

            for (k = 0; k < n && val[k][2] == 0; k++)

                ;



            H = abs(X - val[k][0]) + abs(Y - val[k][1]) + val[k][2];

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

            {

                if (val[i][2] != max((H - abs(X - val[i][0]) - abs(Y - val[i][1])), 0))

                    break;

            }

            if (i == n)

            {

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

                return 0;

            }

        }

    }



    return 0;

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 2.04578786023828x):
#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;

}
// Slower C++ solution:
#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; 

}

}

// Faster C++ solution for the same problem (measured speedup: 7.230490040871339x):
#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; 

			}

		}

	}

}
// Slower C++ solution:
#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;

}

// Faster C++ solution for the same problem (measured speedup: 1.6753499644434644x):
#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;

			}

		}

	}

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.124421299348956x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.1398702351506582x):
#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

#define hg first

#define p second.first

#define q second.second



void mul_mod(ll& a, ll b){

	a *= b;

	a %= MOD;

}



void add_mod(ll& a, ll b){

	b += MOD;

	a += b;

	a %= MOD;

}



vector<E> v;



bool comp(E a, E b){

	return (a.hg < b.hg);

}



int main(void){

	int n,i;

	ll cx,cy,x,y,h;

	bool flag = true;

	cin >> n;

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

		cin >> x >> y >> h;

		v.push_back(E(h,P(x,y)));

	}

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

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

			h=INFLL;

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

				h = min(v[i].hg+abs(v[i].p-cx)+abs(v[i].q-cy),h);

			}

			flag = true;

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

				if(max(h-abs(v[i].p-cx)-abs(v[i].q-cy),0ll)!=v[i].hg){

					flag = false;

					break;

				}

			}

			if(flag){

				cout << cx << " " << cy << " " << h << endl;

				return 0;

			}

		}

	}

	return 0;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.1442879036233984x):
#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;

}
// Slower C++ solution:
#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;

}


// Faster C++ solution for the same problem (measured speedup: 1.557128569699585x):
#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;

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

#include <vector>

#include <algorithm>

#include <math.h>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>



using namespace std;

typedef long long ll;

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define reps(x,c) for(auto x:c)

#define all(x) begin(x), end(x)

#define pb(a) emplace_back(a) 

#define mp(a,b) make_pair((a),(b))

#define pl pair<ll,ll>

#define INF 1e18

#define MOD 1000000007

#define fi first

#define se second

#define dbg(x) cout << #x"="<< (x) << endl

#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl





ll c[110][110];

ll d[110][110];



int main(){

  ll n;cin>>n;

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

  rep(i,n){

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

  }



  rep(i,101){

    rep(j,101){

      c[i][j]=INF;

      rep(k,n){

        if(h[k]==0){

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

        }

      }

    }

  }



  rep(i,101){

    rep(j,101){

      rep(k,n){

        if(h[k]!=0){

          if(d[i][j]==0){

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

          }else{

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

              d[i][j]=-1;

            }

          }

        }

      }

    }

  }



  rep(i,101){

    rep(j,101){

      if(d[i][j]>0&&d[i][j]<=c[i][j]){

        cout<<i<<" "<<j<<" "<<d[i][j]<<endl;

        return 0;        

      }

    }

  }



  rep(i,101){

    rep(j,101){

      if(d[i][j]==0&&INF>c[i][j]){

        cout<<i<<" "<<j<<" "<<c[i][j]<<endl;

        return 0;        

      }

    }

  }



  return 0;

}

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

#include <vector>

#include <algorithm>

#include <math.h>

#include <numeric>

#include <set>

#include <map>

#include <stack>

#include <queue>

#include <time.h>

#include <list>



using namespace std;

typedef long long ll;

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)

#define reps(x,c) for(auto x:c)

#define all(x) begin(x), end(x)

#define pb(a) emplace_back(a) 

#define mp(a,b) make_pair((a),(b))

#define pl pair<ll,ll>

#define INF 1e18

#define MOD 1000000007

#define fi first

#define se second

#define dbg(x) cout << #x"="<< (x) << endl

#define dbgv(x) cout<<#x<<endl;reps(y,x){cout<<y<<" ";}cout<<endl



int main(){

  ll X,Y,H,n;cin>>n;vector<ll> x(n),y(n),h(n);

  rep(i,n){

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

    if(h[i]>0){

      X=x[i];

      Y=y[i];

      H=h[i];

    }

  }

  ll H_cand;

  bool flg=true;

  rep(i,101){

    rep(j,101){

      H_cand=H+abs(i-X)+abs(j-Y);

      flg=true;

      rep(k,n){

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

          flg=false;

          break;

        }

      }

      if(flg){

        cout<<i<<" "<<j<<" "<<H_cand<<endl;

        return 0;

      }

    }

  }  

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

    #include <vector>

    #include <algorithm>

    #include <tuple>

    using namespace std;

     

    long long N, X[1009], Y[1009], H[1009]; vector<tuple<long long, long long, long long>>vec;

     

    int main() {

    	cin >> N; tuple<long long, long long, long long>G = make_tuple(-1, -1, -1);

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

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

    		if (H[i] >= 1) G = make_tuple(X[i], Y[i], H[i]);

    	}

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

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

    			long long 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++) {

    				long long VV = V - abs(X[k] - i) - abs(Y[k] - j); VV = max(VV, 0LL);

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

    			}

    			if (flag == true) vec.push_back(make_tuple(i, j, V));

    		}

    	}

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

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

    	}

    	return 0;

    }

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

typedef long long ll;

using namespace std;



int main(){

    int n; cin >> n;

    int able;

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

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

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

        if(h[i] > 0){

            able = i;

        }

    }

    int flag = 1;

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

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

            flag = 1;

            ll H = h[able] + abs(x[able] - i) + abs(y[able] - l);

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

                ll a = max(H - abs(x[k] - i) - abs(y[k] - l), 0LL);

                if(h[k] != a){

                    flag = 0;

                    break;

                } 

            }

            if(flag == 1){

                if(H == 0){continue;}

                cout << i << ' ' <<l << ' ' <<H << endl;

                return 0;

            }

        }

    }

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

#include<algorithm>

using namespace std;

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

main()

{

	cin>>n;

	for(int i=0;i<n;i++)cin>>x[i]>>y[i]>>h[i];

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

	{

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

		{

			int H;

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

			{

				if(h[i])

				{

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

					break;

				}

			}

			bool flag=1;

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

			{

				flag&=h[i]==max(H-abs(x[i]-cx)-abs(y[i]-cy),0);

			}

			if(flag)

			{

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

				return 0;

			}

		}

	}

}


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



int abs(int i){

	if(i >= 0){

		return i;

	}else{

		return -i;

	}

}



long long int  max(long long int i){

	if(i > 0){

		return i;

	}else{

		return 0;

	}

}



int main(void)

{

	int n;

	scanf("%d",&n);

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

	long long int h[n];

	

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

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

	}

	

	int cx,cy;

	

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

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

			long long int geth;

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

				if(h[i]!=0){

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

					break;

				}

			}

			bool flag=true;

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

				if(h[i]!=max(geth-abs(x[i]-cx)-abs(y[i]-cy)))flag=false;

			}

			if(flag)

			{

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

				return 0;

			}

		}

	}

	

	return 0;

}