Advertising & privacy

How this site makes money β€” and what it refuses to do

This page exists because "free" usually hides something. Here is the whole thing, in plain language, with the actual code that runs on the site. No fine print.

The short version

Claim 1 β€” your code is not uploaded

Everything you type is compiled by JSCPP, a C++ interpreter written in JavaScript, loaded once into your page:

// js/site.js β€” the only place the engine is fetched
var SELF = document.currentScript;
var VENDOR_BASE = (function () {
  var src = (SELF && SELF.src) || "";
  var i = src.indexOf("js/site.js");
  return i >= 0 ? src.slice(0, i) : "";   // works from /, /zh/ and /es/
})();

// A local file that ships with the site. Not a CDN β€” the page loads
// nothing from a third-party host.
var JSCPP_URL = VENDOR_BASE + "vendor/jscpp.min.js";

// ... and here is how your program is executed: locally, in this tab.
function runInPage(code, stdin) {
  return loadEngineScript().then(function (JSCPP) {
    var out = "";
    var exitCode = JSCPP.run(code, stdin || "", {
      stdio: { write: function (s) { out += s; } }
    });
    return { ok: true, output: out, exitCode: exitCode };
  });
}

There is no fetch, no XMLHttpRequest, no form post anywhere in the judging code. You can verify it: open DevTools β†’ Network, run any problem, and watch that no request carries your source code.

Claim 2 β€” no ads beside the editor or the test results

The site has 370 ad placeholder comments. Only seven kinds are allowed to actually serve an ad. The others β€” including every "top of page" slot β€” stay dormant forever, because they would push the content down:

// js/ads.js β€” the actual allow-list shipped on this site
var CPPLAB_AD_PLACEMENT = {
  allow: [
    "below solution",      // one spot, after the problem's solution
    "mid-article",         // long articles only, between sections
    "mid-lesson unit",
    "end of article",
    "end-of-lesson unit",
    "bottom of hub",       // page footer of a list page
    "bottom unit"
  ]
  // "top of article", "top of hub", "above lesson content" and
  // "top responsive unit" are deliberately NOT here. They never render.
};

And here is the loop that walks the page looking for placeholders β€” note the allow.some(...) filter: anything not on the list is skipped, not rendered:

if (/^\s*AD:/.test(t) && allow.some(function (k) { return t.indexOf(k) !== -1; })) {
  marks.push(walker.currentNode);   // only allowed slots get an ad
}

What this means for you as a learner: when you are writing code and reading pass/fail results, there is nothing to click and nothing competing for attention. The first ad you can meet on a problem page appears after the solution, i.e. after you're done.

Claim 3 β€” no tracking cookies from us

This site stores exactly five things, all local, all readable and deletable by you:

KeyWhat it holds
cpplab.themelight or dark mode
cpplab.langyour language choice
cpplab.codeyour playground draft
cpplab.practice.…your draft for each problem
cpplab.gamesolved problems, achievements, streak

We set no cookies of our own. Clearing site data in your browser deletes all of the above and nothing is lost on our side β€” because we don't have a copy.

Claim 4 β€” what Google does, honestly

To keep the site free, we intend to show advertising from Google AdSense. When that is active:

What we will never do

How to check all of this yourself

  1. See the code: the files above (js/site.js, js/ads.js) are plain JavaScript, unabridged, no build step.
  2. Watch the network: DevTools β†’ Network β†’ solve a problem. No request contains your code.
  3. Count the ads: on a problem page, the first ad slot is after the solution; on an article, never above the first heading.
  4. Clean up: DevTools β†’ Application β†’ Local Storage β†’ delete the keys. Reload. You are a brand-new visitor.

If something on this page turns out not to match what the site actually does, that is a bug β€” tell us and we'll fix the code or the page. Full privacy policy.