TopCoder SRM 584 div 2, 250 AC.