C++ Solution
Approach\n Describe your approach to solving the problem. \n    Binary Search\n\n# Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \n 
# Approach\n<!-- Describe your approach to solving the problem. -->\n    Binary Search\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(N * log M)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(N)\n\n# Code\n```\nclass Solution {\npublic:\n    vector<int> successfulPairs(vector<int>& spells, vector<int>& potions, long long success) {\n        int n = potions.size();\n        sort(potions.begin(), potions.end());\n        vector<int> ans;\n        for(auto x: spells) {\n            int l = 0, r = n - 1;\n            while(l <= r) {\n                int mid = (l + r) / 2;\n                if(1ll * potions[mid] * x < success) l = mid + 1;\n                else r = mid - 1;\n            }\n            ans.push_back(n - l);\n        }\n        return ans;\n    }\n};\n```
['C++']