#include <stdio.h>
#include <queue>

int main() {
    priority_queue<int, vector<int>, greater<int> > pq, tmp;
    int t;

    scanf("%d", &t);

    for(int i=0; i<t; i++) {
        int n;
        scanf("%d", &n);
        for(int j=0; j<n; j++) {
            char or;
            int num;
            scanf("%c %d\n", &or, &num);
            if(or=='D') {
                if(!pq.empty()) {
                    if(num==1) pq.
                    else pq.pop();
                }
            }
        }
    }

}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: