Both invasion were greatly affected because both rulers tried to invade Russia during winters. Many soldiers died there because of cold weather. Napoleon tried to invade Russia without listening to his general's advice.
Hitler was unaware about situation, therefore, sent a huge force towards Russia. Many soldiers died during journey due to harsh weather. Others were captured by Russia or died in battle with h Russian forces..
Therefore geography gave Russia a big advantage in wars.