Aviraj29's blog

By Aviraj29, history, 5 months ago, In English

Hey CF!

Built a free tool called Lagwatch that measures your mouse and keyboard input lag live in real time.

As CP guys we care about our setup — I always wondered what my actual mouse polling rate was. No free tool measured it accurately so I built one.

What it does: - Measures input latency with microsecond precision - Shows live mouse polling rate (125/500/1000Hz) - Detects lag spikes instantly - Separate stats for mouse and keyboard

Built in C++ using: - Windows Raw Input API for OS level input hooks - std::chrono for microsecond timing - ImGui + DirectX11 for GUI - Abstract OOP — InputDevice base class with Mouse and Keyboard subclasses

Interesting bug — polling rate was showing 1-7Hz instead of 1000Hz. Fixed by separating counting logic from reading logic.

Download (Windows 10/11): https://github.com/Aviraj2929/lagwatch/releases/download/v1.0/lagwatch.exe

Source: https://github.com/Aviraj2929/lagwatch

Curious — what polling rate does your mouse show? Mine shows 139Hz on a basic mouse

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it

By Aviraj29, history, 8 months ago, In English

Hello Codeforces!

I made a VS Code extension that automatically generates cerr debug print statements for any C++ variable with a single shortcut Ctrl+Shift+D.

Why I made this

I was tired of manually writing:

cerr << "adj: "; for(auto& [k,v]: adj){ cerr << k << "->["; for(auto& x: v) cerr << x << " "; cerr << "] "; } cerr << "\n";

every time I wanted to debug a map<int,vector>. So I built an extension that does it in one keypress.

How it works:

1) Place cursor on any variable (or select it) 2) Press Ctrl+Shift+D 3) The correct debug print is inserted below automatically

Supports all CP templates Every competitive programmer has their own template with custom aliases like ll, pii, vpii, vll or whatever they prefer. The extension automatically reads your using and typedef definitions and fully resolves them — no configuration needed.

TLE Warning — and the fix

As some of you might know, cerr inside loops can cause TLE on submission even if the output is ignored. The fix is to add this at the top of your file:

#ifdef ONLINE_JUDGE #define cerr if(false) cerr #endif

ONLINE_JUDGE is automatically defined on Codeforces, AtCoder and most judges — so debug prints are completely eliminated at compile time via dead code optimization. Zero runtime cost, no need to manually remove anything before submitting.

I'm adding a shortcut in the next version to auto-insert this guard automatically.

Video Demo

Check out a full demo here:https://www.linkedin.com/posts/aviraj-singh-3b996133a_competitiveprogramming-competitivecoding-activity-7436713693985427456-LFrx?utm_source=share&utm_medium=member_desktop&rcm=ACoAAFU2-v0B8PGT34EOco4AlE3Wjx-eenAQjjc

Install

Search CP Debug Printer in the VS Code extensions marketplace or install directly:

https://marketplace.visualstudio.com/items?itemName=Aviraj29.cp-debug-printer

Full text and comments »

  • Vote: I like it
  • -10
  • Vote: I do not like it