Solving a ticket sales problem. This could be improved a bit, would someone like to record a solution to replace this one?