namespace SPFA { vector<pii> g[N]; ll dis[N]; int vis[N]; voidspfa(int s) { queue<int> q; memset(dis, 0x3f3f3f3f, sizeof(dis)); q.push(s); vis[s] = 1; dis[s] = 0; while (!q.empty()) { int x = q.front(); q.pop(); vis[x] = 0; for (pii now : g[x]) { int to = now.first; int w = now.second;