Getting segmentation fault. please help me.

for the question
Oliver and the battle | Practice Problems
I am getting the Segmentation fault.
here is my code
dAzxt5 - Online C++ Compiler & Debugging Tool - Ideone.com