Easy O(nlogn) Solution || Easy to understand || Beats 99% || C++
Complexity
Time complexity:O(max(nums)∗log(max(nums)))

Space complexity:O(max(nums))
Code
# Complexity
- Time complexity:$$O(max(nums) * log(max(nums)))$$
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:$$O(max(nums))$$
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int sumOfFlooredPairs(vector<int>& nums) {
        int mx = *max_element(nums.begin(), nums.end());
        vector<int> freq(mx + 1);
        for(auto &it: nums) freq[it]++;
        for(int i=1; i<=mx; i++) freq[i] += freq[i-1];
        long long ans = 0, mod = 1e9 + 7;
        for(int it=1; it<=mx; it++){
            int occ = freq[it] - freq[it - 1];
            // let's consider each values as the denominator
            for(int j=it; j <=mx && occ; j += it){
                int el = freq[min(mx, j + it - 1)] - freq[j - 1];
                ans = (ans + 1LL * occ * (j / it) * el) % mod;
            }
        }
        return ans;
    }
};
```
['C++']