WA on problem 'Hostel Visit'

The following code is giving 1 AC and 1 WA. Can someone check?

Code : https://ide.codingblocks.com/s/91270