Codeforces 137C: Time Limit Exceeded