Pagini recente » Cod sursa (job #2077020) | Cod sursa (job #95484) | Cod sursa (job #2077209) | Cod sursa (job #2224491) | Cod sursa (job #2294046)
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("triplete.in");
ofstream fout("triplete.out");
int N, M, ans;
vector <int> a[4100];
bool d[4100][4100];
int main()
{
fin >> N >> M;
int x, y;
for(int i = 1; i <= M; i++)
{
fin >> x >> y;
a[x].push_back(y);
a[y].push_back(x);
d[x][y] = d[y][x] = true;
}
for(int i = 1; i <= N - 2; i++)
for(auto it : a[i])
for(auto it2 : a[it])
{
if(i < it && it < it2)
if(d[i][it2] == true)
ans++;
}
fout << ans;
return 0;
}