Codechef COOKMACH solution, exceeding time limit
if(A%2!=0){
        if(A&lt;B){
            while(A!=1){
                A=(A-1)/2;
                count=A;
            }



This looks like a bug.  Consider the case where A is 5 and B is 8 or more.  A is odd, less than B, and not equal to 1, so it enters the while loop.  First iteration A becomes 2.  Second iteration we have \$(2-1)/2\$ which rounds down to become 0.  Since 0 is not equal to 1, we loop again and have \$(0-1)/2\$ which rounds off to 0 (negative fractions rounds up, towards zero).  But now we're back to 0.  So it loops endlessly.  

This is why I would recommend saying A &gt; 1 rather than A != 1.  Then you would have returned an answer (possibly wrong) quickly rather than gotten Time Limit Exceeded.  

The worst part is that this is unnecessary.  Integer arithmetic would have handled this correctly.  You don't need to check for odd numbers.  Normal integer arithmetic already rounds down.  

The count=A; is also wrong.  You'd want to increment count here as well, not set it to 1.  

You also don't correctly handle values for A like 6.  It's not odd, but it's not a power of two either.  You should reduce it to 1, but you won't so long as it is less than B.  Instead you'll endlessly double it until the program crashes.