#include <iostream>
#include <queue>
#include <string>
using namespace std;
const int NO_X = 2e9 ;
const string REMOVE = "removeMin" ;
const string GET = "getMin" ;
const string INSERT = "insert" ;
int main( ) {
ios_base:: sync_with_stdio ( false ) ;
cin .tie ( 0 ) ;
int n;
cin >> n;
vector< pair< string, int > > ans;
priority_queue< int > q;
for ( int i = 0 ; i < n; i++ ) {
string s;
cin >> s;
if ( s == INSERT) {
int x;
cin >> x;
q.push ( - x) ;
ans.push_back ( make_pair( s, x) ) ;
} else if ( s == GET) {
int x;
cin >> x;
while ( ! q.empty ( ) && - q.top ( ) < x) {
q.pop ( ) ;
ans.push_back ( make_pair( REMOVE, NO_X) ) ;
}
if ( q.empty ( ) || - q.top ( ) > x) {
q.push ( - x) ;
ans.push_back ( make_pair( INSERT, x) ) ;
}
ans.push_back ( make_pair( s, x) ) ;
} else { // s == REMOVE
if ( q.empty ( ) ) {
ans.push_back ( make_pair( INSERT, 0 ) ) ;
} else {
q.pop ( ) ;
}
ans.push_back ( make_pair( s, NO_X) ) ;
}
}
cout << ans.size ( ) << "\n " ;
for ( auto & p : ans) {
cout << p.first ;
if ( p.second ! = NO_X) {
cout << " " << p.second ;
}
cout << "\n " ;
}
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8cXVldWU+CiNpbmNsdWRlIDxzdHJpbmc+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE5PX1ggPSAyZTk7Cgpjb25zdCBzdHJpbmcgUkVNT1ZFID0gInJlbW92ZU1pbiI7CmNvbnN0IHN0cmluZyBHRVQgPSAiZ2V0TWluIjsKY29uc3Qgc3RyaW5nIElOU0VSVCA9ICJpbnNlcnQiOwoKaW50IG1haW4oKSB7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTsKICAgIGNpbi50aWUoMCk7CgogICAgaW50IG47CiAgICBjaW4gPj4gbjsKCiAgICB2ZWN0b3I8cGFpcjxzdHJpbmcsIGludD4gPiBhbnM7CiAgICBwcmlvcml0eV9xdWV1ZTxpbnQ+IHE7CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICBzdHJpbmcgczsKICAgICAgICBjaW4gPj4gczsKICAgICAgICBpZiAocyA9PSBJTlNFUlQpIHsKICAgICAgICAgICAgaW50IHg7CiAgICAgICAgICAgIGNpbiA+PiB4OwogICAgICAgICAgICBxLnB1c2goLXgpOwogICAgICAgICAgICBhbnMucHVzaF9iYWNrKG1ha2VfcGFpcihzLCB4KSk7CiAgICAgICAgfSBlbHNlIGlmIChzID09IEdFVCkgewogICAgICAgICAgICBpbnQgeDsKICAgICAgICAgICAgY2luID4+IHg7CiAgICAgICAgICAgIHdoaWxlICghcS5lbXB0eSgpICYmIC1xLnRvcCgpIDwgeCkgewogICAgICAgICAgICAgICAgcS5wb3AoKTsKICAgICAgICAgICAgICAgIGFucy5wdXNoX2JhY2sobWFrZV9wYWlyKFJFTU9WRSwgTk9fWCkpOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGlmIChxLmVtcHR5KCkgfHwgLXEudG9wKCkgPiB4KSB7CiAgICAgICAgICAgICAgICBxLnB1c2goLXgpOwogICAgICAgICAgICAgICAgYW5zLnB1c2hfYmFjayhtYWtlX3BhaXIoSU5TRVJULCB4KSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgYW5zLnB1c2hfYmFjayhtYWtlX3BhaXIocywgeCkpOwogICAgICAgIH0gZWxzZSB7IC8vIHMgPT0gUkVNT1ZFCiAgICAgICAgICAgIGlmIChxLmVtcHR5KCkpIHsKICAgICAgICAgICAgICAgIGFucy5wdXNoX2JhY2sobWFrZV9wYWlyKElOU0VSVCwgMCkpOwogICAgICAgICAgICB9IGVsc2UgewogICAgICAgICAgICAgICAgcS5wb3AoKTsKICAgICAgICAgICAgfQogICAgICAgICAgICBhbnMucHVzaF9iYWNrKG1ha2VfcGFpcihzLCBOT19YKSk7CiAgICAgICAgfQogICAgfQoKICAgIGNvdXQgPDwgYW5zLnNpemUoKSA8PCAiXG4iOwogICAgZm9yIChhdXRvJiBwIDogYW5zKSB7CiAgICAgICAgY291dCA8PCBwLmZpcnN0OwogICAgICAgIGlmIChwLnNlY29uZCAhPSBOT19YKSB7CiAgICAgICAgICAgIGNvdXQgPDwgIiAiIDw8IHAuc2Vjb25kOwogICAgICAgIH0KICAgICAgICBjb3V0IDw8ICJcbiI7CiAgICB9CgoKICAgIHJldHVybiAwOwp9
compilation info
prog.cpp: In function 'int main()':
prog.cpp:54:16: error: ISO C++ forbids declaration of 'p' with no type [-fpermissive]
for (auto& p : ans) {
^
prog.cpp:54:20: warning: range-based 'for' loops only available with -std=c++11 or -std=gnu++11
for (auto& p : ans) {
^
prog.cpp:55:19: error: request for member 'first' in 'p', which is of non-class type 'int'
cout << p.first;
^
prog.cpp:56:15: error: request for member 'second' in 'p', which is of non-class type 'int'
if (p.second != NO_X) {
^
prog.cpp:57:30: error: request for member 'second' in 'p', which is of non-class type 'int'
cout << " " << p.second;
^
stdout