๐ซ CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
๐ง 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
Clone the repository:
git clone https://github.com/camel-ai/camel.git cd examples/usecases/codeforces_question_solverInstall dependencies:
pip install -r requirements.txtConfigure environment variables:
Create a
.envfile 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
- CAMEL AI: Multi-agent reasoning framework
- Firecrawl: Web scraping and data extraction
- Streamlit: Web application framework
๐ฌ Example Usage
- Select Platform: Choose Codeforces or LeetCode
- Input Problem ID:
- For Codeforces: Enter problem ID (e.g.,
2116B) - For LeetCode: Enter problem slug (e.g.,
reverse-integer)
- For Codeforces: Enter problem ID (e.g.,
- 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
- 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!