comefrom: <doocs>0018.4Sum_1.py
code: def fourSum( nums: List[int], target: int) -> List[List[int]]:
      n, res = len(nums), []
      if n < 4:
          return []
      nums.sort()
      for i in range(n - 3):
          if i > 0 and nums[i] == nums[i - 1]:
              continue
          for j in range(i + 1, n - 2):
              if j > i + 1 and nums[j] == nums[j - 1]:
                  continue
              k, l = j + 1, n - 1
              while k < l:
                  if nums[i] + nums[j] + nums[k] + nums[l] == target:
                      res.append([nums[i], nums[j], nums[k], nums[l]])
                      k += 1
                      l -= 1
                      while k < n and nums[k] == nums[k - 1]:
                          k += 1
                      while l > j and nums[l] == nums[l + 1]:
                          l -= 1
                  elif nums[i] + nums[j] + nums[k] + nums[l] < target:
                      k += 1
                  else:
                      l -= 1
      return res
masked: def sample_funcname ( var_0 : List [ int ] , var_1 : int ) -> List [ List [ int ] ] :
      var_2 , var_3 = len ( var_0 ) , [ ]
      if var_2 < 4 :
          return [ ]
      var_0.sort ( )
      for var_4 in range ( var_2 - 3 ) :
          if var_4 > 0 and var_0 [ var_4 ] == var_0 [ var_4 - 1 ] :
              continue
          for var_5 in range ( var_4 + 1 , var_2 - 2 ) :
              if var_5 > var_4 + 1 and var_0 [ var_5 ] == var_0 [ var_5 - 1 ] :
                  continue
              var_6 , var_7 = var_5 + 1 , var_2 - 1
              while var_6 < var_7 :
                  if var_0 [ var_4 ] + var_0 [ var_5 ] + var_0 [ var_6 ] + var_0 [ var_7 ] == var_1 :
                      var_3.append ( [ var_0 [ var_4 ] , var_0 [ var_5 ] , var_0 [ var_6 ] , var_0 [ var_7 ] ] )
                      var_6 += 1
                      var_7 -= 1
                      while var_6 < var_2 and var_0 [ var_6 ] == var_0 [ var_6 - 1 ] :
                          var_6 += 1
                      while var_7 > var_5 and var_0 [ var_7 ] == var_0 [ var_7 + 1 ] :
                          var_7 -= 1
                  elif var_0 [ var_4 ] + var_0 [ var_5 ] + var_0 [ var_6 ] + var_0 [ var_7 ] < var_1 :
                      var_6 += 1
                  else :
                      var_7 -= 1
      return var_3
  