input: 
  class MedianFinder:
   def __init__(self):
       self._data = []
   
   def add(self, num):
       self._data.append(num)
   
   def find_median(self):
       data = sorted(self._data)
       n = len(data)
       return (data[(n-1)//2] + data[n//2])/2
   
  # Example usage:
  # median_finder = MedianFinder()
  # median_finder.add(3)
  # median_finder.add(1)
  # median_finder.add(2)
  # print(median_finder.find_median())  # Output should be 2.0
  
output:     
      def __init__(self):
          self._data = []
          self._min_heap = []
          self._max_heap = []
  
      def add(self, num):
          if len(self._max_heap) == 0 or num <= -self._max_heap[0]:
              heapq.heappush(self._max_heap, -num)
          else:
              heapq.heappush(self._min_heap, num)
          
          if len(self._max_heap) > len(self._min_heap) + 1:
              heapq.heappush(self._min_heap, -heapq.heappop(self._max_heap))
          elif len(self._min_heap) > len(self._max_heap):
              heapq.heappush(self._max_heap, -heapq.heappop(self._min_heap))
  
      def find_median(self):
          if len(self._max_heap) == len(self._min_heap):
              return (-self._max_heap[0] + self._min_heap[0]) / 2
          else:
              return -self._max_heap[0]
  