// ── ABOUT ────────────────────────────────────────────────────────
// Max heap by default → top() always gives largest
// insert  O(log n)
// delete  O(log n)  → can only delete top()
// top     O(1)
 
// ── MAX HEAP (default) ───────────────────────────────────────────
priority_queue<int> maxpq;                  // max heap
maxpq.push(2);
maxpq.push(1);
maxpq.push(3);
maxpq.push(3);
 
cout << maxpq.top();                        // 3
pq.pop();
cout << maxpq.top();                        // 3 (duplicate)
 
// ── MIN HEAP ─────────────────────────────────────────────────────
priority_queue<int, vector<int>, greater<int>> minpq;  // min heap -> greater
minpq.push(2);
minpq.push(1);
minpq.push(3);
 
cout << pqm.top();                       // 1
 
// ── DRAIN ────────────────────────────────────────────────────────
cout << "size: " << minpq.size();          // O(1)
while (!minpq.empty()) {
    cout << minpq.top() << " ";            // 1 2 3
    minpq.pop();
}
 
// ── MIN HEAP TRICK (when you only have max heap) ──────────────────
// push negative values → negate when reading
pq.push(-arr[i]);
int val = -pq.top();
 
// ── LAMBDA COMPARATOR ────────────────────────────────────
auto cmp = [](int a, int b) {
    return a > b;   // min heap
};
 
priority_queue<int,vector<int>,decltype(cmp)> minpq(cmp);
// little complicated but try to understand -> use always reverse.
// 5 > 2 → true
// => 5 goes below 2
// => 2 reaches top
// => Min Heap
 
//    2
//   /
//  5