It's up to the accuser to prove that they copied it and did not actually write it from scratch as they claimed.
Only after that would the burden be on the defendants, such as to give a defense that their usage is sufficiently transformative to qualify as fair use.