Language: C++

#include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
//cin.sync_with_stdio(false);
//streambuf
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
using vi = vector<int>;
using vll = vector<ll>;
using vpii = vector<pii>;
using ti3 = tuple<int, int, int>;
using vti3 = vector<ti3>;
template<class T, class T2> using umap = unordered_map<T, T2>;
template<class T> using uset = unordered_set<T>;
template<class T> void cmin(T &a, const T&b) { if (a > b)a = b; }
#define ALL(a) a.begin(),a.end()
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a) for(int i=1;i<=a;i++)
const ll mod = 1000000007;
const int INF = numeric_limits<int>().max()/2;
template <class T>
#define int long long
inline void hash_combine(size_t & seed, const T & v) {
	hash<T> hasher;
	seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
namespace std {

	template<typename S, typename T> struct hash<pair<S, T>> {
		inline size_t operator()(const pair<S, T> & v) const {
			size_t seed = 0;
			hash_combine(seed, v.first);
			hash_combine(seed, v.second);
			return seed;
		}
	};
	// Recursive template code derived from Matthieu M.
	template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1>
	struct HashValueImpl
	{
		static void apply(size_t& seed, Tuple const& tuple)
		{
			HashValueImpl<Tuple, Index - 1>::apply(seed, tuple);
			hash_combine(seed, std::get<Index>(tuple));
		}
	};

	template <class Tuple>
	struct HashValueImpl<Tuple, 0>
	{
		static void apply(size_t& seed, Tuple const& tuple)
		{
			hash_combine(seed, std::get<0>(tuple));
		}
	};

template <typename ... TT>
struct hash<std::tuple<TT...>>
{
	size_t
		operator()(std::tuple<TT...> const& tt) const
	{
		size_t seed = 0;
		HashValueImpl<std::tuple<TT...> >::apply(seed, tt);
		return seed;
	}

}; }
umap<ti3, ll> memo;
ll pow(ll base, ll i,ll mod) {
	ll a=1;
	while (i) {
		if (i & 1) {
			a *= base;
			a %= mod;
		}
		base *= base;
		base %= mod;
		i/=2;
	}
	return a;
}
class unionfind {
	vector<int> par, rank, size_;//速度ではなくメモリ効率を考えるならrankのかわりにsizeを使う
public:
	unionfind(int n) :par(n), rank(n), size_(n, 1) {
		iota(ALL(par), 0);
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x), y = find(y);
		if (x == y)return;
		if (rank[x] < rank[y])swap(x, y);
		par[y] = x;
		size_[x] += size_[y];
		if (rank[x] == rank[y])rank[x]++;
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
	int size(int x) {
		return size_[find(x)];
	}
};
ll gcd(ll a, ll b) {
	while (b) {
		ll c = a%b;
		a = b;
		b = c;
	}
	return a;
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b)*b;
}
int popcnt(unsigned long long a) {
	a = (a & 0x5555555555555555) + (a >> 1 & 0x5555555555555555);
	a = (a & 0x3333333333333333) + (a >> 2 & 0x3333333333333333);
	a = (a & 0x0f0f0f0f0f0f0f0f) + (a >> 4 & 0x0f0f0f0f0f0f0f0f);
	a = (a & 0x00ff00ff00ff00ff) + (a >> 8 & 0x00ff00ff00ff00ff);
	a = (a & 0x0000ffff0000ffff) + (a >> 16 & 0x0000ffff0000ffff);
	return (a & 0xffffffff) + (a >> 32);
}
singned main() {
	int r, c, n;
	cin >> r >> c >> n;
	vti3 a(n);
	vi vr(n), vc(n);
	rep(i, n) {
		int ri, ci, ai;
		cin >> ri >> ci >> ai;
		a[i] = make_tuple(ri, ci, ai);
		vr[i] = ri, vc[i] = ci;
	}
	sort(ALL(vr)); sort(ALL(vc));
	vr.erase(unique(ALL(vr)), vr.end());
	vc.erase(unique(ALL(vc)), vc.end());
	rep(i, n) {
		int ri, ci, ai;
		tie(ri, ci, ai) = a[i];
		ri = lower_bound(ALL(vr), ri) - vr.begin();
		ci = lower_bound(ALL(vc), ci) - vc.begin();
		a[i] = make_tuple(ri, ci, ai);
	}
	auto ac = a;
	sort(ALL(a));
	sort(ALL(ac), [](const ti3 &a, const ti3 &b) {return (get<1>(a) == get<1>(b)) ? (get<0>(a) < get<0>(b)) : (get<1>(a) < get<1>(b)); });
	vi dr(vr.size(),INF), dc(vc.size(),INF);
	uset<int> used;
	for (auto &x : ac) {
		if (!used.insert(get<0>(x)).second)continue;
		auto lit = lower_bound(ALL(a), make_tuple(get<0>(x) + 1, 0, 0));
		auto it = lower_bound(ALL(a), x);
		int p1 = get<1>(*it);
		if (dc[p1] == INF)dc[p1] = 0;
		int as = get<2>(*it);
		for (it++; it != lit; it++) {
			int p2 = get<1>(*it);
			if (dc[p2] == INF)dc[p2] = get<2>(*it) - as;
			else if (dc[p2] != get<2>(*it) - as) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	used.erase(ALL(used));
	for (auto &x : a) {
		if (!used.insert(get<1>(x)).second)continue;
		auto lit = lower_bound(ALL(ac), make_tuple(0,get<1>(x) + 1, 0), [](const ti3 &a, const ti3 &b) {return (get<1>(a) == get<1>(b)) ? (get<0>(a) < get<0>(b)) : (get<1>(a) < get<1>(b)); });
		auto it = lower_bound(ALL(ac), x, [](const ti3 &a, const ti3 &b) {return (get<1>(a) == get<1>(b)) ? (get<0>(a) < get<0>(b)) : (get<1>(a) < get<1>(b)); });
		int p1 = get<1>(*it);
		if (dr[p1] == INF)dr[p1] = 0;
		int as = get<2>(*it);
		for (it++; it != lit; it++) {
			int p2 = get<0>(*it);
			if (dr[p2] == INF)dr[p2] = get<2>(*it) - as;
			else if (dr[p2] != get<2>(*it) - as) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	int m;
	int min = INF;
	rep(i, dr.size()) {
		if (dr[i] < min)min = dr[i], m = i;
	}
	for (auto&x : a) {
		if (min - dr[get<0>(x)] + get<2>(x) < 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	min = INF;
	rep(i, dc.size()) {
		if (dc[i] < min)min = dc[i], m = i;
	}
	for (auto&x : a) {
		if (min - dc[get<0>(x)] + get<2>(x) < 0) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
}

Compiler output:
a.cc:143:1: error: 'singned' does not name a type; did you mean 'signed'?
  143 | singned main() {
      | ^~~~~~~
      | signed