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

#include<string>

#include<cmath>

using namespace std;

int main(){

	int N;

	cin>>N;

	int a[3][N];

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

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

	}

	int q,w,e;

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

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

			q=a[0][m];

			w=a[1][m];

			e=a[2][m];

			break;

		}

	}

	int i,j,H,f,r;

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

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

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

			r=0;

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

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

				if (h<0){

					h=0;	

				}

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

					r=1;

					break;

				}

			}

			if(r == 0){

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

			}

		}

	}

	return 0;

 } 

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

int abs(int x) {

    return x > 0 ? x : -x;

}

int n, x[102], y[102], l[102], stdPoint, ansx, ansy, h;

bool check(){

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

        int t=h-abs(ansx-x[i])-abs(ansy-y[i]);

        if(t<0)t=0;

        if(l[i]!=t)return false;

    }

    return true;

}

int main() {

    scanf("%d", &n);

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

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

        if (l[i])

            stdPoint = i;

    }

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

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

            ansx = i, ansy = j;

            h = l[stdPoint] + abs(x[stdPoint] - i) + abs(y[stdPoint] - j);

            if (check()){

                printf("%d %d %d\n",ansx,ansy,h);

                return 0;

            }

        }

    }

    return 0;

}

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

#include <cmath>

using namespace std;

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

int c_x,c_y,c_h;

int max_h;

int main()

{

	int n;

	scanf("%d",&n);

	max_h = -1;

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

	{

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

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

	}

	int sign = 1;

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

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

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

			{

				int i = 1;

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

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

						break;

				if(i > n)

					sign = 0;

			}

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

	return 0;

}

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

int abs(int x) {

    return x > 0 ? x : -x;

}

int n, x[102], y[102], l[102], stdPoint, ansx, ansy, h;

bool check(){

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

        int t=h-abs(ansx-x[i])-abs(ansy-y[i]);

        if(t<0)t=0;

        if(l[i]!=t)return false;

    }

    return true;

}

int main() {

    scanf("%d", &n);

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

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

        if (l[i])

            stdPoint = i;

    }

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

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

            ansx = i, ansy = j;

            h = l[stdPoint] + abs(x[stdPoint] - i) + abs(y[stdPoint] - j);

            if (check()){

                printf("%d %d %d\n",ansx,ansy,h);

                return 0;

            }

        }

    }

    return 0;

}

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

#include <string.h>

#include <algorithm>

#include <cmath>





using namespace std;



struct point{

    int x,y;

    long h;

}points[100];



long height;



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

    int i,j,len;

    long h,cur_h;

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

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

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

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

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

    }

    points[p].h = h;

    return true;

}



int main(){

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

    long h;

    while(cin >> n){

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

        break_flag = 0;

        p = -1;

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

            cin >> x >> y >> h;

            points[i].x = x;

            points[i].y = y;

            points[i].h = h;

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

        }

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

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

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

                    break_flag = 1;

                    break;

                }

            }

            if(break_flag) break;

        }

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

    }

    return 0;

}

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

#include<algorithm>

using namespace std;

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

int main(){

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

	scanf("%d",&n);

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

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

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

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

    			if(c[q]!=0){

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

    				break;

				}

			}

			if(q==n){

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

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

				}

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

				return 0;

			}

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

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

    			if(c[k]!=0){

    				if(ans1!=ans2) break;

    				ans1=ans2;

				}

    			else{

    				if(ans1>ans2) break;

				}

			}

			if(k==n){

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

				return 0;

			}

		}

	}

}

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

#include <vector>

#include <tuple>

using namespace std;



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

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



void init_pyramid()

{

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

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

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

    }

  }

}



void read_measure_data()

{

  int n;

  cin >> n;

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

    int a, b, c;

    cin >> a >> b >> c;

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

  }

}



void check1()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

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

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

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

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

	get<2>(p) = guess;

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

	get<2>(p) = -1;

      }

    }

  }

}



void check2()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

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

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

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

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

	get<2>(p) = -1;

      }

    }

  }

}



void print_ans()

{

  for (auto&& p : pyramid) {

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

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

    }

  }

}



int main()

{

  init_pyramid();

  read_measure_data();

  check1();

  check2();

  print_ans();

}


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

using namespace std;



struct xyh {

  int x, y, h;

};



int main()

{

  int n;

  cin >> n;

  vector<xyh> survey(n);



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

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

  }



  vector<xyh> pyramid(101 * 101);



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

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

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

    }

  }



  for (auto&& p : pyramid) {

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h == 0) continue;

      if (p.h == 0) {

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

      } else {

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

          p.h = -1;

          break;

        }

      }

    }

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h != 0) continue;

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

        p.h = -1;

        break;

      }

    }

  }

  for (auto&& p : pyramid) {

    if (p.h > 0) {

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

      break;

    }

  }

}


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

#include <vector>

#include <tuple>

using namespace std;



int p_count;

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

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



void init_pyramid()

{

  p_count = 101 * 101;

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

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

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

    }

  }

}



void read_measure_data()

{

  int n;

  cin >> n;

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

    int a, b, c;

    cin >> a >> b >> c;

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

  }

}



void check1()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

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

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

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

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

	get<2>(p) = guess;

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

	get<2>(p) = -1;

	p_count--;

	if (p_count <= 1) return;

      }

    }

  }

}



void check2()

{

  if (p_count <= 1) return;

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

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

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

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

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

	get<2>(p) = -1;

	if (p_count <= 1) return;

      }

    }

  }

}



void print_ans()

{

  for (auto&& p : pyramid) {

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

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

    }

  }

}



int main()

{

  init_pyramid();

  read_measure_data();

  check1();

  check2();

  print_ans();

}


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

using namespace std;



struct xyh {

  int x, y, h;

};



int main()

{

  int n;

  cin >> n;

  vector<xyh> survey(n);



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

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

  }



  vector<xyh> pyramid(101 * 101);



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

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

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

    }

  }



  for (auto&& p : pyramid) {

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h == 0) continue;

      if (p.h == 0) {

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

      } else {

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

          p.h = -1;

          break;

        }

      }

    }

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h != 0) continue;

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

        p.h = -1;

        break;

      }

    }

  }

  for (auto&& p : pyramid) {

    if (p.h > 0) {

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

      break;

    }

  }

}


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

#include <vector>

#include <tuple>

using namespace std;



int p_count;

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

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



void init_pyramid()

{

  p_count = 101 * 101;

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

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

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

    }

  }

}



void read_measure_data()

{

  int n;

  cin >> n;

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

    int a, b, c;

    cin >> a >> b >> c;

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

  }

}



void check1()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

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

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

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

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

	get<2>(p) = guess;

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

	get<2>(p) = -1;

	if (--p_count <= 1) return;

      }

    }

  }

}



void check2()

{

  for (auto&& m : measure) {

    for (auto&& p : pyramid) {

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

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

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

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

	get<2>(p) = -1;

	if (--p_count <= 1) return;

      }

    }

  }

}



void print_ans()

{

  for (auto&& p : pyramid) {

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

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

    }

  }

}



int main()

{

  init_pyramid();

  read_measure_data();

  check1();

  check2();

  print_ans();

}


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

using namespace std;



struct xyh {

  int x, y, h;

};



int main()

{

  int n;

  cin >> n;

  vector<xyh> survey(n);



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

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

  }



  vector<xyh> pyramid(101 * 101);



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

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

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

    }

  }



  for (auto&& p : pyramid) {

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h == 0) continue;

      if (p.h == 0) {

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

      } else {

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

          p.h = -1;

          break;

        }

      }

    }

    if (p.h < 0) continue;

    for (auto&& s : survey) {

      if (s.h != 0) continue;

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

        p.h = -1;

        break;

      }

    }

  }

  for (auto&& p : pyramid) {

    if (p.h > 0) {

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

      break;

    }

  }

}


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

}

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

#include <algorithm>

#include <tuple>

//#include <string>

#include <vector>

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

#define ll long long

using namespace std;



int H;

int N;

vector<vector<int>> v;

int ansx, ansy, ansh;



int main() {

	cin >> N;

	rep(i, N) {

		int x, y, h;

      	cin >>x >>y >>h;

		v.push_back({h,x,y});

	}



	sort(v.rbegin(), v.rend());

	/*/

  	rep(i,N){

    cout <<v[i][0] <<" "<<v[i][1] <<" " <<v[i][2] <<endl;

    }

    //*/

      

	bool flag = 1;

	rep(i, 101) {

		rep(j, 101) {

			ansh = v[0][0] + abs(i - v[0][1]) + abs(j - v[0][2]);

			rep(k, N) {

				if (v[k][0] != max(ansh- abs(i - v[k][1]) - abs(j - v[k][2]),0)){

                  	flag = 0;

					break;

                }

			}

			

			if (flag) { 

				ansx = i; ansy = j; 

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

				return 0;

			}

          

          	flag=1;

		}

	}





	return 0;

}


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

using namespace std;

typedef long long ll;



int main() {



	ll n; cin >> n;

	vector<ll> vx(n), vy(n), vh(n);

	ll hPositiveIndex;

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

		cin >> vx[i] >> vy[i] >> vh[i];

		if (0 < vh[i]) hPositiveIndex = i;

	}

	const ll p = 100;

	ll resx = -1;

	ll resy = -1;

	ll resh = -1;

	for (ll x = 0; x <= p; x++) {

		for (ll y = 0; y <= p; y++) {			

			ll h = vh[hPositiveIndex] + abs(vx[hPositiveIndex] - x) + abs(vy[hPositiveIndex] - y);

			bool ok = true;

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

				if (0 < vh[i] && vh[i] != h - abs(vx[i] - x) - abs(vy[i] - y)) ok = false;

				if (vh[i] == 0 && h > abs(vx[i] - x) + abs(vy[i] - y)) ok = false;

			}

			if (ok) {

				resx = x;

				resy = y;

				resh = h;

			}

		}

	}

	cout << resx << " " << resy << " " << resh << endl;

	return 0;

}

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

using namespace std;

typedef long long ll;



int main() {



	ll n; cin >> n;

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

	ll index;

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

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

		if (0 < h[i]) index = i;

	}

	const ll p = 100;

	ll ansCx, ansCy, ansH;

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

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

			ll ansH = h[index] + abs(x[index] - cx) + abs(y[index] - cy);

			bool ok = true;

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

				if (0 < h[i] &&  h[i] != ansH - abs(x[i] - cx) - abs(y[i] - cy)) {

					ok = false;

				}

				if (0 == h[i] && h[i] < ansH - abs(x[i] - cx) - abs(y[i] - cy)) {

					ok = false;

				}

			}

			if (ok) {

				ansCx = cx;

				ansCy = cy;

				cout << ansCx << " " << ansCy << " " << ansH << endl;

				return 0;				

			}

		}

	}	

	return 0;

}

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



using namespace std;



int main() {

    int n;

    cin >> n;

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

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

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

    }



    int pos = 0;

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

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

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

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

            bool ok = true;

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

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

                    ok = false;

            }

            if (ok) {

                cout << cx << ' ' << cy << ' ' << H << endl;

                return 0;

            }

        }

    }

}


// Optimized solution to the same problem (faster):


#include<cstdio>

#include<algorithm>

int n,a,b,u,x[101],h[101],y[101],cx,cy,H;

int main()

{

    scanf("%d",&n);

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

    {

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

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

    }

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

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

        {

            cx=xi,cy=yi;

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

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

            {

                if(h[i]!=std::max(H-std::abs(x[i]-cx)-std::abs(y[i]-cy),0))break;

                if(i==n)

                {

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

                    return 0;

                }

            }

        }

}

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

}


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

#include <vector>

#include <algorithm>

#include <map>

#include <set>

#include <cmath>

#include <cstring>

#include <iomanip>

#include <random>

#include <chrono>

#include <queue>

using namespace std;

typedef long long ll;

typedef pair<int, int> PII;

typedef pair<ll, ll> PLL;

#define INF 1000000000

#define MOD 1000000007



int main(){

    int N; cin >> N;

    vector<vector<int>> T(N, vector<int>(3));

    vector<int> smp(3);

    

    for(vector<int> &t:T){

        cin >> t[0] >> t[1] >> t[2];

        if(t[2]!=0)

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

                smp[i] = t[i];

    }



    vector<vector<int>> o;

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

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

            int H = smp[2] + abs(smp[0]-i) + abs(smp[1]-j);

            bool f = true;

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

                int h = max(H - abs(i-T[k][0]) - abs(j-T[k][1]), 0);

                if(h!=T[k][2]) f = false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

}


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

#include <vector>

#include <algorithm>

#include <map>

#include <set>

#include <cmath>

#include <cstring>

#include <iomanip>

#include <random>

#include <chrono>

#include <queue>

using namespace std;

typedef long long ll;

typedef pair<int, int> PII;

typedef pair<ll, ll> PLL;

#define INF 1000000000

#define MOD 1000000007



int main(){

    int N; cin >> N;

    vector<vector<int>> T(N, vector<int>(3));



    for(vector<int> &t:T)

        cin >> t[0] >> t[1] >> t[2];



    map<int, int> M;

    vector<vector<int>> o;

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

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

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

                if(T[k][2]==0) continue;

                M[T[k][2]+abs(i-T[k][0])+abs(j-T[k][1])]++;

            }

            if(M.size()==1) o.push_back({i, j, M.begin()->first});

            M.clear();

        }

    }

    

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

        bool f = true;

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

            if(T[j][2]==0 && max(0, o[i][2] - abs(o[i][0]-T[j][0]) - abs(o[i][1]-T[j][1]))!=0) f = false;

        }

        if(f) cout << o[i][0] << " " << o[i][1] << " " << o[i][2] << endl;

    }

    return 0;

}


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

#include <vector>

#include <algorithm>

#include <map>

#include <set>

#include <cmath>

#include <cstring>

#include <iomanip>

#include <random>

#include <chrono>

#include <queue>

using namespace std;

typedef long long ll;

typedef pair<int, int> PII;

typedef pair<ll, ll> PLL;

#define INF 1000000000

#define MOD 1000000007



int main(){

    int N; cin >> N;

    vector<vector<int>> T(N, vector<int>(3));

    vector<int> smp(3);

    

    for(vector<int> &t:T){

        cin >> t[0] >> t[1] >> t[2];

        if(t[2]!=0)

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

                smp[i] = t[i];

    }



    vector<vector<int>> o;

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

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

            int H = smp[2] + abs(smp[0]-i) + abs(smp[1]-j);

            bool f = true;

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

                int h = max(H - abs(i-T[k][0]) - abs(j-T[k][1]), 0);

                if(h!=T[k][2]) f = false;

            }

            if(f){

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

                return 0;

            }

        }

    }

    return 0;

}


// Fastest known solution for this problem: