comefrom: <qiyuangong>945_Minimum_Increment_to_Make_Array_Unique_1.py
code: def minIncrementForUnique( A):
      if A is None or len(A) == 0:
          return 0
      res = 0
      num_set = set()
      duplicate = []
      A.sort()
      left, right = A[0], A[-1]
      holes = right - left + 1
      for v in A:
          if v in num_set:
              duplicate.append(v)
          else:
              num_set.add(v)
      holes = holes - len(num_set)
      for hole in range(left + 1, right):
          if holes == 0 or len(duplicate) == 0:
              break
          if hole not in num_set and hole > duplicate[0]:
              res += hole - duplicate.pop(0)
              holes -= 1
      while len(duplicate) != 0:
          right += 1
          res += right - duplicate.pop(0)
      return res
masked: def sample_funcname ( var_0 ) :
      if var_0 is None or len ( var_0 ) == 0 :
          return 0
      var_4 = 0
      var_6 = set ( )
      var_7 = [ ]
      var_0.sort ( )
      var_9 , var_11 = var_0 [ 0 ] , var_0 [ - 1 ]
      var_12 = var_11 - var_9 + 1
      for var_13 in var_0 :
          if var_13 in var_6 :
              var_7.append ( var_13 )
          else :
              var_6.add ( var_13 )
      var_12 = var_12 - len ( var_6 )
      for var_17 in range ( var_9 + 1 , var_11 ) :
          if var_12 == 0 or len ( var_7 ) == 0 :
              break
          if var_17 not in var_6 and var_17 > var_7 [ 0 ] :
              var_4 += var_17 - var_7.pop ( 0 )
              var_12 -= 1
      while len ( var_7 ) != 0 :
          var_11 += 1
          var_4 += var_11 - var_7.pop ( 0 )
      return var_4
  