Why am I getting Runtime Error?


#1

Hi guys , I’m trying to solve this problem,
link : https://uva.onlinejudge.org/external/4/429.pdf
on UVA online judge.

I’ve submitted this solution
my solution : https://paste.ubuntu.com/p/tgrq257KrQ/

For the given input my code works fine. When submitted on the Judge I’m getting Runtime Error. Can anyone help me why am i getting runtime error ?? TIA