Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pii Dir[8] = { //移動
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};
class Graph {
public:
	int vn;
	int sumcost = 0;
	vector<vector<pii>> g;

	Graph(int n) {
		vn = n;
		g.resize(n);
	}
	virtual void con(int a, int b, int w) = 0;
	int getWeight(int f, int t) {
		auto itr = lower_bound(ALL(g[f]), make_pair(t, INT_MIN));
		if (itr != g[f].end())
			return itr->second;
		return INT_MIN;
	}
	int Costsum() {
		return sumcost;
	}
};

class BiDGraph : public Graph {//無向
public:
	BiDGraph(int n) : Graph(n) {}

	void con(int a, int b, int w = 1) {
		g[a].push_back({ b,w });
		g[b].push_back({ a, w });
		sumcost++;
	}
};
struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) { //ｘの入ってる集合と yの入ってる集合を併合
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) { //xとyが同じ集合に入っているかどうかを判定
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	bool isroot(int x) {
		return data[x] < 0;
	}
	int size(int x) {
		return -data[root(x)];
	}
};

signed main() {

	int n, m;
	scnaf("%d %d", &n, &m);
	BiDGraph g(n);
	REP(i, m) {
		int a, b;
		scanf("%d %d", &a, &b);
		g.con(--a, --b);
	}

	vector<pii> col(n, {0,-1});
	vector<int> mosq(n);
	int q;
	scanf("%d", &q);
	vector<pair<pii, int>> que(q);
	vector<vector<int>> mat(n);
	REP(i, q) {
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		que[i] = { {--a,b}, c };
	}
	reverse(ALL(que));
	vector<int> al(n);
	function<void(int,int,int,int)> dfs = [&](int cp, int dis, int c, int qn) {
		if (col[cp].second >= dis) return;
		if (col[cp].first) {

			for(auto itr : mat[mosq[cp]])
				dfs(itr, dis - col[cp].second-1 , c,qn);
			mosq[cp] = qn;
			return;
		}

		col[cp] = { c,dis };
		if (dis) {
			for (auto itr : g.g[cp])
				dfs(itr.first, dis - 1, c,qn);
		}
		else {
			for (auto itr : g.g[cp])
				mat[qn].push_aback(itr.first);
		}
	
	};
	REP (i,q) {
		dfs(que[i].first.first, que[i].first.second, que[i].second, i);
	}

	REP(i, n) {
		printf("%d\n", col[i]);
	}
	return 0;
}

Compiler output:
a.cc: In lambda function:
a.cc:150:41: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'push_aback'; did you mean 'push_back'?
  150 |                                 mat[qn].push_aback(itr.first);
      |                                         ^~~~~~~~~~
      |                                         push_back