Language: C++

#include <iostream>
#include <vector>
#include <cmath>

int height(int cx, int cy, vector<vector<int>> &points){
  int hgt = abs(points[0][0] - cx) + abs(points[0][1] - cy) + points[0][2];
  int htmp;
  int ret = hgt;
  for (int i=1; i < points.size(); i++){
    htmp = abs(points[i][0] - cx) + abs(points[i][1] - cy) + points[i][2];
    if (hgt != htmp){
		ret = -1;
      	break;
    }
  }
  
  return ret;
}
      

int main(){
  int N, x, y, h, ans;
  cin >> N;
  vector<vector<int>> points;
  for (int i=0; i<N; i++){
    cin >> x >> y >> h;
    points.push_back(vector<int>({x, y, h}));
  }
  for (int cx = 0; cx <= 100; cx++){
    for (int cy = 0; cy <= 100; cy++){
      ans = height(cx, cy, points);
      if (ans != -1) break;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

      

Compiler output:
a.cc:5:28: error: 'vector' has not been declared
    5 | int height(int cx, int cy, vector<vector<int>> &points){
      |                            ^~~~~~
a.cc:5:34: error: expected ',' or '...' before '<' token
    5 | int height(int cx, int cy, vector<vector<int>> &points){
      |                                  ^
a.cc: In function 'int height(int, int, int)':
a.cc:6:17: error: 'points' was not declared in this scope; did you mean 'printf'?
    6 |   int hgt = abs(points[0][0] - cx) + abs(points[0][1] - cy) + points[0][2];
      |                 ^~~~~~
      |                 printf
a.cc: In function 'int main()':
a.cc:23:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   23 |   cin >> N;
      |   ^~~
      |   std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:24:3: error: 'vector' was not declared in this scope
   24 |   vector<vector<int>> points;
      |   ^~~~~~
a.cc:24:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:24:17: error: expected primary-expression before 'int'
   24 |   vector<vector<int>> points;
      |                 ^~~
a.cc:27:5: error: 'points' was not declared in this scope; did you mean 'printf'?
   27 |     points.push_back(vector<int>({x, y, h}));
      |     ^~~~~~
      |     printf
a.cc:27:29: error: expected primary-expression before 'int'
   27 |     points.push_back(vector<int>({x, y, h}));
      |                             ^~~
a.cc:31:28: error: 'points' was not declared in this scope; did you mean 'printf'?
   31 |       ans = height(cx, cy, points);
      |                            ^~~~~~
      |                            printf
a.cc:36:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   36 |   cout << ans << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:36:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   36 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~