1class Solution {2public:3vector<int> successfulPairs(vector<int> &spells, vector<int> &potions, long long success) {4vector<int> res;5int n(size(potions));6sort(begin(potions), end(potions));78for (auto &spell : spells) {9int start(0), end(n);10while (start < end) {11int mid = start + (end - start) / 2;12((long long)spell * potions[mid] >= success) ? end = mid : start = mid + 1;13}14res.push_back(n - start);15}16return res;17}18};