func_code_string: #include <bits/stdc++.h>   using namespace std;   const int d = 5;   const int MAX = 1 << d;   const int TOTAL = 374;   inline int bit(unsigned int mask, int k) { return (mask >> k) & 1; }   int __builtin_fnz(unsigned int x) { return 31 - __builtin_clz(x); }   void printm(unsigned int mask, int k = d) {     for (int i = 0; i < k; ++i) printf( %d , bit(mask, i));     printf(  n );   }   int dim(unsigned int V) {     int res = 0;     for (; V != 1; ++res) V &= (1U << (1 << __builtin_fnz(__builtin_fnz(V)))) - 1;     return res;   }   unsigned int join_v(unsigned int U, int x) {     unsigned int X = U;     for (int v = 0; v < MAX; ++v)       if (bit(U, v)) X |= 1U << (v ^ x);     return X;   }   unsigned int join(unsigned int U, unsigned int V) {     unsigned int X = U;     int x;     while (V != 1) {       x = __builtin_fnz(V);       X |= join_v(X, x);       V &= (1U << (1U << __builtin_fnz(x))) - 1;     }     return X;   }   void show(unsigned int V) {     printf( %d n , dim(V));     printf( %u n , V);     printm(V, MAX);     for (int v = 0; v < MAX; ++v)       if (bit(V, v)) printm(v, d);     printf(  n );   }   const int MOD = (int)1e9 + 7;   void add(int& a, int b) {     a += b;     if (a >= MOD) a -= MOD;   }   void mult(int& a, int b) { a = (a * 1LL * b) % MOD; }   int prod(int a, int b) { return (a * 1LL * b) % MOD; }   const int N = (int)1e5;   vector<pair<int, int> > g[N];   int pref[N];   int tab[TOTAL][TOTAL];   int dp[2][TOTAL + 1];   int main() {     vector<unsigned int> subspaces;     subspaces.push_back(1);     for (int i = 0; i < d; ++i) {       vector<unsigned int> nsubspaces;       for (unsigned int U : subspaces) {         nsubspaces.push_back(U);         for (int v = (1 << i); v < (1 << (i + 1)); ++v)           nsubspaces.push_back(join_v(U, v));       }       sort((nsubspaces).begin(), (nsubspaces).end());       nsubspaces.erase(unique((nsubspaces).begin(), (nsubspaces).end()),                        nsubspaces.end());       subspaces = nsubspaces;     }     assert(TOTAL == (int)(subspaces).size());     function<int(unsigned int)> id = [&](unsigned int V) {       int i = lower_bound((subspaces).begin(), (subspaces).end(), V) -               subspaces.begin();       return i;     };     for (int i = 0; i < TOTAL; ++i)       for (int j = 0; j < TOTAL; ++j) {         if ((subspaces[i] & subspaces[j]) != 1)           tab[i][j] = TOTAL;         else           tab[i][j] = id(join(subspaces[i], subspaces[j]));       }     int n, m;     scanf( %d %d , &n, &m);     for (int i = 0; i < m; ++i) {       int u, v, w;       scanf( %d %d %d , &u, &v, &w);       --u;       --v;       g[u].push_back({v, w});       g[v].push_back({u, w});     }     int t = 0, nt = 1;     memset(dp[t], 0, sizeof dp[t]);     dp[t][id(1)] = 1;     memset(pref, -1, sizeof pref);     pref[0] = 0;     for (auto& [start, weight] : g[0]) {       if (pref[start] != -1) continue;       int vec = -1;       unsigned int V = 1;       function<void(int, int, bool&)> dfs = [&](int v, int par, bool& ok) {         for (auto& [u, w] : g[v]) {           if (pref[u] == -1) {             pref[u] = pref[v] ^ w;             dfs(u, v, ok);           } else {             if (u > v || u == par) continue;             int add = pref[u] ^ pref[v] ^ w;             if (u == 0) {               vec = add;             } else {               if (bit(V, add)) ok = false;               V = join_v(V, add);             }           }         }       };       pref[start] = weight;       bool ok = true;       dfs(start, 0, ok);       if (!ok) continue;       memcpy(dp[nt], dp[t], sizeof dp[t]);       int i = id(V);       if (vec == -1) {         for (int j = 0; j < TOTAL; ++j) {           add(dp[nt][tab[i][j]], dp[t][j]);         }       } else {         for (int j = 0; j < TOTAL; ++j) {           add(dp[nt][tab[i][j]], dp[t][j]);           add(dp[nt][tab[i][j]], dp[t][j]);         }         int with = id(join_v(V, vec));         if (i != with) {           V = subspaces[with];           for (int j = 0; j < TOTAL; ++j) {             add(dp[nt][tab[with][j]], dp[t][j]);           }         }       }       swap(t, nt);     }     int ans = 0;     for (int i = 0; i < TOTAL; ++i) add(ans, dp[t][i]);     printf( %d n , ans);   }   