Company: Probo_4july
Difficulty: medium
Contest pair Problem Description "Code Mania" is a well-known national coding competition. Meera is in charge of choosing the two programmers who will represent the country's contingent. She wants her final pair to come from two different states, never the same one. She has been handed a list of p pairs of programmer ids, where each pair names two programmers known to share a home state. Keep in mind that state membership is transitive: if programmers 1 and 2 share a state, and programmers 1 and 5 share a state, then programmers 2 and 5 must also share that state. Given N programmer ids in total, work out how many valid pairs Meera could choose where the two programmers come from different states. Input Format The first line contains two integers N and p, the number of programmers and the number of given pairs. Each of the next p lines contains two space-separated integers, the ids of two programmers known to share a state. Output Format Print the number of valid pairs. Examples Exampl