generating all subsets
for ( int i = 1 ; i < ( 1 << N ) ; i ++ ) { vector < int > temp ; for ( int j = 0 ; j < N ; j ++ ) { if ( ( i & ( 1 << j ) ) != 0 ) { temp . push_back ( A [ j ] ) ; } } int flag = 0 ;