#include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <math.h> using namespace std; typedef long long LL; const int N = 1e5 + 10, M = N * 2; int n,m,seq; int L[N], R[N]; int h[N], e[M], ne[M], w[M], idx; int depth[N],mx; LL s[N]; vector&...