For this Question: You are given an N*M grid with you standing at the upper left corner(0,0). You want to reach  lower right(N-1,M-1) cell and you can only move down  or right. Find the Number of ways you can do so. Note that B places on the grid are blocked and you cannot step there. As the answer may be large so print anwer modulo 1000000007.First line contains N M B. 
B lines follow each containing coordinate of the ith blocked cell Xi Yi.

2 <= N,M <= 100
0 <= B <= N*M - 2 (start and end cell will never be blocked)
0 <= X <= N-1
0 <= Y <= M-1Output single integer containing the number of possible paths modulo 1000000007.Sample Input
2 2 0

Sample Output
2

Sample Input
2 2 1
0 1

Sample Output
1, I have written this Solution Code: // Don't use this code as reference. Much simpler solution is provided in the editorial section

#include "bits/stdc++.h"
using namespace std;
 
#define int long long int
#define pi pair<int, int>
#define fi first
#define se second
#define speed ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define endl '\n'
 
const int N = 3e3 + 5;
const int M = 2e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9 + 9;

int power(int a, int b){
	int ans = 1;
	while(b){
		if(b&1)
			ans = (ans * a) % mod;
		b >>= 1;
		a = (a * a) % mod;
	}
	return ans;
}

int f[M], invf[M], p[N], q[N];
pi a[N];
int dp[N];

int path(int x1, int y1, int x2, int y2){
	int x = x2 - x1;
	int y = y2 - y1;
	int res = f[x+y];
	res = (res * invf[x]) % mod;
	res = (res * invf[y]) % mod;
	return res;
}

signed main() {
	speed;
	f[0] = 1;
	for(int i = 1; i < M; i++)
		f[i] = (i * f[i-1]) % mod;
	invf[M-1] = power(f[M-1], mod-2) % mod;
	for(int i = M-2; i >= 0; i--)
		invf[i] = ((i+1) * invf[i+1]) % mod;
	int h, w, n;
	cin >> h >> w >> n;	
	map<int, int> x, y;
	for(int i = 1; i <= n; i++){
		cin >> a[i].fi >> a[i].se;
		a[i].fi++;
		a[i].se++;
		x[a[i].fi] = 1;
		y[a[i].se] = 1;
	}
	a[0].fi = 1;	a[0].se = 1;
	a[n+1].fi = h;	a[n+1].se = w;
	x[1] = 1;	x[h] = 1;
	y[1] = 1;	y[w] = 1;
	int pp = 0;
	for(auto &i: x){
		pp += i.se;
		p[pp] = i.fi;
		i.se = pp;
	}
	pp = 0;
	for(auto &i: y){
		pp += i.se;
		q[pp] = i.fi;
		i.se = pp;
	}
	for(int i = 0; i <= n+1; i++){
		a[i].fi = x[a[i].fi];
		a[i].se = y[a[i].se];
	}
	sort(a + 1, a + n + 1);

	for(int i = 1; i <= n+1; i++){
		dp[i] = path(1, 1, p[a[i].fi], q[a[i].se]);
		for(int j = 1; j < i; j++){
			int x1 = a[j].fi, y1 = a[j].se;
			int x2 = a[i].fi, y2 = a[i].se;
			if(x1 <= x2 && y1 <= y2){
				dp[i] -= (dp[j]*path(p[x1], q[y1], p[x2], q[y2])) % mod;
				dp[i] = (dp[i] + mod*mod) % mod;;
			}
		}
	}
	cout << dp[n+1];
	return 0;
}, In this Programming Language: C++, Now tell me if this Code is compilable or not?