Accelerating Quantum Algorithms with Precomputation