Yamabe type equations with a sign-changing nonlinearity, and the prescribed curvature problem