Painter Problem

Sir, my code is able to pass 4 test cases out of 6. Can you please point out my mistake?

Code:

Question:
https://online.codingblocks.com/app/player/179062/content/173994/5385/code-challenge

Hello @gaurisha check now:

thank you sir, it works now. Sir can you please look at my previous doubt too. It is related to Counting Sort.

@gaurisha you have to raise the doubt again for another question. i will surely help you there.