COSMOS: A Hybrid Adaptive Optimizer for Memory-Efficient Training of LLMs