Language: C++

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define int long long

using namespace std;

inline int read()
{
   int x=0,f=1;char ch=getchar();
   while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}
   while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
   return x*f;
}

const int maxn = 1100;

struct Node{
	int x,y,h;
};

Node a[maxn];
int n,m;

int dis(int x,int y,int x1,int y2)
{
	return abs(x-x1)+abs(y-y2);
}

bool check(int x,int y)
{
	int ymh = max(a[1].h+dis(a[1].x,a[1].y,x,y),0);
	for (int i=2;i<=n;i++)
	{
		if (ymh!=max(a[i].h+dis(a[i].x,a[i].y,x,y),0)) return false;
	}
	return true;
}

signed main()
{
  n=read();
  for (int i=1;i<=n;i++)
  {
  	 a[i].x=read();
  	 a[i].y=read();
  	 a[i].h=read();
  }
  for (int i=0;i<=100;i++)
    for(int j=0;j<=100;j++)
    {
    	if (check(i,j))
    	{
    	   cout<<i<<" "<<j<<" "<<a[1].h+dis(a[1].x,a[1].y,i,j);
    	   return 0;
    	}
    }
  return 0;
}


Compiler output:
a.cc: In function 'bool check(long long int, long long int)':
a.cc:34:22: error: no matching function for call to 'max(long long int, int)'
   34 |         int ymh = max(a[1].h+dis(a[1].x,a[1].y,x,y),0);
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:34:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |         int ymh = max(a[1].h+dis(a[1].x,a[1].y,x,y),0);
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:3:
/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:34:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |         int ymh = max(a[1].h+dis(a[1].x,a[1].y,x,y),0);
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:37:29: error: no matching function for call to 'max(long long int, int)'
   37 |                 if (ymh!=max(a[i].h+dis(a[i].x,a[i].y,x,y),0)) return false;
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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:37:29: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   37 |                 if (ymh!=max(a[i].h+dis(a[i].x,a[i].y,x,y),0)) return false;
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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
/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:37:29: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   37 |                 if (ymh!=max(a[i].h+dis(a[i].x,a[i].y,x,y),0)) return false;
      |                          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~