Pagini recente » Cod sursa (job #3143694) | Profil UAIC_Buruiana_Oprea_Ouatu | Cod sursa (job #232996) | Cod sursa (job #2209836) | Cod sursa (job #2716565)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("triplete.in");
ofstream fout("triplete.out");
const int NMAX = 4100;
const int MAXM = 66000;
int N, M;
bitset<NMAX> adj[NMAX];
pair<int,int> edge[MAXM];
long long ans;
int main() {
fin >> N >> M;
for(int i = 0; i < M; ++i) {
fin >> edge[i].first >> edge[i].second;
adj[edge[i].first][edge[i].second] = adj[edge[i].second][edge[i].first] = true;
}
for(int i = 0; i < M; ++i)
ans += (adj[edge[i].first] & adj[edge[i].second]).count();
fout << ans / 3 << '\n';
}