I was solving CSES problem-set problem called Concert Ticket under the heading Searching and Sorting. Link to the problem : https://cses.fi/problemset/task/1091/ In this the array of price of ticket was to be stored in a multiset and for each price we needed to find the upper bound of the element in the multiset of ticket. I first used upper_bound(ticket.begin(),ticket.end(),price[i]) but it gave tle on some testcases.
Then I changed it to**ticket.upper_bound(price[i])** it was able to pass all the test case.
If somebody knows the reason kindly tell.
Hope it helps..