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 <cstdio>
int a[16][16];
long long dp[18][16];
int main()
{
    while (true) {
        int h, w;
        scanf("%d%d", &w, &h);
        if (!(w | h)) break;
        for (int i = 0; i < 16; ++i) for (int j = 0; j < 16; ++j)
            dp[i][j] = 0;
        for (int i = 0; i < h; ++i) for (int j = 0; j < w; ++j)
            scanf("%d", &a[i][j]);

        for (int j = 0; j < w; ++j)
            if (a[0][j] == 0) dp[0][j] = 1;
        for (int i = 1; i < h; ++i) for (int j = 0; j < w; ++j) {
            if (a[i][j] == 1) continue;
            if (a[i-1][j] != 2) dp[i][j] = dp[i-1][j];
            if (a[i][j] == 0) {
                if (j > 0 && a[i-1][j-1] == 0) dp[i][j] += dp[i-1][j-1];
                if (j < w-1 && a[i-1][j+1] == 0) dp [i][j] += dp[i-1][j+1];
            }
            if (i > 1 && a[i-2][j] == 2) dp[i][j] += dp[i-2][j];
        }
        for (int j = 0; j < w; ++j) {
            dp[h][j] = dp[h-1][j];
            if (h > 1 && a[h-2][j] == 2) dp[h][j] += dp[h-2][j];
        }
        int res = 0;
        for (int j = 0; j < w; ++j) res += dp[h][j];
        printf("%d\n", res);
    }
    return 0;
}

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]){
					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)ans+=P[i][j];
					else P[i+2][j]+=P[i][j];
				}
			}
		}
		for(int i=0;i<x;i++){
			if(D[y-1][i]!=1)ans+=P[y-1][i];
		}
		cout<<ans<<endl;
	}
}

C++: #include<iostream>

int w, h;
int map[16][15], memo[16][15];

int rec(int x, int y){
	if(memo[y][x] >= 0){
		return memo[y][x];
	}

	if(map[y][x] == 1){
		return 0;
	}

	if(y >= h-1){
		return 1;
	}

	int res = 0;
	if(map[y][x] == 0){
		for(int i=-1;i<2;i++){
			if(x+i >= 0 && x+i < w && !(map[y+1][x+i] == 2 && i != 0)){
				res += rec(x+i, y+1);
			}
		}
		return memo[y][x] = res;
	}else if(map[y][x] == 2){
		return memo[y][x] = rec(x, y+2);
	}
}

int main(){
	while(std::cin >> w >> h, w){

		for(int i=0;i<16;i++){
			for(int j=0;j<15;j++){
				memo[i][j] = -1;
				map[i][j] = 0;
			}
		}

		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				std::cin >> map[i][j];
			}
		}

		int res = 0;
		for(int i=0;i<w;i++){
			res += rec(i, 0);
		}

		std::cout << res << std::endl;
	}
}

C++: #include<iostream>

using namespace std;

int main(){
	int n,m;
	int masu[17][17];
	int ura[17][17];
	cin>>n>>m;
	for(int i=0;i<17;i++){
		for(int j=0;j<17;j++){
			masu[i][j]=ura[i][j]=0;
		}
	}
	
	for(int i=0;i<n;i++){
		for(int j=1;j<=m;j++){
			cin>>masu[i][j];
		}
	}
	
	for(int j=1;j<=m;j++){
		ura[0][j]=1;
	}
	
	
	for(int i=0;i<n-1;i++){
		for(int j=1;j<=m;j++){
			if(masu[i][j]==0){
				if(masu[i+1][j-1]==0){
					ura[i+1][j-1]+=ura[i][j];
				}
				if(masu[i+1][j]!=1){
					ura[i+1][j]+=ura[i][j];
				}
				if(masu[i+1][j+1]==0){
					ura[i+1][j+1]+=ura[i][j];
				}
			}
			
			if(masu[i][j]==2){
				if(masu[i+2][j]!=1){
					ura[i+2][j]+=ura[i][j];
				}
			}
		}
	}
	int cont=0;
	for(int i=1;i<=m;i++){
		cont+=ura[n][i]+ura[n-1][i];
	}
	
	/*
	
	for(int i=0;i<17;i++){
		for(int j=0;j<17;j++){
			printf("%2d ",ura[i][j]);
		}
		puts("");
	}*/
	printf("%d\n",cont);
	
	
}

C++: #include<iostream>
#include<vector>
#include<string>
#define int long long
using namespace std;

signed main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		vector<vector<int>>masu(b + 1, vector<int>(a));
		vector<vector<int>>suberikata(b + 1, vector<int>(a));
		for (int c = 0; c < b; c++) {
			for (int d = 0; d < a; d++) {
				cin >> masu[c][d];
			}
		}
		for (int e = 0; e < b; e++) {
			if (masu[0][e] ==0)suberikata[0][e]++;
		}
		for (int f = 0; f < b-1; f++) {
			for (int g = 0; g < a; g++) {
				switch (masu[f][g]) {
				case 0:
					suberikata[f + 1][g] += suberikata[f][g];
					if (g > 0&&masu[f+1][g-1]!=2)suberikata[f + 1][g - 1] += suberikata[f][g];
					if (g < a - 1 && masu[f + 1][g + 1] != 2)suberikata[f + 1][g + 1] += suberikata[f][g];
					break;     
				case 1:break;
				case 2:suberikata[f + 2][g] += suberikata[f][g]; break;
				}
			}
		}
		cout << endl;
		for (auto j : suberikata) {
			for (int i : j)cout << i << " ";
			cout << endl;
		}
		cout << endl;
	}
}
/*int s = 0;
		for (int j : suberikata[suberikata.size() - 2]) {
			s += j;
		}
		cout << s << endl;*/

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

int main() {
	int x, y;
	while (cin >> x >> y && (x != 0 && y != 0)) {
		vector<vector<int>> course(y + 2, vector<int>(x + 2, 0));
		for (int i = 1; i <= y; i++) {
			for (int j = 1; j <= x; j++) {
				cin >> course[i][j];
			}
		}

		vector<vector<int>> path(y + 2, vector<int>(x + 2, 0));
		//?????????????????????????????????1????????????
		for (int i = 1; i <= x; i++) {
			if (course[1][i] != 1) path[1][i] = 1;
		}

		for (int i = 1; i <= y; i++) {
			for (int j = 1; j <= x; j++) {
				//????????????????????´????????????????????´??????????????????????????????????????????
				//?????????????§????????????????????????´?????????????????????????????£????????°?????´????????????????????????
				if (course[i][j] == 0) {
					if (course[i + 1][j + 1] == 0) path[i + 1][j + 1] += path[i][j];
					if (course[i + 1][j] != 1) path[i + 1][j] += path[i][j];
					if (course[i + 1][j - 1] == 0) path[i + 1][j - 1] += path[i][j];
				}
				//?¬???????????????´???????????£????????°????????????????????????????????????
				//?????????????????£????????§??´??????????????´???????????????(?????£?????????????????????????????´???????????????)
				if (course[i][j] == 2 && course[i + 2][j] != 1) {
					path[i + 2][j] += path[i][j];
					if (i + 2 > y && i != y) path[y][j] += path[i][j];
				}
				//???????????´???????????????????????????????????????
				if (course[i][j] == 1) {/*do anything*/ }
			}
		}

		cout << accumulate(path[y].begin() + 1, path[y].end() - 1, 0) << endl;

	}
}