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>
#include <vector>

using namespace std;

#define loop(i,a,b) for(int i=a; i<b; i++)
#define rep(i,b) loop(i,0,b)

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

int main(){
    int w,h;
    while(cin>>w>>h, w||h){
        int G[100][100];
        int dp[100][100]={};
        rep(i,h)rep(j,w) cin>> G[i][j];

        rep(i,w) dp[0][i] = G[0][i]==0;

        rep(i,h-1) rep(j,w){
            if( G[i][j]==1){
                dp[i][j]=0;
            } else if(G[i][j]==2 && G[i+2][j]!=1){
                dp[i+2][j]+=dp[i][j];
            } else {
                if(G[i+1][j]==2) dp[i+1][j]+=dp[i][j];
                loop(k,-1,2){
                    if(0<=j+k && j+k<w && G[i+1][j+k]==0){
                        dp[i+1][j+k]+=dp[i][j];
                    }
                }
            }
        }

        ull res=0;
        loop(i,h-1,h+1)rep(j,w){
            res+=dp[i][j];
        }

        cout<<res<<endl;
    }
}

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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)

int x, y, c[50][50], dp[50][50];
const int dx[3] = {-1, 0, 1};

void solve() {
  memset(dp, 0, sizeof dp);
  
  rep(i,y) rep(j,x) cin>>c[i][j];
  
  rep(i,x) if (c[0][i] == 0) dp[0][i] = 1;
  
  rep(i,y-1) rep(j,x) {
    if (c[i][j] == 0) {
      rep(z,3) {
        int ti = i + 1, tj = j + dx[z];
        if (tj < 0 || tj >= x) continue;
        if (c[ti][tj] == 1) continue;
        if (c[ti][tj] == 2 && z != 1) continue;
        dp[ti][tj] += dp[i][j];
      }
    } else if (c[i][j] == 2) {
      dp[i+2][j] += dp[i][j];
    }
  }
  /*
  rep(i,y+1) {
    rep(j,x) printf("%8d",dp[i][j]);
    cout<<endl;
  }*/
  
  int res = 0;
  rep(j,x) res += dp[y][j] + dp[y-1][j];
  cout<<res<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>x>>y, x||y) {
    solve();
  }
  return 0;
}

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

int main(){
	int w,h;

	while( cin >> w >> h , w||h ){
		int f[200][200] = {0};
		for(int y=1 ; y <= h ; y++ ){
			for(int x=1 ; x <= w ; x++ ){
				cin >> f[y][x];
			}
		}

		int dp[200][200] = {0};
		for(int x=1 ; x <= w ; x++ )
			dp[1][x] = 1;
		for(int y=1 ; y <= h-1 ; y++ ){
			for(int x=1 ; x <= w ; x++ ){
				if( f[y][x] == 0 ){
					if( f[y+1][x-1] == 0 ) dp[y+1][x-1] += dp[y][x];
					if( f[y+1][x]   == 0 ) dp[y+1][x]   += dp[y][x];
					if( f[y+1][x+1] == 0 ) dp[y+1][x+1] += dp[y][x];
					if( f[y+1][x]   == 2 ) dp[y+1][x]   += dp[y][x];
				}else if( f[y][x] == 2 ){
					if( f[y+2][x] == 0 ) dp[y+2][x] += dp[y][x];
					if( f[y+2][x] == 2 ) dp[y+2][x] += dp[y][x];
				}
			}
		}
		int ans = 0;
		for(int x=1 ; x <= w ; x++ ){
			ans += dp[h][x] + dp[h+1][x];
		}
		cout << ans << endl;
	}
}

C++: #include <iostream>
using namespace std;
int w,h;
int mp[16][16];
int ans;
int count;

int saiki(int x,int y) {
  count++;
  // cout << x <<" "<<y <<endl;
  int dx[3] = {-1,0,1};
  int dy[3] = {1,1,1};
  if(mp[y][x] == 2) y++;
  
  if((y >= h)||(y==h-1 && mp[y][x] != 1)) ans++;//,cout <<"ok"<<endl;  
  else if(mp[y][x] != 1) {
    for(int i=0;i<3;i++) {
      int nx = dx[i]+x;
      int ny = dy[i]+y;
      if(nx <0||ny <0||nx >= w|| ny>=h) continue;
      if(mp[ny][nx] == 0){
      saiki(nx,ny);
      }
      else if(nx==x && mp[ny][nx] == 2 ){
	saiki(nx,ny+2);
      }
    } 
  }
}

int main() {

  while(1) {
    cin >> w >> h;
    if(w == 0 && h == 0) break;

    for(int i=0;i<h;i++) 
      for(int j=0;j<w;j++) 
	cin >> mp[i][j];
    /*
    for(int i=0;i<h;i++) {
      for(int j=0;j<w;j++) 
	cout << mp[i][j];
	  cout << endl;
    }
    */

    ans = 0;
    count = 0;
    for(int i=0;i<w;i++) {
      if(mp[0][i] !=1) saiki(i,0);
    }
    cout << ans << endl;
    //cout << count << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <string>
using namespace std;

int main() {
	// your code goes here
	int X,Y;
	
	while(cin >> X >> Y && X){
	int maps[20][20]={};
	int DP[20][20]={};
	for(int j=1;j<=X;j++)
		DP[1][j]=1;
	for(int i=1;i<=Y;i++)
		for(int j=1;j<=X;j++)
			cin >> maps[i][j];
	for(int i=1;i<=Y-1;i++)
		for(int j=1;j<=X;j++)
			if(maps[i][j]==0){
				for(int k=-1;k<=1;k++)
					if(maps[i+1][j+k]!=2 || k==0)
					DP[i+1][j+k]+=DP[i][j];
			}
			else if(maps[i][j]==2)
					DP[i+2][j]+=DP[i][j];
	int sum=0;
	
	for(int i=Y;i<Y+2;i++)
		for(int j=1;j<=X;j++)
			if(maps[i][j]!=1)
				sum+=DP[i][j];
	cout << sum << endl;
}
	
	return 0;
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<int(n);i++)
#define reps(i,n) for(int i=1;i<=int(n);i++)
#define sint(i) scanf("%d",&i);
#define sintt(i,j) scanf("%d%d",&i,&j);
#define sinttt(i,j,k) scanf("%d%d%d",&i,&j,&k);
#define sintttt(i,j,k,m) scanf("%d%d%d%d",&i,&j,&k,&m);

#define INF 1010000000
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};



int main(){
	while(1){
		int n,m;
		sintt(n,m);
		if(n==0)break;
		int masu[17][17];
		int dp[17][17];
		
		rep(i,17)rep(j,17)masu[i][j]=dp[i][j]=0;
		
		rep(i,m)rep(j,n){
			sint(masu[j+1][i]);
		}
		
		reps(j,n){
			if(masu[j][0]==0){
				dp[j][0]=1;
			}
		}
		
		rep(i,m-1){
			reps(j,n){
				if(masu[j][i]==1){
					dp[i][j]=0;
					continue;
				}
				if(masu[j][i]==2){
					if(masu[j][i+2]!=1){
						dp[j][i+2]+=dp[j][i];
					}
					continue;
				}
				if(masu[j][i]==0){
					if(masu[j-1][i+1]==0){
						dp[j-1][i+1]+=dp[j][i];
					}
					if(masu[j+1][i+1]==0){
						dp[j+1][i+1]+=dp[j][i];
					}
					
					if(masu[j][i+1]!=1){
						dp[j][i+1]+=dp[j][i];
					}
				}
			}
		}
		
		int ans=0;
		for(int i=m-1;i<=m;i++){
			reps(j,n){
				ans+=dp[j][i];
			}
		}
		printf("%d\n",ans);
	}
}