Language: C++

class Euclid {
private:
	ll m, n;
	vvll mx_multiply(vvll mx1, vvll mx2) {
		vvll ret(mx1.size(), vll(mx2[0].size(), 0));
		Loop(i, mx1.size()) {
			Loop(j, mx1[0].size()) {
				Loop(k, mx2[0].size()) {
					ret[i][j] += mx1[i][k] * mx2[k][j];
				}
			}
		}
		return ret;
	}
public:
	ll x, y, gcd;
	Euclid(ll M, ll N) {
		m = M;
		n = N;
	}
	//mx+ny=gcd(m,n)??§??????x,y????±???????
	void mainfunc() {
		vll r(100), k(100);
		bool swapflag = false, mflag = false, nflag = false;
		if (m < n) { swap(m, n); swapflag = true; }
		if (m < 0) { m *= -1; mflag = true; }
		if (n < 0) { n *= -1; nflag = true; }
		r[0] = m;
		r[1] = n;
		int h = 1;
		while (1) {
			k[h - 1] = r[h - 1] / r[h];
			r[h + 1] = r[h - 1] % r[h];
			if (r[h + 1] == 0) break;
			h++;
		}
		gcd = r[h];
		vvll mx(2, vll(2, 1));
		mx[0][0] = 0;
		mx[1][1] = (-1) * k[0];
		Loop1(i, h - 1) {
			vvll _mx(2, vll(2, 1));
			_mx[0][0] = 0;
			_mx[1][1] = (-1) * k[i];
			mx = mx_multiply(_mx, mx);
		}
		x = mx[0][0];
		y = mx[0][1];
		if (nflag) { n *= -1; y *= -1; }
		if (mflag) { m *= -1; x *= -1; }
		if (swapflag) { swap(m, n); swap(x, y); }
	}
};

//x! O(x)
vll mod_factorial(ll x, ll mod) {
	if (x < 0) return{};
	else {
		vll ret((int)x + 1);
		ret[0] = 1;
		Loop1(i, (int)x) ret[i] = ret[i - 1] * i % mod;
		return ret;
	}
}

//x^y O(log y)
ll mod_pow(ll x, ll y, ll mod) {
	if (y == 1) return x;
	else {
		ll ans = mod_pow(x, y / 2, mod);
		ans = ans * ans % mod;
		if (y % 2 == 1) ans = ans * x % mod;
		return ans;
	}
}

//???1/x O(log x)
ll mod_inv(ll x, ll mod) {
	Euclid *euclid = new Euclid(x, mod * (-1));
	euclid->mainfunc();
	ll ret = euclid->x;
	if (ret < 0) ret += (ret / mod*(-1) + 1) * mod;
	return ret;
}

Compiler output:
a.cc:3:9: error: 'll' does not name a type
    3 |         ll m, n;
      |         ^~
a.cc:4:9: error: 'vvll' does not name a type
    4 |         vvll mx_multiply(vvll mx1, vvll mx2) {
      |         ^~~~
a.cc:16:9: error: 'll' does not name a type
   16 |         ll x, y, gcd;
      |         ^~
a.cc:17:18: error: expected ')' before 'M'
   17 |         Euclid(ll M, ll N) {
      |               ~  ^~
      |                  )
a.cc: In member function 'void Euclid::mainfunc()':
a.cc:23:17: error: 'vll' was not declared in this scope
   23 |                 vll r(100), k(100);
      |                 ^~~
a.cc:25:21: error: 'm' was not declared in this scope
   25 |                 if (m < n) { swap(m, n); swapflag = true; }
      |                     ^
a.cc:25:25: error: 'n' was not declared in this scope
   25 |                 if (m < n) { swap(m, n); swapflag = true; }
      |                         ^
a.cc:25:30: error: 'swap' was not declared in this scope
   25 |                 if (m < n) { swap(m, n); swapflag = true; }
      |                              ^~~~
a.cc:26:21: error: 'm' was not declared in this scope
   26 |                 if (m < 0) { m *= -1; mflag = true; }
      |                     ^
a.cc:27:21: error: 'n' was not declared in this scope
   27 |                 if (n < 0) { n *= -1; nflag = true; }
      |                     ^
a.cc:28:17: error: 'r' was not declared in this scope
   28 |                 r[0] = m;
      |                 ^
a.cc:28:24: error: 'm' was not declared in this scope
   28 |                 r[0] = m;
      |                        ^
a.cc:29:24: error: 'n' was not declared in this scope
   29 |                 r[1] = n;
      |                        ^
a.cc:32:25: error: 'k' was not declared in this scope
   32 |                         k[h - 1] = r[h - 1] / r[h];
      |                         ^
a.cc:37:17: error: 'gcd' was not declared in this scope
   37 |                 gcd = r[h];
      |                 ^~~
a.cc:38:17: error: 'vvll' was not declared in this scope
   38 |                 vvll mx(2, vll(2, 1));
      |                 ^~~~
a.cc:39:17: error: 'mx' was not declared in this scope
   39 |                 mx[0][0] = 0;
      |                 ^~
a.cc:40:35: error: 'k' was not declared in this scope
   40 |                 mx[1][1] = (-1) * k[0];
      |                                   ^
a.cc:41:23: error: 'i' was not declared in this scope
   41 |                 Loop1(i, h - 1) {
      |                       ^
a.cc:41:17: error: 'Loop1' was not declared in this scope
   41 |                 Loop1(i, h - 1) {
      |                 ^~~~~
a.cc:47:17: error: 'x' was not declared in this scope
   47 |                 x = mx[0][0];
      |                 ^
a.cc:48:17: error: 'y' was not declared in this scope
   48 |                 y = mx[0][1];
      |                 ^
a.cc:51:33: error: 'swap' was not declared in this scope
   51 |                 if (swapflag) { swap(m, n); swap(x, y); }
      |                                 ^~~~
a.cc: At global scope:
a.cc:56:1: error: 'vll' does not name a type
   56 | vll mod_factorial(ll x, ll mod) {
      | ^~~
a.cc:67:1: error: 'll' does not name a type
   67 | ll mod_pow(ll x, ll y, ll mod) {
      | ^~
a.cc:78:1: error: 'll' does not name a type
   78 | ll mod_inv(ll x, ll mod) {
      | ^~