Generate the code prompt for the last task using the similar style of the example codes. Implement the code prompt as much as you can and describe the logic in code following the provided explanation but do not make a code that is biased toward a single task example instance. For example, do not use hard-coded variables that are obtained from task instances (e.g., using specific name of person in the question). The code prompt must be able to be applied to various instances of same task. When returning the final answer, carefully consider the output format. Especially, for the multiple choice questions, the final answer should be one of the given options. The main function name should be '{function_name}'. Along with the main function, you may want to define some helper functions that might be helpful for implementing the '{function_name}'. But you don't have to explicitly implement the helper functions, but just define them with function name and a single-line explanation in comment. When constructing the main function, actively use 'if else statement' to take different reasoning paths based on the condition, 'loop' to efficiently process the repititive instructions, 'dictionary' to keep track of connections between important variables, and 'print()' to output enough intermediate reasoning steps towards the answer and keep tracking changes of important variables. In a free format reasoning step, you don't have to specify the logic, but you should use an abstract fucntion like 'derive_answer_with_explantion' which outputs both reasons and proper answer for the situation. For the variables tracking step, you should use 'for loop' to process the multiple statements or instructions step by step, 'print()' to output intermediate steps to keep track of changes of variables.

{exemplars}