upper_bound

image.png

Returns an iterator pointing to the first element in the range [first,last) which compares greater than val. Return value An iterator to the upper bound position for val in the range. If no element in the range compares greater than val, the function returns last.

lower_bound

Returns an iterator pointing to the first element in the range [first,last) which does not compare less than val. Return value An iterator to the lower bound of val in the range. If all the element in the range compare less than val, the function returns last.

Reference

https://legacy.cplusplus.com/reference/algorithm/upper_bound/