Productive and unproductive competition: a unified framework