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
#include<bits/stdc++.h>
using namespace std;
 
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define ST first
#define ND second
 
ostream& operator<<(ostream &out, string str) {
	for(char c : str) out << c;
	return out;
}
 
template<class L, class R> ostream& operator<<(ostream &out, pair<L, R> p) {
	return out << "(" << p.ST << ", " << p.ND << ")";
}

template<class T> auto operator<<(ostream &out, T &&x) -> decltype(x.begin(), out) {
	out << '{';
	for(auto &e : x)
        	out << e << (&e == &*--x.end() ? "" : ", ");
	return out << '}';
}

template<class... Args> void dump(Args&&... args) {
	((cerr << args << ";  "), ...);
}
 
#ifdef DEBUG
#  define debug(x...) cerr << "[" #x "]: ", dump(x), cerr << "\n"
#else
#  define debug(...) false
#endif
 
template<class T> int size(T && a) { return (int) a.size(); }
 
using LL = long long;
using PII = pair<int, int>;

struct BiconComps {
	using PII = pair<int, int>;
	vector<vector<int>> graph;
	vector<int> low, pre, s;
	vector<array<int, 2>> edges;
	BiconComps(int n) : graph(n), low(n), pre(n, -1) {}
	void add_edge(int u, int v) {
		int q = size(edges);
		graph[u].emplace_back(q);
		graph[v].emplace_back(q);
		edges.push_back({u, v});
	}
	int get(int v, int id) {
		return v ^ edges[id][0] ^ edges[id][1];
	}
	int t = 0;
	void dfs(int v, int p) {
		low[v] = pre[v] = t++;
		bool par = false;
		for(int e : graph[v]) {
			int u = get(v, e);
			if(u == p && !par) {
				par = true;
				continue;
			}
			else if(pre[u] == -1) {
				dfs(u, v);
				low[v] = min(low[v], low[u]);
			}
			else if(pre[v] > pre[u])
				low[v] = min(low[v], pre[u]);
		}
	}
	void init() { dfs(0, -1); }
};

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

	int n, m;
	cin >> n >> m;
	vector<PII> edges(m);
	REP(i, m) {
		int a, b;
		cin >> a >> b;
		edges[i] = {a - 1, b - 1};
	}

	int ans = 0;
	REP(i, m) REP(j, i) {
		BiconComps b(n);
		REP(k, m) if(k != i && k != j)
			b.add_edge(edges[k].ST, edges[k].ND);
		b.init();
		bool connected = true;
		REP(k, n) 
			if(b.pre[k] == -1)
				connected = false;
		if(!connected)
			ans += m - 2;
		else {
			FOR(k, 1, n - 1) 
				ans += b.low[k] == b.pre[k];
		}
	}

	cout << ans / 3 << "\n";
}