func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mxn = 3e5 + 5;   const long long MOD = 1e9 + 7;   const int BASE = 100000000;   const int INF = 1e9 + 8;   long long g[mxn], cnt[mxn], a[mxn];   void up_g(int x, const long long &val) {     while (x < mxn) {       g[x] += val;       x += x & (-x);     }   }   void update_g(int l, int r, const long long &val) {     up_g(l, val);     up_g(r + 1, -val);   }   long long get_g(int x) {     long long res = 0;     while (x) {       res += g[x];       x -= x & (-x);     }     return res;   }   void update_cnt(int x) {     while (x < mxn) {       cnt[x] += 1LL;       x += x & (-x);     }   }   long long get(int x) {     long long res = 0;     while (x) {       res += cnt[x];       x -= x & (-x);     }     return res;   }   long long get_cnt(int l, int r) { return (get(r) - get(l - 1)); }   signed main() {     int n;     cin >> n;     for (int i = (1); i <= (n); ++i) cin >> a[i];     long long cur = 0, sum = 0;     for (int i = (1); i <= (n); ++i) {       cur += (long long)(i - 1) * a[i] - get_g(a[i]);       cur += sum;       int x = (int)(a[i]);       while (x < mxn) {         long long k = min(x + (int)(a[i]) - 1, (int)(mxn - 5));         cur -= (long long)(x)*get_cnt(x, k);         update_g(x, k, x);         x += a[i];       }       update_cnt(a[i]);       sum += a[i];       cout << cur <<    ;     }   }   