Comprehensive List of C++ Inbuilt Functions for Competitive Programming
## 1. Mathematical Functions (cmath, numeric, algorithm)
- abs(x): Returns the absolute value of x.
- gcd(a, b): Computes the greatest common divisor (C++17).
- lcm(a, b): Computes the least common multiple (C++17).
- pow(x, y): Computes x raised to the power of y.
- sqrt(x): Returns the square root of x.
- cbrt(x): Returns the cube root of x.
- ceil(x): Returns the smallest integer greater than or equal to x.
- floor(x): Returns the largest integer less than or equal to x.
- round(x): Rounds x to the nearest integer.
- trunc(x): Returns the integer part of x.
- hypot(x, y): Computes sqrt(x^2 + y^2).
- log(x), log10(x), log2(x): Computes logarithms to base e, 10, and 2 respectively.
- exp(x): Computes e^x.
- modf(x, &intPart): Splits x into integer and fractional parts.
- sin(x), cos(x), tan(x), asin(x), acos(x), atan(x): Trigonometric functions.
- isnan(x), isinf(x), isfinite(x): Checks if x is NaN, infinite, or finite.
- fmod(x, y): Returns remainder of x/y.
- remainder(x, y): Returns remainder rounded to nearest integer.
- nextafter(x, y): Returns next representable value after x towards y.
- accumulate(begin, end, init): Computes sum of elements in range.
- partial_sum(begin, end, result): Computes prefix sum of range.
- adjacent_difference(begin, end, result): Computes adjacent differences.
## 2. String Functions (string, cstring)
- s.length(), s.size(): Returns length of the string.
- s.empty(): Checks if the string is empty.
- s.substr(pos, len): Extracts substring.
- s.find(sub): Finds first occurrence of sub.
- s.rfind(sub): Finds last occurrence of sub.
- s.compare(s2): Compares two strings lexicographically.
- s.append(str): Appends str to s.
- s.insert(pos, str): Inserts str at pos.
- s.erase(pos, len): Erases substring.
- s.replace(pos, len, str): Replaces substring.
- s.at(i): Returns character at index i.
- s.front(), s.back(): Access first and last character.
- s.push_back(c), s.pop_back(): Modify end of string.
- stoi(s), stol(s), stoll(s), stod(s): Converts string to integer/double.
- to_string(x): Converts number to string.
- tolower(c), toupper(c): Converts character case.