Language: C++

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

//#define MOD 1000000007
#define MOD 998244353

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
//const int mod = 1000000007;
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

std::vector<std::vector<int>> iig(int vn, int en) { 
        std::vector<std::vector<int>> res(vn); 
        for(int i = 0; i < en; i++) { 
                int s, t; 
                std::cin >> s >> t; 
                s--; t--; 
		if (s > t) swap(s, t);
                res[t].push_back(s); 
        } 
        return res; 
}

std::vector<int> assign_grundy(std::vector<std::vector<int>>& dg) {
	int gsize = dg.size();
	std::vector<int> incomings(gsize);
	for(int i = 0; i < gsize; i++) {
		for(int j: dg[i]) {
			incomings[j]++;
		}
	}
	std::vector<int> vs_ready;
	for(int i = 0; i < gsize; i++) {
		if (incomings[i] == 0) vs_ready.push_back(i);
	}
	std::vector<std::set<int>> prohibited_grundy(gsize);
	std::vector<int> grundy(gsize);
	while(!vs_ready.empty()) {
		int i = vs_ready.back();
		vs_ready.pop_back();
		int g = 0;
		for(int pg: prohibited_grundy[i]) {
			if (g == pg) g++;
			else break;
		}
		grundy[i] = g;
		for(int j: dg[i]) {
			prohibited_grundy[j].insert(g);
			if ((--incomings[j]) == 0) vs_ready.push_back(j);
		}
	}
	return grundy;
}

int main() {
	int n, m;
	cin >> n;
	cin >> m;
	auto g1 = iig(n, m);
	cin >> m;
	auto g2 = iig(n, m);
	cin >> m;
	auto g3 = iig(n, m);
	// assume that each edge direction is reversed
	auto grn1 = assign_grundy(g1);
	auto grn2 = assign_grundy(g2);
	auto grn3 = assign_grundy(g3);	
	// gmax * (gmax + 1) <= E * 2

	vector<mint> w(n + 1);
	mint step = mint(10).pow(18);
	w[0] = 1;
	for(int i = 1; i <= n; i++) {
		w[i] = w[i-1] * step;
	}

	vector<mint> gcount1(500), gcount2(500), gcount3(500);
	for(int i = 0; i < n; i++) {
		gcount1[grn1[i]] += w[i+1];
		gcount2[grn2[i]] += w[i+1];
		gcount3[grn3[i]] += w[i+1];
	}

	mint res = 0;

	for(int i = 0; i < 500; i++)
		for(int j = 0; j < 500; j++) {
			int k = i ^ j;
			res += gcount1[i] * gcount2[j] * gcount3[k];
		}

	cout << res << endl;
}


Compiler output:
a.cc:14:3: error: 'll' does not name a type
   14 |   ll x; // typedef long long ll;
      |   ^~
a.cc:15:10: error: expected ')' before 'x'
   15 |   mint(ll x=0):x((x%mod+mod)%mod){}
      |       ~  ^~
      |          )
a.cc:29:12: error: 'll' has not been declared
   29 |   mint pow(ll t) const {
      |            ^~
a.cc: In member function 'mint mint::operator-() const':
a.cc:16:41: error: 'x' was not declared in this scope
   16 |   mint operator-() const { return mint(-x);}
      |                                         ^
a.cc: In member function 'mint& mint::operator+=(mint)':
a.cc:18:10: error: 'x' was not declared in this scope
   18 |     if ((x += a.x) >= mod) x -= mod;
      |          ^
a.cc:18:17: error: 'const struct mint' has no member named 'x'
   18 |     if ((x += a.x) >= mod) x -= mod;
      |                 ^
a.cc: In member function 'mint& mint::operator-=(mint)':
a.cc:22:10: error: 'x' was not declared in this scope
   22 |     if ((x += mod-a.x) >= mod) x -= mod;
      |          ^
a.cc:22:21: error: 'const struct mint' has no member named 'x'
   22 |     if ((x += mod-a.x) >= mod) x -= mod;
      |                     ^
a.cc: In member function 'mint& mint::operator*=(mint)':
a.cc:25:37: error: 'x' was not declared in this scope
   25 |   mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
      |                                     ^
a.cc:25:44: error: 'const struct mint' has no member named 'x'
   25 |   mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
      |                                            ^
a.cc: In member function 'mint mint::pow(int) const':
a.cc:30:20: error: could not convert '1' from 'int' to 'mint'
   30 |     if (!t) return 1;
      |                    ^
      |                    |
      |                    int
a.cc: In function 'std::istream& operator>>(std::istream&, const mint&)':
a.cc:42:66: error: 'const struct mint' has no member named 'x'
   42 | istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
      |                                                                  ^
a.cc: In function 'std::ostream& operator<<(std::ostream&, const mint&)':
a.cc:43:66: error: 'const struct mint' has no member named 'x'
   43 | ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}
      |                                                                  ^
a.cc: In function 'int main()':
a.cc:104:28: error: no matching function for call to 'mint::mint(int)'
  104 |         mint step = mint(10).pow(18);
      |                            ^
a.cc:13:8: note: candidate: 'constexpr mint::mint()'
   13 | struct mint {
      |        ^~~~
a.cc:13:8: note:   candidate expects 0 arguments, 1 provided
a.cc:13:8: note: candidate: 'constexpr mint::mint(const mint&)'
a.cc:13:8: note:   no known conversion for argument 1 from 'int' to 'const mint&'
a.cc:13:8: note: candidate: 'constexpr mint::mint(mint&&)'
a.cc:13:8: note:   no known conversion for argument 1 from 'int' to 'mint&&'
a.cc:105:16: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<mint>, mint>::value_type' {aka 'mint'} and 'int')
  105 |         w[0] = 1;
      |                ^
a.cc:13:8: note: candidate: 'constexpr mint& mint::operator=(const mint&)'
   13 | struct mint {
      |        ^~~~
a.cc:13:8: note:   no known conversion for argument 1 from 'int' to 'const mint&'
a.cc:13:8: note: candidate: 'constexpr mint& mint::operator=(mint&&)'
a.cc:13:8: note:   no known conversion for argument 1 from 'int' to 'mint&&'
a.cc:117:20: error: conversion from 'int' to non-scalar type 'mint' requested
  117 |         mint res = 0;
      |                    ^