函数板子
gcd
LL gcd(LL a, LL b){
return (a % b == 0) ? b : gcd(b, a % b);
}
快速幂
LL qp(LL a, LL b){
if (b == 0) return 1;
LL ans = 1;
while (b != 0){
if (b & 1) ans = (ans * a) % mod;
b >>= 1;
a = (a * a) % mod;
}
return ans;
}
sqrt
LL mySqrt(LL x){
LL k = sqrt(x) - 1;
while ((k + 1) * (k + 1) <= x) k++;
return k;
}
unique
vector :: iterator unique(vector &a){
LL j = 0;
for (LL i = 0; i < a.size(); i++)
if (!i || a[i] != a[i - 1])
a[j++] = a[i];
return a.begin() + j;
}