<Problem>
https://code.ptit.edu.vn/student/question/C01025
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
int findMin(int* a, int* b, int* c, int* d) {
int minV = *a;
minV = (minV > *b) ? *b : minV;
minV = (minV > *c) ? *c : minV;
minV = (minV > *d) ? *d : minV;
return minV;
}
int findMax(int* a, int* b, int* c, int* d) {
int maxV = *a;
maxV = (maxV < *b) ? *b : maxV;
maxV = (maxV < *c) ? *c : maxV;
maxV = (maxV < *d) ? *d : maxV;
return maxV;
}
int main() {
int x1, x2, y1, y2;
int c1, c2, d1, d2;
scanf("%d %d %d %d", &x1, &x2, &y1, &y2);
scanf("%d %d %d %d", &c1, &c2, &d1, &d2);
int minX = findMin(&x1, &y1, &c1, &d1);
int maxX = findMax(&x1, &y1, &c1, &d1);
int minY = findMin(&x2, &y2, &c2, &d2);
int maxY = findMax(&x2, &y2, &c2, &d2);
int res = (abs(maxX - minX) > abs(maxY - minY)) ? abs(maxX - minX) : abs(maxY - minY);
printf("%d", res * res);
return 0;
}