#include<bits/stdc++.h>
#define x first
#define y second
using namespace std;
const int N = 3e5+5;
pair<int,int> p[N];
map<int,int> mp;
int main(){
ios::sync_with_stdio(0);cin.tie(0);
cout.tie(0);
int n,ans=0;
cin>>n;
for(int i=1;i<=n;i++) cin>>p[i].x>>p[i].y, mp[p[i].x]++,mp[p[i].y]++;
for(int i=1;i<=n;i++){
ans += (long long )(mp[p[i].x]-1) * (long long )(mp[p[i].y]-1);
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |