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_1 = 0
      var_2 = set ( )
      var_3 = [ ]
      var_0.sort ( )
      var_4 , var_5 = var_0 [ 0 ] , var_0 [ - 1 ]
      var_6 = var_5 - var_4 + 1
      for var_7 in var_0 :
          if var_7 in var_2 :
              var_3.append ( var_7 )
          else :
              var_2.add ( var_7 )
      var_6 = var_6 - len ( var_2 )
      for var_8 in range ( var_4 + 1 , var_5 ) :
          if var_6 == 0 or len ( var_3 ) == 0 :
              break
          if var_8 not in var_2 and var_8 > var_3 [ 0 ] :
              var_1 += var_8 - var_3.pop ( 0 )
              var_6 -= 1
      while len ( var_3 ) != 0 :
          var_5 += 1
          var_1 += var_5 - var_3.pop ( 0 )
      return var_1
  