You can accept them on internal networks, just have a file size limit and don't extract them locally, but send to some cloud service for handling. You could even have it work with email attachments if you want.
Basically:
- Put file somewhere
- Spin up runner
- Upload and execute code
- Spin down runner either upon success or after a time limit
- Send result to the student (if it to took too long, that's a fail too)