Approach hintTry it first, then revealHide
Sort the prices once; for each day the answer is the number of prices not exceeding the budget, which upper_bound returns in O(log n).
Sort the prices once; for each day the answer is the number of prices not exceeding the budget, which upper_bound returns in O(log n).