<doocs>0861.Score After Flipping Matrix_1.py
def matrixScore( grid: List[List[int]]) -> int:
    m, n = len(grid), len(grid[0])
    for i in range(m):
        if grid[i][0] == 0:
            for j in range(n):
                grid[i][j] ^= 1
    
    res = 0
    for j in range(n):
        cnt = 0
        for i in range(m):
            cnt += grid[i][j]
        res += max(cnt, m - cnt) * (1 << (n - j - 1))
    return res
def sample_funcname ( var_0 : List [ List [ int ] ] ) -> int :
    var_4 , var_6 = len ( var_0 ) , len ( var_0 [ 0 ] )
    for var_8 in range ( var_4 ) :
        if var_0 [ var_8 ] [ 0 ] == 0 :
            for var_9 in range ( var_6 ) :
                var_0 [ var_8 ] [ var_9 ] ^= 1
    var_11 = 0
    for var_9 in range ( var_6 ) :
        var_12 = 0
        for var_8 in range ( var_4 ) :
            var_12 += var_0 [ var_8 ] [ var_9 ]
        var_11 += max ( var_12 , var_4 - var_12 ) * ( 1 << ( var_6 - var_9 - 1 ) )
    return var_11
