If it is not your post:
Certainly apply proper citations and attribution for content under licenses that require them. I'd say also for code for which no license is specified.
Certainly bring copied content under restrictive licenses to the attention of the moderators (we'll pass it on to the the team).
If it is your post:
Personally I would not use someone else's code for my answer on CodeGolf.SE.
If you are going to use someone else's code, then make sure you have the right to do so, comply with the license and admit that it is not your own up front.