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
#include <bits/stdc++.h>

using namespace std;

#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define ll long long
ll mod=1000000007;
int inf=1000000007;
ll infl=1000000000000000007;

vector<pair<int,int>>G[200007];
int low[200007];
bool odw[200007];
int nr[200007];
int ban,ban1;
ll ans,br;
ll n,m,a,b,c;

void dfs(int v,int k)
{
    odw[v]=1;
    nr[v]=c++;
    low[v]=nr[v];
    for(auto u:G[v])
    {
        if(u.nd==ban||u.nd==ban1) continue;
        if(!odw[u.st])
        {
            dfs(u.st,u.nd);
            low[v]=min(low[v],low[u.st]);
        }
        else if(u.nd!=k&&nr[u.st]<nr[v]) low[v]=min(low[v],nr[u.st]);
    }
    if(k>ban&&low[v]==nr[v]) br++;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>a>>b;
        G[a].pb({b,i});
        G[b].pb({a,i});
    }
    for(ll i=1;i<=m;i++)
    {
        for(ll j=i+1;j<=m;j++)
        {
            ban1=i;
            ban=j;
            br=0;
            c=1;
            for(int l=1;l<=n;l++) odw[l]=0;
            dfs(1,-1);
            int x=1;
            for(int l=1; l<=n; l++) x&=odw[l];
            if(!x) ans+=m-j;
            else ans+=br;
        }
    }
    cout<<ans<<endl;


    return 0;
}