I saw your code. There are 2 errors in your code first when you are checking how many occurences of num1 and num2 are there you are using else if you see a can be equal to b so you should use only if there. second in this prob*=(double)num_count1/faces;
you are again multiplying with num_count1/faces you should multiply with num_count2/faces
so it should be prob*=(double)num_count2/faces;
I corrected These and got 100% results see CodeChef: Practical coding for everyone
As @ssp547 corrected the solution, I want to highlight a different aspect in your code. You have checked at every stage that the input was correct or not. This is not needed at all in competitive programming. The input is guaranteed to be according to the constraints. So no need to check it and save time. This will help you in short contests.