Codeforces round 216
Topcoder SRM 298