Language: C++

#include <bits/stdc++.h>
using namespace std;

#define int long long // 禁忌
using ll = long long;
using lld = long double;
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>

// 重み付き辺
template<typename T>
struct edge {
  int src, to;
  T cost;
  
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}

  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}

  edge &operator=(const int &x) {
    to = x;
    return *this;
  }

  operator int() const { return to; }
};

// 重み付き辺集合
template<typename T>
using Edges = vector<edge<T>>;

// 重み付きグラフ
template<typename T>
using WeightedGraph = vector<Edges<T>>;

using UnWeightedGraph = VVi; // 重みなしグラフ

// 距離行列
template<typename T>
using Matrix = vector<vector<T>>;

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define PER(i, n) for (int i = (n-1); i >= 0; --i)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NEXP(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define eb(n) emplace_back(n)
#define popb pop_back()
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl

// UnionFind
class UnionFind {
public:
  vector <int> par;
  vector <int> siz;

  UnionFind(int sz_): par(sz_), siz(sz_, 1LL) {
    for (int i = 0; i < sz_; ++i) par[i] = i;
  }
  void init(ll sz_) {
    par.resize(sz_);
    siz.assign(sz_, 1LL);
    for (int i = 0; i < sz_; ++i) par[i] = i;
  }

  int root(int x) {
    while (par[x] != x) {
      x = par[x] = par[par[x]];
    }
    return x;
  }

  bool merge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }

  bool issame(int x, int y) {
    return root(x) == root(y);
  }

  int size(int x) {
    return siz[root(x)];
  }
};

// modint
template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};
using modint = ModInt< MOD >;

// dijkstra O(E logV)
template<typename T>
vector<T> dijkstra(WeightedGraph<T> &g, int s) {
  const auto INF2 = numeric_limits<T>::max();
  vector<T> dist(g.size(), INF2);
  using Pi = pair<T, int>;
  priority_queue<Pi, vector<Pi>, greater<Pi>> que;
  dist[s] = 0;
  que.emplace(dist[s], s);
  while(!que.empty()) {
    T cost;
    int idx;
    tie(cost, idx) = que.top();
    que.pop();
    if(dist[idx] < cost) continue;
    for(auto &e : g[idx]) {
      auto next_cost = cost + e.cost;
      if(dist[e.to] <= next_cost) continue;
      dist[e.to] = next_cost;
      que.emplace(dist[e.to], e.to);
    }
  }
  return dist;
}

// 負の辺を持つ単一始点最短路 O(VE)
template<typename T>
vector<T> bellman_ford(Edges<T> &edges, int V, int s) {
  const auto INF2 = numeric_limits<T>::max();
  vector<T> dist(V, INF2);
  dist[s] = 0;
  REP(i,(V-1)) {
    for(auto &e : edges) {
      if(dist[e.src] == INF2) continue;
      dist[e.to] = min(dist[e.to], dist[e.src] + e.cost);
    }
  }
  for(auto &e : edges) {
    if(dist[e.src] == INF2) continue;
    if(dist[e.src] + e.cost < dist[e.to]) return vector<T>();
  }
  return dist;
}

// 全点対間最短路 O(V^3)
template<typename T>
void warshall_floyd(Matrix<T> &g, T lINF) {
  ll n = g.size();
  REP(k,n){
    REP(i,n){
      REP(j,n){
        if(g[i][k] == lINF || g[k][j] == lINF) continue;
        g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
      }
    }
  }
  return;
}

// 入出力高速化
void fast(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  return;
}

// vectorの合計値を返します
ll vsum(Vi V) {
  ll res = 0LL;
  ll size = V.size();
  REP(i,size) {
    res += V.at(i);
  }
  return res;
}

// vectorの平均値を返します
lld vave(Vi V) {
  lld size = V.size();
  return (lld)vsum(V) / size;
}

// vectorの最大値を返します
ll vmax(Vi V) {
  RSORT(V);
  return V.at(0);
}

// vectorの最小値を返します
ll vmin(Vi V) {
  SORT(V);
  return V.at(0);
}

// 数値 b が a より大きく、 c より小さいことを判定します
template<typename T>
bool mid1(T a, T b, T c) {
  return (a < b) && (b < c);
}

// 数値 b が a以上 で、c以下 であることを判定します
template<typename T>
bool mid2(T a, T b, T c) {
  return (a <= b) && (b <= c);
}

// YES or NO
template<typename T>
void YES(T n) {
  cout << ((n) ? "YES" : "NO" ) << endl;
}

// Yes or No
template<typename T>
void Yes(T n) {
  cout << ((n) ? "Yes" : "No" ) << endl;
}

// yes or no
template<typename T>
void yes(T n) {
  cout << ((n) ? "yes" : "no" ) << endl;
}

// Yay! or :(
template<typename T>
void Yay(T n) {
  cout << ((n) ? "Yay!": ":(") << endl;
}

// 標準入力します
inline void in(void){
  return;
}
template<typename First, typename... Rest>
void in(First& first, Rest&... rest) {
  cin >> first;
  in(rest...);
  return;
}

// vectorを標準入力
template<typename T>
void vin(T& V) {
  ll size = V.size();
  REP(i,size) {
    cin >> V[i];
  }
  return;
}

// 標準出力します
inline void out(void){
  cout << endl;
  return;
}
template<typename T>
void out(T only) {
  cout << only << endl;
  return;
}
template<typename First, typename... Rest>
void out(First first, Rest... rest) {
  cout << first << " ";
  out(rest...);
  return;
}

// vectorを標準出力
template<typename T>
void vout(T& V) {
  ll size = V.size();
  REP(i,size) {
    cout << V.at(i) << endl;
  }
}

// vectorを１行に標準出力
template<typename T>
void vout2(T& V) {
  ll size = V.size();
  REP(i,size) {
    cout << V[i] << " \n"[i==(size-1)];
  }
}

// 最大公約数を求めます
int gcd(int a, int b) {
  return b != 0 ? gcd(b, a % b) : a;
}

// 最小公倍数を求めます
int lcm(int a, int b) {
  return a * b / gcd(a, b);
}

// 文字を全て大文字にします
string toStrUp(string str) {
  char diff = 'A'-'a';
  REP(i,str.size()) str[i] += diff;
  return str;
}

// 素因数分解します (O(sqrt(n)))
map<int,int> prime_factor(int n) {
  map<int,int> ret;
  for(int i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}

// 素数判定 (O(sqrt(n)))
bool is_prime(int x) {
  for(int i = 2; i * i <= x; i++) {
    if(x % i == 0) return false;
  }
  return true;
}

// 進数変換 (O(log n))
template<typename T>
vector<T> convert_base(T x, T b) {
  vector< T > ret;
  T t = 1, k = abs(b);
  while(x) {
    ret.emplace_back((x * t) % k);
    if(ret.back() < 0) ret.back() += k;
    x -= ret.back() * t;
    x /= k;
    t *= b / k;
  }
  if(ret.empty()) ret.emplace_back(0);
  reverse(begin(ret), end(ret));
  return ret;
}

template<class T>
inline bool chmin(T& a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}

template<class T>
inline bool chmax(T& a, T b) {
  if(a < b){
    a = b;
    return true;
  }
  return false;
}

signed main() {
  fast();
  // 使えない変数名
  // P, M, S, PQ, PQG
  // ここから
  int n,m,k; string s;
  in(n);
  VVi vx(n),vy(n),vh(n);
  int si = -1;
  REP(i,n) {
    in(vx[i],vy[i],vz[i]);
    if(vh[i] > 0) si = i;
  }
  int resx = -1, resy = -1, resh = -1;
  REP(x,101) {
    REP(y,101) {
      int h = vh[si] + abs(x - vx[si]) + abs(y - vy[si]);
      bool ok = true;
      REP(i,n) {
        if(vh[i] > 0 && h - vh[i] != abs(x - vx[i]) + abs(y - vy[i])) {
          ok = false;
        }
        if (vh[i] == 0 && h > abs(x - vx[i]) + abs(y - vy[i])) {
          ok = false;
        }
      } 
      if(ok) {
        resx = x;
        resy = y;
        resh = h;
      }
    }
  }
  out(resx,resy,resh);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:462:20: error: 'vz' was not declared in this scope; did you mean 'vh'?
  462 |     in(vx[i],vy[i],vz[i]);
      |                    ^~
      |                    vh
a.cc:463:14: error: no match for 'operator>' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} and 'int')
  463 |     if(vh[i] > 0) si = i;
In file included from /usr/include/c++/14/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
                 from a.cc:1:
/usr/include/c++/14/bits/regex.h:1176:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const sub_match<_BiIter>&)'
 1176 |     operator>(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1176:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/bits/regex.h:1236:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const sub_match<_BiIter>&)'
 1236 |     operator>(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1236:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/bits/regex.h:1329:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>(const sub_match<_BiIter>&, __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1329 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1329:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/bits/regex.h:1403:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type*, const sub_match<_BiIter>&)'
 1403 |     operator>(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1403:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/bits/regex.h:1497:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1497 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1497:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/bits/regex.h:1573:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const typename std::iterator_traits<_Iter>::value_type&, const sub_match<_BiIter>&)'
 1573 |     operator>(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1573:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/bits/regex.h:1673:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>(const sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1673 |     operator>(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/14/bits/regex.h:1673:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
 1058 |     operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::pair<_T1, _T2>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:67:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
  462 |     operator>(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  507 |     operator>(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1714 |     operator>(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::move_iterator<_IteratorL>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
 1774 |     operator>(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} is not derived from 'const std::move_iterator<_IteratorL>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
  695 |     operator> (basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   'std::vector<long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
  702 |     operator> (basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note:   template argument deduction/substitution failed:
a.cc:463:16: note:   'std::vector<long long int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
  463 |     if(vh[i] > 0) si = i;
      |                ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> co