Pagini recente » Cod sursa (job #1505238) | Cod sursa (job #264770) | Cod sursa (job #2267158) | Cod sursa (job #738544) | Cod sursa (job #1901438)
# include <bits/stdc++.h>
using namespace std;
const int nmax = 4096 + 10;
int x, y, n, m, i, ap[nmax];
vector <int> G[nmax];
int sol (int x)
{
int Sol = 0;
for (auto &it : G[x])
ap[it] = true;
for (auto &it : G[x])
{
int y = it;
if (y > x)
{
for (auto &it2 : G[y])
if (it2 > y && ap[it2]) ++Sol;
}
}
for (auto &it : G[x])
ap[it] = false;
return Sol;
}
int main ()
{
freopen("triplete.in", "r", stdin);
freopen("triplete.out", "w", stdout);
scanf("%d %d\n", &n, &m);
for (i = 1; i <= m; ++i)
{
scanf("%d %d\n", &x, &y);
G[x].push_back(y), G[y].push_back(x);
}
int ans = 0;
for (i = 1; i < n - 1; ++i)
{
ans += sol(i);
}
printf("%d\n", ans);
return 0;
}