input: Write a Python function that calculates the highest score achievable given an array representing the energy levels of enemies and an initial energy value. You start with zero points and can perform two types of operations to gain points by engaging enemies. Each engagement affects your energy and may mark the enemy as engaged. Return the maximum points possible.
  
  
  from typing import List
  
  def max_battle_score(enemy_energies: List[int], starting_energy: int) -> int:
      """
      Given an array enemy_energies of integers representing the energy levels of various enemies,
      and an integer starting_energy representing your initial energy.
  
      Starting with 0 points, perform operations to earn maximum points:
  
      1. If your energy is greater than or equal to an unmarked enemy's energy, you gain 1 point and lose energy equivalent to that enemy's energy.
      2. If you have at least 1 point, you can restore energy equal to an unmarked enemy's energy and mark the enemy.
  
      Return the maximum points achievable.
  
      Example:
      >>> enemy_energies = [3,2,2], starting_energy = 2
      3
      >>> enemy_energies = [2], starting_energy = 10
      5
      
      Constraints:
      1 <= len(enemy_energies) <= 10^5
      1 <= enemy_energies[i] <= 10^9
      0 <= starting_energy <= 10^9
      """
  
output: def max_battle_score(enemy_energies: List[int], starting_energy: int) -> int:
      enemy_energies.sort()
      points = 0
      i, j = 0, len(enemy_energies) - 1
      
      while i <= j:
          if starting_energy >= enemy_energies[i]:
              starting_energy -= enemy_energies[i]
              points += 1
              i += 1
          elif points > 0:
              starting_energy += enemy_energies[j]
              points -= 1
              j -= 1
          else:
              break
  
      return points