Alcohol and cannabis can significantly impair memory, even if consumed after learning. While substances like sleeping pills may hinder memory retention, getting enough sleep and staying alert through stimulants like caffeine can enhance memory. Engaging with the material and maintaining attention are crucial for better recall.