~/algor $ cat problems/graf-kopriklar
Number of bridges
Hard
2000 ms
128 MB
67%
$n$ islands and $m$ two-way bridges between them are given. A bridge is called important if, once it is destroyed, some two islands that could reach each other before are no longer connected. How many important bridges are there?
Input
The first line contains two integers: $n$ and $m$. Each of the next $m$ lines contains two positive integers: $u$ and $v$ — the islands joined by a bridge.
Output
One integer — the number of important bridges.
Note
$1 \le n \le 5 * 10^{4}$
$0 \le m \le 10^{5}$
$1 \le u, v \le n$, $u \ne v$
There is at most one bridge between any pair of islands. The graph may be disconnected.
Examples
Input #1
7 8 1 2 2 3 3 1 3 4 4 5 5 6 6 4 6 7
Output #1
2
Input #2
4 0
Output #2
0