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<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int f(int a[][15],int b[][15],int x,int y,int e,int n){
  int z=0;
  if(y>e-1)
    return 1;
  if(a[x][y]==-1)
    return 0;
  if(a[x][y]==-2){
    if(n)
      return 0;
  }
  if(y==e-1){
    if(a[x][y]==0)
      return 1;
    if(a[x][y]==-2){
      if(n==0)
	return 1;
    }
  }
  if(b[x][y]!=-1)
    return b[x][y];
  if(a[x][y]==-2)
    z+=f(a,b,x,y+2,e,0);
  else{
    z+=f(a,b,x-1,y+1,e,1);
    z+=f(a,b,x,y+1,e,0);
    z+=f(a,b,x+1,y+1,e,1);
  }
  b[x][y]=z;
  return z;
}
int main(){
  int i,j;
  int a[17][15],b[17][15],x,y,z;
  memset(a,-1,sizeof(a));
  while(cin>>x>>y&&x&&y){
    for(i=0;i<y;i++){
      for(j=0;j<x;j++){
	cin>>a[j+1][i];
	a[j+1][i]*=-1;
      }
    }
    memset(b,-1,sizeof(b));
    z=0;
    for(i=0;i<x;i++){
      if(a[i+1][0]!=-1)
	z+=f(a,b,i+1,0,y,0);
    }
    cout<<z<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){

    int w,h;
    while(cin>>w>>h){
        int data[16][16]={{0}},dp[17][17]={{0}};
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                cin>>data[i][j];
                if(i==0&&data[i][j]!=1)dp[i][j]=1;
            }
        }
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                if(dp[i][j]!=0){
                    if(data[i][j]==0){
                        if(i!=h-1&&j!=0&&data[i+1][j-1]==0)dp[i+1][j-1]+=dp[i][j];
                        if(data[i+1][j]!=1)dp[i+1][j]+=dp[i][j];
                        if(i!=h-1&&j!=w-1&&data[i+1][j+1]==0)dp[i+1][j+1]+=dp[i][j];
                    }
                    else if(data[i][j]==2){
                        if(i==h-1)dp[i+1][j]+=dp[i][j];
                        else if(data[i+2][j]!=1)dp[i+2][j]+=dp[i][j];
                    }
                }
            }
        }
        /*
        cout<<endl;
        for(int i=0;i<=h;i++){
            cout<<i<<":";
            for(int j=0;j<w;j++){
                cout<<dp[i][j]<<" ";
            }
            cout<<endl;
        }*/
        int ans=0;
        for(int j=0;j<w;j++)ans+=dp[h][j];
        cout<<ans<<endl;
    }
    return 0;
}

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

const int MAX_SIZE = 15;
char field[MAX_SIZE+1][MAX_SIZE+3];
int dp[MAX_SIZE+1][MAX_SIZE+3];
int w, h;

bool judge(int i, int j){
	if(j > 0 && j <= w && field[j][i] == '0')
		return true;
	return false;
}

int main(){
	while(cin >> w >> h){
		if(w == 0 && h == 0) break;
		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= w; j++)
				cin >> field[j][i];
		}
		int pattern = 0;
		for(int i = 0; i < MAX_SIZE+1; i++){
			for(int j = 0; j < MAX_SIZE+3; j++){
				dp[i][j] = 0;
			}
		}
		for(int i = 1; i <= w; i++){
			dp[i][1] = 1;
		}
		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= w; j++){
				if(field[j][i] == '2')
					dp[j][i+2] += dp[j][i];
				if(field[j][i] == '0'){
					dp[j][i+1] += dp[j][i];
					if(judge(i+1, j-1)) dp[j-1][i+1] += dp[j][i];
					if(judge(i+1, j+1)) dp[j+1][i+1] += dp[j][i];
				}
			}
		}
		int count = 0;
		for(int i = h+1; i <= h+2; i++){
			for(int j = 1; j <= w; j++){
				count += dp[j][i];
			}
		}
		cout << count << endl;
	}
	return 0;
}

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

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

using namespace std;

int main(){
    int X,Y;
    while(cin >> X >> Y,X+Y){
        int fld[20][20] = {0};
        rep(y,Y){
            rep(x,X){
                cin >> fld[y][x];
            }
        }

        int dp[20][20] = {0};
        rep(x,X){
            if(fld[0][x] == 0)
                dp[0][x] = 1;
        }

        rep(y,Y-1){
            rep(x,X){
                int val = dp[y][x];
                if(fld[y][x] == 0){
                    if(x>0 && fld[y+1][x-1] == 0){
                        dp[y+1][x-1] += val;
                    }
                    if(fld[y+1][x+1] == 0){
                        dp[y+1][x+1] += val;
                    }
                    dp[y+1][x] += val;
                }else if(fld[y][x] == 2){
                    dp[y+2][x] += val;
                }
            }
        }

        int ans = 0;
        rep(i,2){
            rep(x,X){
                if(fld[Y+i-1][x] != 1)
                    ans += dp[Y+i-1][x];
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  while(1){
    int w,h,mp[20][20]={},dp[20][20] ={};
    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<w;i++) dp[0][i] = 1;

    int ans=0;    
    for(int i=0;i<h-1;i++)
      for(int j=0;j<w;j++) {
	if(mp[i][j] !=0) continue;
	for(int k=-1;k<=1;k++){
	  int nx=j+k,ny=i+1;
	  if(nx<0||nx>=w) continue;
	  while(k==0 && mp[ny][nx]==2) ny+=2;
	  if(mp[ny][nx]!=0) continue;
	  dp[ny][nx]+= dp[i][j];
	  if(ny >= h-1) ans+=dp[i][j];
	}
      }
    cout << ans <<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstring>
 
using namespace std;
 
const int MAX = 17;
short in[MAX][MAX];
int  X,Y,data[MAX][MAX],ans;
int dx[4] = {-1,0,1};
 
 
void init(){
  memset(data,0,sizeof(data));
  ans = 0;
}
 
 
void solve(){
  for(int i = 1; i <= Y; i++)
    for(int j = 1; j <= X; j++){
      for(int k = 0; k < 3; k++)
	if(in[i][j] == 2){
	  if(in[i+2][j] != 1) data[i+2][j] += data[i][j];
	  break;
	}else if(in[i][j] == 0){
	  int nex = j+dx[k];
	  if(nex < 1 || nex > X) continue;

	  if(in[i+1][nex] == 2 && dx[k] == 0) data[i+1][nex] += data[i][j];
	  if(in[i+1][nex] == 0) data[i+1][nex] += data[i][j];

	}
    }
  
  for(int j = 1; j <= X; j++){
    if(Y-1 > 0 && in[Y-1][j] == 2) ans+=data[Y-1][j];
    ans+=data[Y][j];
  }
  cout << ans << endl;
}
 
void print(){
  for(int i = 1; i <= Y; i++){
    for(int j = 1; j <= X; j++)
      cout << data[i][j]<< " ";
    cout << endl;
  }
}
int main(){
  while(cin >> X >> Y && X+Y){
    init();
    for(int i = 1; i <= Y; i++)
      for(int j = 1; j <= X; j++)
    cin >> in[i][j];
     
    for(int i = 1; i <= X; i++)
      if(in[1][i] == 0) data[1][i] = 1;
 
    solve();
    //print();
  }
  return 0;
}