TopCoder SRM 591 div 2, 500 AC.