# https://www.youtube.com/watch?v=HyRjuPP9S3o

from collections import Counter

max_val = 1300

possibilities = list(range(13, max_val+1))

# exclusions = {64, 729}


perfect_squares = {x*x for x in range(100)}
perfect_cubes = {x*x*x for x in range(100) if x*x*x <= max_val}



def less_than_500(x):
    return x < 500

def is_perfect_square(x):
    return x in perfect_squares

def is_perfect_cube(x):
    return x in perfect_cubes

def second_digit_1(x):
    return str(x)[1] == "1"


# print([x for x in possibilities if is_perfect_cube(x) and is_perfect_square(x)])

#             invert                           invert             second digit is a 1
conditions = [less_than_500, is_perfect_square, is_perfect_cube]
for mask in range(2**3):
    pos = set(possibilities)
    for x in possibilities:
        for i, condition in enumerate(conditions):
            if not (condition(x) ^ (mask & (1 << i))):
                pos.remove(x)
                break

    if 1 in Counter(second_digit_1(x) for x in pos).values():
        print(mask, pos)

    # print(mask, pos)


# What was said
# it is >500 (lie)
# it

# truth
# less than 500
# perfect square
# perfect
