Solutions to UVA Online Judge probelms