<doocs>2285.Maximum Total Importance of Roads_1.py
def maximumImportance( n: int, roads: List[List[int]]) -> int:
    deg = [0] * n
    for a, b in roads:
        deg[a] += 1
        deg[b] += 1
    deg.sort()
    return sum(i * v for i, v in enumerate(deg, 1))
def sample_funcname ( var_0 : int , var_2 : List [ List [ int ] ] ) -> int :
    var_5 = [ 0 ] * var_0
    for var_6 , var_7 in var_2 :
        var_5 [ var_6 ] += 1
        var_5 [ var_7 ] += 1
    var_5.sort ( )
    return sum ( var_11 * var_12 for var_11 , var_12 in enumerate ( var_5 , 1 ) )
