<doocs>2007.Find Original Array From Doubled Array_1.py
def findOriginalArray( changed: List[int]) -> List[int]:
    if len(changed) % 2 != 0:
        return []
    n = 100010
    counter = [0] * n
    for x in changed:
        counter[x] += 1
    if counter[0] % 2 != 0:
        return []
    res = [0] * (counter[0] // 2)
    for i in range(1, n):
        if counter[i] == 0:
            continue
        if i * 2 > n or counter[i] > counter[i * 2]:
            return []
        res.extend([i] * counter[i])
        counter[i * 2] -= counter[i]
    return res
def sample_funcname ( var_0 : List [ int ] ) -> List [ int ] :
    if len ( var_0 ) % 2 != 0 :
        return [ ]
    var_7 = 100010
    var_8 = [ 0 ] * var_7
    for var_9 in var_0 :
        var_8 [ var_9 ] += 1
    if var_8 [ 0 ] % 2 != 0 :
        return [ ]
    var_11 = [ 0 ] * ( var_8 [ 0 ] // 2 )
    for var_13 in range ( 1 , var_7 ) :
        if var_8 [ var_13 ] == 0 :
            continue
        if var_13 * 2 > var_7 or var_8 [ var_13 ] > var_8 [ var_13 * 2 ] :
            return [ ]
        var_11.extend ( [ var_13 ] * var_8 [ var_13 ] )
        var_8 [ var_13 * 2 ] -= var_8 [ var_13 ]
    return var_11
