bitset B1[N]; // матрица B1 bitset dp[1 << k]; int up = 0; for (int mask=1; mask<(1<