Python || binary search || Memoization
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(Nlog(N))\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\no(N)\n\n# Code\n```python3 []\nclass Solution:\n    def sumOfFlooredPairs(self, nums: List[int]) -> int:\n        c = Counter(nums)\n        m = (10 ** 9) + 7\n        nums.sort()\n        l = len(nums)\n        ans = 0\n        self.memo = {}\n        for i in range(l - 1, -1, -1):\n            if nums[i] in self.memo:\n                ans = (ans + self.memo[nums[i]]) % m\n                continue\n            l = i + 1\n            j = 1\n            count = 0\n            while nums[i] * j <= nums[-1]:\n                val = (nums[i] * (j + 1)) - 1\n                r = bisect_right(nums, val) - 1\n                ln = r - l + 1\n                count = (count + (ln * j)) % m\n                l = r + 1\n                j += 1\n            self.memo[nums[i]] = count\n            ans = (ans + count) % m\n        for i in c.values():\n            ans = (ans + (i ** 2)) % m \n        return ans\n\n```
['Array', 'Math', 'Binary Search', 'Memoization', 'Python3']