A curated collection of competitive programming problems and solutions in Python, sourced from the most popular platforms. Every solution is adapted with unit tests for easy verification and learning.
- Python: 3.13.3
python -m venv .venvActivate on Windows:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUse
.venv\Scripts\activate.ps1Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUse
| macOS / Linux | source .venv/bin/activate |
pip install -e .
pip install pytestPrefer containers? Build and run tests with Docker:
docker build --target test -t myapp-test .
docker run --rm myapp-testpytestOr explicitly via the venv Python:
.venv/bin/python -m pytestRemove temporary files and the virtual environment:
# Clear all __pycache__ directories and compiled files
find . | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf
# Remove the virtual environment
rm -rf .venv
⚠️ Note: The cleanup command usesrm -rf .venv(notrm .env) to remove the virtual environment directory.
Solutions are sourced from the following competitive programming platforms:
| Platform | URL |
|---|---|
| CodeChef | codechef.com |
| Codeforces | codeforces.com |
| Codility | codility.com |
| LeetCode | leetcode.com |
.
├── solutions/ # Problem solutions organized by platform
├── tests/ # Unit tests for each solution
├── pyproject.toml # Project metadata and dependencies
└── Dockerfile # Docker configuration
Contributions are welcome! When adding a new solution, please ensure:
- The solution is placed in the appropriate platform folder.
- A corresponding unit test is included.
- All existing tests pass before submitting.