Problem in upper_bound c++ stl

you should login to see that code.

anyway here is the code

Exactly! The complete code gives a full picture. Without it, there is always an uncertainity of " are we even looking in right direction?"

Hackerrank solutions are usually private…

can’t post the entire code as it is from ongoing contest.
btw it was because of garbage value and not problem of upper_bound.