P16224 [Lanqiao Cup 2026 NOI Qualifier A] Balanced Number

Description

If the binary representation (without leading $0$) of a positive integer has the same number of $1$'s and $0$'s, then we call it a "balanced number". Now, please find a balanced number $x$ that makes $|2026202620262026 - x|$ as small as possible. If there are multiple balanced numbers with the same minimum value of $|2026202620262026 - x|$, choose the smallest one among them.

Input Format

N/A

Output Format

This is an output-only fill-in-the-blank problem. You only need to compute the result and submit it. The answer to this problem is an integer. When submitting, only fill in this integer; any extra content will make you score $0$.

Explanation/Hint

Translated by ChatGPT 5