Getting wrong answer in 'RANKLIST' problem

Link to my solution for the problem ‘RANKLIST’ . kindly help me in finding a logical error in my solution!

c=(i*(i+1))/2
On first glance I think this is the problem. Given that n can be up to 10^5, and i can be up to n, couldn’t this line overflow? You can define i as a long long int or write ll(i)