finished contest.py; needs testing