Language: C++

#include <bits/stdc++.h>

using namespace std;

using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<vector<int>>> g(3, vector<vector<int>>(n));
  for (int r = 0; r < 3; r++) {
    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
      int x, y;
      cin >> x >> y;
      --x; --y;
      if (x > y) {
        swap(x, y);
      }
      g[r][x].push_back(y);
    }
  }
  Mint p = (long long) 1e18;
  vector<Mint> pw(n);
  pw[0] = p;
  for (int i = 1; i < n; i++) {
    pw[i] = pw[i - 1] * p;
  }
  const int MAX = 512;
  vector<vector<Mint>> cnt(3, vector<Mint>(MAX));
  for (int r = 0; r < 3; r++) {
    vector<int> gr(n);
    for (int i = n - 1; i >= 0; i--) {
      set<int> s;
      for (int j : g[r][i]) {
        s.insert(gr[j]);
      }
      while (s.find(gr[i]) != s.end()) {
        ++gr[i];
      }
      cnt[r][gr[i]] += pw[i];
    }
  }
  Mint ans = 0;
  for (int x = 0; x < MAX; x++) {
    for (int y = 0; y < MAX; y++) {
      ans += cnt[0][x] * cnt[1][y] * cnt[2][x ^ y];
    }
  }
  cout << ans << '\n';
}


Compiler output:
a.cc:5:14: error: 'Modular' does not name a type
    5 | using Mint = Modular<std::integral_constant<decay<decltype(md)>::type, md>>;
      |              ^~~~~~~
a.cc: In function 'int main()':
a.cc:26:3: error: 'Mint' was not declared in this scope; did you mean 'uint'?
   26 |   Mint p = (long long) 1e18;
      |   ^~~~
      |   uint
a.cc:27:14: error: template argument 2 is invalid
   27 |   vector<Mint> pw(n);
      |              ^
a.cc:28:5: error: invalid types 'int[int]' for array subscript
   28 |   pw[0] = p;
      |     ^
a.cc:28:11: error: 'p' was not declared in this scope; did you mean 'pw'?
   28 |   pw[0] = p;
      |           ^
      |           pw
a.cc:30:7: error: invalid types 'int[int]' for array subscript
   30 |     pw[i] = pw[i - 1] * p;
      |       ^
a.cc:30:15: error: invalid types 'int[int]' for array subscript
   30 |     pw[i] = pw[i - 1] * p;
      |               ^
a.cc:33:17: error: template argument 2 is invalid
   33 |   vector<vector<Mint>> cnt(3, vector<Mint>(MAX));
      |                 ^~~~
a.cc:33:21: error: template argument 1 is invalid
   33 |   vector<vector<Mint>> cnt(3, vector<Mint>(MAX));
      |                     ^~
a.cc:33:21: error: template argument 2 is invalid
a.cc:33:42: error: template argument 2 is invalid
   33 |   vector<vector<Mint>> cnt(3, vector<Mint>(MAX));
      |                                          ^
a.cc:33:48: error: expression list treated as compound expression in initializer [-fpermissive]
   33 |   vector<vector<Mint>> cnt(3, vector<Mint>(MAX));
      |                                                ^
a.cc:44:10: error: invalid types 'int[int]' for array subscript
   44 |       cnt[r][gr[i]] += pw[i];
      |          ^
a.cc:44:26: error: invalid types 'int[int]' for array subscript
   44 |       cnt[r][gr[i]] += pw[i];
      |                          ^
a.cc:47:7: error: expected ';' before 'ans'
   47 |   Mint ans = 0;
      |       ^~~~
      |       ;
a.cc:50:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   50 |       ans += cnt[0][x] * cnt[1][y] * cnt[2][x ^ y];
      |       ^~~
      |       abs
a.cc:50:17: error: invalid types 'int[int]' for array subscript
   50 |       ans += cnt[0][x] * cnt[1][y] * cnt[2][x ^ y];
      |                 ^
a.cc:50:29: error: invalid types 'int[int]' for array subscript
   50 |       ans += cnt[0][x] * cnt[1][y] * cnt[2][x ^ y];
      |                             ^
a.cc:50:41: error: invalid types 'int[int]' for array subscript
   50 |       ans += cnt[0][x] * cnt[1][y] * cnt[2][x ^ y];
      |                                         ^
a.cc:53:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   53 |   cout << ans << '\n';
      |           ^~~
      |           abs