func_code_string: #include <bits/stdc++.h>   using namespace std;   int record[300000];   int main() {     map<pair<int, int>, int> m;     memset(record, 0, sizeof(record));     int n, p;     scanf( %d%d , &n, &p);     map<pair<int, int>, int>::iterator iter;     for (int i = 0; i < n; i++) {       int a, b;       scanf( %d%d , &a, &b);       record[a]++;       record[b]++;       if (a > b)         m[make_pair(b, a)]++;       else         m[make_pair(a, b)]++;     }     long long ans = 0;     for (iter = m.begin(); iter != m.end(); iter++) {       int x = (iter->first).first;       int y = (iter->first).second;       if (record[x] + record[y] - iter->second < p && record[x] + record[y] >= p)         ans--;     }     sort(record + 1, record + n + 1);     int ed = n;     for (int st = 1; st <= n; st++) {       while (record[st] + record[ed] >= p && ed > st) ed--;       ans += min(n - ed, n - st);     }     printf( %lld n , ans);     return 0;   }   