This coding problem

i have not understood the problem under my code. And the i also did not understood the solution provided of given problem.

@anujsharmabadboy take the datatype as long long int.