This is a terrible idea
If you're answering a question
Have higher standards. The question should basically never have that much code in it in the first place. Learn to demand a proper minimal reproducible example and keep in mind that questions are about the problem, not the original code in which it was encountered.
OP is not supposed to just ask "about" the original code, but to ask a question motivated by a problem in that code. OP is also supposed to separate the original context from the question as much as makes sense, because questions are not about the people who ask nor those who answer. They're about building a reference, so that everyone can learn answers to questions by searching the site.
Code in your answer should be similarly short. Not only are you not getting paid to write it, you aren't even specifically volunteering to write it. You're volunteering to answer a question.
If you're "researching"
If your copy-paste of code into your own code base is mindless, then you are failing your duty of care as a programmer. A code snippet posted to answer someone else's question will hardly ever work in a vacuum without adaptation to its surroundings - and if it does, it should have been packaged up in a library instead.
A code snippet posted to answer your question is still one where you are responsible for understanding the code and the explanation given by the person who posted it. Stack Overflow is not a place for people to post code to fix and other people to fix it for the OP. That is completely counter to the spirit of the site and actively degrades its usefulness for everyone else. Please see the SO tour as well as Why should I help close "bad" questions that I think are valid, instead of helping the OP with an answer? and What is the point of closing questions for details and clarity, debugging details, needs more focus, or very low quality? for details.
If you're paying attention to the code and will put in the time to review it, then you should have plenty of time to copy and paste it manually. Or even to type it in manually.
If you're a beginner, manually typing in someone else's code - carefully, making sure you have it exact - is a useful exercise. You get to understand the structure of the code and develop the discipline to make all the brackets match up, etc. that a programming language demands.