Marauder: complicated way is only slightly better

There are 4 possibilities: (e+, c+), (e+, c-), (e-, c+), (e-, c-)
Code with enemy priority runs for 34.3s in my case:

while True:
   coin = hero.findNearestItem()
   enemy = hero.findNearestEnemy()
   if enemy:                   
       if coin:
           # hero attacks enemy # (e+, c+)
       else:
           # hero attacks enemy # (e+, c-)
   elif coin:
       # hero moves to coin     # (e-, c+)
   else:
       # pass                   # (e-, c-)

Code with coin priority runs for 34.1s in my case:

while True:
    coin = hero.findNearestItem()
    enemy = hero.findNearestEnemy()
    
    if coin:
        if enemy:
            # hero moves to coin  # (e+, c+)  
        else:
            # hero moves to coin  # (e-, c+)
    elif enemy:
        # hero attacks enemy      # (e+, c-)
    else:
        # pass                    # (e-, c-)  

Original Code runs for 34.1s in my case:

I can be wrong, but imo there is no gain in this technique in this level and if the hero is a accomplishing an action in a loop inside the main loop the allied minions will freeze.