from functools import lru_cache @lru_cache(maxsize=None) def main(n): s = ["{"] for i in range(n.bit_length()): if n&1<