diff --git a/40-env-update.sh b/40-env-update.sh new file mode 100755 index 000000000..fc13da397 --- /dev/null +++ b/40-env-update.sh @@ -0,0 +1,20 @@ +#! /bin/bash + +if [ -z "$API_URL" ] + +then + echo No API Environment Variable Set. Set "-e API_URL='your-server.tld'" in your Docker Config +else + if [ -f /api_set ] + then + echo API URL Already set to $API_URL + else + echo Setting API URL to: $API_URL + sed -i 's#var apiUrl = localStorageGetItem("api-url") || "https://ce.judge0.com";#var apiUrl = '"$API_URL"'#' /usr/share/nginx/html/js/ide.js + + echo Disabling messages from public Judge CE API + sed -i "s^loadMessages();^^1" /usr/share/nginx/html/js/ide.js + + touch /api_set + fi +fi diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..bd095e56d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM nginx +ADD 40-env-update.sh /docker-entrypoint.d +RUN chmod +x /docker-entrypoint.d/40-env-update.sh +COPY . /usr/share/nginx/html + diff --git a/js/ide.js b/js/ide.js index 61c3ed522..cfb020398 100755 --- a/js/ide.js +++ b/js/ide.js @@ -1,9 +1,8 @@ -var defaultUrl = localStorageGetItem("api-url") || "https://ce.judge0.com"; -var apiUrl = defaultUrl; +var apiUrl = localStorageGetItem("api-url") || "https://ce.judge0.com"; var wait = localStorageGetItem("wait") || true; var check_timeout = 300; -var blinkStatusLine = ((localStorageGetItem("blink") || "true") === "true"); +var blinkStatusLine = (localStorageGetItem("blink") || "true") === "true"; var editorMode = localStorageGetItem("editorMode") || "normal"; var editorModeObject = null; @@ -36,69 +35,76 @@ var timeEnd; var messagesData; var layoutConfig = { - settings: { - showPopoutIcon: false, - reorderEnabled: true - }, - dimensions: { - borderWidth: 3, - headerHeight: 22 + settings: { + showPopoutIcon: false, + reorderEnabled: true, + }, + dimensions: { + borderWidth: 3, + headerHeight: 22, + }, + content: [ + { + type: "column", + content: [ + { + type: "component", + height: 70, + componentName: "source", + id: "source", + title: "SOURCE", + isClosable: false, + componentState: { + readOnly: false, + }, + }, + { + type: "stack", + content: [ + { + type: "component", + componentName: "stdin", + id: "stdin", + title: "Input", + isClosable: false, + componentState: { + readOnly: false, + }, + }, + { + type: "component", + componentName: "stdout", + id: "stdout", + title: "Output", + isClosable: false, + componentState: { + readOnly: true, + }, + }, + ], + }, + ], }, - content: [{ - type: "column", - content: [{ - type: "component", - height: 70, - componentName: "source", - id: "source", - title: "SOURCE", - isClosable: false, - componentState: { - readOnly: false - } - }, { - type: "stack", - content: [{ - type: "component", - componentName: "stdin", - id: "stdin", - title: "Input", - isClosable: false, - componentState: { - readOnly: false - } - }, { - type: "component", - componentName: "stdout", - id: "stdout", - title: "Output", - isClosable: false, - componentState: { - readOnly: true - } - }] - }] - }] + ], }; function encode(str) { - return btoa(unescape(encodeURIComponent(str || ""))); + return btoa(unescape(encodeURIComponent(str || ""))); } function decode(bytes) { - var escaped = escape(atob(bytes || "")); - try { - return decodeURIComponent(escaped); - } catch { - return unescape(escaped); - } + var escaped = escape(atob(bytes || "")); + try { + return decodeURIComponent(escaped); + } catch { + return unescape(escaped); + } } function localStorageSetItem(key, value) { try { localStorage.setItem(key, value); - } catch (ignorable) { - } + } catch (ignorable) {} } function localStorageGetItem(key) { @@ -110,91 +116,100 @@ function localStorageGetItem(key) { } function showMessages() { - var width = $updates.offset().left - parseFloat($updates.css("padding-left")) - - $navigationMessage.parent().offset().left - parseFloat($navigationMessage.parent().css("padding-left")) - 5; - - if (width < 200 || messagesData === undefined) { - return; - } + var width = + $updates.offset().left - + parseFloat($updates.css("padding-left")) - + $navigationMessage.parent().offset().left - + parseFloat($navigationMessage.parent().css("padding-left")) - + 5; + + if (width < 200 || messagesData === undefined) { + return; + } - var messages = messagesData["messages"]; + var messages = messagesData["messages"]; - $navigationMessage.css("animation-duration", messagesData["duration"]); - $navigationMessage.parent().width(width - 5); + $navigationMessage.css("animation-duration", messagesData["duration"]); + $navigationMessage.parent().width(width - 5); - var combinedMessage = ""; - for (var i = 0; i < messages.length; ++i) { - combinedMessage += `${messages[i]}`; - if (i != messages.length - 1) { - combinedMessage += " ".repeat(Math.min(200, messages[i].length)); - } + var combinedMessage = ""; + for (var i = 0; i < messages.length; ++i) { + combinedMessage += `${messages[i]}`; + if (i != messages.length - 1) { + combinedMessage += " ".repeat(Math.min(200, messages[i].length)); } + } - $navigationMessage.html(combinedMessage); + $navigationMessage.html(combinedMessage); } function loadMessages() { - $.ajax({ - url: `https://minio.judge0.com/public/ide/messages.json?${Date.now()}`, - type: "GET", - headers: { - "Accept": "application/json" - }, - success: function (data, textStatus, jqXHR) { - messagesData = data; - showMessages(); - } - }); + $.ajax({ + url: `https://minio.judge0.com/public/ide/messages.json?${Date.now()}`, + type: "GET", + headers: { + Accept: "application/json", + }, + success: function (data, textStatus, jqXHR) { + messagesData = data; + showMessages(); + }, + }); } function showError(title, content) { - $("#site-modal #title").html(title); - $("#site-modal .content").html(content); - $("#site-modal").modal("show"); + $("#site-modal #title").html(title); + $("#site-modal .content").html(content); + $("#site-modal").modal("show"); } function handleError(jqXHR, textStatus, errorThrown) { - showError(`${jqXHR.statusText} (${jqXHR.status})`, `
${JSON.stringify(jqXHR, null, 4)}
`); + showError( + `${jqXHR.statusText} (${jqXHR.status})`, + `
${JSON.stringify(jqXHR, null, 4)}
` + ); } function handleRunError(jqXHR, textStatus, errorThrown) { - handleError(jqXHR, textStatus, errorThrown); - $runBtn.removeClass("loading"); + handleError(jqXHR, textStatus, errorThrown); + $runBtn.removeClass("loading"); } function handleResult(data) { - timeEnd = performance.now(); - console.log("It took " + (timeEnd - timeStart) + " ms to get submission result."); - - var status = data.status; - var stdout = decode(data.stdout); - var compile_output = decode(data.compile_output); - var time = (data.time === null ? "-" : data.time + "s"); - var memory = (data.memory === null ? "-" : data.memory + "KB"); - - $statusLine.html(`${status.description}, ${time}, ${memory}`); - - if (blinkStatusLine) { - $statusLine.addClass("blink"); - setTimeout(function() { - blinkStatusLine = false; - localStorageSetItem("blink", "false"); - $statusLine.removeClass("blink"); - }, 3000); - } + timeEnd = performance.now(); + console.log( + "It took " + (timeEnd - timeStart) + " ms to get submission result." + ); + + var status = data.status; + var stdout = decode(data.stdout); + var compile_output = decode(data.compile_output); + var time = data.time === null ? "-" : data.time + "s"; + var memory = data.memory === null ? "-" : data.memory + "KB"; + + $statusLine.html(`${status.description}, ${time}, ${memory}`); + + if (blinkStatusLine) { + $statusLine.addClass("blink"); + setTimeout(function () { + blinkStatusLine = false; + localStorageSetItem("blink", "false"); + $statusLine.removeClass("blink"); + }, 3000); + } - var output = [compile_output, stdout].join("\n").trim(); + var output = [compile_output, stdout].join("\n").trim(); - stdoutEditor.setValue(output); + stdoutEditor.setValue(output); - if (output !== "") { - var dot = document.getElementById("stdout-dot"); - if (!dot.parentElement.classList.contains("lm_active")) { - dot.hidden = false; - } + if (output !== "") { + var dot = document.getElementById("stdout-dot"); + if (!dot.parentElement.classList.contains("lm_active")) { + dot.hidden = false; } + } - $runBtn.removeClass("loading"); + $runBtn.removeClass("loading"); } function getIdFromURI() { @@ -203,391 +218,418 @@ function getIdFromURI() { } function downloadSource() { - var value = parseInt($selectLanguage.val()); - download(sourceEditor.getValue(), fileNames[value], "text/plain"); + var value = parseInt($selectLanguage.val()); + download(sourceEditor.getValue(), fileNames[value], "text/plain"); } function loadSavedSource() { - snippet_id = getIdFromURI(); - - if (snippet_id.length == 36) { - $.ajax({ - url: apiUrl + "/submissions/" + snippet_id + "?fields=source_code,language_id,stdin,stdout,stderr,compile_output,message,time,memory,status,compiler_options,command_line_arguments&base64_encoded=true", - type: "GET", - success: function(data, textStatus, jqXHR) { - sourceEditor.setValue(decode(data["source_code"])); - $selectLanguage.dropdown("set selected", data["language_id"]); - $compilerOptions.val(data["compiler_options"]); - $commandLineArguments.val(data["command_line_arguments"]); - stdinEditor.setValue(decode(data["stdin"])); - stdoutEditor.setValue(decode(data["stdout"])); - var time = (data.time === null ? "-" : data.time + "s"); - var memory = (data.memory === null ? "-" : data.memory + "KB"); - $statusLine.html(`${data.status.description}, ${time}, ${memory}`); - changeEditorLanguage(); - }, - error: handleRunError - }); - } else { - loadRandomLanguage(); - } + snippet_id = getIdFromURI(); + + if (snippet_id.length == 36) { + $.ajax({ + url: + apiUrl + + "/submissions/" + + snippet_id + + "?fields=source_code,language_id,stdin,stdout,stderr,compile_output,message,time,memory,status,compiler_options,command_line_arguments&base64_encoded=true", + type: "GET", + success: function (data, textStatus, jqXHR) { + sourceEditor.setValue(decode(data["source_code"])); + $selectLanguage.dropdown("set selected", data["language_id"]); + $compilerOptions.val(data["compiler_options"]); + $commandLineArguments.val(data["command_line_arguments"]); + stdinEditor.setValue(decode(data["stdin"])); + stdoutEditor.setValue(decode(data["stdout"])); + var time = data.time === null ? "-" : data.time + "s"; + var memory = data.memory === null ? "-" : data.memory + "KB"; + $statusLine.html(`${data.status.description}, ${time}, ${memory}`); + changeEditorLanguage(); + }, + error: handleRunError, + }); + } else { + loadRandomLanguage(); + } } function run() { - if (sourceEditor.getValue().trim() === "") { - showError("Error", "Source code can't be empty!"); - return; - } else { - $runBtn.addClass("loading"); - } - - document.getElementById("stdout-dot").hidden = true; + if (sourceEditor.getValue().trim() === "") { + showError("Error", "Source code can't be empty!"); + return; + } else { + $runBtn.addClass("loading"); + } - stdoutEditor.setValue(""); + document.getElementById("stdout-dot").hidden = true; - var x = layout.root.getItemsById("stdout")[0]; - x.parent.header.parent.setActiveContentItem(x); + stdoutEditor.setValue(""); - var sourceValue = encode(sourceEditor.getValue()); - var stdinValue = encode(stdinEditor.getValue()); - var languageId = resolveLanguageId($selectLanguage.val()); - var compilerOptions = $compilerOptions.val(); - var commandLineArguments = $commandLineArguments.val(); + var x = layout.root.getItemsById("stdout")[0]; + x.parent.header.parent.setActiveContentItem(x); - if (parseInt(languageId) === 44) { - sourceValue = sourceEditor.getValue(); - } + var sourceValue = encode(sourceEditor.getValue()); + var stdinValue = encode(stdinEditor.getValue()); + var languageId = resolveLanguageId($selectLanguage.val()); + var compilerOptions = $compilerOptions.val(); + var commandLineArguments = $commandLineArguments.val(); - var data = { - source_code: sourceValue, - language_id: languageId, - stdin: stdinValue, - compiler_options: compilerOptions, - command_line_arguments: commandLineArguments, - redirect_stderr_to_stdout: true - }; - - var sendRequest = function(data) { - timeStart = performance.now(); - $.ajax({ - url: apiUrl + `/submissions?base64_encoded=true&wait=${wait}`, - type: "POST", - async: true, - contentType: "application/json", - data: JSON.stringify(data), - xhrFields: { - withCredentials: apiUrl.indexOf("/secure") != -1 ? true : false - }, - success: function (data, textStatus, jqXHR) { - console.log(`Your submission token is: ${data.token}`); - if (wait == true) { - handleResult(data); - } else { - setTimeout(fetchSubmission.bind(null, data.token), check_timeout); - } - }, - error: handleRunError - }); - } + if (parseInt(languageId) === 44) { + sourceValue = sourceEditor.getValue(); + } - var fetchAdditionalFiles = false; - if (parseInt(languageId) === 82) { - if (sqliteAdditionalFiles === "") { - fetchAdditionalFiles = true; - $.ajax({ - url: `https://minio.judge0.com/public/ide/sqliteAdditionalFiles.base64.txt?${Date.now()}`, - type: "GET", - async: true, - contentType: "text/plain", - success: function (responseData, textStatus, jqXHR) { - sqliteAdditionalFiles = responseData; - data["additional_files"] = sqliteAdditionalFiles; - sendRequest(data); - }, - error: handleRunError - }); - } - else { - data["additional_files"] = sqliteAdditionalFiles; + var data = { + source_code: sourceValue, + language_id: languageId, + stdin: stdinValue, + compiler_options: compilerOptions, + command_line_arguments: commandLineArguments, + redirect_stderr_to_stdout: true, + }; + + var sendRequest = function (data) { + timeStart = performance.now(); + $.ajax({ + url: apiUrl + `/submissions?base64_encoded=true&wait=${wait}`, + type: "POST", + async: true, + contentType: "application/json", + data: JSON.stringify(data), + xhrFields: { + withCredentials: apiUrl.indexOf("/secure") != -1 ? true : false, + }, + success: function (data, textStatus, jqXHR) { + console.log(`Your submission token is: ${data.token}`); + if (wait == true) { + handleResult(data); + } else { + setTimeout(fetchSubmission.bind(null, data.token), check_timeout); } + }, + error: handleRunError, + }); + }; + + var fetchAdditionalFiles = false; + if (parseInt(languageId) === 82) { + if (sqliteAdditionalFiles === "") { + fetchAdditionalFiles = true; + $.ajax({ + url: `https://minio.judge0.com/public/ide/sqliteAdditionalFiles.base64.txt?${Date.now()}`, + type: "GET", + async: true, + contentType: "text/plain", + success: function (responseData, textStatus, jqXHR) { + sqliteAdditionalFiles = responseData; + data["additional_files"] = sqliteAdditionalFiles; + sendRequest(data); + }, + error: handleRunError, + }); + } else { + data["additional_files"] = sqliteAdditionalFiles; } + } - if (!fetchAdditionalFiles) { - sendRequest(data); - } + if (!fetchAdditionalFiles) { + sendRequest(data); + } } function fetchSubmission(submission_token) { - $.ajax({ - url: apiUrl + "/submissions/" + submission_token + "?base64_encoded=true", - type: "GET", - async: true, - success: function (data, textStatus, jqXHR) { - if (data.status.id <= 2) { // In Queue or Processing - setTimeout(fetchSubmission.bind(null, submission_token), check_timeout); - return; - } - handleResult(data); - }, - error: handleRunError - }); + $.ajax({ + url: apiUrl + "/submissions/" + submission_token + "?base64_encoded=true", + type: "GET", + async: true, + success: function (data, textStatus, jqXHR) { + if (data.status.id <= 2) { + // In Queue or Processing + setTimeout(fetchSubmission.bind(null, submission_token), check_timeout); + return; + } + handleResult(data); + }, + error: handleRunError, + }); } function changeEditorLanguage() { - monaco.editor.setModelLanguage(sourceEditor.getModel(), $selectLanguage.find(":selected").attr("mode")); - currentLanguageId = parseInt($selectLanguage.val()); - $(".lm_title")[0].innerText = fileNames[currentLanguageId]; - apiUrl = resolveApiUrl($selectLanguage.val()); + monaco.editor.setModelLanguage( + sourceEditor.getModel(), + $selectLanguage.find(":selected").attr("mode") + ); + currentLanguageId = parseInt($selectLanguage.val()); + $(".lm_title")[0].innerText = fileNames[currentLanguageId]; + apiUrl = resolveApiUrl($selectLanguage.val()); } function insertTemplate() { - currentLanguageId = parseInt($selectLanguage.val()); - sourceEditor.setValue(sources[currentLanguageId]); - stdinEditor.setValue(inputs[currentLanguageId] || ""); - $compilerOptions.val(compilerOptions[currentLanguageId] || ""); - changeEditorLanguage(); + currentLanguageId = parseInt($selectLanguage.val()); + sourceEditor.setValue(sources[currentLanguageId]); + stdinEditor.setValue(inputs[currentLanguageId] || ""); + $compilerOptions.val(compilerOptions[currentLanguageId] || ""); + changeEditorLanguage(); } function loadRandomLanguage() { - var values = []; - for (var i = 0; i < $selectLanguage[0].options.length; ++i) { - values.push($selectLanguage[0].options[i].value); - } - // $selectLanguage.dropdown("set selected", values[Math.floor(Math.random() * $selectLanguage[0].length)]); - $selectLanguage.dropdown("set selected", values[19]); - apiUrl = resolveApiUrl($selectLanguage.val()) - insertTemplate(); + var values = []; + for (var i = 0; i < $selectLanguage[0].options.length; ++i) { + values.push($selectLanguage[0].options[i].value); + } + // $selectLanguage.dropdown("set selected", values[Math.floor(Math.random() * $selectLanguage[0].length)]); + $selectLanguage.dropdown("set selected", values[19]); + apiUrl = resolveApiUrl($selectLanguage.val()); + insertTemplate(); } function resizeEditor(layoutInfo) { - if (editorMode != "normal") { - var statusLineHeight = $("#editor-status-line").height(); - layoutInfo.height -= statusLineHeight; - layoutInfo.contentHeight -= statusLineHeight; - } + if (editorMode != "normal") { + var statusLineHeight = $("#editor-status-line").height(); + layoutInfo.height -= statusLineHeight; + layoutInfo.contentHeight -= statusLineHeight; + } } function disposeEditorModeObject() { - try { - editorModeObject.dispose(); - editorModeObject = null; - } catch(ignorable) { - } + try { + editorModeObject.dispose(); + editorModeObject = null; + } catch (ignorable) {} } function changeEditorMode() { - disposeEditorModeObject(); - - if (editorMode == "vim") { - editorModeObject = MonacoVim.initVimMode(sourceEditor, $("#editor-status-line")[0]); - } else if (editorMode == "emacs") { - var statusNode = $("#editor-status-line")[0]; - editorModeObject = new MonacoEmacs.EmacsExtension(sourceEditor); - editorModeObject.onDidMarkChange(function(e) { - statusNode.textContent = e ? "Mark Set!" : "Mark Unset"; - }); - editorModeObject.onDidChangeKey(function(str) { - statusNode.textContent = str; - }); - editorModeObject.start(); - } + disposeEditorModeObject(); + + if (editorMode == "vim") { + editorModeObject = MonacoVim.initVimMode( + sourceEditor, + $("#editor-status-line")[0] + ); + } else if (editorMode == "emacs") { + var statusNode = $("#editor-status-line")[0]; + editorModeObject = new MonacoEmacs.EmacsExtension(sourceEditor); + editorModeObject.onDidMarkChange(function (e) { + statusNode.textContent = e ? "Mark Set!" : "Mark Unset"; + }); + editorModeObject.onDidChangeKey(function (str) { + statusNode.textContent = str; + }); + editorModeObject.start(); + } } function resolveLanguageId(id) { - id = parseInt(id); - return languageIdTable[id] || id; + id = parseInt(id); + return languageIdTable[id] || id; } function resolveApiUrl(id) { - id = parseInt(id); - return languageApiUrlTable[id] || defaultUrl; + id = parseInt(id); + return languageApiUrlTable[id] || apiUrl; } function editorsUpdateFontSize(fontSize) { - sourceEditor.updateOptions({fontSize: fontSize}); - stdinEditor.updateOptions({fontSize: fontSize}); - stdoutEditor.updateOptions({fontSize: fontSize}); + sourceEditor.updateOptions({ fontSize: fontSize }); + stdinEditor.updateOptions({ fontSize: fontSize }); + stdoutEditor.updateOptions({ fontSize: fontSize }); } function updateScreenElements() { - var display = window.innerWidth <= 1200 ? "none" : ""; - $(".wide.screen.only").each(function(index) { - $(this).css("display", display); - }); + var display = window.innerWidth <= 1200 ? "none" : ""; + $(".wide.screen.only").each(function (index) { + $(this).css("display", display); + }); } -$(window).resize(function() { - layout.updateSize(); - updateScreenElements(); - showMessages(); +$(window).resize(function () { + layout.updateSize(); + updateScreenElements(); + showMessages(); }); $(document).ready(function () { - updateScreenElements(); - - console.log("Hey, Judge0 IDE is open-sourced: https://github.com/judge0/ide. Have fun!"); - - $selectLanguage = $("#select-language"); - $selectLanguage.change(function (e) { - if (!isEditorDirty) { - insertTemplate(); - } else { - changeEditorLanguage(); - } - }); + updateScreenElements(); - $compilerOptions = $("#compiler-options"); - $commandLineArguments = $("#command-line-arguments"); - $commandLineArguments.attr("size", $commandLineArguments.attr("placeholder").length); + console.log( + "Hey, Judge0 IDE is open-sourced: https://github.com/judge0/ide. Have fun!" + ); - $insertTemplateBtn = $("#insert-template-btn"); - $insertTemplateBtn.click(function (e) { - if (isEditorDirty && confirm("Are you sure? Your current changes will be lost.")) { - insertTemplate(); - } - }); - - $runBtn = $("#run-btn"); - $runBtn.click(function (e) { - run(); - }); - - $navigationMessage = $("#navigation-message span"); - $updates = $("#judge0-more"); - - $(`input[name="editor-mode"][value="${editorMode}"]`).prop("checked", true); - $("input[name=\"editor-mode\"]").on("change", function(e) { - editorMode = e.target.value; - localStorageSetItem("editorMode", editorMode); + $selectLanguage = $("#select-language"); + $selectLanguage.change(function (e) { + if (!isEditorDirty) { + insertTemplate(); + } else { + changeEditorLanguage(); + } + }); + + $compilerOptions = $("#compiler-options"); + $commandLineArguments = $("#command-line-arguments"); + $commandLineArguments.attr( + "size", + $commandLineArguments.attr("placeholder").length + ); + + $insertTemplateBtn = $("#insert-template-btn"); + $insertTemplateBtn.click(function (e) { + if ( + isEditorDirty && + confirm("Are you sure? Your current changes will be lost.") + ) { + insertTemplate(); + } + }); + + $runBtn = $("#run-btn"); + $runBtn.click(function (e) { + run(); + }); + + $navigationMessage = $("#navigation-message span"); + $updates = $("#judge0-more"); + + $(`input[name="editor-mode"][value="${editorMode}"]`).prop("checked", true); + $('input[name="editor-mode"]').on("change", function (e) { + editorMode = e.target.value; + localStorageSetItem("editorMode", editorMode); + + resizeEditor(sourceEditor.getLayoutInfo()); + changeEditorMode(); + + sourceEditor.focus(); + }); + + $statusLine = $("#status-line"); + + $(document).on("keydown", "body", function (e) { + var keyCode = e.keyCode || e.which; + if (keyCode == 120) { + // F9 + e.preventDefault(); + run(); + } else if (keyCode == 119) { + // F8 + e.preventDefault(); + var url = prompt("Enter URL of Judge0 API:", apiUrl); + if (url != null) { + url = url.trim(); + } + if (url != null && url != "") { + apiUrl = url; + localStorageSetItem("api-url", apiUrl); + } + } else if (keyCode == 118) { + // F7 + e.preventDefault(); + wait = !wait; + localStorageSetItem("wait", wait); + alert(`Submission wait is ${wait ? "ON. Enjoy" : "OFF"}.`); + } else if (event.ctrlKey && keyCode == 107) { + // Ctrl++ + e.preventDefault(); + fontSize += 1; + editorsUpdateFontSize(fontSize); + } else if (event.ctrlKey && keyCode == 109) { + // Ctrl+- + e.preventDefault(); + fontSize -= 1; + editorsUpdateFontSize(fontSize); + } + }); + + $("select.dropdown").dropdown(); + $(".ui.dropdown").dropdown(); + $(".ui.dropdown.site-links").dropdown({ action: "hide", on: "hover" }); + $(".ui.checkbox").checkbox(); + $(".message .close").on("click", function () { + $(this).closest(".message").transition("fade"); + }); + + loadMessages(); + + require([ + "vs/editor/editor.main", + "monaco-vim", + "monaco-emacs", + ], function (ignorable, MVim, MEmacs) { + layout = new GoldenLayout(layoutConfig, $("#site-content")); + + MonacoVim = MVim; + MonacoEmacs = MEmacs; + + layout.registerComponent("source", function (container, state) { + sourceEditor = monaco.editor.create(container.getElement()[0], { + automaticLayout: true, + theme: "vs-dark", + scrollBeyondLastLine: true, + readOnly: state.readOnly, + language: "cpp", + minimap: { + enabled: false, + }, + }); - resizeEditor(sourceEditor.getLayoutInfo()); - changeEditorMode(); + changeEditorMode(); - sourceEditor.focus(); - }); + sourceEditor.getModel().onDidChangeContent(function (e) { + currentLanguageId = parseInt($selectLanguage.val()); + isEditorDirty = sourceEditor.getValue() != sources[currentLanguageId]; + }); - $statusLine = $("#status-line"); - - $(document).on("keydown", "body", function (e) { - var keyCode = e.keyCode || e.which; - if (keyCode == 120) { // F9 - e.preventDefault(); - run(); - } else if (keyCode == 119) { // F8 - e.preventDefault(); - var url = prompt("Enter URL of Judge0 API:", apiUrl); - if (url != null) { - url = url.trim(); - } - if (url != null && url != "") { - apiUrl = url; - localStorageSetItem("api-url", apiUrl); - } - } else if (keyCode == 118) { // F7 - e.preventDefault(); - wait = !wait; - localStorageSetItem("wait", wait); - alert(`Submission wait is ${wait ? "ON. Enjoy" : "OFF"}.`); - } else if (event.ctrlKey && keyCode == 107) { // Ctrl++ - e.preventDefault(); - fontSize += 1; - editorsUpdateFontSize(fontSize); - } else if (event.ctrlKey && keyCode == 109) { // Ctrl+- - e.preventDefault(); - fontSize -= 1; - editorsUpdateFontSize(fontSize); - } + sourceEditor.onDidLayoutChange(resizeEditor); }); - $("select.dropdown").dropdown(); - $(".ui.dropdown").dropdown(); - $(".ui.dropdown.site-links").dropdown({action: "hide", on: "hover"}); - $(".ui.checkbox").checkbox(); - $(".message .close").on("click", function () { - $(this).closest(".message").transition("fade"); + layout.registerComponent("stdin", function (container, state) { + stdinEditor = monaco.editor.create(container.getElement()[0], { + automaticLayout: true, + theme: "vs-dark", + scrollBeyondLastLine: false, + readOnly: state.readOnly, + language: "plaintext", + minimap: { + enabled: false, + }, + }); }); - loadMessages(); - - require(["vs/editor/editor.main", "monaco-vim", "monaco-emacs"], function (ignorable, MVim, MEmacs) { - layout = new GoldenLayout(layoutConfig, $("#site-content")); - - MonacoVim = MVim; - MonacoEmacs = MEmacs; - - layout.registerComponent("source", function (container, state) { - sourceEditor = monaco.editor.create(container.getElement()[0], { - automaticLayout: true, - theme: "vs-dark", - scrollBeyondLastLine: true, - readOnly: state.readOnly, - language: "cpp", - minimap: { - enabled: false - } - }); - - changeEditorMode(); - - sourceEditor.getModel().onDidChangeContent(function (e) { - currentLanguageId = parseInt($selectLanguage.val()); - isEditorDirty = sourceEditor.getValue() != sources[currentLanguageId]; - }); - - sourceEditor.onDidLayoutChange(resizeEditor); - }); - - layout.registerComponent("stdin", function (container, state) { - stdinEditor = monaco.editor.create(container.getElement()[0], { - automaticLayout: true, - theme: "vs-dark", - scrollBeyondLastLine: false, - readOnly: state.readOnly, - language: "plaintext", - minimap: { - enabled: false - } - }); - }); - - layout.registerComponent("stdout", function (container, state) { - stdoutEditor = monaco.editor.create(container.getElement()[0], { - automaticLayout: true, - theme: "vs-dark", - scrollBeyondLastLine: false, - readOnly: state.readOnly, - language: "plaintext", - minimap: { - enabled: false - } - }); - - container.on("tab", function(tab) { - tab.element.append(""); - tab.element.on("mousedown", function(e) { - e.target.closest(".lm_tab").children[3].hidden = true; - }); - }); - }); + layout.registerComponent("stdout", function (container, state) { + stdoutEditor = monaco.editor.create(container.getElement()[0], { + automaticLayout: true, + theme: "vs-dark", + scrollBeyondLastLine: false, + readOnly: state.readOnly, + language: "plaintext", + minimap: { + enabled: false, + }, + }); - layout.on("initialised", function () { - $(".monaco-editor")[0].appendChild($("#editor-status-line")[0]); - if (getIdFromURI()) { - loadSavedSource(); - } else { - loadRandomLanguage(); - } - $("#site-navigation").css("border-bottom", "1px solid black"); - sourceEditor.focus(); - editorsUpdateFontSize(fontSize); + container.on("tab", function (tab) { + tab.element.append(''); + tab.element.on("mousedown", function (e) { + e.target.closest(".lm_tab").children[3].hidden = true; }); + }); + }); - layout.init(); + layout.on("initialised", function () { + $(".monaco-editor")[0].appendChild($("#editor-status-line")[0]); + if (getIdFromURI()) { + loadSavedSource(); + } else { + loadRandomLanguage(); + } + $("#site-navigation").css("border-bottom", "1px solid black"); + sourceEditor.focus(); + editorsUpdateFontSize(fontSize); }); + + layout.init(); + }); }); // Template Sources -var assemblySource = "\ +var assemblySource = + "\ section .text\n\ global _start\n\ \n\ @@ -610,38 +652,42 @@ msg db 'hello, world', 0xa\n\ len equ $ - msg\n\ "; -var bashSource = "echo \"hello, world\""; +var bashSource = 'echo "hello, world"'; -var basicSource = "PRINT \"hello, world\""; +var basicSource = 'PRINT "hello, world"'; -var cSource = "\ +var cSource = + '\ // Powered by Judge0\n\ #include \n\ \n\ int main(void) {\n\ - printf(\"Hello Judge0!\\n\");\n\ + printf("Hello Judge0!\\n");\n\ return 0;\n\ }\n\ -"; +'; -var csharpSource = "\ +var csharpSource = + '\ public class Hello {\n\ public static void Main() {\n\ - System.Console.WriteLine(\"hello, world\");\n\ + System.Console.WriteLine("hello, world");\n\ }\n\ }\n\ -"; +'; -var cppSource = "\ +var cppSource = + '\ #include \n\ \n\ int main() {\n\ - std::cout << \"hello, world\" << std::endl;\n\ + std::cout << "hello, world" << std::endl;\n\ return 0;\n\ }\n\ -"; +'; -var competitiveProgrammingSource = "\ +var competitiveProgrammingSource = + "\ #include \n\ #include \n\ #include \n\ @@ -748,151 +794,167 @@ int main()\n\ }\n\ "; -var clojureSource = "(println \"hello, world\")\n"; +var clojureSource = '(println "hello, world")\n'; -var cobolSource = "\ +var cobolSource = + '\ IDENTIFICATION DIVISION.\n\ PROGRAM-ID. MAIN.\n\ PROCEDURE DIVISION.\n\ -DISPLAY \"hello, world\".\n\ +DISPLAY "hello, world".\n\ STOP RUN.\n\ -"; +'; -var lispSource = "(write-line \"hello, world\")"; +var lispSource = '(write-line "hello, world")'; -var dSource = "\ +var dSource = + '\ import std.stdio;\n\ \n\ void main()\n\ {\n\ - writeln(\"hello, world\");\n\ + writeln("hello, world");\n\ }\n\ -"; +'; -var elixirSource = "IO.puts \"hello, world\""; +var elixirSource = 'IO.puts "hello, world"'; -var erlangSource = "\ +var erlangSource = + '\ main(_) ->\n\ - io:fwrite(\"hello, world\\n\").\n\ -"; + io:fwrite("hello, world\\n").\n\ +'; -var executableSource = "\ +var executableSource = + '\ Judge0 IDE assumes that content of executable is Base64 encoded.\n\ \n\ This means that you should Base64 encode content of your binary,\n\ -paste it here and click \"Run\".\n\ +paste it here and click "Run".\n\ \n\ -Here is an example of compiled \"hello, world\" NASM program.\n\ +Here is an example of compiled "hello, world" NASM program.\n\ Content of compiled binary is Base64 encoded and used as source code.\n\ \n\ https://ide.judge0.com/?kS_f\n\ -"; +'; -var fsharpSource = "printfn \"hello, world\"\n"; +var fsharpSource = 'printfn "hello, world"\n'; -var fortranSource = "\ +var fortranSource = + '\ program main\n\ - print *, \"hello, world\"\n\ + print *, "hello, world"\n\ end\n\ -"; +'; -var goSource = "\ +var goSource = + '\ package main\n\ \n\ -import \"fmt\"\n\ +import "fmt"\n\ \n\ func main() {\n\ - fmt.Println(\"hello, world\")\n\ + fmt.Println("hello, world")\n\ }\n\ -"; +'; -var groovySource = "println \"hello, world\"\n"; +var groovySource = 'println "hello, world"\n'; -var haskellSource = "main = putStrLn \"hello, world\""; +var haskellSource = 'main = putStrLn "hello, world"'; -var javaSource = "\ +var javaSource = + '\ public class Main {\n\ public static void main(String[] args) {\n\ - System.out.println(\"hello, world\");\n\ + System.out.println("hello, world");\n\ }\n\ }\n\ -"; +'; -var javaScriptSource = "console.log(\"hello, world\");"; +var javaScriptSource = 'console.log("hello, world");'; -var kotlinSource = "\ +var kotlinSource = + '\ fun main() {\n\ - println(\"hello, world\")\n\ + println("hello, world")\n\ }\n\ -"; +'; -var luaSource = "print(\"hello, world\")"; +var luaSource = 'print("hello, world")'; -var objectiveCSource = "\ +var objectiveCSource = + '\ #import \n\ \n\ int main() {\n\ @autoreleasepool {\n\ char name[10];\n\ - scanf(\"%s\", name);\n\ - NSString *message = [NSString stringWithFormat:@\"hello, %s\\n\", name];\n\ - printf(\"%s\", message.UTF8String);\n\ + scanf("%s", name);\n\ + NSString *message = [NSString stringWithFormat:@"hello, %s\\n", name];\n\ + printf("%s", message.UTF8String);\n\ }\n\ return 0;\n\ }\n\ -"; +'; -var ocamlSource = "print_endline \"hello, world\""; +var ocamlSource = 'print_endline "hello, world"'; -var octaveSource = "printf(\"hello, world\\n\");"; +var octaveSource = 'printf("hello, world\\n");'; -var pascalSource = "\ +var pascalSource = + "\ program Hello;\n\ begin\n\ writeln ('hello, world')\n\ end.\n\ "; -var perlSource = "\ +var perlSource = + '\ my $name = ;\n\ -print \"hello, $name\";\n\ -"; +print "hello, $name";\n\ +'; -var phpSource = "\ +var phpSource = + '\ \n\ -"; +'; var plainTextSource = "hello, world\n"; -var prologSource = "\ +var prologSource = + "\ :- initialization(main).\n\ main :- write('hello, world\\n').\n\ "; -var pythonSource = "print(\"hello, world\")"; +var pythonSource = 'print("hello, world")'; -var rSource = "cat(\"hello, world\\n\")"; +var rSource = 'cat("hello, world\\n")'; -var rubySource = "puts \"hello, world\""; +var rubySource = 'puts "hello, world"'; -var rustSource = "\ +var rustSource = + '\ fn main() {\n\ - println!(\"hello, world\");\n\ + println!("hello, world");\n\ }\n\ -"; +'; -var scalaSource = "\ +var scalaSource = + '\ object Main {\n\ def main(args: Array[String]) = {\n\ val name = scala.io.StdIn.readLine()\n\ - println(\"hello, \"+ name)\n\ + println("hello, "+ name)\n\ }\n\ }\n\ -"; +'; -var sqliteSource = "\ +var sqliteSource = + "\ -- On Judge0 IDE your SQL script is run on chinook database (https://www.sqlitetutorial.net/sqlite-sample-database).\n\ -- For more information about how to use SQL with Judge0 API please\n\ -- watch this asciicast: https://asciinema.org/a/326975.\n\ @@ -906,23 +968,26 @@ LIMIT 4;\n\ "; var sqliteAdditionalFiles = ""; -var swiftSource = "\ +var swiftSource = + '\ import Foundation\n\ let name = readLine()\n\ -print(\"hello, \\(name!)\")\n\ -"; +print("hello, \\(name!)")\n\ +'; -var typescriptSource = "console.log(\"hello, world\");"; +var typescriptSource = 'console.log("hello, world");'; -var vbSource = "\ +var vbSource = + '\ Public Module Program\n\ Public Sub Main()\n\ - Console.WriteLine(\"hello, world\")\n\ + Console.WriteLine("hello, world")\n\ End Sub\n\ End Module\n\ -"; +'; -var c3Source = "\ +var c3Source = + '\ // On the Judge0 IDE, C3 is automatically\n\ // updated every hour to the latest commit on master branch.\n\ module main;\n\ @@ -931,12 +996,13 @@ extern func void printf(char *str, ...);\n\ \n\ func int main()\n\ {\n\ - printf(\"hello, world\\n\");\n\ + printf("hello, world\\n");\n\ return 0;\n\ }\n\ -"; +'; -var javaTestSource = "\ +var javaTestSource = + "\ import static org.junit.jupiter.api.Assertions.assertEquals;\n\ \n\ import org.junit.jupiter.api.Test;\n\ @@ -957,8 +1023,9 @@ class MainTest {\n\ }\n\ "; -var mpiccSource = "\ -// Try adding \"-n 5\" (without quotes) into command line arguments. \n\ +var mpiccSource = + '\ +// Try adding "-n 5" (without quotes) into command line arguments. \n\ #include \n\ \n\ #include \n\ @@ -973,16 +1040,17 @@ int main()\n\ int world_rank;\n\ MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);\n\ \n\ - printf(\"Hello from processor with rank %d out of %d processors.\\n\", world_rank, world_size);\n\ + printf("Hello from processor with rank %d out of %d processors.\\n", world_rank, world_size);\n\ \n\ MPI_Finalize();\n\ \n\ return 0;\n\ }\n\ -"; +'; -var mpicxxSource = "\ -// Try adding \"-n 5\" (without quotes) into command line arguments. \n\ +var mpicxxSource = + '\ +// Try adding "-n 5" (without quotes) into command line arguments. \n\ #include \n\ \n\ #include \n\ @@ -997,50 +1065,54 @@ int main()\n\ int world_rank;\n\ MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);\n\ \n\ - std::cout << \"Hello from processor with rank \"\n\ - << world_rank << \" out of \" << world_size << \" processors.\\n\";\n\ + std::cout << "Hello from processor with rank "\n\ + << world_rank << " out of " << world_size << " processors.\\n";\n\ \n\ MPI_Finalize();\n\ \n\ return 0;\n\ }\n\ -"; +'; -var mpipySource = "\ -# Try adding \"-n 5\" (without quotes) into command line arguments. \n\ +var mpipySource = + '\ +# Try adding "-n 5" (without quotes) into command line arguments. \n\ from mpi4py import MPI\n\ \n\ comm = MPI.COMM_WORLD\n\ world_size = comm.Get_size()\n\ world_rank = comm.Get_rank()\n\ \n\ -print(f\"Hello from processor with rank {world_rank} out of {world_size} processors\")\n\ -"; +print(f"Hello from processor with rank {world_rank} out of {world_size} processors")\n\ +'; -var nimSource = "\ +var nimSource = + '\ # On the Judge0 IDE, Nim is automatically\n\ # updated every day to the latest stable version.\n\ -echo \"hello, world\"\n\ -"; +echo "hello, world"\n\ +'; -var pythonForMlSource = "\ +var pythonForMlSource = + '\ import mlxtend\n\ import numpy\n\ import pandas\n\ import scipy\n\ import sklearn\n\ \n\ -print(\"hello, world\")\n\ -"; +print("hello, world")\n\ +'; -var bosqueSource = "\ +var bosqueSource = + '\ // On the Judge0 IDE, Bosque (https://github.com/microsoft/BosqueLanguage)\n\ // is automatically updated every hour to the latest commit on master branch.\n\ \n\ namespace NSMain;\n\ \n\ concept WithName {\n\ - invariant $name != \"\";\n\ + invariant $name != "";\n\ \n\ field name: String;\n\ }\n\ @@ -1049,7 +1121,7 @@ concept Greeting {\n\ abstract method sayHello(): String;\n\ \n\ virtual method sayGoodbye(): String {\n\ - return \"goodbye\";\n\ + return "goodbye";\n\ }\n\ }\n\ \n\ @@ -1057,31 +1129,32 @@ entity GenericGreeting provides Greeting {\n\ const instance: GenericGreeting = GenericGreeting@{};\n\ \n\ override method sayHello(): String {\n\ - return \"hello world\";\n\ + return "hello world";\n\ }\n\ }\n\ \n\ entity NamedGreeting provides WithName, Greeting {\n\ override method sayHello(): String {\n\ - return String::concat(\"hello\", \" \", this.name);\n\ + return String::concat("hello", " ", this.name);\n\ }\n\ }\n\ \n\ entrypoint function main(arg?: String): String {\n\ - var val = arg ?| \"\";\n\ - if (val == \"1\") {\n\ + var val = arg ?| "";\n\ + if (val == "1") {\n\ return GenericGreeting@{}.sayHello();\n\ }\n\ - elif (val == \"2\") {\n\ + elif (val == "2") {\n\ return GenericGreeting::instance.sayHello();\n\ }\n\ else {\n\ - return NamedGreeting@{name=\"bob\"}.sayHello();\n\ + return NamedGreeting@{name="bob"}.sayHello();\n\ }\n\ }\n\ -"; +'; -var cppTestSource = "\ +var cppTestSource = + "\ #include \n\ \n\ int add(int x, int y) {\n\ @@ -1104,7 +1177,8 @@ int main(int argc, char **argv) {\n\ }\n\ "; -var csharpTestSource ="\ +var csharpTestSource = + "\ using NUnit.Framework;\n\ \n\ public class Calculator\n\ @@ -1143,187 +1217,188 @@ public class Tests\n\ "; var sources = { - 45: assemblySource, - 46: bashSource, - 47: basicSource, - 48: cSource, - 49: cSource, - 50: cSource, - 51: csharpSource, - 52: cppSource, - 53: cppSource, - 54: competitiveProgrammingSource, - 55: lispSource, - 56: dSource, - 57: elixirSource, - 58: erlangSource, - 44: executableSource, - 59: fortranSource, - 60: goSource, - 61: haskellSource, - 62: javaSource, - 63: javaScriptSource, - 64: luaSource, - 65: ocamlSource, - 66: octaveSource, - 67: pascalSource, - 68: phpSource, - 43: plainTextSource, - 69: prologSource, - 70: pythonSource, - 71: pythonSource, - 72: rubySource, - 73: rustSource, - 74: typescriptSource, - 75: cSource, - 76: cppSource, - 77: cobolSource, - 78: kotlinSource, - 79: objectiveCSource, - 80: rSource, - 81: scalaSource, - 82: sqliteSource, - 83: swiftSource, - 84: vbSource, - 85: perlSource, - 86: clojureSource, - 87: fsharpSource, - 88: groovySource, - 1001: cSource, - 1002: cppSource, - 1003: c3Source, - 1004: javaSource, - 1005: javaTestSource, - 1006: mpiccSource, - 1007: mpicxxSource, - 1008: mpipySource, - 1009: nimSource, - 1010: pythonForMlSource, - 1011: bosqueSource, - 1012: cppTestSource, - 1013: cSource, - 1014: cppSource, - 1015: cppTestSource, - 1021: csharpSource, - 1022: csharpSource, - 1023: csharpTestSource, - 1024: fsharpSource + 45: assemblySource, + 46: bashSource, + 47: basicSource, + 48: cSource, + 49: cSource, + 50: cSource, + 51: csharpSource, + 52: cppSource, + 53: cppSource, + 54: competitiveProgrammingSource, + 55: lispSource, + 56: dSource, + 57: elixirSource, + 58: erlangSource, + 44: executableSource, + 59: fortranSource, + 60: goSource, + 61: haskellSource, + 62: javaSource, + 63: javaScriptSource, + 64: luaSource, + 65: ocamlSource, + 66: octaveSource, + 67: pascalSource, + 68: phpSource, + 43: plainTextSource, + 69: prologSource, + 70: pythonSource, + 71: pythonSource, + 72: rubySource, + 73: rustSource, + 74: typescriptSource, + 75: cSource, + 76: cppSource, + 77: cobolSource, + 78: kotlinSource, + 79: objectiveCSource, + 80: rSource, + 81: scalaSource, + 82: sqliteSource, + 83: swiftSource, + 84: vbSource, + 85: perlSource, + 86: clojureSource, + 87: fsharpSource, + 88: groovySource, + 1001: cSource, + 1002: cppSource, + 1003: c3Source, + 1004: javaSource, + 1005: javaTestSource, + 1006: mpiccSource, + 1007: mpicxxSource, + 1008: mpipySource, + 1009: nimSource, + 1010: pythonForMlSource, + 1011: bosqueSource, + 1012: cppTestSource, + 1013: cSource, + 1014: cppSource, + 1015: cppTestSource, + 1021: csharpSource, + 1022: csharpSource, + 1023: csharpTestSource, + 1024: fsharpSource, }; var fileNames = { - 45: "main.asm", - 46: "script.sh", - 47: "main.bas", - 48: "main.c", - 49: "main.c", - 50: "main.c", - 51: "Main.cs", - 52: "main.cpp", - 53: "main.cpp", - 54: "main.cpp", - 55: "script.lisp", - 56: "main.d", - 57: "script.exs", - 58: "main.erl", - 44: "a.out", - 59: "main.f90", - 60: "main.go", - 61: "main.hs", - 62: "Main.java", - 63: "script.js", - 64: "script.lua", - 65: "main.ml", - 66: "script.m", - 67: "main.pas", - 68: "script.php", - 43: "text.txt", - 69: "main.pro", - 70: "script.py", - 71: "script.py", - 72: "script.rb", - 73: "main.rs", - 74: "script.ts", - 75: "main.c", - 76: "main.cpp", - 77: "main.cob", - 78: "Main.kt", - 79: "main.m", - 80: "script.r", - 81: "Main.scala", - 82: "script.sql", - 83: "Main.swift", - 84: "Main.vb", - 85: "script.pl", - 86: "main.clj", - 87: "script.fsx", - 88: "script.groovy", - 1001: "main.c", - 1002: "main.cpp", - 1003: "main.c3", - 1004: "Main.java", - 1005: "MainTest.java", - 1006: "main.c", - 1007: "main.cpp", - 1008: "script.py", - 1009: "main.nim", - 1010: "script.py", - 1011: "main.bsq", - 1012: "main.cpp", - 1013: "main.c", - 1014: "main.cpp", - 1015: "main.cpp", - 1021: "Main.cs", - 1022: "Main.cs", - 1023: "Test.cs", - 1024: "script.fsx" + 45: "main.asm", + 46: "script.sh", + 47: "main.bas", + 48: "main.c", + 49: "main.c", + 50: "main.c", + 51: "Main.cs", + 52: "main.cpp", + 53: "main.cpp", + 54: "main.cpp", + 55: "script.lisp", + 56: "main.d", + 57: "script.exs", + 58: "main.erl", + 44: "a.out", + 59: "main.f90", + 60: "main.go", + 61: "main.hs", + 62: "Main.java", + 63: "script.js", + 64: "script.lua", + 65: "main.ml", + 66: "script.m", + 67: "main.pas", + 68: "script.php", + 43: "text.txt", + 69: "main.pro", + 70: "script.py", + 71: "script.py", + 72: "script.rb", + 73: "main.rs", + 74: "script.ts", + 75: "main.c", + 76: "main.cpp", + 77: "main.cob", + 78: "Main.kt", + 79: "main.m", + 80: "script.r", + 81: "Main.scala", + 82: "script.sql", + 83: "Main.swift", + 84: "Main.vb", + 85: "script.pl", + 86: "main.clj", + 87: "script.fsx", + 88: "script.groovy", + 1001: "main.c", + 1002: "main.cpp", + 1003: "main.c3", + 1004: "Main.java", + 1005: "MainTest.java", + 1006: "main.c", + 1007: "main.cpp", + 1008: "script.py", + 1009: "main.nim", + 1010: "script.py", + 1011: "main.bsq", + 1012: "main.cpp", + 1013: "main.c", + 1014: "main.cpp", + 1015: "main.cpp", + 1021: "Main.cs", + 1022: "Main.cs", + 1023: "Test.cs", + 1024: "script.fsx", }; var languageIdTable = { - 1001: 1, - 1002: 2, - 1003: 3, - 1004: 4, - 1005: 5, - 1006: 6, - 1007: 7, - 1008: 8, - 1009: 9, - 1010: 10, - 1011: 11, - 1012: 12, - 1013: 13, - 1014: 14, - 1015: 15, - 1021: 21, - 1022: 22, - 1023: 23, - 1024: 24 -} + 1001: 1, + 1002: 2, + 1003: 3, + 1004: 4, + 1005: 5, + 1006: 6, + 1007: 7, + 1008: 8, + 1009: 9, + 1010: 10, + 1011: 11, + 1012: 12, + 1013: 13, + 1014: 14, + 1015: 15, + 1021: 21, + 1022: 22, + 1023: 23, + 1024: 24, +}; var extraApiUrl = "https://extra-ce.judge0.com"; var languageApiUrlTable = { - 1001: extraApiUrl, - 1002: extraApiUrl, - 1003: extraApiUrl, - 1004: extraApiUrl, - 1005: extraApiUrl, - 1006: extraApiUrl, - 1007: extraApiUrl, - 1008: extraApiUrl, - 1009: extraApiUrl, - 1010: extraApiUrl, - 1011: extraApiUrl, - 1012: extraApiUrl, - 1013: extraApiUrl, - 1014: extraApiUrl, - 1015: extraApiUrl, - 1021: extraApiUrl, - 1022: extraApiUrl, - 1023: extraApiUrl, - 1024: extraApiUrl -} + 1001: extraApiUrl, + 1002: extraApiUrl, + 1003: extraApiUrl, + 1004: extraApiUrl, + 1005: extraApiUrl, + 1006: extraApiUrl, + 1007: extraApiUrl, + 1008: extraApiUrl, + 1009: extraApiUrl, + 1010: extraApiUrl, + 1011: extraApiUrl, + 1012: extraApiUrl, + 1013: extraApiUrl, + 1014: extraApiUrl, + 1015: extraApiUrl, + 1021: extraApiUrl, + 1022: extraApiUrl, + 1023: extraApiUrl, + 1024: extraApiUrl, +}; -var competitiveProgrammingInput = "\ +var competitiveProgrammingInput = + "\ 3\n\ 3 2\n\ 1 2 5\n\ @@ -1340,11 +1415,12 @@ var competitiveProgrammingInput = "\ "; var inputs = { - 54: competitiveProgrammingInput -} + 54: competitiveProgrammingInput, +}; -var competitiveProgrammingCompilerOptions = "-O3 --std=c++17 -Wall -Wextra -Wold-style-cast -Wuseless-cast -Wnull-dereference -Werror -Wfatal-errors -pedantic -pedantic-errors"; +var competitiveProgrammingCompilerOptions = + "-O3 --std=c++17 -Wall -Wextra -Wold-style-cast -Wuseless-cast -Wnull-dereference -Werror -Wfatal-errors -pedantic -pedantic-errors"; var compilerOptions = { - 54: competitiveProgrammingCompilerOptions -} + 54: competitiveProgrammingCompilerOptions, +};