<doocs>0477.Total Hamming Distance_1.py
def totalHammingDistance( nums: List[int]) -> int:
    ans = 0
    for i in range(31):
        a = b = 0
        for v in nums:
            t = (v >> i) & 1
            if t:
                a += 1
            else:
                b += 1
        ans += a * b
    return ans
def sample_funcname ( var_0 : List [ int ] ) -> int :
    var_4 = 0
    for var_7 in range ( 31 ) :
        var_9 = var_8 = 0
        for var_10 in var_0 :
            var_12 = ( var_10 >> var_7 ) & 1
            if var_12 :
                var_9 += 1
            else :
                var_8 += 1
        var_4 += var_9 * var_8
    return var_4
