Help me in solving SHKNUM problem

My issue

it showing partially correct answer

My code

def min_operations(N):
    if N == 0:
        return 0
    min_ops = float('inf')
    for x in range(32):
        for y in range(32):
            if x != y:
                m = (2 ** x) + (2 ** y)
                min_ops = min(min_ops, abs(N - m))
    return min_ops
def solve():
    T = int(input().strip())
    for _ in range(T):
        N = int(input().strip())
        result = min_operations(N)
if __name__ == "__main__":

Learning course: Kalasalingam Academy of Research and Education
Problem Link: CodeChef: Practical coding for everyone