func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n, m, k;   vector<vector<pair<long long, long long>>> graph;   long long ok[10][10];   long long fine[10][10][10][10];   bitset<(long long)(2e5 + 5)> incoming[10][10];   long long answer = 0;   vector<long long> temp;   void dfs() {     if (temp.size() == k) {       answer++;       return;     }     long long ind = temp.size() + 1;     for (long long i = 0; i < ind; i++) {       bool flag = true;       for (long long j = 1; j < ind; j++) {         if (!fine[ind][i][j][temp[j - 1]]) {           flag = false;           break;         }       }       if (!flag) continue;       if (ok[ind][i]) {         temp.push_back(i);         dfs();         temp.pop_back();       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     cin >> n >> m >> k;     graph.resize(n + 1);     for (long long i = 0; i < m; i++) {       long long u, v, w;       cin >> u >> v >> w;       graph[u].push_back({w, v});     }     for (long long i = 1; i < n + 1; i++) {       if (graph[i].size() == 0) {         cout << 0 <<   n ;         return 0;       }       sort(graph[i].begin(), graph[i].end());     }     for (long long i = 1; i < k + 1; i++)       for (long long j = 0; j < i; j++) ok[i][j] = 1;     for (long long out = 1; out < k + 1; out++) {       for (long long i = 1; i < n + 1; i++) {         if (graph[i].size() == out) {           for (long long j = 0; j < graph[i].size(); j++) {             long long ver = graph[i][j].second;             if (incoming[out][j][ver]) {               ok[out][j] = 0;               continue;             }             incoming[out][j][ver] = 1;           }         }       }     }     for (long long a = 1; a < k + 1; a++)       for (long long b = 0; b < a; b++)         for (long long c = a; c < k + 1; c++)           for (long long d = 0; d < c; d++) {             if ((incoming[a][b] & incoming[c][d]) == 0) {               fine[a][b][c][d] = fine[c][d][a][b] = 1;             }           }     dfs();     cout << answer <<   n ;   }   