def state2iset(s):
    """
    Return a set that contains the index of each 1 in the binary representation of non-negative number s
    """
    iset = []
    i = 0
    while s > 0:
        if (s & 1) != 0:
            iset.append(i)
        s = s >> 1
        i += 1
    return iset