Basic solution to the first contest I organized.