Language: C++

//#include <stdio.h>
//#include <algorithm>
//
//using namespace std;
//
//typedef long long ll;
//
//int main() {
//    ll n, m;
//    while (scanf("%lld%lld", &n, &m) != EOF) {
//        if (m % n == 0) { printf("%lld\n", m / n); continue; }
//        else {
//            ll l = 1, r = 1; r << 34;
//            while (l < r) {
//                ll mid = (l + r) / 2;
//                ll k = m - n * mid;
//                if (k < 0) r = mid;
//                else if (k == 0) l = mid;
//                else if (__gcd(k, mid) == mid) l = mid;
//                else r = mid;
//            }
//            printf("%lld\n", l);
//        }
//    }
//    return 0;
//}
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

using namespace std;

#define N 110

typedef long long ll;

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

int main() {
    int n;
    while (scanf("%d", &n) != EOF) {
        int a, b, d;
        ll c;
        for (int i = 0; i < n; ++i) {
            scanf("%d%d%lld", &x[i], &y[i], &h[i]);
            if (h[i] != 0) d = i;
        }
        for (a = 0; a <= 100; ++a) {
            int flag;
            for (b = 0; b <= 100; ++b) {
                flag = 1;
                c = h[d] + abs(a - x[d]) + abs(b - y[d]);
                for (int i = 0; i < n; ++i) {
                    if (h[i] != max(c - abs(a - x[i]) - abs(b - y[i])), 0) { flag = 0; break; }
                }
                if (flag) break;
            }
            if (flag) break;
        }
        printf("%d %d %lld\n", a, b, c);
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:55:36: error: no matching function for call to 'max(ll)'
   55 |                     if (h[i] != max(c - abs(a - x[i]) - abs(b - y[i])), 0) { flag = 0; break; }
      |                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from a.cc:29:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   template argument deduction/substitution failed:
a.cc:55:36: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   55 |                     if (h[i] != max(c - abs(a - x[i]) - abs(b - y[i])), 0) { flag = 0; break; }
      |                                 ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   candidate expects 2 arguments, 1 provided