So, I was doing this this problem and noticed the drastic difference between std::pair and std::vector in C++. I preferred to use std::vector over pairs as I don't have to write .first and .second every time.
Submission using std::vector (GETS TLE) View
Submission using std::pair (GETS AC easily) View
What could be the reason behind it?