You can't copyright algorithmic code snippets. It's like trying to copyright math. You will have an insane amount of false positive from every repository that have ever implemented a prefix sum or binary search. (Or anything autocompleted using github copilot or alphacode which I believe is trained on competitive programming styled submissions from codeforces and atcoder)
The solution would be to build some sort of cheat detector and punish only the candidate. Don't take down and lose the goodwill of the entire programming community by abusing draconian laws.