input: from typing import List
  
  def fibonacci(n: int) -> List[int]:
      """ Generate a list of Fibonacci numbers up to the given number n.
      >>> fibonacci(5)
      [0, 1, 1, 2, 3]
      >>> fibonacci(10)
      [0, 1, 1, 2, 3, 5, 8]
      """
      if n < 0:
          return []
      elif n == 0:
          return [0]
      elif n == 1:
          return [0, 1]
      
      fib_list = [0, 1]
      a, b = 0, 1
      while b < n:
          a, b = b, a + b
          if b < n:
              fib_list.append(b)
      return fib_list
output:     if n < 0:
          return []
      elif n == 0:
          return [0]
      elif n == 1:
          return [0, 1]
      
      fib_list = [0, 1]
      a, b = 0, 1
      while b < n:
          a, b = b, a + b
          if b < n:
              fib_list.append(b)
      return fib_list