Math solves the puzzle of the perfect parking lot