func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 4;   const int maxlog = 22;   const int mod = 1e9 + 7;   const int sq = 350;   int deg[maxn], cnt[maxn];   map<pair<int, int>, int> m;   long long ans = 0;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cout.precision(20);     int n, p;     cin >> n >> p;     for (int i = 0; i < n; i++) {       int u, v;       cin >> u >> v;       deg[u]++, deg[v]++;       if (u > v) swap(u, v);       m[make_pair(u, v)]++;     }     for (int i = 1; i <= n; i++) cnt[deg[i]]++;     for (int i = n; i >= 0; i--) cnt[i] += cnt[i + 1];     for (int i = 1; i <= n; i++) {       int x = max(0, p - deg[i]);       ans += (long long)cnt[x];       if (2 * deg[i] >= p) ans--;     }     ans /= 2;     for (map<pair<int, int>, int>::iterator it = m.begin(); it != m.end(); it++) {       int u = (*it).first.first, v = (*it).first.second;       int cnt = (*it).second;       if (deg[u] + deg[v] >= p && deg[u] + deg[v] - cnt < p) ans--;     }     cout << ans;     return 0;   }   