Useful tricks to remember while solving problems:
- In
$\text{avg} = x$ problems on array$a$ , you can do$a[i] = a[i] - x$ for all$i$ , so that size of subarr/subseq becomes irrelevant. [https://codeforces.com/gym/104471/problem/C] - For median problems, you can use "replace by
$-1,$ $+1$ " trick to estimate the median. [https://codeforces.com/problemset/problem/1486/D] - To factorize large numbers upto
$10^{18}$ , we must use Pollard Rho's algorithm, which works in$\mathcal{O}(n^{1/4})$ . - Never compare floats/doubles with 128-bit integers in C++ (__int128). [https://codeforces.com/gym/101485/problem/K]

- Stars and Bars problem, but with (common) upper bound: https://math.stackexchange.com/questions/553960/ [https://codeforces.com/gym/510395/problem/H]
- More tricks will be added here..