[competitive] unify shared parts of templates (close gh-16).