def solution(bandage, health, attacks):
full_time=attacks[-1][0]
sp_t, tp_heal, plus_heal= bandage
count_heal=0
full_health=health
for t in range(full_time+1):
print(f"time:{t}")
if t==attacks[0][0]:
count_heal=0
health-=attacks[0][1]
attacks.pop(0)
print(f"health:{health}")
if health<=0:
print("Died")
return -1
elif t>0:
if health<full_health:
health+=tp_heal
if health>full_health:
health=full_health
count_heal+=1
if count_heal==sp_t:
health+=plus_heal
if health>full_health:
health=full_health
count_heal=0
print(f"health:{health}")
print(f"count_heal:{count_heal}")
else:
count_heal+=1
print(f"count_heal:{count_heal}")
return health