So, I have encountered a strange problem while solving 1541B — Pleasent Pairs My first solution gets accepted ( Solution 1 ) , while the second one got TLE ( Solution 2).
I don't understand why this is happening. They both are almost same. Any help? Thank you.