#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pll pair<int, int>
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define endl '\n'
#define ld long double
signed main(){
int n;cin>>n;
vector<pair<int,int>> v(n);
map<int,int> x, y;
for(int i=0;i<n;i++){
cin>>v[i].f>>v[i].s;
x[v[i].f]++;
y[v[i].s]++;
}
//~ sort(v.begin(),v.end());
int ans=0;
for(int i=0;i<n;i++){
//~ x[v[i].f]--;
//~ y[v[i].s]--;
ans+=(x[v[i].f]-1)*(y[v[i].s]-1);
}
cout<<ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |