#include using namespace std; #define out(v) cout<> x >> y >> d; if (d <= min(x, y)) { out(d+1); } else if (min(x, y) <= d && d <= max(x, y)) { out(min(x, y)+1); } else if (max(x, y) <= d) { out(max(0, x + y - d + 1)); } return 0; }