#include <set>
#include <iostream>
struct Point {
int x, y;
};
int main() {
auto comp = [](const Point& p1, const Point& p2) {
return p1.x < p2.x || (p1.x == p2.x && p1.y < p2.y);
};
std::set<Point, decltype(comp)> mySet({ {2, 1}, {1, 2} }, comp);
Point myPoint;
myPoint.x = 1;
myPoint.y = 3;
mySet.insert(myPoint);
for (auto const& pt : mySet) {
std::cout << "(" << pt.x << ", " << pt.y << ")" << std::endl;
}
return 0;
}
I2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IFBvaW50IHsKICAgIGludCB4LCB5Owp9OwoKaW50IG1haW4oKSB7CiAgICBhdXRvIGNvbXAgPSBbXShjb25zdCBQb2ludCYgcDEsIGNvbnN0IFBvaW50JiBwMikgewogICAgICAgIHJldHVybiBwMS54IDwgcDIueCB8fCAocDEueCA9PSBwMi54ICYmIHAxLnkgPCBwMi55KTsKICAgIH07CiAgICBzdGQ6OnNldDxQb2ludCwgZGVjbHR5cGUoY29tcCk+IG15U2V0KHsgezIsIDF9LCB7MSwgMn0gfSwgY29tcCk7CgogICAgUG9pbnQgbXlQb2ludDsKICAgIG15UG9pbnQueCA9IDE7CiAgICBteVBvaW50LnkgPSAzOwogICAgbXlTZXQuaW5zZXJ0KG15UG9pbnQpOwoKICAgIGZvciAoYXV0byBjb25zdCYgcHQgOiBteVNldCkgewogICAgICAgIHN0ZDo6Y291dCA8PCAiKCIgPDwgcHQueCA8PCAiLCAiIDw8IHB0LnkgPDwgIikiIDw8IHN0ZDo6ZW5kbDsKICAgIH0KCglyZXR1cm4gMDsKfQ==