C++ アルゴリズムとデータ構造のライブラリ
#include "library/search/binary_search/bi_lt_cnt.hpp"$O(logN)$
sort(A.begin(), A.end());
int cnt = bi_lt_cnt(A, x);
#pragma once
template <typename T> int bi_lt_cnt(vector<T> &v, const T &x) {
return lower_bound(v.begin(), v.end(), x) - v.begin();
}#line 2 "library/search/binary_search/bi_lt_cnt.hpp"
template <typename T> int bi_lt_cnt(vector<T> &v, const T &x) {
return lower_bound(v.begin(), v.end(), x) - v.begin();
}