can we copy other peoples codes and publish them?
Like on khan achademy? or on replit itself?
That, my friend, is called theft, and it has happened a few times to me in the past.
General rule of thumb: ask the creator first! That's a surefire way of getting the answer you need. Also look around for any licenses, readmes, or copyright claims laying around in the code.
What project do you plan on running, may I ask?