Synaptic competition in structural plasticity and cognitive function