Wrong Answer in output (Painter Problem

The output shows the wrong answer. I am unable to understand where my code is failing. Here’s the link to my code

Hi @isa67719, modify your input order.
It should be k and then n while taking input.
If doubt still persists, reply to this thread, else mark it as resolved.