func_code_string: #include <bits/stdc++.h>   using namespace std;   int round_up(int i) {     while (i & (i - 1)) {       i = ((i - 1) | i) + 1;     }     return i;   }   class seg_t {    public:     vector<int> seg, ar;     int n;     seg_t(vector<int>& a) {       n = a.size();       ar = a;       int si = round_up(n);       seg.resize(si * 2);       build(0, 0, n - 1);     }     void build(int i, int l, int r) {       if (l == r) {         seg[i] = ar[l];         return;       }       int mid = (l + r) / 2;       build(i * 2 + 1, l, mid);       build(i * 2 + 2, mid + 1, r);       seg[i] = min(seg[i * 2 + 1], seg[i * 2 + 2]);     }     int q(int i, int l, int r, int lind, int rind, int val) {       if (r < lind || r > rind) {         return -1;       }       if (l == r) {         if (seg[i] >= val) return -1;         return l;       }       if (lind <= l && r <= rind) {         if (seg[i] >= val) return -1;       }       int mid = (l + r) / 2;       int t = q(i * 2 + 1, l, mid, lind, rind, val);       if (t >= 0) return t;       return q(i * 2 + 2, mid + 1, r, lind, rind, val);     }     int qq(int i, int l, int r, int lind, int rind) {       if (r < lind || r > rind) {         return 1000000000;       }       if (lind <= l && r <= rind) {         return seg[i];       }       int mid = (l + r) / 2;       return min(qq(i * 2 + 1, l, mid, lind, rind),                  qq(i * 2 + 2, mid + 1, r, lind, rind));     }   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     vector<int> a(2 * n);     for (int i = 0; i < n; i++) {       cin >> a[i];       a[i + n] = a[i];     }     seg_t t(a);     vector<int> b(2 * n);     for (int i = 0; i < n; i++) {       int tmp = t.q(0, 0, 2 * n - 1, i, n * 2 - 1, (a[i] + 1) / 2);       if (tmp == -1)         b[i] = 1000000000;       else         b[i] = tmp;       b[i + n] = b[i] + n;     }     seg_t tt(b);     for (int i = 0; i < n; i++) {       int tmp = tt.qq(0, 0, 2 * n - 1, i, n * 2 - 1);       if (tmp >= 1000000000)         cout << -1 <<    ;       else         cout << tmp - i <<    ;     }     cout << endl;     return 0;   }   