I wrote a solution to 295B... After getting wrong ans on test case 4 I tested my solution on Custom Innovation and it is showing the correct output for the 4th case.
I tested my code in ideone also. here is the ideone test. It produces correct output both on CUSTOM INVOCATION and on Ideone.
I can't figure out what is wrong with my submission. could somebody please help me?