Sets and maps provide lower_bound(x) and upper_bound(x) as member functions. They return iterators for range queries using the internal tree structure. Use s.lower_bound(5) to find the first element not less than 5, meaning 5 or greater.
Use s.upper_bound(5) to find the first element strictly greater than 5. These member functions are faster than the algorithm versions because they use the tree directly. Always prefer the member functions for sets and maps rather than the std::algorithm versions.