C++ | O(Nlog(N))
\n    int sumOfFlooredPairs(vector<int>& nums) {\n        int N = 1e5 + 100, MOD = 1e9 + 7;\n\n        vector<int> frq(N, 0), preFrq(N, 0);\n\n        for (int 
```\n    int sumOfFlooredPairs(vector<int>& nums) {\n        int N = 1e5 + 100, MOD = 1e9 + 7;\n\n        vector<int> frq(N, 0), preFrq(N, 0);\n\n        for (int i : nums)\n            frq[i]++;\n\n        for (int i = 1; i < N; ++i)\n            preFrq[i] = preFrq[i - 1] + frq[i];\n\n        int ans = 0 ;\n\n        for (int i = 1; i < N; ++i)\n        {\n            if (frq[i] == 0)\n                continue;\n\n            for (int j = i; j < N; j += i)\n            {\n\n                int numOfElements = preFrq[ min(N-1, j + i - 1) ] - preFrq[ j - 1];\n                ans = ( ans ) % MOD + (numOfElements * (j / i) * frq[i] ) % MOD;\n            }\n        }\n\n        return ans % MOD;\n    }\n```\n\n
[]