#include #include using namespace std; class UnionFind { vector par; public: explicit UnionFind(int n) : par(n, -1) {} int root(int a) { if(par[a] < 0) { return a; } return par[a] = root(par[a]); } int size(int a) { return -par[root(a)]; } void unite(int a, int b) { a = root(a); b = root(b); if(a == b) { return; } if(size(a) < size(b)) { swap(a, b); } par[a] += par[b]; par[b] = a; } }; template inline void readint(T *x) { *x = 0; int c; for(;;) { c = getchar_unlocked(); switch(c) case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: goto num; } num: for(;;) { switch(c) { case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: *x *= 10; *x += c - 48; break; default: return; } c = getchar_unlocked(); } } int main(void) { int N, M; readint(&N); readint(&M); UnionFind uf(N); vector deg(N); int x = 0; for(int i=0; i