H-Fac: Memory-Efficient Optimization with Factorized Hamiltonian Descent