input: Write a Python function named `min_levels_to_earn_more_points` that takes a binary list called `levels` with length `n`. 
  
  Alice and Bob are participating in a game involving `n` levels. Some levels are impossible to complete (denoted by 0), while others are always completable (denoted by 1). If a level is impossible, both players can neither gain nor lose points on that level. Players gain a point for a completed level and lose a point for a failed attempt.
  
  Alice starts from the 0th level and can choose to play a number of consecutive levels before Bob takes over and plays the remaining levels. The goal is to determine the minimum number of levels Alice needs to play first to ensure she has a higher score than Bob, assuming both play optimally to maximize their scores.
  
  Return the minimum number of levels Alice must play to secure more points than Bob. If it is not possible for Alice to gain more points than Bob, return -1. Each player must play at least one level.
  
  Examples:
  >>> levels = [1,0,1,0]
  1
  >>> levels = [1,1,1,1,1]
  3
  >>> levels = [0,0]
  -1
  
  Constraints:
  - 2 <= n == len(levels) <= 100000
  - levels[i] is either 0 or 1.
output: def min_levels_to_earn_more_points(levels):
      n = len(levels)
      total_levels = sum(levels)
      if total_levels == 0:
          return -1
      
      alice_points = 0
      for i in range(n):
          alice_points += levels[i]
          bob_points = total_levels - alice_points
          if alice_points > bob_points:
              return i + 1
      
      return -1