input: from typing import List
  
  def calculate_fibonacci(n: int) -> List[int]:
      """ Calculate the Fibonacci numbers up to a given number n and return them as a list.
      >>> calculate_fibonacci(5)
      [0, 1, 1, 2, 3, 5]
      >>> calculate_fibonacci(10)
      [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]
      """
output:     if n < 0:
          return []
      fib_sequence = [0, 1]
      while fib_sequence[-1] <= n:
          fib_sequence.append(fib_sequence[-1] + fib_sequence[-2])
      if fib_sequence[-1] > n:
          fib_sequence.pop()
      return fib_sequence