input: 
  def generate_random_string(length: int) -> str:
      """Generates a random string of specified length, consisting of uppercase letters and digits.
      >>> generate_random_string(8)
      'K7L3P9Q2'
      >>> generate_random_string(8)
      '5A8FQ2Z4'
      """
      import string
      import random
      chars = string.ascii_uppercase + string.digits
      return ''.join(random.choice(chars) for _ in range(length))
  
output:     import string
      import random
      chars = string.ascii_uppercase + string.digits
      return ''.join(random.choice(chars) for _ in range(length))