def cost(shots):
    hit = units = 0
for show, shot in zip(bird_data, shots):
    units += 1
for n, birds in enumerate(show):
    if shot & 1:
        units += 1
hit |= birds
if hit == 15:
    return units
shot >>= 1
return 99
Finding an optimal solution that minimizes a constraint?