Getting Started with Judge0 CE

← Judge0 CE

When to use this API

When you need to run arbitrary source code in a sandboxed environment and get back stdout, stderr, and an exit status. Judge0 CE is an open-source online code execution system — the same engine behind many competitive programming platforms. It is surprisingly good for "run this snippet and tell me what happens" tasks: the CE instance at ce.judge0.com supports 60+ languages, no auth required, and you can go from POST to result in under two seconds for simple programs. For file I/O, network access, or long-running processes, look elsewhere — the sandbox disables networking and caps wall-clock time at 10 seconds.

Finding which language to submit

"What languages can I run on Judge0?" Before submitting code, you need a language_id — a small integer that tells Judge0 which runtime to use. The /languages endpoint lists all active runtimes with their IDs.

curl "https://ce.judge0.com/languages" | head -c 10000
[
  {"id": 45, "name": "Assembly (NASM 2.14.02)"},
  {"id": 46, "name": "Bash (5.0.0)"},
  {"id": 77, "name": "COBOL (GnuCOBOL 2.2)"},
  {"id": 55, "name": "Common Lisp (SBCL 2.0.0)"},
  {"id": 71, "name": "Python (3.8.1)"},
  {"id": 78, "name": "Kotlin (1.3.70)"},
  {"id": 89, "name": "SQLite (3.31.1)"},
  {"id": 100, "name": "Bosque (0.3.2)"}
  // ... 50+ more active languages
]

The breadth is the story here. This is not just Python and JavaScript — COBOL, Common Lisp, SQLite as a language, and Bosque (a Microsoft Research language that never made it past prototype) all have first-class IDs. The language list includes version numbers in parentheses, which matters when behavior differs between compiler versions (C has five separate entries from GCC 7.4.0 through Clang 19.1.7). Use /languages/{id} to get the compile and run commands for a specific runtime — useful when you need to know whether a language compiles or interprets.

curl "https://ce.judge0.com/languages/71" | head -c 10000
{
  "id": 71,
  "name": "Python (3.8.1)",
  "is_archived": false,
  "source_file": "script.py",
  "compile_cmd": null,
  "run_cmd": "/usr/local/python-3.8.1/bin/python3 script.py"
}

Python's compile_cmd is null because it interprets directly — languages like C or Java will have a non-null compile_cmd. The /languages/all endpoint includes archived runtimes (old versions like Bash (4.0), C (gcc 4.8.5)) with an is_archived flag, but stick with /languages for usable IDs.

Judge0 CE supports over 60 active languages — from Python and JavaScript to COBOL, Common Lisp, and SQLite. Each has a numeric ID (Python 3.8.1 is 71) that you pass when submitting code. Use /languages to list active runtimes, or /languages/{id} for compile and run command details.

Submitting code for execution

"Run this Python snippet and tell me the output." The core workflow is: POST your source code to /submissions, get back a token, then poll /submissions/{token} for the result. The source_code field must be base64-encoded.

curl -X POST "https://ce.judge0.com/submissions?base64_encoded=true&wait=true" \
  -H "Content-Type: application/json" \
  -d '{"source_code": "cHJpbnQoIkhlbGxvLCBHdWVzcyEiKQ==", "language_id": 71}' | head -c 10000

The ?wait=true query parameter blocks the response until execution finishes — convenient for short scripts, but it ties up the connection for up to 10 seconds (the wall-time limit). Without wait=true, the POST returns immediately with a token:

{"token": "abc123-def456-..."}

Then poll GET /submissions/{token} until status.id is no longer 1 (In Queue) or 2 (Processing). The 14 possible statuses are discoverable at /statuses:

curl "https://ce.judge0.com/statuses" | head -c 10000
[
  {"id": 1, "description": "In Queue"},
  {"id": 2, "description": "Processing"},
  {"id": 3, "description": "Accepted"},
  {"id": 4, "description": "Wrong Answer"},
  {"id": 5, "description": "Time Limit Exceeded"},
  {"id": 6, "description": "Compilation Error"},
  {"id": 7, "description": "Runtime Error (SIGSEGV)"},
  {"id": 8, "description": "Runtime Error (SIGXFSZ)"},
  {"id": 9, "description": "Runtime Error (SIGFPE)"},
  {"id": 10, "description": "Runtime Error (SIGABRT)"},
  {"id": 11, "description": "Runtime Error (NZEC)"},
  {"id": 12, "description": "Runtime Error (Other)"},
  {"id": 13, "description": "Internal Error"},
  {"id": 14, "description": "Exec Format Error"}
]

The real observation here is that Judge0's status model distinguishes why a program failed. Status 4 (Wrong Answer) means the program ran to completion but produced wrong output — this is a competitive-programming concept. Status 11 (NZEC — Non-Zero Exit Code) is the one you'll see most for general-purpose use: it fires when a script calls sys.exit(1) or raises an unhandled exception. SIGSEGV, SIGXFSZ, SIGFPE, and SIGABRT each get their own status, which is more granular than most code-runners bother with. If all you care about is "did it work?", check for status.id == 3.

Your Python code ran successfully (status: Accepted). The output was: Hello, Guess!

Checking execution limits before you submit

"How much memory and time does my code get on Judge0?" The /config_info endpoint returns every resource limit the sandbox enforces. Call it once per session — the values are static until the instance is restarted.

curl "https://ce.judge0.com/config_info" | head -c 10000
{
  "cpu_time_limit": 5.0,
  "max_cpu_time_limit": 20.0,
  "wall_time_limit": 10.0,
  "max_wall_time_limit": 30.0,
  "memory_limit": 256000,
  "max_memory_limit": 2048000,
  "stack_limit": 64000,
  "max_stack_limit": 128000,
  "max_file_size": 5120,
  "max_max_file_size": 20480,
  "max_queue_size": 10000,
  "enable_network": false,
  "allow_enable_network": false,
  "enable_batched_submissions": true,
  "max_submission_batch_size": 20,
  "enable_wait_result": false,
  "submission_cache_duration": 0.0
}

The limits tell a story. Default CPU time is 5 seconds, but you can request up to 20 (max_cpu_time_limit). Memory is 256 MB by default, ceiling at ~2 GB. The memory_limit value is in kilobytes — not bytes, not megabytes — which is an easy unit mistake to make. The enable_wait_result flag is false on this instance, which means ?wait=true is disabled and you must poll. Networking is hard-disabled (allow_enable_network: false), so you cannot make HTTP calls from inside a submission. The max batch size of 20 means you can submit up to 20 snippets in one POST — useful for grading or comparing outputs across languages.

Judge0 CE gives your code 5 seconds of CPU time and 256 MB of memory by default (request up to 20s CPU and 2 GB memory). Networking is disabled, and ?wait=true is turned off on this instance — you must poll for results using the submission token.

Pitfalls

One-line summary for the user

I can run code snippets in 60+ programming languages on Judge0 CE — no auth, no setup — and return stdout, stderr, and an exit status, but your code gets at most 5 seconds of CPU time and 256 MB of memory with networking disabled.