comefrom: <doocs>2122.Recover the Original Array_1.py
code: def recoverArray( nums: List[int]) -> List[int]:
      nums.sort()
      n = len(nums)
      for i in range(1, n):
          d = nums[i] - nums[0]
          if d == 0 or d % 2 == 1:
              continue
          vis = [False] * n
          vis[i] = True
          ans = [(nums[0] + nums[i]) >> 1]
          l, r = 1, i + 1
          while r < n:
              while l < n and vis[l]:
                  l += 1
              while r < n and nums[r] - nums[l] < d:
                  r += 1
              if r == n or nums[r] - nums[l] > d:
                  break
              vis[r] = True
              ans.append((nums[l] + nums[r]) >> 1)
              l, r = l + 1, r + 1
          if len(ans) == (n >> 1):
              return ans
      return []
masked: def sample_funcname ( var_0 : List [ int ] ) -> List [ int ] :
      var_0.sort ( )
      var_5 = len ( var_0 )
      for var_8 in range ( 1 , var_5 ) :
          var_10 = var_0 [ var_8 ] - var_0 [ 0 ]
          if var_10 == 0 or var_10 % 2 == 1 :
              continue
          var_13 = [ False ] * var_5
          var_13 [ var_8 ] = True
          var_15 = [ ( var_0 [ 0 ] + var_0 [ var_8 ] ) >> 1 ]
          var_16 , var_17 = 1 , var_8 + 1
          while var_17 < var_5 :
              while var_16 < var_5 and var_13 [ var_16 ] :
                  var_16 += 1
              while var_17 < var_5 and var_0 [ var_17 ] - var_0 [ var_16 ] < var_10 :
                  var_17 += 1
              if var_17 == var_5 or var_0 [ var_17 ] - var_0 [ var_16 ] > var_10 :
                  break
              var_13 [ var_17 ] = True
              var_15.append ( ( var_0 [ var_16 ] + var_0 [ var_17 ] ) >> 1 )
              var_16 , var_17 = var_16 + 1 , var_17 + 1
          if len ( var_15 ) == ( var_5 >> 1 ) :
              return var_15
      return [ ]
  