<doocs>1122.Relative Sort Array_1.py
def relativeSortArray( arr1: List[int], arr2: List[int]) -> List[int]:
    mp = [0] * 1001
    for x in arr1:
        mp[x] += 1
    i = 0
    for x in arr2:
        while mp[x] > 0:
            arr1[i] = x
            mp[x] -= 1
            i += 1
    for x, cnt in enumerate(mp):
        for _ in range(cnt):
            arr1[i] = x
            i += 1
    return arr1
def sample_funcname ( var_0 : List [ int ] , var_3 : List [ int ] ) -> List [ int ] :
    var_6 = [ 0 ] * 1001
    for var_7 in var_0 :
        var_6 [ var_7 ] += 1
    var_9 = 0
    for var_7 in var_3 :
        while var_6 [ var_7 ] > 0 :
            var_0 [ var_9 ] = var_7
            var_6 [ var_7 ] -= 1
            var_9 += 1
    for var_7 , var_11 in enumerate ( var_6 ) :
        for var_13 in range ( var_11 ) :
            var_0 [ var_9 ] = var_7
            var_9 += 1
    return var_0
