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;
int X,Y;
int fields[20][20];
int dp[20][20];
int counter=0;
int Max(int x,int y){
        return x>y?x:y;
}
int Min(int x,int y){
        return x>y?y:x;
}
int recursion(int y,int x){
        int res=0;
        if(dp[y][x]!=-1)
                return dp[y][x];
        if(y>=Y){
                res=1;
        }
        else if(fields[y][x]==3)
                res=0;
        else if(fields[y][x]==2){
                if(fields[y+2][x]==1)
                        return 0;
                res+=recursion(y+2,x);
        }
        else{
                if(fields[y+1][x]!=1){
                        res+=recursion(y+1,x);
                }
                if(fields[y+1][x-1]==0){
                        res+=recursion(y+1,x-1);
                }
                if(fields[y+1][x+1]==0){
                        res+=recursion(y+1,x+1);
                }
        }
        return dp[y][x]=res;
}
int main(){
        while(true){
                for(int i=0 ; i<20 ; i++ )
                        for(int j=0 ; j<20 ; j++ )
                                dp[i][j]=-1;
                cin >> X >> Y;
                counter=0;
                if(X+Y==0)
                        break;
                for(int i=0 ; i<=X ; i++ ){
                        fields[0][i]=3;
                        fields[Y+1][i]=3;
                }
                for(int i=0 ; i<=Y ; i++ ){
                        fields[i][0]=3;
                        fields[i][X+1]=3;
                }
                for(int i=1 ; i<=Y ; i++ )
                        for(int j=1 ; j<=X ; j++ )
                                cin >> fields[i][j];
                int ans=0;
                for(int i=1 ; i<=X ; i++ ){
                        if(fields[1][i]==1)
                                continue;
                        ans+=recursion(1,i);
                }
                cout << ans << endl;
        }
        return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

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

int main() {
    while (1) {
        int dp[17][15] = { 0 };
        int field[15][15] = { 0 };
        int h, w;

        cin >> w >> h;
        if (w == 0) {
            break;
        }
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                cin >> field[i][j];
            }
        }
        
        for (int j = 0; j < w; j++) {
            if (field[0][j] == 0) {
            dp[0][j] = 1;
            }
        }
        
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (dp[i][j] > 0) {
                    if (i == h - 1) {
                        dp[i + 1][j] += dp[i][j];
                        continue;
                    }
                    if (field[i][j] == 2) {
                        if (field[i + 2][j] == 0 || field[i + 2][j] == 2) {
                            dp[i + 2][j] += dp[i][j];
                        }
                        continue;
                    }
                    for (int k = 0; k < 3; k++) {
                        int nx = j + dx[k];
                        int ny = i + dy[k];
                        if (nx < 0 || nx >= w) {
                            continue;
                        }
                        if (field[ny][nx] == 0 || (field[ny][nx] == 2 && k == 1)) {
                            dp[ny][nx] += dp[i][j];
                        }
                    }
                }
            }
        }
        
        int ans = 0;
        for (int i = h; i <= h + 1; i++) {
            for (int j = 0; j < w; j++) {
                ans += dp[i][j];
            }
        }
        cout << ans << endl;
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int n, m;
	while (true){
		cin >> n >> m;
		if (n == 0 && m == 0){
			break;
		}
		int map[100][100] = { 0 };
		int dp[100][100] = { 0 };
		for (int i = 0; i < m; i++){
			for (int i2 = 0; i2 < n; i2++){
				cin >> map[i][i2];
			}
		}
		for (int i = 0; i < n; i++){
			if (map[0][i] == 0){
				dp[0][i] = 1;
			}
		}
		for (int i = 0; i < m; i++){
			for (int i2 = 0; i2 < n; i2++){
				if (map[i][i2] == 0){
					if (map[i + 1][i2] == 0 || map[i + 1][i2] == 2){
						dp[i + 1][i2] += dp[i][i2];
					}
					if (i2+1<m&&map[i + 1][i2 + 1] == 0&&i<m-1){
						dp[i + 1][i2 + 1] += dp[i][i2];
					}
					if (i2 - 1 >= 0 && map[i + 1][i2 - 1] == 0&&i<m - 1){
						dp[i + 1][i2 - 1] += dp[i][i2];
					}
				}
				if (map[i][i2] == 2){
					if (map[i + 2][i2] == 0 || map[i + 2][i2] == 2){
						dp[i + 2][i2] += dp[i][i2];
					}
				}
			}
		}
		int ans = 0;
		for (int i = 0; i < n; i++){
			ans += dp[m][i];
			ans += dp[m + 1][i];
		}
		cout << ans << endl;
	}
}

C++: #include<stdio.h>
int dp[20][20];
int dat[20][20];
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		for(int i=0;i<20;i++)
			for(int j=0;j<20;j++)dp[i][j]=dat[i][j]=0;
		for(int i=0;i<b;i++)
			for(int j=0;j<a;j++)
				scanf("%d",&dat[i][j]);
		for(int i=0;i<a;i++)if(dat[0][i]!=1)dp[0][i]=1;
		for(int i=0;i<b;i++){
			for(int j=0;j<a;j++){
				if(dat[i][j]==0){
					if(i<b-1&&j&&dat[i+1][j-1]==0)dp[i+1][j-1]+=dp[i][j];
					if(i<b-1&&j<a-1&&dat[i+1][j+1]==0)dp[i+1][j+1]+=dp[i][j];
					if(dat[i+1][j]!=1)dp[i+1][j]+=dp[i][j];
				}
				if(dat[i][j]==2){
					if(dat[i+2][j]!=1)dp[i+2][j]+=dp[i][j];
				}
			}
		}
		int ret=0;
		for(int i=b;i<20;i++)
			for(int j=0;j<a;j++)
				ret+=dp[i][j];
		printf("%d\n",ret);
	}
}