Question regarding a practice problem

Hello everyone,
I have a question regarding a practice problem named “Second largest”. When I tried to submit my code, this page returns “Runtime error” but I have seen lengthier solutions to the problem that have more lines of code, but are marked as correct. I ran my code on my computer and it returns the correct output. I don’t want to copy someone else’s code, so I am asking for an advice.

Your code has a bug for some input. Eg- for some input division by 0, out of bound exception etc.

Debug it and try running at codechef IDE “Code compile and run”