struct point { int x, y; }; int max(int a, int b) { return a < b ? b : a; } // Chebyshev int distance(struct point A, struct point B) { return max(A.x - B.x, A.y - B.y); }