for (int pr = 0; pr < (1 << n) - 1; pr++) { int go = p[pr] & ~pr; for (int v = 0; v < n; v++) if (((go >> v) & 1) != 0) { p[pr | (1 << v)] |= c[v]; } }