Runtime error in fenwick tree (BIT)

hi everyone,
I try the below question using Fenwick tree but I get a runtime error…

question screenshot:

my solution: SPOJ-Solution/Curious Robin Hood.txt at main · prafull-vrsh/SPOJ-Solution · GitHub

question link: http://www.lightoj.com/volume_showproblem.php?problem=1112

It will be a great help if anyone tells me the reason for the runtime error.
Thank you in advance.