Pagini recente » Cod sursa (job #1950023) | Cod sursa (job #825219) | Cod sursa (job #1232125) | Cod sursa (job #673106) | Cod sursa (job #2907370)
#include <bits/stdc++.h>
using namespace std;
int const nmax = 4096 + 5;
int n , m;
vector <pair<int,int>> v;
bitset<nmax> priet[nmax];
int main()
{
freopen("triplete.in","r",stdin);
freopen("triplete.out","w",stdout);
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n >> m;
for(int i = 1;i <= m; ++i){
int x , y;
cin >> x >> y;
v.push_back({x,y});
priet[x][y] = priet[y][x] = 1;
}
long long int ans = 0;
for(int i = 1;i <= m; ++i){
bitset<nmax> comun = priet[v[i-1].first] & priet[v[i-1].second];
ans += comun.count();
}
cout << ans / 3;
}