AlgoUniversity
  • Go Back
Discussion
Special Edge :

Author

Yash Sahijwani

Difficulty Level : Medium

Submissions : 828

Asked In : Hilabs

Marks :50

: 23 | : 0

You are given a connected undirected graph having $$$N$$$ nodes numbered from $$$1$$$ to $$$N$$$ and $$$M$$$ edges between its nodes. It is guaranteed that the input graph is connected and consists of no self loops and no multiple edges between two vertices. Edges are given in the form of $$$u, v$$$.

An edge is special if, when removed, the number of connected components in the graph increases.

Determine the number of unordered pairs of nodes $$$(u, v)$$$ such that each and every simple path (path with no edges repeated) between node $$$u$$$ and node $$$v$$$ consists of exactly 1 special edge.

Input

The first line of input consists of 2 space separated integers $$$-$$$ $$$n$$$ and $$$m$$$ $$$(1 \leq n, m \leq 2$$$ x $$$10^5)$$$ where $$$n$$$ is the total number of nodes and $$$m$$$ is the number of edges in the graph. Then, each of the next $$$m$$$ lines consists of 2 space separated integers $$$-$$$ $$$u$$$ and $$$v$$$, which denotes that there is an edge between the nodes $$$u$$$ and $$$v$$$.

Output

The output should consist of a single integer $$$-$$$ the total number of such pairs.

Examples

Input
4 4
1 2
2 3
3 4
2 4
Output
3
Input
8 8
1 2
2 3
3 4
4 1
1 5
2 6
3 7
4 8
Output
16

Note

$$$m \geq n-1$$$

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.