Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

ZhangShan's blog

By ZhangShan, history, 7 weeks ago, In English

TL;DR: I built stress.ojcloud.net — a free online stress tester for competitive programmers. Paste your main, brute, and gen into three tabs, hit Run, and it streams per-test verdicts and stops at the first counterexample with Input / Main Output / Brute Output side-by-side. No signup, no install, 8 languages (C++ 03/11/14/17/20, C, Python/PyPy, Java, Kotlin, Go, Rust).

Hello, Codeforces!

If you've been doing CP for more than a week, you already know the routine. You submit, you get Wrong answer on pretest 2, the test is hidden, and your solution is 300 lines long. You open a terminal, mkdir stress, write the same while true; do ./gen > in; ./a.out < in > out1; ./brute < in > out2; diff out1 out2 || break; done you've written a hundred times, realize you forgot to seed the generator, rewrite it, forget to recompile brute, finally see a diff, and now you're squinting at 2000 random numbers trying to minimize the counterexample by hand.

We all do it. tourist does it, Um_nik does it, I do it. Stress testing is probably the single most valuable debugging skill in CP, and yet every single one of us has hand-rolled the same bash script a hundred times.

The friction with the bash approach

  • Boilerplate every single time: compile three files, seed loop, diff, break.
  • No UI. You can't see which test is running or how far along you are.
  • Switching languages (Python brute, C++ main) means rewriting the runner.
  • No history. Close the terminal, lose everything.
  • Sharing a counterexample with a teammate means pasting 3 files into Discord.
  • Forget to -O2 the brute and it takes 40 seconds per test. Forget to seed the RNG and every test is identical.

I got tired of this, so I built something.

What stress.ojcloud.net does

  • 8 languages: C++ 03/11/14/17/20, C, Python 3, PyPy 3, Java, Kotlin, Go, Rust. Switch from a dropdown; templates auto-load.
  • 5 built-in generator snippets: Array, Tree, Graph, String, Grid — one click drops working code into the gen tab. Each snippet uses a random(lo, hi) helper and a seed from argv[1], so runs are reproducible.
  • Real-time verdicts: the right panel streams Test 1 → Test 2 → … live. Stops the moment it finds a mismatch — no waiting for the remaining 900 tests.
  • Counterexample card: shows Input, Main Output, Brute Output side-by-side with one-click copy on each.
  • Configurable tests & timeout: default 200 tests / 2s per test, tune to taste.
  • Browser-resumable session: close the tab mid-run, reopen it, your code and last result are still there.
  • 7-language UI: English / Tiếng Việt / Русский / 简体中文 / 日本語 / 한국어 / Português.
  • Free. No signup. No account. No email. Just open the page and paste.

Demo: finding a real bug in ~30 seconds

Let's do the most classic bug in CP — Kadane's on max subarray sum, with best = 0 instead of LLONG_MIN. Invisible on positive inputs, fatal on all-negative ones.

main (buggy O(n) Kadane):

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    vector<long long> a(n);
    for (auto& x : a) cin >> x;
    long long best = 0, cur = 0;          // BUG: should be LLONG_MIN
    for (long long x : a) {
        cur = max(x, cur + x);
        best = max(best, cur);
    }
    cout << best << "\n";
}

brute (O(n²), definitely correct):

#include <bits/stdc++.h>
using namespace std;
int main() {
    int n; cin >> n;
    vector<long long> a(n);
    for (auto& x : a) cin >> x;
    long long best = LLONG_MIN;
    for (int i = 0; i < n; i++) {
        long long s = 0;
        for (int j = i; j < n; j++) { s += a[j]; best = max(best, s); }
    }
    cout << best << "\n";
}

gen: click the Array snippet, tweak the range to random(1, 8) and random(-10, 10) so negatives actually appear. Hit Run.

Within a few tests the stream stops on:

Input          Main Output    Brute Output
2              0              -3
-3 -5

There's the bug. All-negative array, buggy Kadane returns 0, correct answer is -3. Fix the init to LLONG_MIN, re-run, green "All 200 tests passed". Total time: under a minute.

Try it

stress.ojcloud.net — open the page, paste 3 files, hit Run. That's it. No signup flow to click through.

If you prefer a walkthrough, here's a 30-second video covering the exact Kadane example above: youtu.be/XI1HNegwFuI.

Feedback / bug reports / feature requests

I'd love to hear what breaks, what's missing, and what languages/snippets you'd want next. Join the Discord: discord.gg/pg52FspEns — share counterexamples, report bugs, argue about generators.

Thanks

Huge thanks to MikeMirzayanov — the checker design for OJCloud's main judge was shaped heavily by testlib.h, and the same philosophy (strict, readable, reproducible) carried over into this stress runner. And thanks to the countless CF blogs over the years that taught everyone the gen / main / brute / diff pattern in the first place — this tool is just that pattern with a UI bolted on.

Happy stressing.

Full text and comments »

  • Vote: I like it
  • +64
  • Vote: I do not like it

By ZhangShan, history, 2 months ago, In English

TL;DR: I couldn't register on usaco.org (Gmail verification bug), so I built OJCloud — all 484 USACO problems (2011–2024, Bronze → Platinum) on a modern judge with partial scoring, 16 languages, real-time per-test-case verdicts, progress tracking, and both ICPC/IOI contest modes. Everything uses standard I/O. Register with just a handle + password — no email, no OAuth, no waiting.

Full text and comments »

  • Vote: I like it
  • +247
  • Vote: I do not like it

By ZhangShan, history, 2 years ago, In English

Hello, Codeforces!

We are happy to invite you to CodeQuest which contains many problems on many topics for you to exercise and improve your algorithms knowledge.

Our goal is to make a pathway for everyone to reach their aim with only a Codeforces account !

It currently contains these topics (with 100+ problems):

  • Prefix Sums

  • Custom Comparators

  • Coordinate Compression

  • Two Pointers

  • Sorted Sets

  • Greedy Algorithms

  • Binary Search

And we have reformatted these problems to make it more readable (I think) from the original sources !

We will add more problems and more topics in the future, hope that you guys enjoy it.

We currently just summarize problems from USACO Guide, we think that we will summarize more problems from more sources. The reason why we summarize problems from USACO Guide is because we know that not many people have the account on USACO and many other platform and those problems are really good for exercising.

Join Discord Server ! (for discussing about CP problems and we will make some video and living tutorial for these problems).

Update: Our Discord server has reached 120+ people, i'm really thank you.

Full text and comments »

  • Vote: I like it
  • +63
  • Vote: I do not like it