#include using namespace std; #define ALL(a) (a).begin(),(a).end() #define ALLR(a) (a).rbegin(),(a).rend() #define spa << " " << #define lfs <= (ll)(m); i--) typedef long long ll; typedef long double ld; const ll MOD = 1e9+7; //const ll MOD = 998244353; const ll INF = 1e18; using P = pair; template void chmin(T &a,T b){if(a>b)a=b;} template void chmax(T &a,T b){if(a void ans(bool x,T1 y,T2 z){if(x)cout< void debug(vector>v,ll h,ll w){for(ll i=0;iv,ll h,ll w){for(ll i=0;i void debug(vectorv,ll n){cout< vector>vec(ll x, ll y, T w){ vector>v(x,vector(y,w));return v;} ll gcd(ll x,ll y){ll r;while(y!=0&&(r=x%y)!=0){x=y;y=r;}return y==0?x:y;} template void emp(map&m, T x){m.emplace(x,0).first->second++;} ll MAX_V = 2e5 + 5; //頂点数 struct edge { ll to; ll cost; }; //<最短距離, 頂点の番号>using P = pair; vector> G(MAX_V); //隣接リスト vectort(MAX_V);//訪問したかどうか ll ret=0; ll n; ll dfs(ll k){ t[k]=1; ll num=1; for(ll i=0;i>n; for(ll i=0;i>u>>v>>c; struct edge e ={v,c}; G[u].push_back(e); e ={u,c}; G[v].push_back(e); } dfs(1); cout<