Language: C++

#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>

using namespace std;


	int n,m;
	int masu[17][17];
	int ura[17][17];
	
int motom(){
		for(int i=0;i<17;i++){
			for(int j=0;j<17;j++){
				masu[i][j]=0;
			}
		}
		for(int i=1;i<=m;i++){
			switch(ura[1][i]){
				case 0:masu[1][i]+=1;break;
				case 1:masu[1][i]+=0;break;
				case 2:masu[1][i]+=1;break;
			}
		}
		for(int i=1;i<n;i++){
			for(int j=1;j<=m;j++){
				if(ura[i][j]==0){
					if(ura[i+1][j-1]==0){
						masu[i+1][j-1]+=masu[i][j];
					}
					if(ura[i+1][j]!=1){
						masu[i+1][j]+=masu[i][j];
					}
					if(ura[i+1][j+1]==0){
						masu[i+1][j+1]+=masu[i][j];
					}
				}else if(ura[i][j]==2){
					if(ura[i+2][j]!=1){
						masu[i+2][j]+=masu[i][j];
					}
				}
			}
		}
		
		int cont=0;
		for(int i=n;i<=n+1;i++){
			for(int j=1;j<=m;j++){
				cont+=masu[i][j];
			}
		}
		return cont;
}

int main(){
	srand(time(NULL));
	int cc=0;
	while(1){
		scanf("%d%d",&n,&m);
		if(n==0 && m==0){
			break;
		}
		for(int i=0;i<17;i++){
			for(int j=0;j<17;j++){
				masu[i][j]=0;
				ura[i][j]=0;
			}
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				scanf("%d",&ura[i][j]);
			}
		}
		
		printf("%d\n",motom());
	}
	
}#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>

using namespace std;


	int n,m;
	int masu[17][17];
	int ura[17][17];
	
int motom(){
		for(int i=0;i<17;i++){
			for(int j=0;j<17;j++){
				masu[i][j]=0;
			}
		}
		for(int i=1;i<=m;i++){
			switch(ura[1][i]){
				case 0:masu[1][i]+=1;break;
				case 1:masu[1][i]+=0;break;
				case 2:masu[1][i]+=1;break;
			}
		}
		for(int i=1;i<n;i++){
			for(int j=1;j<=m;j++){
				if(ura[i][j]==0){
					if(ura[i+1][j-1]==0){
						masu[i+1][j-1]+=masu[i][j];
					}
					if(ura[i+1][j]!=1){
						masu[i+1][j]+=masu[i][j];
					}
					if(ura[i+1][j+1]==0){
						masu[i+1][j+1]+=masu[i][j];
					}
				}else if(ura[i][j]==2){
					if(ura[i+2][j]!=1){
						masu[i+2][j]+=masu[i][j];
					}
				}
			}
		}
		
		int cont=0;
		for(int i=n;i<=n+1;i++){
			for(int j=1;j<=m;j++){
				cont+=masu[i][j];
			}
		}
		return cont;
}
int contt;
void saiki(int x,int y){
	if(y<1||y>m){
		return;
	}
	
		masu[x][y]++;
	if(x>n-1){
		contt++;
		return;
	}
	if(ura[x][y]==0){
		if(ura[x+1][y-1]==0){
			saiki(x+1,y-1);
		}
		if(ura[x+1][y]!=1){
			saiki(x+1,y);
		}
		if(ura[x+1][y+1]==0){
			saiki(x+1,y+1);
		}
	}
	if(ura[x][y]==2){
		if(ura[x+2][y]!=1){
			saiki(x+2,y);
		}
	}
}
int simu(){
		for(int i=0;i<17;i++){
			for(int j=0;j<17;j++){
				masu[i][j]=0;
			}
		}
	contt=0;
	for(int i=1;i<=m;i++){
		if(ura[1][i]!=1){
			saiki(1,i);
		}
	}
	/*
	puts("");
	for(int i=1;i<=n+1;i++){
		for(int j=1;j<=m;j++){
			printf("%d ",masu[i][j]);
		}
		puts("");
	}*/
	return contt;
}

int main(){
	srand(time(NULL));
	int cc=0;
	while(1){
		scanf("%d%d",&n,&m);
		if(n==0 && m==0){
			break;
		}
		for(int i=0;i<17;i++){
			for(int j=0;j<17;j++){
				masu[i][j]=0;
				ura[i][j]=0;
			}
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				scanf("%d",&ura[i][j]);
			}
		}
		int aa=motom();
		
		printf("%d\n",aa);
	}
	
}

Compiler output:
a.cc:80:2: error: stray '#' in program
   80 | }#include<cstdio>
      |  ^
a.cc:80:3: error: 'include' does not name a type
   80 | }#include<cstdio>
      |   ^~~~~~~
a.cc:90:13: error: redefinition of 'int n'
   90 |         int n,m;
      |             ^
a.cc:11:13: note: 'int n' previously declared here
   11 |         int n,m;
      |             ^
a.cc:90:15: error: redefinition of 'int m'
   90 |         int n,m;
      |               ^
a.cc:11:15: note: 'int m' previously declared here
   11 |         int n,m;
      |               ^
a.cc:91:13: error: redefinition of 'int masu [17][17]'
   91 |         int masu[17][17];
      |             ^~~~
a.cc:12:13: note: 'int masu [17][17]' previously declared here
   12 |         int masu[17][17];
      |             ^~~~
a.cc:92:13: error: redefinition of 'int ura [17][17]'
   92 |         int ura[17][17];
      |             ^~~
a.cc:13:13: note: 'int ura [17][17]' previously declared here
   13 |         int ura[17][17];
      |             ^~~
a.cc:94:5: error: redefinition of 'int motom()'
   94 | int motom(){
      |     ^~~~~
a.cc:15:5: note: 'int motom()' previously defined here
   15 | int motom(){
      |     ^~~~~
a.cc:186:5: error: redefinition of 'int main()'
  186 | int main(){
      |     ^~~~
a.cc:57:5: note: 'int main()' previously defined here
   57 | int main(){
      |     ^~~~