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 map[15][15];

int count[15][15];

int main () {

	while(true) {
		int w, h;
		cin >> w >> h;

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

		for ( int i=1; i<h; i++ ) {
			for ( int j=0; j<w; j++ ) {
				count[i][j] = 0;
			}
		}
		
		for ( int i=0; i<w; i++ ) {
			if ( map[0][i] == 0 )
				count[0][i] = 1;
		}

		for ( int i=1; i<h; i++ ) {
			for ( int j=0; j<w; j++ ) {
				if ( map[i][j] != 1 ) {
					if ( map[i][j] != 2 ) {
						if ( j-1 >= 0 ) {
							if ( map[i-1][j-1] == 0 ) {
								count[i][j] += count[i-1][j-1];
							}
						}

						if ( j+1 < w ) {
							if ( map[i-1][j+1] == 0 ) {
								count[i][j] += count[i-1][j+1];
							}
						}
					}
					if ( map[i-1][j] == 0 ) {
						count[i][j] += count[i-1][j];
					}

					if ( i-2 >= 0 ) {
						if ( map[i-2][j] == 2 ) {
							count[i][j] += count[i-2][j];
						}
					}
				}

			}
		}

		/*
		for ( int i=0; i<h; i++ ) {
			for ( int j=0; j<w; j++ ) {
				cout << count[i][j] << "\t";
			}
			cout << endl;
		}
		cout << endl;
		*/
		int sum = 0;

		for ( int i=0; i<w; i++ ) {
			sum += count[h-1][i];
		}

		for ( int i=0; i<w; i++ ) {
			if ( map[h-2][i] == 2 )
				sum += count[h-2][i];
		}

		cout << sum << endl;
	}
}

C++: #include<iostream>

using namespace std;

int main() {
	int x, y;
	while (cin >> x >> y, x * y) {//
		int skimap[15][15] = {};//x = j y = i
		int dp[15][15] = {};//x = j y = i
		int flyover = 0;//??´????£??????????????????????
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < x; j++) {
				cin >> skimap[i][j];
			}
		}
		for(int i = 0; i < x; i++){
			if (skimap[0][i] == 0)dp[0][i] = 1;
		}
		for (int i = 0; i < y - 1; i++) {
			for (int j = 0; j < x; j++) {
				if (skimap[i][j] == 0) {
					if (j - 1 >= 0) {
						if (skimap[i + 1][j - 1] == 0) {
							dp[i + 1][j - 1] += dp[i][j];
						}
					}
					if (skimap[i + 1][j] != 1)dp[i + 1][j] += dp[i][j];
					if (j + 1 < x) {
						if (skimap[i + 1][j + 1] == 0) {
							dp[i + 1][j + 1] += dp[i][j];
						}
					}
				}
				else if (skimap[i][j] == 1) {
					continue;
				}else {
					if (i + 2 < y) {
						if (skimap[i + 2][j] != 1)dp[i + 2][j] = dp[i][j];
					}else {
						flyover += dp[i][j];
					}
				}
			}
		}
		int sum = flyover;
		for (int i = 0; i < x; i++) {
			sum += dp[y - 1][i];
		}
		cout << sum << endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main() {
	int x, y;
	while (cin >> x >> y, x * y) {//
		int skimap[15][15] = {};//x = j y = i
		int dp[15][15] = {};//x = j y = i
		int flyover = 0;//??´????£??????????????????????
		for (int i = 0; i < y; i++) {
			for (int j = 0; j < x; j++) {
				cin >> skimap[i][j];
			}
		}
		for(int i = 0; i < x; i++){
			if (skimap[0][i] == 0)dp[0][i] = 1;
		}
		for (int i = 0; i < y - 1; i++) {
			for (int j = 0; j < x; j++) {
				if (skimap[i][j] == 0) {
					if (j - 1 >= 0) {
						if (skimap[i + 1][j - 1] == 0) {
							dp[i + 1][j - 1] += dp[i][j];
						}
					}
					if (skimap[i + 1][j] != 1)dp[i + 1][j] += dp[i][j];
					if (j + 1 < x) {
						if (skimap[i + 1][j + 1] == 0) {
							dp[i + 1][j + 1] += dp[i][j];
						}
					}
				}
				else if (skimap[i][j] == 1) {
					continue;
				}else {
					if (i + 2 < y) {
						dp[i + 2][j] = dp[i][j];
					}else {
						flyover += dp[i][j];
					}
				}
			}
		}
		int sum = flyover;
		for (int i = 0; i < x; i++) {
			sum += dp[y - 1][i];
		}
		cout << sum << endl;
	}
	return 0;
}

C++: #include <iostream>
#define N 15
using namespace std;
void func(int,int);
int jump(int,int);
int X,Y,data[N][N],memo[N][N];
int main(){
  while(1){
    cin >> X >> Y;
    if(X==0&&Y==0) break;
    for(int i=0;i<Y;i++)
      for(int j=0;j<X;j++) cin >> data[i][j],memo[i][j]=0;
    for(int i=0;i<X;i++)
      if(data[0][i]==0) func(0,i);
    int cnt=0;
    for(int i=0;i<X;i++) cnt+=memo[0][i];
    cout << cnt << endl;
  }
  return 0;
}
void func(int y,int x){
  if(y==Y-1){
    memo[Y-1][x]=1;
    return ;
  }
  if(0<=x-1&&data[y+1][x-1]==0){
    if(memo[y+1][x-1]==0) func(y+1,x-1);
    memo[y][x]+=memo[y+1][x-1];
  }
  if(x+1<X&&data[y+1][x+1]==0){
    if(memo[y+1][x+1]==0) func(y+1,x+1);
    memo[y][x]+=memo[y+1][x+1];
  }
  if(data[y+1][x]==0){
    if(memo[y+1][x]==0) func(y+1,x);
    memo[y][x]+=memo[y+1][x];
  }
  if(data[y+1][x]==2){
    int r=jump(y+1,x);
    if(r==-2) memo[y][x]+=1;
    else if(r!=-1){
      if(memo[r][x]==0) func(r,x);
      memo[y][x]+=memo[r][x];
    }
  }
  if(memo[y][x]==0) data[y][x]=1;
}
int jump(int y,int x){
  while(1){
    y+=2;
    if(y<=Y-1&&data[y][x]==1) break;
    if(y>=Y-1) return -2;
    if(data[y][x]==0) return y;
  }
  return -1;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int w, h;
        cin >> w >> h;
        if(w == 0)
            return 0;

        vector<vector<int> > grid(h+1, vector<int>(w+2, 0));
        for(int i=0; i<h+1; ++i)
            grid[i][0] = grid[i][w+1] = 1;
        for(int i=0; i<h; ++i){
            for(int j=1; j<=w; ++j){
                cin >> grid[i][j];
            }
        }

        vector<vector<int> > num(h+1, vector<int>(w+2, 0));
        for(int i=1; i<=w; ++i){
            if(grid[0][i] != 1)
                num[0][i] = 1;
        }

        for(int y=0; y<h-1; ++y){
            for(int x=1; x<=w; ++x){
                if(grid[y][x] == 2){
                    num[y+2][x] += num[y][x];
                }else{
                    for(int dx=-1; dx<=1; ++dx){
                        if(grid[y+1][x+dx] == 1 || (grid[y+1][x+dx] == 2 && dx != 0))
                            continue;
                        num[y+1][x+dx] += num[y][x];
                    }
                }
            }
        }

        int ret = accumulate(num[h-1].begin(), num[h-1].end(), 0);
        ret += accumulate(num[h].begin(), num[h].end(), 0);
        cout << ret << endl;
    }
}