Files
2026-08-03 19:03:58 +01:00

20 lines
343 B
C++

#include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
using namespace std;
int main() {
freopen("paint.in", "r", stdin);
freopen("paint.out", "w", stdout);
int a, b, c, d;
cin >> a >> b >> c >> d;
if (d < a || b < c) {
cout << (b - a) + (d - c);
} else {
cout << abs(max(b, d) - min(a, c));
}
}