Python 3 best N log(N) solution with 98.78% beats.
Intuition\n Describe your first thoughts on how to solve this problem. \nThink about frequencies and multiples!\n\n# Approach\n Describe your approach to solvin
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nThink about frequencies and multiples!\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nFrequencies and multiples.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nN log(N)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(N)\n# Code\n```\nclass Solution:\n    \n    MOD = 10**9 + 7\n   \n    def sumOfFlooredPairs(self, nums):\n        # Initialize an array to keep track of count for each number\n        N = max(nums)\n        count = [0] * (N + 1)\n       \n        # Count occurrences of each number in the input list\n        for num in nums:\n            count[num] += 1\n           \n        # Calculate cumulative count for each number\n        for i in range(1, N + 1):\n            count[i] += count[i - 1]\n       \n        ans = 0\n        for i in range(1, N + 1):\n            if count[i] - count[i - 1] > 0:\n                sum_val = 0\n                # Iterate over multiples of i (i * j) up to N\n                for j in range(1, (N // i) + 1):\n                    low = i * j\n                    high = min(i * (j + 1) - 1, N)\n                   \n                    # Calculate the count of numbers in the range [low, high]\n                    cnt = count[high] - count[low - 1]\n                    \n                   \n                    # Update the sum_val\n                    sum_val = (sum_val + (cnt * j) % self.MOD) % self.MOD\n               \n                # Calculate the contribution of the current number\n                curr = count[i] - count[i - 1]\n                \n                ans = (ans + (curr * sum_val) % self.MOD) % self.MOD\n       \n        return ans\n\n\n```
['Python3']