C++ ON2 solution Using Frequency Array
\nclass Solution {\npublic:\n    int sumOfFlooredPairs(vector<int>& nums) {\n        int A[200005]={0};\n\t    int M[200005]={0};\n        int N = *max_element(
```\nclass Solution {\npublic:\n    int sumOfFlooredPairs(vector<int>& nums) {\n        int A[200005]={0};\n\t    int M[200005]={0};\n        int N = *max_element(nums.begin(), nums.end())*2+1;\n        \n        for(int i=0;i<nums.size();i++)\n            A[nums[i]]++;\n        \n        for(int i=1;i<N;i++)\n\t\t    M[i]=M[i-1]+A[i];\n        \n        long long ans = 0;\n        for(int i=1;i<N;i++){\n            if(A[i]!=0)\n            for(int j=2*i;j<N;j+=i)\n                ans += (M[j-1] - M[j-i-1]) * 1LL * (j / i - 1) * A[i];\n        }\n        \n        return ans%1000000007;\n    }\n};\n```\n\nThe Time Complexity is On2 and The Space Complexity is On
['C', 'Counting']