TopCoder SRM 596 div2, 250 and 500 AC.