func_code_string: #include <bits/stdc++.h>   using namespace std;   long long A[200005], tree[200005];   void update(int pos, long long v) {     for (; pos < 200005; pos += pos & -pos) tree[pos] += v;   }   long long read(int pos) {     long long ret = 0;     for (; pos; pos -= pos & -pos) ret += tree[pos];     return ret;   }   int main() {     ios::sync_with_stdio(false);     cout.setf(ios::fixed);     cout.precision(10);     int i, size = 1, t, n, lo, hi;     long long x, sum = 0, a;     cin >> n;     for (i = 1; i <= n; i++) {       cin >> t;       if (t == 1) {         cin >> a >> x;         lo = 1, hi = min((long long)size, a);         update(lo, x);         update(hi + 1, -x);         sum += hi * x;       } else {         if (t == 2) {           cin >> x;           update(size + 1, x);           update(size + 2, -x);           size++;           sum += x;         } else {           if (size >= 2) {             long long val = read(size);             update(size, -val);             update(size + 1, val);             size--;             sum -= val;           }         }       }       cout << (sum * 1.0 / size) << endl;     }     return 0;   }   