Pagini recente » Cod sursa (job #486108) | Cod sursa (job #2620067) | Cod sursa (job #1695668) | Cod sursa (job #1990922) | 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;
}