Hostel Visit Code in Heaps

My given test case is running and I have taken care of all the possibilities in my code still only 20 percent i.e. 1 in 4 testcases are running. I m not getting what is that I am missing.

okay I have converted all int to long and now it is working fine