TC Div2 prob2 solutions