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

#include<cmath>

#include<cstdlib>

using namespace std;

struct coo{

	int x;

	int y;

	int h;

}c[110];

int main()

{

	int n;

	cin>>n;

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

	{

		cin>>c[i].x;

		cin>>c[i].y;

		cin>>c[i].h;

	}

	int ch;

	int p=0;

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

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

	{

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

		{

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

			int f=0;

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

			{

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

				if(hh<0) hh=0;

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

				{

					f=1;

					break;

				}

			}

			if(!f)

			{

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

			} 

		}

	}

} 




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

#include<algorithm>

using namespace std;

int n,a,b,f,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)

            f=i;

    }

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

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

        {

            cx=xx,cy=yy;

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

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

            {

                if(h[i]!=max(H-abs(x[i]-cx)-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 <cstdio>

#include <iostream>

#include <algorithm>

#include <cstdlib>

#include <cstring>

#include <cassert>

#include <string>

using namespace std;



int N;

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

bool flag;



int main(){

	cin >> N;

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

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

	flag = false;

	for (int x = 0; x <= 100 && !flag; x++)

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

			int h = 0;

			flag = true;

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

				if (H[i] > 0){

					if (h == 0)

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

					else if (h != H[i] + abs(X[i] - x) + abs(Y[i] - y))

						flag = false;

				}

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

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

					flag = false;

			if (h == 0)

				flag = false;

			if (flag)

				printf("%d %d %d\n", x, y, h);

		}

	assert(flag);

}

// Optimized solution to the same problem (faster):
//Acknowledgement:  Xiaoyu Han, for his "brute-force" proposal



#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);

            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<algorithm>

using namespace std;

struct point{

    int x_coo;

    int y_coo;

    int height;

};

int main(){

    int n,i;

    cin>>n;

    point p[n];

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

        cin>>p[i].x_coo>>p[i].y_coo>>p[i].height;

    }

    int cx,cy,ch,flag,h;

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

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

            flag=0;

            for(i=0;p[i].height==0;i++);

            ch=p[i].height+abs(cx-p[i].x_coo)+abs(cy-p[i].y_coo);

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

                h=ch-abs(cx-p[i].x_coo)-abs(cy-p[i].y_coo);

                if(h<0)h=0;

                if(h!=p[i].height){flag=1;break;}

            }

            if(!flag)goto a1;

        }

    }

    a1:cout<<cx<<' '<<cy<<' '<<ch;

    return 0;

}

// Optimized solution to the same problem (faster):
//Acknowledgement:  Xiaoyu Han, for his "brute-force" proposal



#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);

            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<cmath>

#include<cstdlib>

using namespace std;

struct coo{

	int x;

	int y;

	int h;

}c[110];

int main()

{

	int n;

	cin>>n;

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

	{

		cin>>c[i].x;

		cin>>c[i].y;

		cin>>c[i].h;

	}

	int ch;

	int p=0;

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

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

	{

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

		{

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

			int f=0;

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

			{

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

				if(hh<0) hh=0;

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

				{

					f=1;

					break;

				}

			}

			if(!f)

			{

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

			} 

		}

	}

} 

// Optimized solution to the same problem (faster):
//Acknowledgement:  Xiaoyu Han, for his "brute-force" proposal



#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);

            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>

using namespace std;



int cx,cy;



int absolute(int a,int b){

    if(a<b) return b-a;

    else

        return a-b;

}



int tempH(int x,int y,int h){

    int H1=h+absolute(x,cx)+absolute(y,cy);

    return H1;

}



int main(){

    int n;

    cin>>n;

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

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

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

    int cxf=0,cyf=0,Hf=0;

    cx=0;

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

        cy=0;

        part1:

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

            int k=0,i=0;

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

                if(h[i]!=0)

                    H[k++]=tempH(x[i],y[i],h[i]);

            }

            int j=1;

            while(j<k&&H[j]==H[j-1])

                j++;

            if(j==k){

                cxf=cx;cyf=cy;Hf=H[0];

                if(k==n) goto part2;

                else{

                    int i=0;

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

                        if(h[i]==0){

                            if((Hf-absolute(cxf,x[i])-absolute(cyf,y[i]))>0) {cy++;goto part1;}

                            else continue;

                        }

                    }

                    if(i==n) goto part2;

                }

            }

        }

    }

    part2:

    cout<<cxf<<' '<<cyf<<' '<<Hf;

    return 0;

}


// Optimized solution to the same problem (faster):
//Acknowledgement:  Xiaoyu Han, for his "brute-force" proposal



#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);

            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<vector>



using namespace std;



class Point {

public:

	int x;

	int y;

	int h;

	Point(int a, int b, int c) {

		x = a;

		y = b;

		h = c;

	}

};





int main() {

	int i = 0, j, h, N, c;

	int xi, yi, hi;

	cin >> N;

	vector<Point> pts;

	int max_h = 0;//所有坐标中的最大高度

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

		cin >> xi >> yi >> hi;

		if (hi > max_h) 

			max_h = hi;



		Point r(xi, yi, hi);

		pts.push_back(r);

	}

	int flag = 0;

	int c_h;

	for (i = 0; (i <= 100)&&(flag ==0); ++i) { //给定横坐标i

		for (j = 0; (j <= 100)&&(flag ==0); ++j) { //给定纵坐标j

			for (h = max_h; h <= max_h+200; ++h) { //给定高度h

				for (c = 0; c < N; ++c) { //检查每个坐标是否符合给定条件

					c_h = h - abs(pts[c].x - i) - abs(pts[c].y - j);

					if (pts[c].h == c_h)  ++flag;

					else if ((pts[c].h == 0) && c_h < 0)  ++flag;

					else break;

				}

				if (flag != N) flag = 0;

				else break;

			}

		}

	}

	cout << i - 1 << ' ' << j - 1 << ' ' << h;

	return 0;

}

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

#include<string>

#include<algorithm>

#include<math.h>



using namespace std;



int main(void)

{

	long h[100][3];

	long i, j, t, k, r=1, N, p;

	cin >> N;

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

	{

		cin >> h[i][0];

		cin >> h[i][1];

		cin >> h[i][2];

		if (h[i][2] != long(0))

			p = i;

	}

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

	{

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

		{

			t = h[p][2] + abs(i - h[p][0]) + abs(j - h[p][1]);

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

			{

				if (max(t - abs(i - h[k][0]) - abs(j - h[k][1]), long(0)) != h[k][2])

				{

					r = 0;

					break;

				}

				r = 1;

			}

			if (r == 1)

				break;

		}

		if (r == 1)

			break;

	}

	cout << i << " " << j << " " << t << endl;

}

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

using namespace std;



int Abs(int num){

    if(num<0)num*=-1;

    return num;

}



signed main(){

    ios::sync_with_stdio(false);

    cin.tie(0);



    int n;

    cin>>n;

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

    int ansx=-1,ansy=-1,ansh=-1;

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

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

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

            int H=-1;

            bool f=true;

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

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

                int tmp=Abs(x[k]-i)+Abs(y[k]-j)+h[k];

                if(H==-1)H=tmp;

                else if(H!=tmp)f=false;

            }

            if(f){

                bool ff=true;

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

                    int num=max(0,H-Abs(x[k]-i)-Abs(y[k]-j));

                    if(num!=h[k])ff=false;

                }

                if(ff){

                    ansx=i;

                    ansy=j;

                    ansh=H;

                }

            }

        }

    }



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

    

}

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

#define INF 1e18

#define int long long

#define Rep(i, a, n) for (int i = (a); i < (n); i++)

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

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

using namespace std;

typedef pair<int, int> P;

typedef pair<int, P> PP;

const int mod = 1000000007;



int Abs(int x) { return max(x, -x); }



signed main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);



    int n;

    cin >> n;

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

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

    rep(X, 101) rep(Y, 101)

    {

        bool f = true;

        int H = -1;

        rep(i, n)

        {

            if (z[i] == 0)

                continue;

            int h = z[i] + abs(x[i] - X) + abs(y[i] - Y);

            if (H == -1)

                H = h;

            if (H != h)

                f = false;

        }

        if (f)

        {

            bool che = true;

            rep(i, n)

            {

                int h = max(H - abs(x[i] - X) - abs(y[i] - Y), 0LL);

                if (z[i] != h)

                    che = false;

            }

            if (che)

            {

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

                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); 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):
// ABC112_C

#include <iostream>

#include <vector>

#include <tuple>  // std::tuple std::get

#include <algorithm>

using namespace std;

typedef long long ll;



#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1



int main() {

    // input

    ll N, idx = 0;

    cin >> N;

    vector<ll> X(N), Y(N), H(N);

    REP(i, N) {

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

        if (H[i] > 0) idx = i;  // 制約上，必ず1組は h_i > 0 となっている

    }

    

    // 中心座標を全探索

    ll now_H, d_i, tmp_h_i, tmp_d_i;

    bool flag;

    

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

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

            d_i = abs(X[idx] - Cx) + abs(Y[idx] - Cy);

            now_H = H[idx] + d_i;

            

            // 中心座標を固定した時，それが入力に合うかを求める

            flag = true;

            

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

                tmp_d_i = abs(X[i] - Cx) + abs(Y[i] - Cy);

                tmp_h_i = max(now_H - tmp_d_i, 0LL);

                if (H[i] != tmp_h_i) {

                    flag = false;  // 矛盾したら false

                    break;

                }

            }

            

            if (flag) {

                cout << Cx << " " << Cy << " " << now_H << "\n";

                return 0;

            }

        }

    }

    

    return 0;

}


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

using Int = long long;

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

using namespace std;

struct Data {

    Int x, y, h;

    Int valid(Int cx, Int cy, Int ch) {

        return max(ch - abs(cx - x) - abs(cy - y), 0LL) == h;

    }

};



int main() {

    int n;

    cin >> n;

    auto v = vector<Data>();

    auto maxH = 0LL;

    rep(i, n) {

        Int x, y, h;

        cin >> x >> y >> h;

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

        maxH = max(maxH, h);

    }

    rep(cx, 101) {

        rep(cy, 101) {

            rep(ch, 202) {

                auto flag = true;

                for (auto d : v) {

                    if (!d.valid(cx, cy, maxH + ch)) {

                        flag = false;

                        break;

                    }

                }

                if (flag) {

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

                    return 0;

                }

            }

        }

    }

}


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

using Int = long long;

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

using namespace std;

struct Data {

    Int x, y, h;

    Int valid(Int cx, Int cy, Int ch) {

        return max(ch - abs(cx - x) - abs(cy - y), 0LL) == h;

    }

};



int main() {

    int n;

    cin >> n;

    auto v = vector<Data>();

    auto maxH = 0LL;

    Int px, py;

    rep(i, n) {

        Int x, y, h;

        cin >> x >> y >> h;

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

        if (h > maxH) {

            maxH = h;

            px = x;

            py = y;

        }

    }

    rep(cx, 101) {

        rep(cy, 101) {

            auto ch = maxH + abs(cx - px) + abs(cy - py);

            auto flag = true;

            for (auto d : v) {

                if (!d.valid(cx, cy, ch)) {

                    flag = false;

                    break;

                }

            }

            if (flag) {

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

                return 0;

            }

        }

    }

}

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

#include<stdlib.h>

#include<algorithm>

using namespace std;

#define MAX 101

bool flag;

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

void search(int, int);

int main() {

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

	cin >> N;

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

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

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

			search(i, j);

			if (flag) {

				ansx = i;

				ansy = j;

				ansh = High;

			}

		}

	}

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

	return 0;

}

void search(int cx, int cy) {

	int set=0;

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

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

		set = i;

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

		break;

	}

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

		if (i == set)continue;

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

			flag = false;

			break;

		}

		if (i == N - 1)flag = true;

	}

}

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

using namespace std;

typedef long long ll;

const ll INF=1e18,MOD=1e9+7;

const int iINF=1e9;

typedef struct{

    int x,y,h;

} pyramid;

int main(){

    int n,s,high,k;

    cin>>n;

    vector<pyramid>p(n);

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

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

        if(p[i].h!=0)s=i;

    }

    for(int i=0;i<101;i++){//x

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

            bool flag=true;

            high=p[s].h+abs(i-p[s].x)+abs(j-p[s].y);

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

                if(p[k].h!=max(high-abs(i-p[k].x)-abs(j-p[k].y),0))flag=false;

            }

            if(flag){

                cout<<i<<" "<<j<<" "<<high<<endl;

                return 0;

            }

        }

    }

}


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

using namespace std;

#define ll long long int

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

#define rrep(i,n) for( int i = n; i >= 0; i-- )

#define REP(i,s,t) for( int i = s; i <= t; i++ )

#define RREP(i,s,t) for( int i = s; i >= t; i-- )

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF 2000000000

#define mod 1000000007

#define INF2 1000000000000000000





int main(void)

{

    cin.tie(0);

    ios::sync_with_stdio(false);

    int N; cin >> N;

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

    rep(i, N) {

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

    }

    REP(X, 0, 100) {

        REP(Y, 0, 100) {

            REP(H, max(1, h[0] - 200), h[0] + 200){

                bool ok = true;

                rep(i, N) {

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

                    if (!ok) break;

                }

                if (ok) {

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

                    return 0;

                }

            } 

        }

    }



    return 0;

}


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

#include <fstream>

#include <set>

#include <map>

#include <string>

#include <vector>

#include <queue>

#include <deque>

#include <stack>

#include <functional>

#include <algorithm>

#include <climits>

#include <cmath>

#include <iomanip>

using namespace std;

#define ll long long int

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

#define rrep(i,n) for( int i = n; i >= 0; i-- )

#define REP(i,s,t) for( int i = s; i <= t; i++ )

#define RREP(i,s,t) for( int i = s; i >= t; i-- )

#define dump(x)  cerr << #x << " = " << (x) << endl;

#define INF 2000000000

#define mod 1000000007

#define INF2 1000000000000000000



signed main(void)

{

    cin.tie(0);

    ios::sync_with_stdio(false);

    int n; cin >> n;

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

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

    int maximam = 0;

    rep(i, n) maximam = max(maximam, h[i]);

    REP(i, 0, 100) {

        REP(j, 0, 100) {

            REP(H, maximam, maximam + 100) {

                bool ok = true;

                rep(k, n) {

                    int tmpH = max(0, H - abs(x[k] - i) - abs(y[k] - j));

                    if(h[k] != tmpH) ok = false;

                    if(!ok) 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>

typedef long long ll;

const int maxn=1e6+5;

using namespace std;

const ll INF=1e13+7;

ll n,m;

char str[maxn];

ll dp[maxn];

ll q[maxn];

int pre[maxn];

void TraceBack(int x)

{

    if(pre[x]==-1)

    {

        printf("%d",x);

        return;

    }

    TraceBack(pre[x]);

    printf(" %d",x-pre[x]);

}

int main()

{

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

    scanf("%lld%lld",&n,&m);

    scanf("%s",str);

    //数有n+1个

    int s=1,e=0;

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

    {

        if(str[i]=='0')

            dp[i]=1;

        else

            dp[i]=INF;

        while(s<=e&&dp[i]<dp[q[e]]) e--;

        q[++e]=i;

    }

    s++;

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

    {

        dp[i]=INF;

        if(str[i]=='0')

        {

            dp[i]=min(dp[q[s]]+1,dp[i]);

            if(!dp[i]!=INF)

                pre[i]=q[s];

        }

        while(s<=e&&dp[i]<dp[q[e]]) e--;

        q[++e]=i;

        while(s<=e&&q[s]<i+1-m)

            s++;

    }

    if(dp[n]==INF) printf("-1\n");

    else TraceBack(n);

    return 0;

}




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

using namespace std;

#define ll long long 

ll n,m,cur;

int main(){

  vector<ll> ans;

  string s;

  cin>>n>>m>>s;

  cur=n;

  while(cur)

  {

  	 bool check=true;

  	 for(int i=max(0ll,cur-m);i<cur;i++)

  	    if(s[i]=='0'){

  	    	check=false;

  	    	ans.push_back(cur-i);

  	    	cur=i;

  	    	break;

  	    }

  	  if(check){

  	  	cout<<-1<<endl;return 0;

  	  }

  }

  reverse(ans.begin(),ans.end());

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

  	  cout<<ans[i];

  	  if(i==ans.size()-1)cout<<endl;

  	  else cout<<" ";

  }







	return 0;

}


// Fastest known solution for this problem: