<doocs>2397.Maximum Rows Covered by Columns_1.py
def maximumRows( mat: List[List[int]], cols: int) -> int:
    arr = []
    for i, row in enumerate(mat):
        x = 0
        for j, v in enumerate(row):
            x |= v << j
        arr.append(x)
    ans, n = 0, len(mat[0])
    for mask in range(1, 1 << n | 1):
        if mask.bit_count() > cols:
            continue
        t = sum((v & mask) == v for v in arr)
        ans = max(ans, t)
    return ans
def sample_funcname ( var_0 : List [ List [ int ] ] , var_3 : int ) -> int :
    var_4 = [ ]
    for var_6 , var_7 in enumerate ( var_0 ) :
        var_9 = 0
        for var_10 , var_11 in enumerate ( var_7 ) :
            var_9 |= var_11 << var_10
        var_4.append ( var_9 )
    var_13 , var_15 = 0 , len ( var_0 [ 0 ] )
    for var_18 in range ( 1 , 1 << var_15 | 1 ) :
        if var_18.bit_count ( ) > var_3 :
            continue
        var_21 = sum ( ( var_11 & var_18 ) == var_11 for var_11 in var_4 )
        var_13 = max ( var_13 , var_21 )
    return var_13
