func_code_string: #include <bits/stdc++.h>   using namespace std;   mt19937 ran(time(0));   long long mod = 1e9 + 7;   long long gcd(long long a, long long b) {     if (!b) return a;     return gcd(b, a % b);   }   long long Bpow(long long a, long long b) {     long long ans = 1;     while (b) {       if (b & 1) {         ans *= a;         ans %= mod;       }       a = a * a % mod;       b >>= 1;     }     return ans;   }   const long long MX = 1 << 19;   long long t1[2 * MX];   long long t2[2 * MX];   void upd(long long x) {     x += MX;     for (; x > 0; x >>= 1) {       t1[x]++;     }   }   void upd2(long long l, long long r, long long x) {     for (l += MX, r += MX; l <= r; l >>= 1, r >>= 1) {       if (l & 1) {         t2[l++] -= x;       }       if (~r & 1) t2[r--] -= x;     }   }   long long get1(long long l, long long r) {     long long ans = 0;     for (l += MX, r += MX; l <= r; l >>= 1, r >>= 1) {       if (l & 1) ans += t1[l++];       if (~r & 1) ans += t1[r--];     }     return ans;   }   long long get2(long long x) {     x += MX;     long long ans = 0;     while (x > 0) {       ans += t2[x];       x >>= 1;     }     return ans;   }   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     vector<long long> a(n);     for (long long i = 0; i < n; i++) {       cin >> a[i];     }     long long ans = 0;     vector<long long> h(MX + 1);     long long sum = 0;     for (long long i = 0; i < n; i++) {       ans += sum + i * a[i];       long long now = a[i];       while (now < MX) {         long long v = get1(now, MX - 1);         upd2(now + (a[i] == now), MX - 1, a[i]);         ans -= a[i] * v;         now += a[i];       }       ans += get2(a[i]);       upd(a[i]);       h[a[i]]++;       sum += a[i];       cout << ans <<    ;     }   }   