It is honestly impossible to imagine copy-pasting code and getting it to work without knowing what you're doing.
I had an acquaintance at uni who got a job at a software company by taking credit for a friend's work and basically being the hack & fraud that the person in this post thinks they are - although I didn't realise this at the time. He asked me to help him write some code that was needed for a presentation the next day. I decided to try to help, and I took a look.
It was a bug that required a little epsilon value to be tolerant of small changes in input in order to not constantly fire. I wrote that tiny bit of code and gave it back to him. Then he told me it wasn't working and could I look at it again. I did, and there were two epsilon values with different names in it. I asked him about that and he said he had gotten help from another friend.
He had literally attempted to merge our two functions that did the same thing into one grotesque chimeric piece of code that would only have worked if he had accidentally made one or the other of our snippets inoperative. This was like a 20 line function. It was basic, easy shit. The guy didn't know anything.
I didn't explain this. I told him I couldn't keep troubleshooting this for him and left him to it. To my understanding he was fired and cost that company a lot of money. But really if they couldn't figure out that the programmer they hired couldn't actually program then it's really hard to feel that sorry for them. It seemed like everyone was flying by the seat of their pants.