Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
	)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		X, _ := strconv.Atoi(buf[0])
		Y, _ := strconv.Atoi(buf[1])
		if X == 0 && Y == 0 {
			break
		}
		tbl := make([][]int, Y+2)
		field := make([][]int, Y+2)
		for i := range field {
			field[i] = make([]int, X+2)
			tbl[i] = make([]int, X+2)
			for j := range field[i] {
				field[i][j] = 2
				tbl[i][j] = 0
			}
		}
		buf_ := make([][]string, Y)
		for i := range buf_ {
			scanner.Scan()
			buf_[i] = strings.Split(scanner.Text(), " ")
		}
		for i := 1; i <= Y; i++ {
			for j := 1; j <= X; j++ {
				field[i][j], _ = strconv.Atoi(buf_[i-1][j-1])
				switch field[i][j] {
				case 0:
					if i == 1 {
						tbl[i][j] = 1 // スタートy=1
					} else {
						if field[i-1][j-1] != 2 {
							tbl[i][j] += tbl[i-1][j-1] // 左上からやってくる
						}
						if field[i-1][j] != 2 {
							tbl[i][j] += tbl[i-1][j] // 真上からやってくる
						}
						if field[i-1][j+1] != 2 {
							tbl[i][j] += tbl[i-1][j+1] // 右上からやってくる
						}
						if field[i-2][j] == 2 {
							tbl[i][j] += tbl[i-2][j] // ジャンプしてくる
						}
					}
				case 1:
					tbl[i][j] = 0 // 障害物あり
				case 2:
					if field[i-1][j] != 2 {
						tbl[i][j] += tbl[i-1][j] // 真上からくる
					}
					if field[i-2][j] == 2 {
						tbl[i][j] += tbl[i-2][j] // ジャンプ台からジャンプしてくる
					}
				}
			}
		}
		sum := 0
		for i := 1; i <= X; i++ {
			sum += tbl[Y][i] // とびこさないでゴール
			if field[Y-1][i] == 2 {
				sum += tbl[Y-1][i] // 飛び越してゴール
			}
		}
		fmt.Println(sum)
	}
}

C++: #include<iostream>
using namespace std;
long long solve(int x,int y);
int ax,ay;
int mas[200][200];
long long memo[200][200];
int main(){
  while(1){
    for(int i=0;i<200;i++){
      for(int j=0;j<200;j++){
	memo[i][j]=0;
      }
    }
    long long ans=0;
    cin>>ax>>ay;
    if(ax==0 && ay==0) break;
    
    for(int i=0;i<ay;i++){
      for(int j=0;j<ax;j++){
	cin>>mas[i][j];
      }
    }
    
    for(int i=0;i<ax;i++){
      if(mas[0][i]!=1){
	ans+=solve(i,0);
      }
    }
    cout<<ans<<endl;
  }
}
long long solve(int x,int y){
  if(y>=ay){
    return 1;
  }else if(memo[y][x]!=0){
    return memo[y][x];
  }else if(mas[y][x]==2){
    if(mas[y+2][x]!=1){
      return memo[y][x]=solve(x,y+2);
    } 
    else{
      return 0;
    }
  }
  else if(mas[y][x]==1){
    return 0;
  }
  else{
    long long anss=0; 
    if(mas[y+1][x]!=1){
      anss+=solve(x,y+1);
    }
    if(x+1<ax && mas[y+1][x+1]==0 && y+1!=ay){
      anss+=solve(x+1,y+1);
    }
    if(0<=x-1 && mas[y+1][x-1]==0 && y+1!=ay){
      anss+=solve(x-1,y+1);
    }
    return memo[y][x]=anss;
  }
}

C++: #include<cstdio>
#include<cstring>

int map[15][15],table[15][15],X,Y;

int main(){
while(1){

scanf("%d%d",&X,&Y);
if(X==0&&Y==0) return 0;
memset(map,-1,sizeof(map));
memset(table,0,sizeof(table));
for(int i=0;i<Y;i++){
for(int j=0;j<X;j++){
scanf("%d",&map[i][j]);
if(i==0&&map[i][j]==0) table[i][j]=1;
else if(i!=0&&map[i][j]==0){
if(j>0&&map[i-1][j-1]==0) table[i][j]+=table[i-1][j-1];
if(j<X-1&&map[i-1][j+1]==0) table[i][j]+=table[i-1][j+1];
if(map[i-1][j]==0)table[i][j]+=table[i-1][j];
if(i>2&&map[i-2][j]==2) table[i][j]+=table[i-2][j]; 
} 
}
int sum=0;
for(int i=0;i<X;i++){
sum+=map[Y-1][i];
}
printf("%d\n",sum);

}

}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

int maps[20][20];
int course[20][20];
int X, Y;

int way(int y, int x){
  if(course[y][x] > 0) return course[y][x];
  else if(maps[y][x] == 1) return 0;
  else if(y >= Y) return 1;
  else if(maps[y][x] == 2 && maps[y + 2][x] != 1) return course[y][x] = way(y + 2, x);
  else{
    int SUM = 0;
    for(int i = 0; i < 3; i++){
      int ny = y + 1;
      int nx = x - 1 + i;
      if(maps[ny][nx] != 1 && 1 <= nx && nx <= X){
	int flug = 1;
	if(i != 1 && maps[ny][nx] == 2) flug = 0;
	if(flug) SUM += way(ny, nx);
      }
    }
    return course[y][x] = SUM;
  }
} 

int main(){
  while(1){
    cin >> X >> Y;
    if(X == 0 && Y == 0) break;
    for(int i = 1; i <= Y; i++){
      for(int j = 1; j <= X; j++){
	cin >> maps[i][j];
	course[i][j] = 0;
      }
    }
    int cnt = 0;
    for(int i = 1; i <= X; i++){
      if(maps[0][i] != 1) cnt += way(1, i);
    }
    cout << cnt << endl;
  }
}

C++: #include <iostream>
using namespace std;

int dx[3] = {-1,0,+1};

int main(){
	int w, h, s[20][20];
	while( cin >> w >> h, w || h ){
		for(int y=0 ; y < h ; y++ ){
			for(int x=0 ; x < w ; x++ ){
				cin >> s[y][x];
			}
		}
		
		int dp[20][20] = {0};
		for(int x=0 ; x < w ; x++ ){
			if( s[0][x] == 0 ) dp[0][x] = 1;
		}
		for(int y=0 ; y < h-1 ; y++ ){
			for(int x=0 ; x < w ; x++ ){
				if( s[y][x] == 0 ){
					for(int i=0 ; i < 3 ; i++ ){
						int mx = x + dx[i];
						int my = y + 1;
						if( mx < 0 || mx >= w ) continue;
						
						if( s[my][mx] == 0 ){
							dp[my][mx] += dp[y][x];
						}else if( i == 1 && s[my][mx] == 2 ){
							dp[my][mx] += dp[y][x];
						}
					}
				}else if( s[y][x] == 2 ){
					int mx = x;
					int my = y + 2;
					if( s[my][mx] != 1 ){
						dp[my][mx] += dp[y][x];
					}
				}
			}
		}
		
		int ans=0;
		for(int x = 0 ; x < w ; x++ ){
			ans += dp[h-1][x] + dp[h][x];
		}
		cout << ans << endl;
	}
}

C++: #include<iostream>
using namespace std;
 
int main(){
        int x,y;
        while(cin>>x>>y,x){
                int D[16][16],P[16][16],ans=0;
                for(int i=0;i<256;i++)P[i/16][i%16]=0;
                for(int i=0;i<y;i++)for(int j=0;j<x;j++)cin>>D[i][j];
                for(int i=0;i<x;i++)if(!D[0][i])P[0][i]=1;
                for(int i=0;i<y-1;i++){
                        for(int j=0;j<x;j++){
                                if(!D[i][j]){
                                        if (D[i + 1][j] != 1) P[i+1][j]+=P[i][j];
                                        if(j>0 && D[i + 1][j - 1] != 2)P[i+1][j-1]+=P[i][j];
                                        if(j<x-1 && !D[i + 1][j + 1] != 2)P[i+1][j+1]+=P[i][j];
                                }
                                if(D[i][j]==2){
//                                        if(i+2>y-1)P[i+1][j]+=P[i][j];
                                        P[i+2][j]+=P[i][j];
                                }
                        }
                }
                for(int i=0;i<x;i++)ans+=P[y-1][i];
                cout<<ans<<endl;
        }
}

C++: #include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<algorithm>

using namespace std;

int main(){
	int n,m;
	int masu[17][17];
	int ura[17][17];
	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]);
			}
		}
		for(int i=1;i<=n;i++){
			switch(ura[1][i]){
				case 0:masu[1][i]+=1;break;
				case 1:masu[1][i]+=0;break;
				case 2:if(ura[2][i]==0){masu[2][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];
			}
		}
		printf("%d\n",cont);
	}
	
}