In copyright lingo (see U.S. Copyright Office), a "derived work" is something that is reworked from a copyrighted work. It's still copyrighted by the owner. You can copyright their work if you obtain permission from them to do so. But I am unsure if that has anything to do with putting copyright lines in your code that says "this function is Copyright 1990 X Software, All Rights Reserved", etc.
Also, according to U.S. Copyright Office, if I remember right, when someone authors something, they own an automatic copyright on it, however, it's not defensible (you have to buy that privilege for about $35). and if you change the code, that's another $35 next year I think.
I noticed the GPL mentions that you can't GPL anything under 10 lines of code (that means no short utility scripts). This is not entirely from copyright law, just a GPL requirement because they wanted a number I think.
How much of someone else's work can I use without getting permission?
Why should I register my work if copyright protection is automatic?
How much do I have to change in order to claim copyright in someone else's work?
Note: the last one is regarding other people's code and what you may do with it/how/permissions. Interesting read.
Copyright Basics mentions the allowable formats of a copyright string (page 4).
This says that there isn't a fixed number of lines/percentage/whatever for "fair use"; it should be just "limited". One book publisher (I won't name names) charge fees for permission, even for little stuff that should actually fall under "fair use" under copyright law. So picking engineering books and book publishers takes a little work for me.
But when you see "All rights reserved", I don't know how fair use comes into play... maybe it still does, but that phrase does come with certain restrictions.