#include using namespace std; typedef long long ll; #define rep(i,n) for(i=0;i>x >>y >>d; long left=max(d-y,(long)0); long right=min(d,x); std::cout << max(right-left+1,(long)0) << std::endl; return 0; }