CodeMat problem

In CodeMat, i dont know why, but even though my logic and my code passed all samples, its saying partially correct. I even asked AI and ChatGPT, but they cant get the correct code. Plz help me :frowning: