in reply to
how to get rid of cut-and-paste sins?
To put your question in different terms: How do I detect plagiarism, even if it's done by me? ;-)
There's a paper on that topic here, it's about a program called moss.
There are other code similarity analyzers out there, it's surely worth a look.
If you want to detect blatant copy & paste a simple similarity search should be enough, for anything more elaborate you need a parse tree or an AST on which you can perform similarity checks.
There's much research done on that topic, you should fine some useful papers and implementations with your favorite search engine ;-)