#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long Int; typedef pair P; #define rep(i,x) for(Int i = 0; i < (Int)(x); i++) #define rrep(i,x) for(Int i = ((Int)(x) - 1); i >= 0; i--) #define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define all(x) (x).begin(), (x).end() #define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() ); #define pb push_back #define MX 100010 template void chmin(T1 &a, T2 b){if(a>b)a=b;} template void chmax(T1 &a, T2 b){if(a> n >> m; vector> d(n, vector(n, -INF)); for(int i = 0; i < m; i++) { int a, b, c; cin >> a >> b >> c; a--; b--; chmax(d[a][b], c); chmax(d[b][a], c); } vector> dp(n, vector(1< 0) { chmax(dp[dd][s ^ (1<