Getting segmentation fault. please help me.

for the question
https://www.hackerearth.com/practice/algorithms/graphs/breadth-first-search/practice-problems/algorithm/oliver-and-the-battle-1/#c120773
I am getting the Segmentation fault.
here is my code
https://ideone.com/dAzxt5

//