Segmentation fault in the code

code is showing segmentation fault please correct how and where long long int is to be used to pass all the testcases. Make the necessary corrections .

hi @himanshuanand729 refer