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++: //03
#include<iostream>

using namespace std;

int main(){
  for(int x,y;cin>>x>>y,x|y;){
    int g[17][16]={};
    for(int i=1;i<=x;i++){
      for(int j=1;j<=y;j++){
	cin>>g[i][j];
      }
    }
    int a[17][16]={};
    for(int i=1;i<=x;i++){
      a[1][i]=g[1][i]==0;
    }
    for(int i=1;i<=y-1;i++){
      for(int j=1;j<=x;j++){
	if(g[i][j]==0){
	  for(int k=-1;k<=1;k++){
	    if(1<=j+k&&j+k<=x){
	      if(g[i+1][j+k]==0){
		a[i+1][j+k]+=a[i][j];
	      }else if(k==0&&g[i+1][j]==2){
		a[i+1][j]+=a[i][j];
	      }
	    }
	  }
	}else if(g[i][j]==2){
	  if(g[i+2][j]!=1){
	    a[i+2][j]+=a[i][j];
	  }
	}
      }
    }
    int ans=0;
    for(int i=1;i<=x;i++){
      ans+=a[y][i]+a[y+1][i];
    }
    cout<<ans<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define MAX 25

int main()
{
    int H, W;
    while (cin >> W >> H, W) {
        vector<vector<int>> a(H, vector<int>(W));
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                cin >> a[i][j];
            }
        }
        int dp[MAX][MAX] = {{}};
        for (int i = 0; i < W; i++) {
            dp[0][i] = (a[0][i] == 0);
        }

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (dp[i][j] <= 0 || a[i][j] == 1) continue;
                if (a[i][j] == 2) {
                    int ni = min(i + 2, H - 1);
                    if (i + 2 < H && a[i+2][j] == 1) continue;
                    dp[ni][j] += dp[i][j];
                } else {
                    for (int k = -1; k <= 1; k++) {
                        int ni = i + 1;
                        int nj = j + k;
                        if (nj < 0 || nj >= W || ni >= H) continue;
                        if (a[ni][nj] == 1) continue;
                        if (a[ni][nj] == 2 && j != nj) continue;
                        dp[ni][nj] += dp[i][j];
                    }
                }
            }
        }
        int res = 0;
        for (int i = 0; i < W; i++) {
            res += dp[H-1][i];
        }
        cout << res << endl;
    }
    return 0;
}

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++){
		if(masu[i][j]!=1){
		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<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reg(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second

int dat[30][30];
int dp[30][30];
int main(void){
	int x,y;
	for(;;){
		scanf("%d%d",&x,&y);
		if(x==0)break;
		memset(dp,0,sizeof(dp));
		memset(dat,0,sizeof(dat));
		rep(j,y)rep(i,x){
			scanf("%d",&dat[i][j]);
		}
		rep(i,x)if(dat[i][0]==0)dp[i][0]=1;
		rep(j,y)rep(i,x){
			if(dat[i][j]==1)continue;
			if(dat[i][j]==2){
				if(dat[i][j+2]!=1)dp[i][j+2]+=dp[i][j];
				continue;
			}
			if(j!=y-1){
				if(i>0 && dat[i-1][j+1]==0){
					dp[i-1][j+1]+=dp[i][j];
				}
				if(i<x-1 && dat[i+1][j+1]==0){
					dp[i+1][j+1]+=dp[i][j];
				}
			}
			if(dat[i][j+1]!=1)dp[i][j+1]+=dp[i][j];
		}
		lli ans=0;
		/*
		printf("\n");
		rep(j,y){
			rep(i,x){
				//printf("(%2d %2d)",dat[i][j],dp[i][j]);
				printf("%2d",dp[i][j]);
			}
			printf("\n");
		}*/
		reg(j,y,y+1){
			//printf("\n");
			rep(i,x){
				//printf("%2d ",dp[i][j]);
				ans+=dp[i][j];
			}
		}
		printf("%lld\n",ans);
	}
	return 0;
}

C++: #include<stdio.h>
#include<numeric>
int main()
{
	int x,y,i,j;
	while(scanf("%d%d",&x,&y),x)
	{
		int m[15][17];
		for(i=0;i<15;++i)for(j=0;j<17;++j) m[i][j]=-1;
		for(i=0;i<y;++i)for(j=0;j<x;++j) scanf("%d",&m[i][1+j]);

		int a[16][17]={0};
		for(j=1;j<=x;++j)a[0][j]=(m[0][j]-1?1:0);
		for(i=0;i<y-1;++i)
			for(j=1;j<=x;++j)
			{
				if(m[i][j]==0)
				{
					if(m[i+1][j-1]==0) a[i+1][j-1]+=a[i][j];
					if(m[i+1][j+1]==0) a[i+1][j+1]+=a[i][j];
					if(m[i+1][j]==0 || m[i+1][j]==2) a[i+1][j]+=a[i][j];
				}
				else if(m[i][j]==2)
				{
					a[i+2][j] += (m[i+2][j]!=1?a[i][j]:0);
				}
			}
		for(i=1;i<=x;++i) a[y][i] += a[y-1][i];
		printf("%d\n", std::accumulate(&a[y][1],&a[y][x+1],0));
	}
	return 0;
}

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

int main(){

  int x,y;
  int a[100][100];
  int w[100][100];

  while(true){
    cin >> x >> y;
    if(!x && !y) break;

    memset(w,0,sizeof(w));
    int ans = 0;

    for(int i=0;i<y;i++){
      for(int j=0;j<x;j++) cin >> a[i][j];
    }

    for(int i=0;i<x;i++){
      if(a[0][i] == 0) w[0][i] = 1;
    }

    for(int i=1;i<y;i++){
      for(int j=0;j<x;j++){

	if(i-2 >= 0 && a[i-2][j] == 2) w[i][j] += w[i-2][j];

	if(j-1 >= 0 && !a[i-1][j-1] && !a[i][j]) w[i][j] += w[i-1][j-1];
	if(j+1 < x && !a[i-1][j+1] && !a[i][j]) w[i][j] += w[i-1][j+1];

	if(a[i][j] != 1 && a[i-1][j] != 2) w[i][j] += w[i-1][j];

	if(a[i][j] == 1) w[i][j] = 0;
      }
    }

    for(int i=0;i<x;i++){
      if(a[y-2][i] == 2) ans += w[y-2][i];
      if(a[y-1][i] == 2) ans += w[y-1][i];
    }

    for(int i=0;i<x;i++){
      if(a[y-1][i] == 0) ans += w[y-1][i];
    }

    cout << ans << endl;
  }
}