input: Write a Python function max_triangle_height(red: int, blue: int) -> int:
      """
      Given two integers red and blue, which represent the quantities of red and blue balls respectively, arrange these balls to form a triangle. The 1st row must contain 1 ball, the 2nd row must contain 2 balls, the 3rd row must contain 3 balls, etc.
  
      Each row should be composed entirely of balls of the same color, and consecutive rows should consist of different colors.
  
      Determine and return the maximum possible height of the triangle.
  
      Examples:
      >>> red = 2, blue = 4
      3
      >>> red = 2, blue = 1
      2
  
      Constraints:
      1 <= red, blue <= 100
      """
output: def max_triangle_height(red: int, blue: int) -> int:
      height = 0
      current_row_balls = 1
      use_red = True
      
      while red >= 0 and blue >= 0:
          if (use_red and red >= current_row_balls) or (not use_red and blue < current_row_balls):
              red -= current_row_balls
              use_red = not use_red
          elif (not use_red and blue >= current_row_balls) or (use_red and red < current_row_balls):
              blue -= current_row_balls
              use_red = not use_red
          else:
              break
  
          height += 1
          current_row_balls += 1
      
      return height