def get_basis(a): basis = [] top = [] for e in a: for b,t in zip(basis,top): if e>>t&1: e ^= b if e: basis.append(e) top.append(e.bit_length()-1) return basis,top def normalize(v,basis,top): for e,l in zip(basis,top): if v&(1<