2 Test Cases not working for the problem " Painter Problem"

2 of the test cases for the above stated problem are producing incorrect answers and I am unable to figure out why. Please help.

Here is my code: https://ide.codingblocks.com/s/291782

hello @Yash5646
dont sort the array , because painters r allowed to paint only contiguos blocks .