func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = (long long)1e9 + 7;   const long long N = (long long)2e6 + 222;   const long long INF = (long long)1e18;   const double eps = (double)1e-6;   long long n, m, l, r, used[N];   vector<long long> g[N];   set<long long> s;   long long cnt = 0;   void dfs(long long x) {     used[x] = 1;     s.erase(x);     cnt++;     long long pr = 0;     for (auto to : g[x]) {       while (s.upper_bound(pr) != s.end() && (*s.upper_bound(pr)) < to) {         long long k = (*s.upper_bound(pr));         if (!used[k]) dfs(k);       }       pr = to;     }   }   void solve() {     cin >> n >> m;     for (long long i = 1; i <= m; ++i) {       cin >> l >> r;       g[l].push_back(r);       g[r].push_back(l);     }     for (long long i = 1; i <= n; ++i) s.insert(i);     long long ans = 0;     for (long long i = 1; i <= n; ++i) sort(g[i].begin(), g[i].end());     for (long long i = 1; i <= n; ++i) g[i].push_back(n + 1);     for (long long i = 1; i <= n; ++i) {       if (!used[i]) {         ans++;         dfs(i);       }     }     cout << ans - 1;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) {       solve();     }     return 0;   }   