Spoj Biased ranking problem

I’m getting runtime error in spoj in this problem. Can anyone help me please. Given test cases are passing but Im getting run time error

Hey @sounakume just do n+1 instead of n in array.


it is because you are allocating n space to array so it have indexes 0 to n-1.
but you are also accessing nth index thats why n+1.