Doubt in MIC AND PIC

Problem link

I submitted these two solutions and one got AC and one got WA. These two solution only vary in line 53 .
if (n < r || r < 0 || n < 0) return 0;

AC Submission
WA Submission

If the solution was wrong because of this line , why didn’t it give Runtime error and WA , as then either of the value would have tried to access a negative index .

Thanks in advance.