Pagini recente » Cod sursa (job #619837) | Cod sursa (job #310325) | Cod sursa (job #2109943) | Cod sursa (job #332267) | Cod sursa (job #2756639)
#include <bits/stdc++.h>
using namespace std;
bitset<4100>b[4100];
ifstream fin("triplete.in");
ofstream fout("triplete.out");
int n, m;
pair<int, int> a[65600];
int main()
{
int i, x, y;
long long cnt = 0;
fin >> n >> m;
for (i = 1; i <= m; i++)
{
fin >> x >> y;
if (x > y) swap(x, y);
a[i].first = x;
a[i].second = y;
b[x][y] = 1;
///b[y][x] = 1;
}
for (i = 1; i <= m; i++)
{
x = a[i].first;
y = a[i].second;
cnt += (b[x] & b[y]).count();
}
fout << cnt << "\n";
fout.close();
return 0;
}