#include<bits/stdc++.h> using namespace std; // #define int long long const int N=1e6+10; int h[N],e[N],ne[N],w[N],idx; void add(int a,int b,int c){ e[idx]=b,w[idx]=c,ne[idx]=h[a],h[a]=idx++; } typedef pair<int,int> PII ; bool st[N]; #define x first #define y second int n,k; // int v...