#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define all(v) begin(v), end(v)
#define pi pair<int, int>
#define vi vector<int>
using namespace std;
const int N = 3e5+3;
int n, x[N], y[N];
map<int, int> mx, my;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n;
for(int i = 1; i <= n; i++){
cin >> x[i] >> y[i];
mx[x[i]]++;
my[y[i]]++;
}
ll ans = 0;
for(int i = 1; i <= n; i++){
ans += 1ll * (mx[x[i]] - 1) * (my[y[i]] - 1);
}
cout << ans;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |