Language: C++

#include <stdio.h>
#include <algorithm>
#include <tuple>
using namespace std;
int n, ret, res, ptr; tuple<int, int, int> d[100000];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%d%d%d", &get<0>(d[i]), &get<1>(d[i]), &get<2>(d[i]));
	sort(d, d + n);
	for (int i = 0; i < n; i++) {
		res = get<2>(d[i]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]), get<1>(d[i]) + 2, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) && get<1>(d[ptr]) == get<1>(d[i]) + 1) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]) + 1, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i])) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]) + 2, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i]) + 1) res += get<2>(d[ptr]);
		ret = max(res, ret);
		res = get<2>(d[i]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]), get<1>(d[i]), 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) && get<1>(d[ptr]) == get<1>(d[i]) - 1) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]) + 1, 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i])) res += get<2>(d[ptr]);
		ptr = lower_bound(d, d + n, make_tuple(get<0>(d[i]) + 1, get<1>(d[i]), 0)) - d - 1;
		if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i] - 1)) res += get<2>(d[ptr]);
		ret = max(res, ret);
	}
	printf("%d / 1\n", ret);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:89: error: no match for 'operator-' (operand types are 'std::tuple<int, int, int>' and 'int')
   25 |                 if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i] - 1)) res += get<2>(d[ptr]);
      |                                                                                    ~~~~ ^ ~
      |                                                                                       |   |
      |                                                                                       |   int
      |                                                                                       std::tuple<int, int, int>
In file included from /usr/include/c++/14/bits/stl_algobase.h:67,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
  618 |     operator-(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note:   template argument deduction/substitution failed:
a.cc:25:91: note:   'std::tuple<int, int, int>' is not derived from 'const std::reverse_iterator<_Iterator>'
   25 |                 if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i] - 1)) res += get<2>(d[ptr]);
      |                                                                                           ^
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
 1790 |     operator-(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note:   template argument deduction/substitution failed:
a.cc:25:91: note:   'std::tuple<int, int, int>' is not derived from 'const std::move_iterator<_IteratorL>'
   25 |                 if (get<0>(d[ptr]) == get<0>(d[i]) + 1 && get<1>(d[ptr]) == get<1>(d[i] - 1)) res += get<2>(d[ptr]);
      |                                                                                           ^