func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long sz = 2e6 + 5, mod = 1e9 + 9;   long long t, n, m, k, q;   const long long inf = 3e18;   long long dx[] = {1, 0, -1, 0};   long long dy[] = {0, 1, 0, -1};   bool vis[sz];   vector<vector<long long> > gr(sz);   vector<long long> cnt(sz, 0);   void DFS(long long s) {     vis[s] = 1;     for (auto i : gr[s]) {       if (!vis[i]) DFS(i);     }     return;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     t = 1;     while (t--) {       cin >> n >> m;       for (long long i = 0; i < m; i++) {         long long a, b;         cin >> a >> b;         if (a == b) {           cnt[a]++;           continue;         }         gr[a].push_back(b);         gr[b].push_back(a);       }       long long cnt1 = 0;       for (long long i = 1; i <= n; i++) {         cnt1 += cnt[i];       }       long long c = 0;       for (long long i = 1; i <= n; i++) {         if (!vis[i] && gr[i].size())           DFS(i), c++;         else if (!vis[i]) {           if (cnt[i]) c++;         }       }       if (c > 1) {         cout << 0 <<   n ;         return 0;       }       long long ans = 0;       ans += cnt1 * (cnt1 - 1) / 2;       ans += cnt1 * (m - cnt1);       for (long long i = 1; i <= n; i++) {         ans += gr[i].size() * (gr[i].size() - 1) / 2;       }       cout << ans <<   n ;     }     return 0;   }   