#include <map>
#include <iostream>
struct coord {
int x, y;
};
int main() {
auto comp = [](const coord& c1, const coord& c2){
return c1.x < c2.x || (c1.x == c2.x && c1.y < c2.y);
};
std::map<coord, int, decltype(comp)> m(comp);
m.insert({ { 0, 0 }, 123 });
m.insert({ { 1, 1 }, 234 });
m.insert({ { 0, 1 }, 345 });
m.insert({ { 1, 0 }, 456 });
for (auto const &c : m)
std::cout << c.first.x << ", " << c.first.y << ", " << c.second << std::endl;
return 0;
}
I2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IGNvb3JkIHsKICAgIGludCB4LCB5Owp9OwoKaW50IG1haW4oKSB7CiAgICBhdXRvIGNvbXAgPSBbXShjb25zdCBjb29yZCYgYzEsIGNvbnN0IGNvb3JkJiBjMil7CiAgICAgICAgcmV0dXJuIGMxLnggPCBjMi54IHx8IChjMS54ID09IGMyLnggJiYgYzEueSA8IGMyLnkpOwogICAgfTsKICAgIHN0ZDo6bWFwPGNvb3JkLCBpbnQsIGRlY2x0eXBlKGNvbXApPiBtKGNvbXApOwoKICAgIG0uaW5zZXJ0KHsgeyAwLCAwIH0sIDEyMyB9KTsKICAgIG0uaW5zZXJ0KHsgeyAxLCAxIH0sIDIzNCB9KTsKICAgIG0uaW5zZXJ0KHsgeyAwLCAxIH0sIDM0NSB9KTsKICAgIG0uaW5zZXJ0KHsgeyAxLCAwIH0sIDQ1NiB9KTsKCiAgICBmb3IgKGF1dG8gY29uc3QgJmMgOiBtKQogICAgICAgIHN0ZDo6Y291dCA8PCBjLmZpcnN0LnggPDwgIiwgIiA8PCBjLmZpcnN0LnkgPDwgIiwgIiA8PCBjLnNlY29uZCA8PCBzdGQ6OmVuZGw7CgoJcmV0dXJuIDA7Cn0=