https://math.ucsd.edu/programs/undergraduate/Entry_to_the_Math_Majors.pdf describes entry to math majors at UCSD.
However, CS courses are likely to be quite full, which is the reason that the CS major has to limit enrollment. Presumably, CS majors get enrollment priority for CS courses over other majors.