Language: C++

#include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
#include<queue>
#include<set>

typedef std::vector<std::set<int>> graph_t;

void splatter(graph_t const& graph, std::vector<std::int64_t>& color,int now, int target, int dist, std::int64_t flag, int& rest)
{
	if (dist == -1)
	{
		return;
	}
	if (color[now] == -1)
	{
		color[now] = flag | target;
		--rest;
	}
	else if ((color[now] & flag) == flag)
	{
		return;
	}
	color[now] = color[now] % (1 << 17) | flag;
	for (auto v : graph[now])
	{
		splatter(graph, color, v, target, dist - 1, flag, rest);
	}
}

int main()
{
	int N, M;
	std::cin >> N >> M;
	graph_t graph(N);
	for (int i{}; i < M; ++i)
	{
		int a, b;
		std::cin >> a >> b;
		--a;
		--b;
		graph[a].emplace(b);
		graph[b].emplace(a);
	}
	int Q;
	std::cin >> Q;
	std::vector<std::int64_t> color(N, -1);
	int rest = N;
	struct data_t
	{
		int vertex;
		int dist;
		int color;
	};
	std::vector<data_t> query(Q);
	for (int i{}; i < Q; ++i)
	{
		auto& q = query[i];
		std::cin >> q.vertex >> q.dist >> q.color;
		--q.vertex;
	}
	for (int j = 1; j <= Q; ++j)
	{
		int i = Q - j;
		auto const& q = query[i];
		splatter(graph, color, q.vertex, q.color, q.dist, j << 17, rest);
		if (rest == 0)
		{
			break;
		}
	}
	for (auto c : color)
	{
		std::cout << std::max(c % (1 << 17), 0ll) << std::endl;
	}
}

Compiler output:
a.cc:10:54: error: 'int64_t' is not a member of 'std'; did you mean 'int64_t'?
   10 | void splatter(graph_t const& graph, std::vector<std::int64_t>& color,int now, int target, int dist, std::int64_t flag, int& rest)
      |                                                      ^~~~~~~
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:155,
                 from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:2:
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: 'int64_t' declared here
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
a.cc:10:61: error: template argument 1 is invalid
   10 | void splatter(graph_t const& graph, std::vector<std::int64_t>& color,int now, int target, int dist, std::int64_t flag, int& rest)
      |                                                             ^
a.cc:10:61: error: template argument 2 is invalid
a.cc:10:101: error: 'std::int64_t' has not been declared
   10 | void splatter(graph_t const& graph, std::vector<std::int64_t>& color,int now, int target, int dist, std::int64_t flag, int& rest)
      |                                                                                                     ^~~
a.cc: In function 'void splatter(const graph_t&, int&, int, int, int, int, int&)':
a.cc:16:18: error: invalid types 'int[int]' for array subscript
   16 |         if (color[now] == -1)
      |                  ^
a.cc:18:22: error: invalid types 'int[int]' for array subscript
   18 |                 color[now] = flag | target;
      |                      ^
a.cc:21:24: error: invalid types 'int[int]' for array subscript
   21 |         else if ((color[now] & flag) == flag)
      |                        ^
a.cc:25:14: error: invalid types 'int[int]' for array subscript
   25 |         color[now] = color[now] % (1 << 17) | flag;
      |              ^
a.cc:25:27: error: invalid types 'int[int]' for array subscript
   25 |         color[now] = color[now] % (1 << 17) | flag;
      |                           ^
a.cc: In function 'int main()':
a.cc:48:26: error: 'int64_t' is not a member of 'std'; did you mean 'int64_t'?
   48 |         std::vector<std::int64_t> color(N, -1);
      |                          ^~~~~~~
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:27:19: note: 'int64_t' declared here
   27 | typedef __int64_t int64_t;
      |                   ^~~~~~~
a.cc:48:33: error: template argument 1 is invalid
   48 |         std::vector<std::int64_t> color(N, -1);
      |                                 ^
a.cc:48:33: error: template argument 2 is invalid
a.cc:48:46: error: expression list treated as compound expression in initializer [-fpermissive]
   48 |         std::vector<std::int64_t> color(N, -1);
      |                                              ^
a.cc:73:23: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   73 |         for (auto c : color)
      |                       ^~~~~
      |                       std::begin
In file included from /usr/include/c++/14/vector:69,
                 from a.cc:1:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
  114 |   template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
      |                                     ^~~~~
a.cc:73:23: error: 'end' was not declared in this scope; did you mean 'std::end'?
   73 |         for (auto c : color)
      |                       ^~~~~
      |                       std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
  116 |   template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
      |                                     ^~~