#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
void dbg_out() { cerr << "\b\b]\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T){ cerr << H << ", "; dbg_out(T...);}
#define watch(...) cerr << "[" << #__VA_ARGS__ << "]: [", dbg_out(__VA_ARGS__)
/****************************** CODE IS HERE ***********************************/
struct cmp {
bool operator()(int a, int b){
return a > b;
}
};
struct my{
struct comparator{
bool operator()(int a, int b){
return (a > b);
}
};
bool (*f)(int,int) = [](int a, int b){ return (a < b);}; //I guess, auto does not support in class as return type
void go(){
vector <int> v = {4, 3, 2, 10, 1, -1, 0, 20};
sort(all(v), comparator());
for (int i: v)
cout << i << ' ';
cout << endl;
sort(all(v), f);
for(int i: v)
cout << i << ' ';
cout << endl;
}
}OBJ;
int main(){
ios_base::sync_with_stdio(false); cin.tie(nullptr);
priority_queue<int, vector<int>, cmp> pq;
pq.push(20);
pq.push(10);
pq.push(30);
pq.push(40);
pq.push(0);
while(!pq.empty()){
cout << pq.top() << ' ';
pq.pop();
}
cout << endl;
OBJ.go();
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBsbCBsb25nIGxvbmcKI2RlZmluZSBlbmRsICdcbicKI2RlZmluZSBzeih2KSAoaW50KXYuc2l6ZSgpIAojZGVmaW5lIGFsbCh2KSB2LmJlZ2luKCksIHYuZW5kKCkKdm9pZCBkYmdfb3V0KCkgeyBjZXJyIDw8ICJcYlxiXVxuIjsgfQp0ZW1wbGF0ZTx0eXBlbmFtZSBIZWFkLCB0eXBlbmFtZS4uLiBUYWlsPiB2b2lkIGRiZ19vdXQoSGVhZCBILCBUYWlsLi4uIFQpeyBjZXJyIDw8IEggPDwgIiwgIjsgZGJnX291dChULi4uKTt9CiNkZWZpbmUgd2F0Y2goLi4uKSBjZXJyIDw8ICJbIiA8PCAjX19WQV9BUkdTX18gPDwgIl06IFsiLCBkYmdfb3V0KF9fVkFfQVJHU19fKQoKCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKiogQ09ERSBJUyBIRVJFICoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwoKc3RydWN0IGNtcCB7CiAgYm9vbCBvcGVyYXRvcigpKGludCBhLCBpbnQgYil7CiAgICByZXR1cm4gYSA+IGI7CiAgfQp9OwoKc3RydWN0IG15ewogIHN0cnVjdCBjb21wYXJhdG9yewogICAgYm9vbCBvcGVyYXRvcigpKGludCBhLCBpbnQgYil7CiAgICAgIHJldHVybiAoYSA+IGIpOwogICAgfQogIH07Cgpib29sICgqZikoaW50LGludCkgPSBbXShpbnQgYSwgaW50IGIpeyByZXR1cm4gKGEgPCBiKTt9OyAgLy9JIGd1ZXNzLCBhdXRvIGRvZXMgbm90IHN1cHBvcnQgaW4gY2xhc3MgYXMgcmV0dXJuIHR5cGUKCiAgdm9pZCBnbygpewogICAgdmVjdG9yIDxpbnQ+IHYgPSB7NCwgMywgMiwgMTAsIDEsIC0xLCAwLCAyMH07CiAgICBzb3J0KGFsbCh2KSwgY29tcGFyYXRvcigpKTsKICAgIGZvciAoaW50IGk6IHYpCiAgICAgIGNvdXQgPDwgaSA8PCAnICc7CiAgICBjb3V0IDw8IGVuZGw7CiAgICAKICAgIHNvcnQoYWxsKHYpLCBmKTsKICAgIGZvcihpbnQgaTogdikKICAgICAgY291dCA8PCBpIDw8ICcgJzsKICAgIGNvdXQgPDwgZW5kbDsKICB9Cgp9T0JKOwoKaW50IG1haW4oKXsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOyBjaW4udGllKG51bGxwdHIpOwogICAgcHJpb3JpdHlfcXVldWU8aW50LCB2ZWN0b3I8aW50PiwgY21wPiBwcTsKICAgIHBxLnB1c2goMjApOwogICAgcHEucHVzaCgxMCk7CiAgICBwcS5wdXNoKDMwKTsKICAgIHBxLnB1c2goNDApOwogICAgcHEucHVzaCgwKTsKICAgIHdoaWxlKCFwcS5lbXB0eSgpKXsKICAgICAgY291dCA8PCBwcS50b3AoKSA8PCAnICc7CiAgICAgIHBxLnBvcCgpOwogICAgfQogICAgY291dCA8PCBlbmRsOwogICAgT0JKLmdvKCk7CiAgcmV0dXJuIDA7Cn0K