Fix referee.py

template[i][j] might be already filled, which should be the same as ch.
Merge pull request #2 from cielavenir/patch-2

Fix referee.py