#include #include #include #include #include using namespace std; using ll = long long; #include int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n,m; cin>>n>>m; vector cnt(n,0); set s; atcoder::dsu uf(n); vector> g(n); for(int i = 0;i>u>>v; u--;v--; uf.merge(u,v); s.insert(u); s.insert(v); cnt[u]++; cnt[v]--; g[u].push_back(v); g[v].push_back(u); } int sum = 0; int all = 0; int c = 0; vector vis(n,0); for(int i = 0;i que; que.push_back(i); vis[i]++; for(int j = 0;j0) tmp += cnt[ni]; for(auto&to:g[ni]){ if(vis[to]) continue; vis[to]++; que.push_back(to); } } tmp = max(0,tmp-1); all += tmp; c++; } cout<