Getting Wrong Answer in 2 test cases MARBLES

here is the link to my solution: https://ideone.com/j3wxQw
Where am I wring

Answer can overflow long long int.
Use bigint class of c++.
Refer this -: