Pagini recente » Cod sursa (job #324846) | Cod sursa (job #2297631) | Cod sursa (job #2357754) | Cod sursa (job #2571164) | Cod sursa (job #2829085)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("triplete.in");
ofstream fout("triplete.out");
const int NMAX = 4096;
int N, M, ans;
vector<pair<short int, short int>> v;
bitset<NMAX> mat[NMAX];
int main() {
fin >> N >> M;
for(int i = 0; i < M; i++) {
short int x, y;
fin >> x >> y;
x--; y--;
v.push_back({x, y});
mat[x][y] = 1;
mat[y][x] = 1;
}
for(int i = 0; i < M; i++) {
ans += (mat[v[i].first] & mat[v[i].second]).count();
}
fout << ans / 3 << '\n';
return 0;
}