Stack Overflow has seen a substantial decline in traffic over the last year that appears to be accelerating. https://observablehq.com/@ayhanfuat/the-fall-of-stack-overflow
You can have it generate shitty code and then compare it against examples it finds online to iterate that code. Also, it was trained on the whole internet, including those good solutions, and can often reproduce them on its own. but you have to tell it, explicitly, to do all this to make better code, rather than just asking for the code.