I donot understand why my code is getting error . Please check it once

ide:-https://ide.geeksforgeeks.org/HQNRQ4ha0O
Question:- Bridges

Pls help me on this question and help me to find out error in my code

sorry i missed your doubt

your mistakes

  1. you have to clear the vector after each testcases
    otherwise the new values will mix with old one
  2. the way of taking input is wrong
    it will not store the vector of pairs
    try to print the vector for more details

i have fixed all the errors

Modified Code

But why can you please explain me what is wrong in my code

i have already tell you the mistakes