TopCoder SRM 517 div 1, 250 AC.