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 <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <cstring>
#include <fstream>
#include <numeric>
#include <algorithm>

using namespace std;

int main(int argc, char **argv) {
  int x, y, field[15 * 15], route[15 * 15], rsum;

  while (true) {
    cin >> x >> y;
    if (x == 0 && y == 0)
      break;
    rsum = 0;
    memset(route, 0, sizeof(int) * x * y);
    for (int i = 0; i < y; i++)
      for (int j = 0; j < x; j++)
        cin >> field[i * y + j];
    for (int i = 0; i < x; i++) {
      int f = field[i];
      if (!f)
        route[i] = 1;
    }

    for (int i = 1; i < y; i++)
      for (int j = 0; j < x; j++) {
        int f = field[i * y + j];
        if (f == 0) {
          for (int k = -1; k <= 1; k++)
            if ((j + k >= 0 && j + k < x) &&
                ((k == 0 && field[(i-1) * y + j+k] == 2) ||
                 (field[(i-1) * y + j+k] != 2)))
              route[i * y + j] += route[(i-1) * y + j+k];
        } else if (f == 1) {
          route[i * y + j] = 0;
        } else if (f == 2 && i + 2 < y && field[(i+2) * y + j] != 1) {
          route[(i+2) * y + j] = route[(i-1) * y + j];
        } else if (f == 2 && i + 2 >= y) {
          rsum += route[(i-1) * y + j];
        }
      }
    for (int i = 0; i < x; i++)
      rsum += route[(y-1) * y + i];

    cout << rsum << endl;
    /* FOR DEBUG                                                                                                                                                                                            
    for (int i = 0; i < y; i++) {                                                                                                                                                                           
      for (int j = 0; j < x; j++) {                                                                                                                                                                         
        cout << route[i * y + j];                                                                                                                                                                           
        cout << ' ';                                                                                                                                                                                        
      }                                                                                                                                                                                                     
      cout << endl;                                                                                                                                                                                         
      }*/
  }
  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <iomanip>
using namespace std;
int main(){
	int x,y;
	while(1){
		cin >> x >> y;
		if(x+y==0) break;
		int a[x][y];
		for(int j=0;j<y;j++) for(int i=0;i<x;i++) cin >> a[i][j];
		long long d[x][y];
		for(int i=0;i<x;i++) d[i][0] = 1 - a[i][0];
		for(int j=1;j<y;j++){
			for(int i=0;i<x;i++){
				if(a[i][j]==1) d[i][j] = 0;
				else if(a[i][j]==0){
					if(a[i][j-1]!=2) d[i][j] = d[i][j-1];
					if(i>0 and a[i-1][j-1]!=2) d[i][j] += d[i-1][j-1];
					if(i<x-1 and a[i+1][j-1]!=2) d[i][j] += d[i+1][j-1];
					if(j>1 and a[i][j-2]==2) d[i][j] += d[i][j-2];
				}
				else{
					d[i][j] = d[i][j-1];
					if(j>1 and a[i][j-2]==2) d[i][j] += d[i][j-2];
				}
			}
		}
		int s = 0;
		for(int i=0;i<x;i++){
			if(y>2 and a[i][y-2]==2) s += d[i][y-2];
			s += d[i][y-1];
		}
		cout << s << endl;
	}
}

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

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;
}