#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fr first
#define sc second
#define ld long double
using namespace std;
const ll N = 3e5 + 7;
const ll mod = 1e9 + 7;
ll n , x[N] , y[N];
map < ll , ll > X , Y;
void solve(){
cin >> n;
for(int i = 1; i <= n; ++ i){
cin >> x[i] >> y[i];
X[x[i]] ++;
Y[y[i]] ++;
}
ll ans = 0;
for(int i = 1; i <= n; ++ i){
X[x[i]] --;
Y[y[i]] --;
ans += X[x[i]] * Y[y[i]];
X[x[i]] ++;
Y[y[i]] ++;
}
cout << ans;
}
main(){
/// ******************************
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll tt = 1;
/// ******************************
//cin >> tt;
while(tt --){
solve();
}
return 0;
}
/**
**/
Compilation message
triangle.cpp:34:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
34 | main(){
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
288 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
0 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
384 KB |
Output is correct |
8 |
Correct |
1 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
384 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
10 ms |
1280 KB |
Output is correct |
13 |
Correct |
9 ms |
1280 KB |
Output is correct |
14 |
Correct |
16 ms |
1792 KB |
Output is correct |
15 |
Correct |
190 ms |
8048 KB |
Output is correct |
16 |
Correct |
203 ms |
8312 KB |
Output is correct |
17 |
Correct |
215 ms |
8056 KB |
Output is correct |
18 |
Correct |
202 ms |
7928 KB |
Output is correct |
19 |
Correct |
543 ms |
14968 KB |
Output is correct |
20 |
Correct |
407 ms |
12012 KB |
Output is correct |
21 |
Correct |
579 ms |
15736 KB |
Output is correct |
22 |
Correct |
576 ms |
15736 KB |
Output is correct |