Language: C++

#include "bits/stdc++.h"
#define r(i,a,n) for(int i=a;i<n;i++)
using namespace std;
const int max=100;
int main(){
  int n;cin>>n;
  int x[n],y[n],h[n];
  r(i,0,n)cin>>x[i]>>y[i]>>h[i];
  r(posY,0,max){
    r(posX,0,max){
      int needH=-1;
      r(i,0,n){
        if(h[i]>0){
          int tmp=h[i]+abs(posX-x[i])+abs(posY-y[i]);
          if(needH==-1){
            needH=tmp;
          }else{
            if(needH!=tmp){
              needH=-2;
              break;
            }
          }
        }
      }
      if(needH==-2)continue;
      r(i,0,n){
        if(h[i]==0){
          int dst=abs(posX-x[i])+abs(posY-y[i]);
          if(needH>dst){
            needH=-2;
            break;
          }
        }
      }
      if(needH==-2)continue;
      cout<<posX<<" "<<posY<<" "<<needH<<endl;
      return 0;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: reference to 'max' is ambiguous
    9 |   r(posY,0,max){
      |            ^~~
a.cc:2:32: note: in definition of macro 'r'
    2 | #define r(i,a,n) for(int i=a;i<n;i++)
      |                                ^
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:4:11: note:                 'const int max'
    4 | const int max=100;
      |           ^~~
a.cc:10:14: error: reference to 'max' is ambiguous
   10 |     r(posX,0,max){
      |              ^~~
a.cc:2:32: note: in definition of macro 'r'
    2 | #define r(i,a,n) for(int i=a;i<n;i++)
      |                                ^
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:4:11: note:                 'const int max'
    4 | const int max=100;
      |           ^~~