Hello fellow programmer! Welcome to the Awesome Competitive Programming Template GitHub repository. π This repository is your go-to destination for a comprehensive and handy competitive programming template written in C++. Whether you're a seasoned coder or just getting started, this template is designed to supercharge your problem-solving skills! π
- Introduction
- Getting Started
- π Macros
- π¦ Container Macros
- π Typedefs
- π Debug Utilities
- π Predefined Goodies
- Solving Problems
- β±οΈ Time Complexity
- Contributing
- License
Hey there, future coding champion! π Competitive programming is like a puzzle-solving adventure. 𧩠Our template is your trusty sidekick to tackle those algorithmic challenges head-on!
Ideal Setup for Quick Run and Debug
Excited to dive in? It's simple! Copy the amazing C++ code provided in this repository and paste it into your favorite C++ development environment or online compiler. VoilΓ ! You've got the power of the template at your fingertips. πͺ
Add Test Case in Input File and Hit CTRL + R to Run
FastIO
: Speed up your input/output operations with this magical macro.el
: Say bye-bye to '\n'! Use this instead for a friendly newline.MOD1
andMOD2
: Ready-to-use modular constants for those modulo calculations.INF
: Your personal "infinity" for comparisons. π
all(x)
: Wrangle your containers with ease, get the full range.rall(x)
: Reverse the fun! Go from end to start in a snap.popFront(x)
: Bye-bye first element! Remove it from your container.mp(x, y)
: Create a magicalpair
with valuesx
andy
.pb(x)
: Pushx
into your container (e.g., vector), like a pro.ppb(x)
: Pop the last element from your container, with flair.
ll
: Short forlong long int
- your trusty big integer friend.ull
: Say hi tounsigned long long int
for all those positive vibes.lld
: For precise calculations with a touch of decimal magic.vl
: An abbreviation forvector<ll>
- your versatile list.vll
: It's likevl
, but each element is a pair. Cool, right?pll
: Say hello topair<ll, ll>
- two values in one! π€
Noticed a pesky bug? π Our debug utilities come to the rescue! These helpful tools are only active when you're not on an online judge.
debug(x)
: Peek into the value ofx
during debugging._print()
: A bunch of overloads to print various data types and containers.- Operator overloads for input and output streams.
We've got some coding superpowers lined up for you:
We've got some coding superpowers lined up for you:
GCD(a, b)
: The magical way to find the greatest common divisor ofa
andb
. Learn moreLCM(a, b)
: Compute the least common multiple ofa
andb
effortlessly. Learn morepwr(a, b, mod)
: Ace the power ofa
raised tob
, modulomod
. Learn moremminvprime(a, b)
: The modular multiplicative inverse ofa
w.r.t. primeb
. Learn moremodAdd
,modMul
,modSub
,modDiv
: Modular arithmetic made simple! Learn moreisPrime(n)
: Unlock the secret to checking ifn
is prime. Learn more
Ready to conquer problems? Implement the solveMyProblem
function. It reads from the input stream (in
) and writes solutions to the output stream (out
). All neatly wrapped in a test case loop!
void solveMyProblem(istream &cin, ostream &cout, ll testCase) {
// Your brilliant solution goes here!
}
Time is precious in competitive programming! Keep an eye on the time complexity of your solutions to ensure they're as efficient as can be.
Ready to add your magic touch? Feel free to contribute to this template or report any issues on our GitHub repository.
This project is licensed under the MIT License. So feel free to create, explore, and shine!
This amazing template was crafted with love by DocFlex. π