#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
#define PB push_back
#define F first
#define S second
#define M move
#define B begin
#define E end
#define Fr front
#define Ba back
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pdd = pair<double, double>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
using vi = vector<int>;
using vll = vector<ll>;
const int INF = 2e9;
const ll INFL = 2e18;
const ll MOD = 1e9 + 7;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cout << fixed << setprecision(0);
ll n, ans = 0; cin >> n;
map<ll, ll> fx, fy;
vector<pll> a;
for (ll i = 0; i < n; i++) {
ll x, y; cin >> x >> y;
fx[x]++, fy[y]++, a.push_back({x, y});
}
for (auto [x, y]: a) ans += (fx[x] - 1) * (fy[y] - 1);
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |