A curated collection of competitive programming solutions and templates. This repository is intended to help you practice algorithmic problems, study efficient implementations, and keep useful snippets and templates for contests.
This repository contains solutions to problems from various online judges (Codeforces, AtCoder, UVA, SPOJ, LeetCode, etc.), as well as reusable templates and utility snippets that are helpful during competitive programming contests.
Solutions aim to be clear, well-documented, and (where useful) optimized for performance. Use this repo as a learning resource or a reference during practice.
-
Clone the repository:
git clone https://github.com/killer4639/Competitve-Programming.git
-
Open and run problem solution files using the appropriate compiler/interpreter.
C++ (example):
-
Compile:
g++ -std=c++17 -O2 -pipe solution.cpp -o solution
-
Run:
./solution < input.txt
Contributions are welcome! If you'd like to add solutions, templates, or notes:
- Fork the repository.
- Create a new branch:
git checkout -b feat/add-solution. - Add your solution in the appropriate language folder. Include a comment header with problem link, contest, complexity, and short description.
- Commit your changes and open a pull request describing what you added.
Please follow these guidelines:
- Name files clearly (e.g.,
1234A.cpportwo_sum.py). - Include problem source/link in a comment at the top.
- Keep code readable and add brief explanatory comments for non-trivial solutions.
Consider organizing problems by source (Codeforces/AtCoder) and tags (graphs, dp, greedy) to make navigation easier.
Example:
- /cpp/codeforces/ - Codeforces solutions grouped by contest id
- /python/leetcode/ - LeetCode practice solutions