generate_problems now writes problems to file