KU competitive programming solution