Language: C++

#include<bits/stdc++.h>

using namespace std;
const int MX=21,MXM=1<<19|1
int d[MXM],f[MXM],md=1000000007;
int n,m,K,u[MX][MX],ans;
#define lb(x) ((x)&(-(x)))
int main() {
	int i,j,a,b,c,k;
	cin>>n>>m>>K;
	for(i=0;i<K;i++)cin>>a>>b>>c,u[a-1][b-1]=c+1;
	d[0]=1;
	#define A(x) (f[x]=(f[x]+d[k])%md)
	for(i=0;i<m;i++)for(j=0;j<n-1;j++){
		for(k=0;k<(1<<(n-1));k++){
			if(!((k>>j)&1)&&u[i][j]!=2)A(k);
			if(u[i][j]!=1){
				if((k>>j)&1)A(k);
				else A(k+(1<<j)-(lb(k>>j)<<j));
			}
		}
		memcpy(d,f,sizeof(int)*(1<<(n-1)));
		memset(f,0,sizeof(int)*(1<<(n-1)));
	}
	for(i=0;i<(1<<(n-1));i++)ans=(ans+d[i])%md;
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:5:1: error: expected ',' or ';' before 'int'
    5 | int d[MXM],f[MXM],md=1000000007;
      | ^~~
a.cc: In function 'int main()':
a.cc:12:9: error: 'd' was not declared in this scope
   12 |         d[0]=1;
      |         ^
a.cc:13:23: error: 'f' was not declared in this scope
   13 |         #define A(x) (f[x]=(f[x]+d[k])%md)
      |                       ^
a.cc:16:52: note: in expansion of macro 'A'
   16 |                         if(!((k>>j)&1)&&u[i][j]!=2)A(k);
      |                                                    ^
a.cc:13:40: error: 'md' was not declared in this scope; did you mean 'm'?
   13 |         #define A(x) (f[x]=(f[x]+d[k])%md)
      |                                        ^~
a.cc:16:52: note: in expansion of macro 'A'
   16 |                         if(!((k>>j)&1)&&u[i][j]!=2)A(k);
      |                                                    ^
a.cc:13:23: error: 'f' was not declared in this scope
   13 |         #define A(x) (f[x]=(f[x]+d[k])%md)
      |                       ^
a.cc:18:45: note: in expansion of macro 'A'
   18 |                                 if((k>>j)&1)A(k);
      |                                             ^
a.cc:13:40: error: 'md' was not declared in this scope; did you mean 'm'?
   13 |         #define A(x) (f[x]=(f[x]+d[k])%md)
      |                                        ^~
a.cc:18:45: note: in expansion of macro 'A'
   18 |                                 if((k>>j)&1)A(k);
      |                                             ^
a.cc:13:23: error: 'f' was not declared in this scope
   13 |         #define A(x) (f[x]=(f[x]+d[k])%md)
      |                       ^
a.cc:19:38: note: in expansion of macro 'A'
   19 |                                 else A(k+(1<<j)-(lb(k>>j)<<j));
      |                                      ^
a.cc:13:40: error: 'md' was not declared in this scope; did you mean 'm'?
   13 |         #define A(x) (f[x]=(f[x]+d[k])%md)
      |                                        ^~
a.cc:19:38: note: in expansion of macro 'A'
   19 |                                 else A(k+(1<<j)-(lb(k>>j)<<j));
      |                                      ^
a.cc:22:26: error: 'f' was not declared in this scope
   22 |                 memcpy(d,f,sizeof(int)*(1<<(n-1)));
      |                          ^
a.cc:25:49: error: 'md' was not declared in this scope; did you mean 'm'?
   25 |         for(i=0;i<(1<<(n-1));i++)ans=(ans+d[i])%md;
      |                                                 ^~
      |                                                 m