// File: vividvilla[P]hackerrank/src/median.cpp
// Function: outputMedians(std::vector<char, std::allocator<char>>, std::vector<long long, std::allocator<long long>>)
void outputMedians(vector<char> ops, vector<long long> ints) {
    int N = ops.size();

    multiset<long long> left;
    multiset<long long> right;

    for (int i = 0; i < N; i++) {
        bool valid = true;

        if (ops[i] == 'r') {
            multiset<long long>::iterator li = left.find(ints[i]);
            multiset<long long>::iterator ri = right.find(ints[i]);
            if (li != left.end())
                left.erase(li);
            else if (ri != right.end())
                right.erase(ri);
            else
                valid = false;
        } else if (ops[i] == 'a') {
            if (left.size() == 0 || ints[i] < *left.rbegin())
                left.insert(ints[i]);
            else
                right.insert(ints[i]);
        }

        if (left.size() > right.size() + 1) {
            right.insert(*left.rbegin());
            left.erase(left.find(*left.rbegin()));
        } else if (right.size() > left.size()) {
            left.insert(*right.begin());
            right.erase(right.find(*right.begin()));
        }

        if (valid && left.size() + right.size() > 0) {
            if (left.size() > right.size())
                cout << *left.rbegin() << endl;
            else {
                long long m = *left.rbegin() + *right.begin();
                if (m % 2)
                    printf("%.1lf\n", m / 2.);
                else
                    printf("%.0lf\n", m / 2.);
            }
        } else {
            cout << "Wrong!" << endl;
        }
    }
}

// Assembly:
subq $0x268, %rsp            # imm = 0x268
movq %rdi, 0x100(%rsp)
movq %rsi, 0x108(%rsp)
movq %rdi, 0x260(%rsp)
movq %rsi, 0x258(%rsp)
callq 0x1c60
movl %eax, 0x254(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x1c80
leaq 0x1f0(%rsp), %rdi
callq 0x1c80
movl $0x0, 0x1ec(%rsp)
movl 0x1ec(%rsp), %eax
cmpl 0x254(%rsp), %eax
jge 0x1a97
movq 0x100(%rsp), %rdi
movb $0x1, 0x1eb(%rsp)
movslq 0x1ec(%rsp), %rsi
callq 0x1c90
movsbl (%rax), %eax
cmpl $0x72, %eax
jne 0x155a
movq 0x108(%rsp), %rdi
movslq 0x1ec(%rsp), %rsi
callq 0x1cf0
movq %rax, %rsi
leaq 0x220(%rsp), %rdi
callq 0x1cb0
movq %rax, 0xf8(%rsp)
jmp 0x13e4
movq 0x108(%rsp), %rdi
movq 0xf8(%rsp), %rax
movq %rax, 0x1e0(%rsp)
movslq 0x1ec(%rsp), %rsi
callq 0x1cf0
movq %rax, %rsi
leaq 0x1f0(%rsp), %rdi
callq 0x1cb0
movq %rax, 0xf0(%rsp)
jmp 0x1423
movq 0xf0(%rsp), %rax
movq %rax, 0x1c8(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x1d30
movq %rax, 0x1c0(%rsp)
leaq 0x1e0(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x1d10
testb $0x1, %al
jne 0x1463
jmp 0x14da
movq 0x1e0(%rsp), %rax
movq %rax, 0x1b8(%rsp)
movq 0x1b8(%rsp), %rsi
leaq 0x220(%rsp), %rdi
callq 0x1d60
movq %rax, 0xe8(%rsp)
jmp 0x1492
movq 0xe8(%rsp), %rax
movq %rax, 0x1b0(%rsp)
jmp 0x1555
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1d8(%rsp)
movl %eax, 0x1d4(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x1eb0
leaq 0x220(%rsp), %rdi
callq 0x1eb0
jmp 0x1ab9
leaq 0x1f0(%rsp), %rdi
callq 0x1d30
movq %rax, 0x1a8(%rsp)
leaq 0x1c8(%rsp), %rdi
leaq 0x1a8(%rsp), %rsi
callq 0x1d10
testb $0x1, %al
jne 0x150a
jmp 0x154b
movq 0x1c8(%rsp), %rax
movq %rax, 0x1a0(%rsp)
movq 0x1a0(%rsp), %rsi
leaq 0x1f0(%rsp), %rdi
callq 0x1d60
movq %rax, 0xe0(%rsp)
jmp 0x1539
movq 0xe0(%rsp), %rax
movq %rax, 0x198(%rsp)
jmp 0x1553
movb $0x0, 0x1eb(%rsp)
jmp 0x1555
jmp 0x169c
movq 0x100(%rsp), %rdi
movslq 0x1ec(%rsp), %rsi
callq 0x1c90
movsbl (%rax), %eax
cmpl $0x61, %eax
jne 0x169a
leaq 0x220(%rsp), %rdi
callq 0x1db0
movq %rax, %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, 0xdf(%rsp)
je 0x160b
movq 0x108(%rsp), %rdi
movslq 0x1ec(%rsp), %rsi
callq 0x1cf0
movq (%rax), %rax
movq %rax, 0xc0(%rsp)
leaq 0x190(%rsp), %rdi
movq %rdi, 0xc8(%rsp)
leaq 0x220(%rsp), %rsi
callq 0x1dc0
movq 0xc8(%rsp), %rdi
callq 0x1df0
movq %rax, 0xd0(%rsp)
jmp 0x15ee
movq 0xc0(%rsp), %rax
movq 0xd0(%rsp), %rcx
cmpq (%rcx), %rax
setl %al
movb %al, 0xdf(%rsp)
movb 0xdf(%rsp), %al
testb $0x1, %al
jne 0x1618
jmp 0x1659
movq 0x108(%rsp), %rdi
movslq 0x1ec(%rsp), %rsi
callq 0x1cf0
movq %rax, %rsi
leaq 0x220(%rsp), %rdi
callq 0x1e20
movq %rax, 0xb8(%rsp)
jmp 0x1647
movq 0xb8(%rsp), %rax
movq %rax, 0x188(%rsp)
jmp 0x1698
movq 0x108(%rsp), %rdi
movslq 0x1ec(%rsp), %rsi
callq 0x1cf0
movq %rax, %rsi
leaq 0x1f0(%rsp), %rdi
callq 0x1e20
movq %rax, 0xb0(%rsp)
jmp 0x1688
movq 0xb0(%rsp), %rax
movq %rax, 0x180(%rsp)
jmp 0x169a
jmp 0x169c
leaq 0x220(%rsp), %rdi
callq 0x1db0
movq %rax, 0xa8(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x1db0
movq %rax, %rcx
movq 0xa8(%rsp), %rax
addq $0x1, %rcx
cmpq %rcx, %rax
jbe 0x17c4
leaq 0x178(%rsp), %rdi
movq %rdi, 0x98(%rsp)
leaq 0x220(%rsp), %rsi
callq 0x1dc0
movq 0x98(%rsp), %rdi
callq 0x1df0
movq %rax, 0xa0(%rsp)
jmp 0x170a
movq 0xa0(%rsp), %rsi
leaq 0x1f0(%rsp), %rdi
callq 0x1e20
movq %rax, 0x90(%rsp)
jmp 0x1729
movq 0x90(%rsp), %rax
movq %rax, 0x170(%rsp)
leaq 0x160(%rsp), %rdi
movq %rdi, 0x80(%rsp)
leaq 0x220(%rsp), %rsi
callq 0x1dc0
movq 0x80(%rsp), %rdi
callq 0x1df0
movq %rax, 0x88(%rsp)
jmp 0x176d
movq 0x88(%rsp), %rsi
leaq 0x220(%rsp), %rdi
callq 0x1cb0
movq %rax, 0x78(%rsp)
jmp 0x1789
movq 0x78(%rsp), %rax
movq %rax, 0x168(%rsp)
movq 0x168(%rsp), %rsi
leaq 0x220(%rsp), %rdi
callq 0x1d60
movq %rax, 0x70(%rsp)
jmp 0x17b2
movq 0x70(%rsp), %rax
movq %rax, 0x158(%rsp)
jmp 0x18ad
leaq 0x1f0(%rsp), %rdi
callq 0x1db0
movq %rax, 0x68(%rsp)
leaq 0x220(%rsp), %rdi
callq 0x1db0
movq %rax, %rcx
movq 0x68(%rsp), %rax
cmpq %rcx, %rax
jbe 0x18ab
leaq 0x1f0(%rsp), %rdi
callq 0x1e60
movq %rax, 0x150(%rsp)
leaq 0x150(%rsp), %rdi
callq 0x1e90
movq %rax, %rsi
leaq 0x220(%rsp), %rdi
callq 0x1e20
movq %rax, 0x60(%rsp)
jmp 0x182d
movq 0x60(%rsp), %rax
movq %rax, 0x148(%rsp)
leaq 0x1f0(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x1e60
movq %rax, 0x138(%rsp)
leaq 0x138(%rsp), %rdi
callq 0x1e90
movq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0x1cb0
movq %rax, 0x58(%rsp)
jmp 0x1875
movq 0x58(%rsp), %rax
movq %rax, 0x140(%rsp)
movq 0x140(%rsp), %rsi
leaq 0x1f0(%rsp), %rdi
callq 0x1d60
movq %rax, 0x48(%rsp)
jmp 0x189e
movq 0x48(%rsp), %rax
movq %rax, 0x130(%rsp)
jmp 0x18ad
testb $0x1, 0x1eb(%rsp)
je 0x1a52
leaq 0x220(%rsp), %rdi
callq 0x1db0
movq %rax, 0x40(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x1db0
movq %rax, %rcx
movq 0x40(%rsp), %rax
addq %rcx, %rax
cmpq $0x0, %rax
jbe 0x1a52
leaq 0x220(%rsp), %rdi
callq 0x1db0
movq %rax, 0x38(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x1db0
movq %rax, %rcx
movq 0x38(%rsp), %rax
cmpq %rcx, %rax
jbe 0x1979
leaq 0x128(%rsp), %rdi
movq %rdi, 0x28(%rsp)
leaq 0x220(%rsp), %rsi
callq 0x1dc0
movq 0x28(%rsp), %rdi
callq 0x1df0
movq %rax, 0x30(%rsp)
jmp 0x1946
movq 0x30(%rsp), %rax
movq (%rax), %rsi
movq 0x667b(%rip), %rdi      # 0x7fd0
callq 0x10a0
movq %rax, 0x20(%rsp)
jmp 0x1961
movq 0x20(%rsp), %rdi
movq 0x6653(%rip), %rsi      # 0x7fc0
callq 0x1140
jmp 0x1974
jmp 0x1a50
leaq 0x118(%rsp), %rdi
movq %rdi, 0x10(%rsp)
leaq 0x220(%rsp), %rsi
callq 0x1dc0
movq 0x10(%rsp), %rdi
callq 0x1df0
movq %rax, 0x18(%rsp)
jmp 0x19a4
movq 0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
leaq 0x1f0(%rsp), %rdi
callq 0x1e60
movq %rax, 0x110(%rsp)
leaq 0x110(%rsp), %rdi
callq 0x1e90
movq %rax, %rcx
movq 0x8(%rsp), %rax
addq (%rcx), %rax
movq %rax, 0x120(%rsp)
movq 0x120(%rsp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
cmpq $0x0, %rdx
je 0x1a26
cvtsi2sdq 0x120(%rsp), %xmm0
movsd 0x35f8(%rip), %xmm1     # 0x5008
mulsd %xmm1, %xmm0
leaq 0x35f5(%rip), %rdi      # 0x5010
movb $0x1, %al
callq 0x1030
jmp 0x1a24
jmp 0x1a4e
cvtsi2sdq 0x120(%rsp), %xmm0
movsd 0x35d0(%rip), %xmm1     # 0x5008
mulsd %xmm1, %xmm0
leaq 0x35d4(%rip), %rdi      # 0x5017
movb $0x1, %al
callq 0x1030
jmp 0x1a4c
jmp 0x1a4e
jmp 0x1a50
jmp 0x1a7f
movq 0x6577(%rip), %rdi      # 0x7fd0
leaq 0x35be(%rip), %rsi      # 0x501e
callq 0x1110
movq %rax, (%rsp)
jmp 0x1a6b
movq (%rsp), %rdi
movq 0x654a(%rip), %rsi      # 0x7fc0
callq 0x1140
jmp 0x1a7d
jmp 0x1a7f
jmp 0x1a81
movl 0x1ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1ec(%rsp)
jmp 0x1378
leaq 0x1f0(%rsp), %rdi
callq 0x1eb0
leaq 0x220(%rsp), %rdi
callq 0x1eb0
addq $0x268, %rsp            # imm = 0x268
retq
movq 0x1d8(%rsp), %rdi
callq 0x11d0
nopw %cs:(%rax,%rax)