def palindrome(s):
    return all(s[i] == s[-(i + 1)] for i in range(len(s) // 2))


s = 0
for n in range(10 ** 6):
    if palindrome(str(n)) and palindrome(bin(n)[2:]):
        s += n
print(s)

3223bbffcc0d9346c6f27e68e85e253fc372f89d
<mask token>

def palindrome(s):
    return all(s[i] == s[-(i + 1)] for i in range(len(s) // 2))


<mask token>

def palindrome(s):
    return all(s[i] == s[-(i + 1)] for i in range(len(s) // 2))


<mask token>
for n in range(10 ** 6):
    if palindrome(str(n)) and palindrome(bin(n)[2:]):
        s += n
print(s)

def palindrome(s):
    return all(s[i] == s[-(i + 1)] for i in range(len(s) // 2))


s = 0
for n in range(10 ** 6):
    if palindrome(str(n)) and palindrome(bin(n)[2:]):
        s += n
print(s)
