#include <iostream>
#include <algorithm>
class cool {
public:
int a, b;
bool operator<(const cool& rhs) const
{
return a < rhs.a || a == rhs.a && b > rhs.b;
}
};
int main()
{
cool arr[5] = {{2, 1}, {2, 3}, {2, 2}, {3, 1}, {1, 1}};
std::sort(arr, arr+5);
for (int i = 0; i < 5; ++i)
{
std::cout << '(' << arr[i].a << ", " << arr[i].b << ") ";
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKY2xhc3MgY29vbCB7IApwdWJsaWM6IAogIGludCBhLCBiOyAKICBib29sIG9wZXJhdG9yPChjb25zdCBjb29sJiByaHMpIGNvbnN0IAogIHsgCiAgICByZXR1cm4gYSA8IHJocy5hIHx8IGEgPT0gcmhzLmEgJiYgYiA+IHJocy5iOyAKICB9Cn07IAoKaW50IG1haW4oKQp7IAogIGNvb2wgYXJyWzVdID0ge3syLCAxfSwgezIsIDN9LCB7MiwgMn0sIHszLCAxfSwgezEsIDF9fTsKICBzdGQ6OnNvcnQoYXJyLCBhcnIrNSk7CiAgZm9yIChpbnQgaSA9IDA7IGkgPCA1OyArK2kpIAogIHsKICAgIHN0ZDo6Y291dCA8PCAnKCcgPDwgYXJyW2ldLmEgPDwgIiwgIiA8PCBhcnJbaV0uYiA8PCAiKSAiOwkKICB9Cn0=