Painter partition doubt

https://ide.codingblocks.com/s/66126
giving wrong answer and runtime error
@Anubhav-Aron-1353657628083250