Painter Problem

Please correct my mistake in the code!
2 testcases are failing

Please someone Help me on this!!!

please reply Iā€™m really stuck on this question??