#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<int> numbers = {1, 2, 2, 2, 3, 4, 4, 5};

    int target = 3;

    // 使用 std::upper_bound() 函数在已排序的向量中查找第一个大于指定值的元素
    auto result = std::upper_bound(numbers.begin(), numbers.end(), target);

    // 输出查找结果
    if (result != numbers.end()) {
        std::cout << "First element greater than " << target << " is: " << *result << std::endl;
    } else {
        std::cout << "No element greater than " << target << " found in the vector." << std::endl;
    }

    return 0;
}
