Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<numeric>
#include<vector>
#include<map>
using namespace std;

int n;

int main(){
  cin >> n;
  long long x[n],y[n],h[n];
  for (int i=0;i<n;i++){
    cin >> x[i] >> y[i] >> h[i];
  }
  int x_a,y_a;
  long long h_c;
  bool flag = true;
  for (int cx=0;cx<101;cx++){
    for (int cy=0;cy<101;cy++){
      h_c = -1;
      flag = true;
      for (int i=0;i<n;i++){
        if (h[i] > 0) {
          h_c = h[i]+abs(x[i]-cx)+abs(y[i]-cy);
          break;
        }
      }
      for (int i=0;i<n;i++){
        if (h[i] != max(0,h_c-abs(x[i]-cx)-abs(y[i]-cy))) {
          flag = false;
          break;
        }
      }

      }
      if (flag){
        x_a = cx;
        y_a = cy;
        break;
      }
    }
    if (flag) break;
  }

  cout << x_a << " " << y_a << " " <<  h_c << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:31:24: error: no matching function for call to 'max(int, long long int)'
   31 |         if (h[i] != max(0,h_c-abs(x[i]-cx)-abs(y[i]-cy))) {
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/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:   template argument deduction/substitution failed:
a.cc:31:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   31 |         if (h[i] != max(0,h_c-abs(x[i]-cx)-abs(y[i]-cy))) {
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:2:
/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:   candidate expects 1 argument, 2 provided
/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:   template argument deduction/substitution failed:
a.cc:31:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   31 |         if (h[i] != max(0,h_c-abs(x[i]-cx)-abs(y[i]-cy))) {
      |                     ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:40:15: error: 'cy' was not declared in this scope; did you mean 'cx'?
   40 |         y_a = cy;
      |               ^~
      |               cx
a.cc:44:15: error: break statement not within loop or switch
   44 |     if (flag) break;
      |               ^~~~~
a.cc: At global scope:
a.cc:47:3: error: 'cout' does not name a type
   47 |   cout << x_a << " " << y_a << " " <<  h_c << endl;
      |   ^~~~
a.cc:49:3: error: expected unqualified-id before 'return'
   49 |   return 0;
      |   ^~~~~~
a.cc:50:1: error: expected declaration before '}' token
   50 | }
      | ^