Language: C++

fine FORD(i,a,b) for(int i=(a),b_=(b);i>=b_;--i)
#define TR(c, it) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); it++)
#define removeDuplicate(a) sort(a.begin(), a.end()); a.resize(distance(a.begin(), unique(a.begin(), a.end())))
 
const int N = 2e5 + 1;
const int MOD = 1e9 + 7;
 
int add (int a, int b) {
  return (a += b) >= MOD ? a - MOD : a;
}
 
int sub (int a, int b) {
  return (a -= b) < 0 ? a + MOD : a;
}
 
int mul (int a, int b) {
  return (long long) a * b % MOD;
}
 
int power(int a, long long n) {
  int res = 1;
  while(n) {
    if (n & 1LL) res = mul(res, a);
    a = mul(a, a);
    n >>= 1LL;
  }
  return res;
}
int inv(int a) {
  return power(a, MOD - 2);
}
 
int h, w, n; 
 
class Binomial {
  vector <int> fact, inv; 
  int n; 
  public:
    Binomial() {};
    Binomial(int sz) : n(sz), fact(sz + 1), inv(sz + 1) {
      fact[0] = fact[1] = inv[0] = inv[1] = 1;
        for (int i = 2; i <= n; ++i) {
            fact[i] = 1LL * fact[i - 1] * i % MOD;
            inv[i] = (MOD - 1LL * (MOD / i) * inv[MOD % i] % MOD) % MOD;
        }
        for (int i = 2; i <= n; ++i) inv[i] = 1LL * inv[i] * inv[i - 1] % MOD;
    };
    int operator() (int y, int x) { // x<=y; x>=0
        if (x > y) return 0;
        return 1LL * fact[y] * inv[x] % MOD * inv[y - x] % MOD;
    }
} nCr(N);
 
int solve (int n, int r) {
    return nCr(n + r, r); 
}
 
int calc (int a, int b, int c, int d) {
    int res = solve(c - a, d - b); 
    return res; 
}
 
 
 
int main() {
    #define TASK "TASK"	
	// freopen(TASK".inp","r",stdin);
	// freopen(TASK".out","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cin >> h >> w >> n;
	h--, w--; 
	vector <int> ans(n + 2);
	vector < pair<int, int> > cells;   
	for (int i = 0; i < n; ++i) {
		int x, y;
		cin >> x >> y; 
		x--, y--; 
		cells.push_back(make_pair(x, y)); 
	}
	cells.push_back(make_pair(h, w)); 
	sort(cells.begin(), cells.end());
	for(int i = 0; i <= n; ++i) {
		// auto [x, y] = cells[i]; 
		int x = cells[i].st; 
		int y = cells[i].nd; 
		ans[i] = solve(x, y); 
	}
	for(int i = 0; i < n; ++i) {
		// auto [x, y] = cells[i];
		int x = cells[i].st; 
		int y = cells[i].nd;  
		for (int j = i + 1; j <= n; ++j) {
			// auto[u, v] = cells[j];
			int u = cells[j].st; 
			int v = cells[j].nd;  
			if (u < x || v < y || j == i) continue; 
			ans[j] = sub(ans[j], mul(ans[i], calc(x, y, u, v))); 
		}
	}
	cout << ans[n] << endl; 
 
     
  	return 0;
}

Compiler output:
a.cc:1:1: error: 'fine' does not name a type
    1 | fine FORD(i,a,b) for(int i=(a),b_=(b);i>=b_;--i)
      | ^~~~
a.cc:1:39: error: 'i' does not name a type
    1 | fine FORD(i,a,b) for(int i=(a),b_=(b);i>=b_;--i)
      |                                       ^
a.cc:1:45: error: expected unqualified-id before '--' token
    1 | fine FORD(i,a,b) for(int i=(a),b_=(b);i>=b_;--i)
      |                                             ^~
a.cc:36:3: error: 'vector' does not name a type
   36 |   vector <int> fact, inv;
      |   ^~~~~~
a.cc: In constructor 'Binomial::Binomial(int)':
a.cc:40:31: error: class 'Binomial' does not have any field named 'fact'
   40 |     Binomial(int sz) : n(sz), fact(sz + 1), inv(sz + 1) {
      |                               ^~~~
a.cc:40:45: error: class 'Binomial' does not have any field named 'inv'
   40 |     Binomial(int sz) : n(sz), fact(sz + 1), inv(sz + 1) {
      |                                             ^~~
a.cc:41:7: error: 'fact' was not declared in this scope
   41 |       fact[0] = fact[1] = inv[0] = inv[1] = 1;
      |       ^~~~
a.cc:41:32: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   41 |       fact[0] = fact[1] = inv[0] = inv[1] = 1;
      |                                ^
a.cc:41:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   41 |       fact[0] = fact[1] = inv[0] = inv[1] = 1;
      |                                         ^
a.cc:41:43: error: assignment of read-only location '*(inv + 1)'
   41 |       fact[0] = fact[1] = inv[0] = inv[1] = 1;
      |                                    ~~~~~~~^~~
a.cc:44:18: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |             inv[i] = (MOD - 1LL * (MOD / i) * inv[MOD % i] % MOD) % MOD;
      |                  ^
a.cc:44:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |             inv[i] = (MOD - 1LL * (MOD / i) * inv[MOD % i] % MOD) % MOD;
      |                                                          ^
a.cc:44:45: error: invalid operands of types 'long long int' and 'int(int)' to binary 'operator*'
   44 |             inv[i] = (MOD - 1LL * (MOD / i) * inv[MOD % i] % MOD) % MOD;
      |                             ~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~
      |                                 |                        |
      |                                 long long int            int(int)
a.cc:46:43: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |         for (int i = 2; i <= n; ++i) inv[i] = 1LL * inv[i] * inv[i - 1] % MOD;
      |                                           ^
a.cc:46:58: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |         for (int i = 2; i <= n; ++i) inv[i] = 1LL * inv[i] * inv[i - 1] % MOD;
      |                                                          ^
a.cc:46:51: error: invalid operands of types 'long long int' and 'int(int)' to binary 'operator*'
   46 |         for (int i = 2; i <= n; ++i) inv[i] = 1LL * inv[i] * inv[i - 1] % MOD;
      |                                               ~~~ ^ ~~~~~~
      |                                               |          |
      |                                               |          int(int)
      |                                               long long int
a.cc:46:71: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   46 |         for (int i = 2; i <= n; ++i) inv[i] = 1LL * inv[i] * inv[i - 1] % MOD;
      |                                                                       ^
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc: In member function 'int Binomial::operator()(int, int)':
a.cc:50:22: error: 'fact' was not declared in this scope
   50 |         return 1LL * fact[y] * inv[x] % MOD * inv[y - x] % MOD;
      |                      ^~~~
a.cc:50:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   50 |         return 1LL * fact[y] * inv[x] % MOD * inv[y - x] % MOD;
      |                                     ^
a.cc:50:56: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   50 |         return 1LL * fact[y] * inv[x] % MOD * inv[y - x] % MOD;
      |                                                        ^
a.cc: At global scope:
a.cc:52:7: error: 'N' was not declared in this scope
   52 | } nCr(N);
      |       ^
a.cc: In function 'int main()':
a.cc:69:9: error: 'ios_base' has not been declared
   69 |         ios_base::sync_with_stdio(false); cin.tie(NULL);
      |         ^~~~~~~~
a.cc:69:43: error: 'cin' was not declared in this scope
   69 |         ios_base::sync_with_stdio(false); cin.tie(NULL);
      |                                           ^~~
a.cc:69:51: error: 'NULL' was not declared in this scope
   69 |         ios_base::sync_with_stdio(false); cin.tie(NULL);
      |                                                   ^~~~
a.cc:1:1: note: 'NULL' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | fine FORD(i,a,b) for(int i=(a),b_=(b);i>=b_;--i)
a.cc:72:9: error: 'vector' was not declared in this scope
   72 |         vector <int> ans(n + 2);
      |         ^~~~~~
a.cc:72:17: error: expected primary-expression before 'int'
   72 |         vector <int> ans(n + 2);
      |                 ^~~
a.cc:73:18: error: 'pair' was not declared in this scope
   73 |         vector < pair<int, int> > cells;
      |                  ^~~~
a.cc:73:23: error: expected primary-expression before 'int'
   73 |         vector < pair<int, int> > cells;
      |                       ^~~
a.cc:78:17: error: 'cells' was not declared in this scope
   78 |                 cells.push_back(make_pair(x, y));
      |                 ^~~~~
a.cc:78:33: error: 'make_pair' was not declared in this scope
   78 |                 cells.push_back(make_pair(x, y));
      |                                 ^~~~~~~~~
a.cc:80:9: error: 'cells' was not declared in this scope
   80 |         cells.push_back(make_pair(h, w));
      |         ^~~~~
a.cc:80:25: error: 'make_pair' was not declared in this scope
   80 |         cells.push_back(make_pair(h, w));
      |                         ^~~~~~~~~
a.cc:81:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   81 |         sort(cells.begin(), cells.end());
      |         ^~~~
      |         short
a.cc:86:17: error: 'ans' was not declared in this scope
   86 |                 ans[i] = solve(x, y);
      |                 ^~~
a.cc:97:25: error: 'ans' was not declared in this scope
   97 |                         ans[j] = sub(ans[j], mul(ans[i], calc(x, y, u, v)));
      |                         ^~~
a.cc:100:9: error: 'cout' was not declared in this scope
  100 |         cout << ans[n] << endl;
      |         ^~~~
a.cc:100:17: error: 'ans' was not declared in this scope
  100 |         cout << ans[n] << endl;
      |                 ^~~
a.cc:100:27: error: 'endl' was not declared in this scope
  100 |         cout << ans[n] << endl;
      |                           ^~~~