Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

#define fir fisrt
#define sec second

int n, x[105], y[105], h[105];
bool vis[105][105];

int main(){
	scanf(" %d", &n);
	for(int i = 1; i <= n; i ++){
		scanf(" %d %d %d", &x[i], &y[i], &h[i]);
		vis[x[i]][y[i]] = 1;
	}
	bool VIS = 0;
	int H;
	int pos = 0;
	int resx = -1, resy = -1, resh = -1;
	for(int i = 0; i <= 100; i ++){
		for(int j = 0; j <= 100; j ++){
			pos = 0;
			pos = 1;
			H = h[1] + abs(i - x[1]) + abs(j - y[1]);
			VIS = 0;
			for(int k = 1; k <= n; k ++){
				if(H - max(h[k] - abs(i - x[k]) - abs(j - y[k], 0)) != 0){
					VIS = 1;
					break;
				}
			}
			if(VIS == 0){
				resx = i;
				resy = j;
				resh = H;
				break;
			}
		}
		if(VIS == 0 && pos == 1) break;
	}
	/*if(resx == -1){
	  for(int i = 1; i <= n; i ++){
	  VIS = 0;
	  for(int j = 1; j <= n; j ++){
	  if(h[i] < h[j]){
	  VIS = 1;
	  break;
	  }
	  if(h[i] - h[j] - abs(x[i] - x[j]) - abs(y[i] - y[j]) != 0){
	  VIS = 1;
	  break;
	  }
	  }
	  if(VIS == 0){
	  resx = x[i];
	  resy = y[i];
	  resh = h[i];
	  break;
	  }
	  }
	  }*/
	printf("%d %d %d\n", resx, resy, resh);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:70: error: no matching function for call to 'abs(int, int)'
   37 |                                 if(H - max(h[k] - abs(i - x[k]) - abs(j - y[k], 0)) != 0){
      |                                                                   ~~~^~~~~~~~~~~~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from a.cc:2:
/usr/include/stdlib.h:980:12: note: candidate: 'int abs(int)'
  980 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
      |            ^~~
/usr/include/stdlib.h:980:12: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/14/cstdlib:81:
/usr/include/c++/14/bits/std_abs.h:137:3: note: candidate: 'constexpr __float128 std::abs(__float128)'
  137 |   abs(__float128 __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:137:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:85:3: note: candidate: 'constexpr __int128 std::abs(__int128)'
   85 |   abs(__GLIBCXX_TYPE_INT_N_0 __x) { return __x >= 0 ? __x : -__x; }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:85:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:79:3: note: candidate: 'constexpr long double std::abs(long double)'
   79 |   abs(long double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:79:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:75:3: note: candidate: 'constexpr float std::abs(float)'
   75 |   abs(float __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:75:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:71:3: note: candidate: 'constexpr double std::abs(double)'
   71 |   abs(double __x)
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:71:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
   61 |   abs(long long __x) { return __builtin_llabs (__x); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:61:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
   56 |   abs(long __i) { return __builtin_labs(__i); }
      |   ^~~
/usr/include/c++/14/bits/std_abs.h:56:3: note:   candidate expects 1 argument, 2 provided