Book allocation problem

https://ide.codingblocks.com/s/244379 sir ans is coming right but test case are not passing plz tell me the error

the mistake is inside isPossible function in if else conditions

correct one is

 for (int i = 0; i < n; i++)
    {
        if (pr + arr[i] > curr_min)
        {
            su++;
            pr = arr[i];
            if (su > m)
            {
                return false;
            }
        }
        else {
            pr += arr[i];
        }
    }

MODIFIED CODE