Pagini recente » Cod sursa (job #2554450) | Cod sursa (job #2585499) | Cod sursa (job #3145417) | Cod sursa (job #3256090) | Cod sursa (job #2324993)
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("triplete.in");
ofstream fout("triplete.out");
const int NMax = 4096;
vector <int> G[NMax + 5];
int N, M, x, y, Ans;
bool A[NMax + 5][NMax + 5];
void Read()
{
fin >> N >> M;
for(int i = 0; i < M; i++) {
fin >> x >> y;
G[x].push_back(y);
G[y].push_back(x);
A[x][y] = A[y][x] = true;
}
}
void Solve_and_Print()
{
for(int a = 1; a < N - 1; a++)
{
for(auto b : G[a])
for(auto c : G[b])
{
if(a < b && b < c && A[a][c])
Ans++;
}
}
fout << Ans << '\n';
}
int main()
{
Read();
Solve_and_Print();
fin.close();
fout.close();
return 0;
}