another solved top coder problem