I just ran your code and it’s working but you don’t produce enough troops to support an effective defense. If you can, try using Pender. Pender is the fastest and can gather coins the quickest, especially if you can cast haste and reset the cooldown on haste along with using mana-blast. That way your hero is participating in the killing of enemies without interrupting the gathering of coins.
As you can see in the below pic, others have successfully passed the level using similar code to yours using Ida, Anya, Alejandro, and Tharin as heroes. What gear are you using? Are you using fast boots? The faster you go, the more coins you can collect and the more soldiers you can summon. Also, try submitting it anyway, even though it isn’t passing with the current seed and see if you can get another seed that passes.