#include <iostream>
#include <queue>
using namespace std;
int main() {
// Create a priority queue of integers
priority_queue<int> pq;
// Add elements to the priority queue
pq.push(10);
pq.push(20);
pq.push(30);
pq.push(40);
// Print the top element of the priority queue
cout << "Top element: " << pq.top() << endl;
// Remove the top element from the priority queue
pq.pop();
// Print the top element of the priority queue again
cout << "Top element after pop: " << pq.top() << endl;
// Check if the priority queue is empty
if (pq.empty()) {
cout << "Priority queue is empty" << endl;
} else {
cout << "Priority queue is not empty" << endl;
}
// Print the size of the priority queue
cout << "Size of priority queue: " << pq.size() << endl;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAgCiNpbmNsdWRlIDxxdWV1ZT4gIAogIAp1c2luZyBuYW1lc3BhY2Ugc3RkOyAgCiAgCmludCBtYWluKCkgeyAgCiAgICAvLyBDcmVhdGUgYSBwcmlvcml0eSBxdWV1ZSBvZiBpbnRlZ2VycyAgCiAgICBwcmlvcml0eV9xdWV1ZTxpbnQ+IHBxOyAgCiAgCiAgICAvLyBBZGQgZWxlbWVudHMgdG8gdGhlIHByaW9yaXR5IHF1ZXVlICAKICAgIHBxLnB1c2goMTApOyAgCiAgICBwcS5wdXNoKDIwKTsgIAogICAgcHEucHVzaCgzMCk7ICAKICAgIHBxLnB1c2goNDApOyAgCiAgCiAgICAvLyBQcmludCB0aGUgdG9wIGVsZW1lbnQgb2YgdGhlIHByaW9yaXR5IHF1ZXVlICAKICAgIGNvdXQgPDwgIlRvcCBlbGVtZW50OiAiIDw8IHBxLnRvcCgpIDw8IGVuZGw7ICAKICAKICAgIC8vIFJlbW92ZSB0aGUgdG9wIGVsZW1lbnQgZnJvbSB0aGUgcHJpb3JpdHkgcXVldWUgIAogICAgcHEucG9wKCk7ICAKICAKICAgIC8vIFByaW50IHRoZSB0b3AgZWxlbWVudCBvZiB0aGUgcHJpb3JpdHkgcXVldWUgYWdhaW4gIAogICAgY291dCA8PCAiVG9wIGVsZW1lbnQgYWZ0ZXIgcG9wOiAiIDw8IHBxLnRvc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