Solutions for Uva OnlineJudge problems