1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include<bits/stdc++.h>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define gcu getchar_unlocked
#define JOIN(_a0,_a1) ((((ll)_a0)<<32)|(((ll)_a1)))
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
vector<pp> bg;
vector<vector<int>> graph;
vector<int> bn,tin,low;
int bnl,tmin;
int bri=0;
unordered_map<ll,int> M;
void spo(int p)
{
	bn[p]=bnl;
	for(auto I : graph[p])	if(bn[I]!=bnl)	spo(I);
}
void build(int p,int o)
{
	bn[p]=bnl;
	tin[p]=low[p]=++tmin;
	for(auto I : graph[p])
	{
		if(I==o)	continue;
		if(bn[I]!=bnl)
		{
			build(I,p);
			low[p]=min(low[p],low[I]);
			if(low[I]>tin[p])	if(M[JOIN(max(p,I),min(p,I))]==1)	++bri;
		}
		else
		{
			low[p]=min(low[p],low[I]);
		}
	}
}
inline void get(int *x)
{
	int r=0;
	char c=gcu();
	while((c<'0')||(c>'9')) c=gcu();
	while((c>='0')&&(c<='9'))
	{
		r=(r<<3)+(r<<1)+c-48;
		c=gcu();
	}
	(*x)=r;
}
int n,m,a,b;
ll w;
int main()
{
	get(&n);
	get(&m);
	graph.resize(n+1);
	bn.resize(n+1);
	tin.resize(n+1);
	low.resize(n+1);
	bg.resize(m);
	for(int i=0;i<m;++i)
	{
		get(&a);
		get(&b);
		bg[i]=(mp(a,b));
	}

	//budowanie grafu

	for(int r1=0;r1<m;++r1)
	{
		for(int i=1;i<=n;++i)	graph[i].clear();
		for(int i=0;i<m;++i)
		{
			if(i==r1)	continue;
			graph[bg[i].ff].pb(bg[i].ss);
			graph[bg[i].ss].pb(bg[i].ff);
		}
		++bnl;
		spo(1);
		bool f=0;
		for(int i=1;i<=n;++i)
		{
			if(bn[i]!=bnl)
			{
				f=1;
				break;
			}
		}
		if(f)
		{
//			printf("br1\n");
			w+=(((ll)m-1)*((ll)m-2));
			continue;
		}
		for(int r2=0;r2<m;++r2)
		{
			if(r1==r2)	continue;
			for(int i=1;i<=n;++i)	graph[i].clear();
			for(int i=0;i<m;++i)
			{
				if((i==r1)||(i==r2))	continue;
				graph[bg[i].ff].pb(bg[i].ss);
				graph[bg[i].ss].pb(bg[i].ff);
			}
			++bnl;
			spo(1);
			bool fail=0;
			for(int i=1;i<=n;++i)
			{
				if(bn[i]!=bnl)
				{
					fail=1;
					break;
				}
			}
			if(fail)
			{
//				printf("(%d %d)  %d\n",r1,r2,m-2);
				w+=m-2;
				continue;
			}
			M.clear();
			for(int i=0;i<m;++i)
			{
				if((i==r1)||(i==r2))	continue;
				++M[JOIN(max(bg[i].ff,bg[i].ss),min(bg[i].ff,bg[i].ss))];
			}
			tmin=0;
			bri=0;
			++bnl;
			build(1,-1);
//			printf("(%d, %d) bri: %d\n",r1,r2,bri);
			w+=bri;
		}
	}
	printf("%lld\n",w/6);
}