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_1 = len ( var_0 )
      for var_2 in range ( 1 , var_1 ) :
          var_3 = var_0 [ var_2 ] - var_0 [ 0 ]
          if var_3 == 0 or var_3 % 2 == 1 :
              continue
          var_4 = [ False ] * var_1
          var_4 [ var_2 ] = True
          var_5 = [ ( var_0 [ 0 ] + var_0 [ var_2 ] ) >> 1 ]
          var_6 , var_7 = 1 , var_2 + 1
          while var_7 < var_1 :
              while var_6 < var_1 and var_4 [ var_6 ] :
                  var_6 += 1
              while var_7 < var_1 and var_0 [ var_7 ] - var_0 [ var_6 ] < var_3 :
                  var_7 += 1
              if var_7 == var_1 or var_0 [ var_7 ] - var_0 [ var_6 ] > var_3 :
                  break
              var_4 [ var_7 ] = True
              var_5.append ( ( var_0 [ var_6 ] + var_0 [ var_7 ] ) >> 1 )
              var_6 , var_7 = var_6 + 1 , var_7 + 1
          if len ( var_5 ) == ( var_1 >> 1 ) :
              return var_5
      return [ ]
  