Dielectron and heavy-quark production in inelastic and high-multiplicity proton–proton collisions at s=13TeV