Runtime Error(SIGSEGV) in magic rankings

my solution have Runtime Error(SIGSEGV) in this problem could someone tell me why? and here is
my solution

//