Add #include <climits> to get the definition of INT_MAX.