Skip to content

armgit / camel

Public Imported from GitHub
0

๐Ÿซ CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

3.4 KB
Raw Blame

๐Ÿง  Competitive Programming Problem Solver with CAMEL Agents & Firecrawl

This project enables users to input problems from competitive programming platforms (Codeforces or LeetCode) and receive AI-generated Python solutions. It integrates:

  • ๐Ÿ” Web scraping via Firecrawl
  • ๐Ÿค– Multi-agent reasoning with CAMEL AI
  • ๐Ÿงช Code execution and validation against sample tests
  • ๐ŸŒ Streamlit interface for user interaction
  • ๐Ÿ”„ Auto-fix functionality for Codeforces problems

๐Ÿš€ Features

  • Multi-Platform Support: Solves problems from both Codeforces and LeetCode
  • Problem Retrieval: Fetches problem statements using Firecrawl
  • Sample Extraction: Parses and extracts sample inputs/outputs from problem descriptions
  • AI-Powered Solution: Utilizes CAMEL AI agents to generate Python solutions
  • Automated Testing: Executes generated code against extracted samples
  • Auto-Fix Capability: Iteratively improves solutions for Codeforces problems
  • Platform-Specific Handling: Different solution approaches for Codeforces vs LeetCode

๐Ÿ“ฆ Requirements

Install Python packages:

pip install -r requirements.txt

๐Ÿ› ๏ธ Setup

  1. Clone the repository:

    git clone https://github.com/camel-ai/camel.git
    cd examples/usecases/codeforces_question_solver
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Configure environment variables:

    Create a .env file in the root directory and add your API keys:

    FIRECRAWL_API_KEY=your_firecrawl_api_key
    OPENAI_API_KEY=your_openai_api_key
    FIRECRAWL_API_KEY='your_firecrawl_key'
    

๐Ÿงช Run the App

Start the Streamlit application:

streamlit run app.py

Then, open the provided URL in your browser to interact with the app.


๐Ÿ“ File Structure

โ”œโ”€โ”€ app.py             # Main Streamlit application
โ”œโ”€โ”€ requirements.txt   # Python dependencies
โ”œโ”€โ”€ .env               # Environment variables
โ””โ”€โ”€ README.md          # Project documentation

๐Ÿง  Powered By


๐Ÿ’ฌ Example Usage

  1. Select Platform: Choose Codeforces or LeetCode
  2. Input Problem ID:
    • For Codeforces: Enter problem ID (e.g., 2116B)
    • For LeetCode: Enter problem slug (e.g., reverse-integer)
  3. Process:
    • Fetches problem statement using Firecrawl
    • Extracts sample inputs/outputs
    • Generates Python solution using CAMEL AI
    • For Codeforces: Optionally auto-fixes solution based on test failures
  4. Output: Displays generated code, and test results

๐Ÿ“Œ Notes

  • Ensure your API keys are valid and have sufficient quota
  • Solution accuracy depends on problem complexity and AI capabilities
  • Always review generated code before using in competitions
  • Auto-fix is currently only available for Codeforces problems

๐Ÿ™Œ Acknowledgements


Feel free to contribute by submitting issues or pull requests!