Блог пользователя Hmzaawy

Автор Hmzaawy, история, 3 месяца назад, По-английски

Hello Codeforces!

We are excited to share a massive update for the Repovive extension. Our goal remains the same: to provide an all-in-one toolkit for Competitive Programmers. Whether you are upsolving, practicing, or competing, we want to make your life easier.

This update comes in two parts: features that are Live Now in the store, and a sneak peek at ground-breaking features Coming Soon (currently in review).

TLDR; Check the AI Coach Chrome Extension Here: Repovive Competitive Programming


Live Now: Multi-Model AI, Dark Mode & More

The latest version published to the store brings significant power-ups:

1. The Trinity of AI Coaches: ChatGPT + DeepSeek + Gemini

Why settle for one when you can have three? The AI Coach now supports ChatGPT and DeepSeek alongside the existing Gemini integration. - Stuck on a problem? Get hints, code explanations, or complexity analysis from your favorite LLM. - Switch between models seamlessly to get different perspectives on a solution.

2. Native Dark Mode (Codeforces & AtCoder)

Save your eyes during those late-night upsolving sessions. We've added a highly requested Dark Mode that works beautifully on both Codeforces and AtCoder. - Automatically injects a sleek dark theme. - Toggleable via the extension settings.

 Dark

 Dark

3. Private Group Support

Repovive AI Coach now works inside Private Groups!

(Note: Solution fetching for private groups is currently limited, but the editor and other tools are fully functional).

4. Code Editor Improvements

We've squashed annoying bugs related to language selection in the embedded editor. Your coding experience should be smoother than ever.


In Review (Coming Very Soon)

We have another update currently waiting for approval that introduces features you won't find anywhere else:

1. Live Rating Predictor

Predict your rating changes directly on the Codeforces standings page. No need to wait for the system update!

 Rating

2. Problem Rating Predictor (New!)

This is a game-changer. Ever practiced on Gym mashups or unrated problems and wondered "What rating is this?" Our new Problem Rating Predictor uses AI to estimate the difficulty rating of any problem, even if it doesn't have an official tag.

 Problem Rating


Install / Update

Get the latest version here: Repovive Competitive Programming

As always, we love your feedback. Let us know which AI model you find best for competitive programming!

Happy Coding!

Полный текст и комментарии »

  • Проголосовать: нравится
  • -19
  • Проголосовать: не нравится

Автор Hmzaawy, история, 4 месяца назад, По-английски

Hello Codeforces!

TLDR; Chcek the AI Coach Chrome Extension Here: Repovive Competitive Programming, And get your Gemini API Keys Here: Google AI Studio

I’m excited to share a project I've been working on at Repovive, with the Great Shayan.

We all know the struggle: you're stuck on a problem, the editorial is confusing (or non-existent), and you just need a small hint to nudge you in the right direction—not the full solution. That's exactly what this tool is built for.

What is it?

The new addition to the Repovive Chorme Extension, an AI Agent, that embeds a context-aware AI chat directly into Codeforces (and AtCoder/LeetCode) problem pages.

It isn't just a wrapper around ChatGPT, nor is it a proprietary "Black Box" model trained from scratch.

  • Powered by Gemini: It leverages the Google Gemini API (gemini-pro/flash) for reasoning.

  • Your Own Keys: You use your own free API key from Google AI Studio. This means no subscription fees and total control over your usage.

  • Context Aware: It specifically understands competitive programming contexts:

    • It reads the problem statement, constraints, and test cases automatically.
    • It fetches Accepted solutions from top rankers (Red Coders) to understand the optimal approach.
    • It simulates a "Socratic Coach": it refuses to give you the code initially. Instead, it asks you guiding questions to help you derive the solution yourself.

First Message Logic

Platform Deep Dive: Under the Hood

Each platform requires a unique engineering approach. Here is how we handle the "Big Three":

1. Codeforces

Codeforces Support

  • How it works:
    • Parsing: We use the official codeforces.com/api to fetch problem metadata.
    • Solution Mining: We identify the contest "Winners" via the API, find their submission IDs, and then get their source code.
    • Anti-Cheat: We detect the specific .countdown timer element used in active rounds.
  • Tradeoffs & Limitations:
    • API Rate Limits: Codeforces has a strict 5 req/sec limit. If the site is under load (e.g., right after a contest), the "Solution Mining" might fail or be slow.
    • Old Contests: Some very old problems ($$$ \lt 2015$$$) might have missing metadata or different DOM structures that break parsing.

2. AtCoder

AtCoder Supoort

  • How it works:
    • Parsing: Since AtCoder has no official API, we built a robust HTML parser that reads the DOM directly to extract inputs/outputs.
    • Solution Mining: The agent navigates to the submissions page, filters for "Accepted" + "C++" + "Fastest", and gets the code from the top result.
  • Tradeoffs & Limitations:
    • Login Wall: For some contests, you must be logged in to view submissions. The agent might show a "Cookie Error" if it can't access the submission page (it tries to inherit your session, but browser security can block this).
    • Fragility: If AtCoder changes their website UI (class names), the geter will break until we update the extension.

3. LeetCode

LeetCode Support

  • How it works:
    • Parsing: We reverse-engineered LeetCode's GraphQL API to fetch clean problem questions without parsing messy HTML.
    • Knowledge Source:
      • Old Problems (ID < 3200): Since these are in the LLM's training data, we rely on the model's internal knowledge for faster responses.
      • New Problems: We fetch the top-voted "Community Solution" via GraphQL to give the model context on brand new questions.
    • Anti-Cheat: We strictly disable the agent on any URL containing /contest/.
  • Tradeoffs & Limitations:
    • SPA Navigation: LeetCode is a Single Page Application (React). Sometimes the button might disappear when navigating between problems; a page refresh fixes this.
    • Community Quality: For new problems, (ID > 3200), it is unlikely to get a solution, because the only way is to use leetcode GraphQL API, there is no official documentation, so we are still working on the best way to get a solution to feed the AI.

Customizing Your Experience

Settings Dialog

The extension also includes deep theming support to match your system style!

Legal & Ethical Notices (Anti-Cheat)

Crucial Point: We take fair play seriously.

  • Strict Anti-Cheat: The agent is programmed to automatically disable itself during live contests.
    • Codeforces: It detects the server-side countdown timer for active rounds.
    • AtCoder: It checks the contest timer element.
    • LeetCode: It hard-blocks any URL containing /contest/.
  • Purpose: This tool is strictly for upsolving and practice. Using AI assistance during a rated contest is cheating and will get you banned. Don't do it.

Privacy & Security

  • No Data Collection: Repovive DOES NOT collect, store, or transmit your data to its servers. We do not access your cookies or personal information.
  • Local Storage Only: Your API keys, settings, and chat history are stored exclusively in your browser's local storage. Nothing leaves your machine except the API request to Gemini.

How to Get Started

  1. Install Repovive: Repovive Competitive Programming
  2. Get a Gemini API Key:

    • Go to Google AI Studio and sign in with your Google account.
    • Click on the blue "Get API key" button in the top-left sidebar.
    • Click "Create API key". You might need to select "Create API key in new project" if you don't have one.

    Google AI Studio Dashboard

    • Copy the key that starts with AIza....

    Copying the API Key

  3. Open a Problem: Navigate to any Codeforces problem.
  4. Click the Sparkle: You'll see the floating AI button. Click it, paste your API key once, and start upsolving!

Known Issues & Roadmap

Since this is an early beta, you might encounter:

  • Rate Limits: If too many people use it at once, Codeforces API might slow down context fetching.

  • Parsing Errors: Extremely old contests (10+ years ago) might have broken HTML structures.

  • LeetCode Spa: On LeetCode, if the button disappears after navigating, just refresh the page.

  • Gemini Free Limits: The Google Gemini Free Tier has usage limits (RPM/TPM).

    • If you see ResourceExhausted or 429 errors, it means you've hit the limit.
    • Auto-Downgrade Feature: To keep you coding, the agent will automatically downgrade from Gemini Pro to Gemini Flash, then downgrade to Gemini Flash-Light if it detects quota issues. It automatically tries to upgrade back after 6 hours.

What's Next?

  • Better support for LeetCode new problems (ID > 3200).
  • More robust cookie handling for AtCoder login walls.
  • Integrating a "Hint Mode" that blurs the code mining output initially.

Feedback & Support

We need your help to make this better!

  • Found a bug? Please report it to me on Codeforces

  • Have a suggestion? Message me directly on Codeforces

  • Wanna contribute? Message me directly on Codeforces with your idea you want to contribute!


Features Requested And will be added Soon:

After I submit my correct code, it can take my code and create a step by step solution or hint in plain English, highlighting the key areas and how i solved it. this will be useful when we revisit the problem.

We hope to see the extension working on the private groups & private gyms too!  

Can we add  Online Judge (UVa) support?  

btw can u add so we can use Chatgpt / Deepseek too?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +154
  • Проголосовать: не нравится

Автор Hmzaawy, история, 5 месяцев назад, По-английски

A modern CLI tool that brings the entire problem-setting workflow to your terminal


TL;DR: I built Polyman — a command-line tool that lets you create, test, and verify competitive programming problems entirely on your local machine before touching Polygon. It supports test generation, validation, multiple solutions, standard checkers, and full Polygon integration.

Installation: npm install -g polyman-cli


The Problem with Problem Setting

If you've ever tried to create a problem for Codeforces (or other competitive programming platforms), you know the pain:

  • Upload a solution to Polygon → Wait → Compile error → Fix → Repeat
  • Upload tests one by one → Realize they're invalid → Delete → Upload again
  • Test your checker → It fails → Download, fix locally, re-upload
  • Want to test multiple solutions? Good luck switching between them all on Polygon
  • Need to regenerate 100 tests? Hope you enjoy clicking buttons

Sound familiar?

I got tired of this workflow. So I built Polyman — a tool that lets you do everything locally, with your favorite text editor, your terminal, and full automation.


What is Polyman?

Polyman is a CLI tool (think testlib.h, but for the entire problem-setting workflow) that helps you:

  • Create problems with a single command — complete folder structure, templates, everything
  • Generate tests programmatically using C++ generators (with testlib.h)
  • Validate inputs automatically against your constraints
  • Run multiple solutions (correct, wrong answer, TLE, etc.) and verify their verdicts
  • Use standard checkers (or write custom ones) to verify outputs
  • Sync with Polygon — pull problems, work locally, push changes back
  • Verify everything with a single command before uploading

All from your terminal. No browser tabs. No waiting for Polygon to compile. No clicking through endless menus.


Quick Example: Creating Your First Problem

Let's create a simple problem — "Sum of Two Numbers":

# Create problem
polyman new sum-problem
cd sum-problem

# Download testlib.h
polyman download-testlib

Now you have this structure:

sum-problem/
├── Config.json              # Problem configuration
├── solutions/               # Your solutions
├── generators/              # Test generators
├── validator/               # Input validator
├── checker/                 # Output checker
├── testsets/                # Generated tests
└── statements/              # Problem statements

Write your solution (solutions/Solution.cpp):

#include <iostream>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a + b << endl;
    return 0;
}

Write your validator (validator/Validator.cpp):

#include "testlib.h"

int main(int argc, char* argv[]) {
    registerValidation(argc, argv);

    int a = inf.readInt(1, 1000, "a");
    inf.readSpace();
    int b = inf.readInt(1, 1000, "b");
    inf.readEoln();
    inf.readEof();

    return 0;
}

Write your generator (generators/Generator.cpp):

#include "testlib.h"

int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);

    int testNum = atoi(argv[1]);
    int maxValue = min(100 * testNum, 1000);

    int a = rnd.next(1, maxValue);
    int b = rnd.next(1, maxValue);

    cout << a << " " << b << endl;
    return 0;
}

Configure your problem (Config.json):

{
  "name": "sum-problem",
  "timeLimit": 1000,
  "memoryLimit": 256,
  "inputFile": "stdin",
  "outputFile": "stdout",

  "solutions": [
    {
      "name": "main",
      "source": "./solutions/Solution.cpp",
      "tag": "MA"
    }
  ],

  "checker": {
    "name": "ncmp",
    "isStandard": true
  },

  "testsets": [
    {
      "name": "tests",
      "generatorScript": {
        "commands": [
          {
            "type": "generator-range",
            "generator": "gen",
            "range": [1, 20]
          }
        ]
      }
    }
  ]
}

Now verify everything:

polyman verify

That's it. One command. It will:

  • Generate all 20 tests
  • Validate all inputs
  • Run your solution on all tests
  • Verify all outputs with the checker
  • Tell you if anything is wrong

If everything passes, your problem is ready to upload to Polygon!


Real Power: Working with Multiple Solutions

Want to test that your problem actually rejects wrong solutions? Add them to Config.json:

"solutions": [
  {
    "name": "main",
    "source": "./solutions/correct.cpp",
    "tag": "MA"
  },
  {
    "name": "wrong",
    "source": "./solutions/wrong.cpp",
    "tag": "WA"
  },
  {
    "name": "slow",
    "source": "./solutions/slow.cpp",
    "tag": "TL"
  }
]

Run polyman verify and it will:

  • Verify main solution gets AC on all tests
  • Verify wrong solution gets WA on at least one test
  • Verify slow solution gets TLE on at least one test

If any solution doesn't behave as expected, it tells you immediately. No more uploading 5 different solutions to Polygon and manually checking each one.


Standard Checkers: No Need to Reinvent the Wheel

Polyman includes all the standard testlib.h checkers:

polyman list-checkers

Shows you:

  • wcmp — Compare tokens (whitespace-insensitive)
  • ncmp — Compare sequences of numbers
  • fcmp — Compare floating-point numbers
  • lcmp — Compare lines exactly
  • yesno — Compare yes/no answers
  • And 20+ more...

Just set "isStandard": true in your config. No need to download or compile them manually.


Polygon Integration: The Best of Both Worlds

Already have problems on Polygon? No problem. Polyman syncs with Polygon seamlessly:

# Register your API key (one-time)
polyman remote register

# Pull a problem from Polygon
polyman remote pull 123456 ./my-problem
cd my-problem

# Work on it locally...
# Make changes, test everything

# Push changes back to Polygon
polyman remote push .

# Commit your changes
polyman remote commit . -m "Added new test cases"

# Build and download package
polyman remote package . --full

Work locally with your tools, then push to Polygon when ready. No more choosing between local development and Polygon's features.


Advanced Features

Organized Test Groups

"testsets": [{
  "name": "tests",
  "groupsEnabled": true,
  "groups": [
    {"name": "samples"},
    {"name": "small"},
    {"name": "large"}
  ],
  "generatorScript": {
    "commands": [
      {
        "type": "manual",
        "manualFile": "./manual/sample1.txt",
        "group": "samples"
      },
      {
        "type": "generator-range",
        "generator": "gen-small",
        "range": [1, 30],
        "group": "small"
      },
      {
        "type": "generator-range",
        "generator": "gen-large",
        "range": [1, 70],
        "group": "large"
      }
    ]
  }
}]

Selective Generation/Validation

polyman generate --testset tests --group samples    # Only samples
polyman validate --testset tests --index 5          # Only test 5
polyman run main --testset tests --group large      # Only large tests

Multiple Languages

Polyman supports C++ (g++, clang, MSVC), Java, and Python solutions. Mix and match as needed.

Custom Checkers

Write your own checker with testlib.h, test it with checker_tests.json, and Polyman handles the rest.


Installation

Requirements:

  • Node.js v14+
  • C++ compiler (g++, clang, or MSVC)
  • Java/Python (optional, for those solution types)

Install:

npm install -g polyman-cli

Verify:

polyman --version

That's it. You're ready to create problems.


Documentation & Learning Resources

The tutorial walks you through creating your first problem from scratch. The guide covers everything — validators, generators, checkers, testsets, remote operations, best practices, troubleshooting, and more.


Why I Built This

I love creating problems, but I hated the workflow. Every time I had to:

  • Switch between my editor and Polygon
  • Wait for compilations
  • Manually test edge cases
  • Upload tests one by one

I thought: "There has to be a better way."

So I built Polyman. It's the tool I wish I had when I started problem setting. It lets you work the way developers actually work — locally, with automation, with proper testing, with version control.


Try It Out!

If you're a problem setter (or want to become one), give Polyman a try:

npm install -g polyman-cli
polyman new my-first-problem
cd my-first-problem
polyman download-testlib
# ... create your problem ...
polyman verify

Follow the tutorial if you're new, or dive into the complete guide if you want to see everything it can do.

Found a bug? Have a feature request? Open an issue on GitHub. PRs are welcome!

Star the repo if you find it useful: github.com/HamzaHassanain/polyman


Want to Contribute?

Polyman is open source and I'd love your help making it better! Whether you're a beginner or experienced developer, there are plenty of ways to contribute.

Open Issues & Feature Requests

Here are some exciting features we're working on that you can help with:

  • Auto-Deriving Config Names from File Paths (#12) — Simplify configuration by automatically inferring names from file paths
  • Smart Compilation Cache with Dependency Tracking (#11) — Speed up workflow by caching compilations intelligently
  • Diff Viewer for Local vs Remote Changes (#10) — See what changed before pushing to Polygon
  • Shell Auto-Completion Support (#9) — Add tab completion for bash/zsh/fish
  • Comprehensive Unit Test Coverage (#8) — Help us reach better test coverage
  • Parallel Execution for Independent Operations (#7) — Make test generation and validation faster
  • Java Class Naming Conflict Resolution (#6) — Handle Java/Polygon naming conflicts better
  • Time Scaling for Java & Python (#5) — Automatically adjust time limits for different languages

All issues are tagged with good first issue, help wanted, enhancement, or documentation to help you find where you can contribute. Check out the full list of issues on GitHub!

How to Get Started

  1. Fork the repository
  2. Pick an issue (or suggest a new feature!)
  3. Create a branch and make your changes
  4. Submit a pull request

Questions?

Drop them in the comments! I'd love to hear:

  • What features would make your problem-setting workflow easier?
  • What problems have you faced when creating problems?
  • What would you want to see in future versions?

UPDATE

Notes Regarding Windows Users

When using this project on Windows, please be aware of the following considerations:

Line Endings:

Windows uses different line endings (CRLF) compared to Unix-based systems (LF). Ensure your text editor is configured to handle line endings appropriately to avoid issues in scripts and configuration files.

UNIX
{
  "tests": [
    {
      "input": "5 10\n1 2 3 4 5\n",
      "expectedVerdict": "VALID"
    },
    {
      "input": "0 0\n\n",
      "expectedVerdict": "INVALID"
    }
  ]
}
WINDOWS
{
  "tests": [
    {
      "input": "5 10\r\n1 2 3 4 5\r\n",
      "expectedVerdict": "VALID"
    },
    {
      "input": "0 0\r\n\r\n",
      "expectedVerdict": "INVALID"
    }
  ]
}
Notes About The TUTORIAL.md File

We always use Unix-style line endings (LF) in the TUTORIAL.md file to maintain consistency across different operating systems. If you are using Windows, please ensure your text editor can handle LF line endings correctly to avoid any formatting issues.

PLEASE REPORT ANY ISSUES YOU ENCOUNTER WHILE USING THIS PROJECT ON WINDOWS. YOUR FEEDBACK IS VALUABLE TO US!

File Paths:

Windows uses backslashes (\) for file paths, while Unix-based systems use forward slashes (/). Be cautious when specifying file paths in scripts or configuration files to ensure compatibility.

{
  "filePath": "C:\\Users\\Username\\Documents\\project\\file.txt"
}
Solutions, Validators, Generators, and Checkers That Exceed The Time Limit:

I had a hard time trying to ensure the proper cleanup of the processes terminated duo to time limit exceeded on Windows, Most of the time, you will find that the processes are not being killed properly, leading to resource leaks and other unexpected behavior.

That is most of the time you will recive that error saying something like:

EBUSY: resource busy or locked, open 'C:\Users\hamza\sum-problem\solutions-outputs\tlee\tests\output_test1.txt'

This error mostly happens while wrting to files that are being used by another process (the one that was not killed properly).

For such cases, open your Task Manager and manually kill the processes that are still running, search for the name of the executable you were trying to run (that is the name of your solution, validator, generator, or checker executable).

Compilation Errors ALSO MAY HAPPEN DUE TO THE SAME REASON

If you face compilation errors that you are sure are not related to your code, try to manually kill the processes as mentioned above, and then try to recompile.

Notes Regarding Polygon

I found no way to disable the automatic update of the checker, so it will give you a warning (when useing a standard checker). You may need to consider doing that manually if you want to avoid that warning.

Notes Regarding The Validators new line.

Please keep in mind that on Windows, the new line character is represented by a carriage return followed by a line feed (\r\n), while on Unix-based systems, it is represented by just a line feed (\n). Also keep in mind that some code editors will use \n even on Windows.

So when you write a manual test case for your validator, make sure to use the correct new line character based on the operating system you are using.

Best option is to use the windows Text Editor (the built-in one) to write your test cases, as it will use the correct new line characters for your OS.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +332
  • Проголосовать: не нравится