compile (std::numeric_limits<int>::max()) error, replace it by (1<<31 -1)