• + 1 comment

    For C++ solution change the return type of solve function to long long and also type of result variable in main function from where solve is being called.