Codeforces Round #235 (Div. 2), Problem D (update 1)
Codeforces Round #229 (Div. 2), Problem C