Shortest python3 code for: Find the difference between a number and a power of two not exceeding a given number So, this is a task from one very popular educational site in Russia:
https://acmp.ru/index.asp?main=task&amp;id_task=786&amp;ins=1
Mathematically, you need to find the power of two not exceeding the given number, read from the standard input stream, and output their difference in the standard output stream.
My python3 solution takes 41 characters, but the leader’s solution is only 40 characters.
Who can shorten the code?
Newlines, spaces and tabs are not included while counting code length.
x = int(input())
print(x - 2 ** (len(bin(x)) - 3))
Python 3, 39 bytes

print(int('0'+bin(int(input()))[3:],2))

Try it online!
Subtracting the largest power of two less than a number is the same as removing the first 1 from its binary representation.
Unfortunately python rather mysteriously errors on trying to convert the empty binary string to an int so we need '0'+ if we want it to work on zero or one.  If we relax the requirements to only require two or more then we can remove 4 bytes.
Python 3, 35 bytes

print(int(bin(int(input()))[3:],2))

Try it online!