func_code_string: #include <bits/stdc++.h>   const unsigned long long M1 = 1e8 + 7;   const unsigned long long M2 = 1e9 + 7;   const unsigned long long M3 = 998244353;   const int N = 2e5 + 5;   int n, m, k, U[N], V[N], h[10], ans;   unsigned long long k1[N], k2[N], k3[N], f1[10][10], f2[10][10], f3[10][10],       g[10][10];   unsigned long long s1, s2, s3;   std::vector<int> E[N];   void dfs(int dep) {     if (dep == k + 1) {       unsigned long long b1, b2, b3, d = 0;       b1 = 0;       b2 = 0;       b3 = 0;       for (int i = 1; i <= k; i++) {         b1 += f1[i][h[i]];         b2 += f2[i][h[i]];         b3 += f3[i][h[i]];         d += g[i][h[i]];       }       if (b1 == s1 && b2 == s2 && b3 == s3 && d == n) ++ans;       return;     }     for (int i = 1; i <= dep; i++) {       h[dep] = i;       dfs(dep + 1);     }   }   int main() {     scanf( %d%d%d , &n, &m, &k);     for (int i = 1, x, y, w; i <= m; i++) {       scanf( %d%d%d , &x, &y, &w);       U[w] = x;       V[w] = y;       E[x].push_back(w);     }     k1[0] = k2[0] = k3[0] = 1;     for (int i = 1; i <= n; i++) {       std::sort(E[i].begin(), E[i].end());       k1[i] = k1[i - 1] * M1;       k2[i] = k2[i - 1] * M2;       k3[i] = k3[i - 1] * M3;       s1 += k1[i];       s2 += k2[i];       s3 += k3[i];     }     for (int i = 1; i <= n; i++)       for (int v = 0, s = E[i].size(); v < s; v++) {         f1[s][v + 1] += k1[V[E[i][v]]];         f2[s][v + 1] += k2[V[E[i][v]]];         f3[s][v + 1] += k3[V[E[i][v]]];         g[s][v + 1]++;       }     dfs(1);     printf( %d n , ans);     return 0;   }   