Solution code for problems from U