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>

enum class State {
	Empty, Tree, Jump
};
class Ski_run {
public:
	Ski_run(const int &x, const int &y) :width(x), height(y), state(y, std::vector<State>(x, State::Empty)), route(y + 1, std::vector<int>(x, 0)), null(0), res(-1) {
		for (auto &line : state) {
			for (auto &c : line) {
				int a;
				std::cin >> a;
				c = static_cast<State>(a);
			}
		}
		state.push_back(std::vector<State>(width, State::Empty));
		state.push_back(std::vector<State>(width, State::Empty));
		route.at(height) = std::vector<int>(x, 1);
		route.at(height - 1) = std::vector<int>(x, 1);
	}
	void show() const {
		for (const auto &l : route) {
			for (const auto &c : l) {
				std::cout << c;
			}
			std::cout << '\n';
		}
	}
	int solve() {
		if (res >= 0) {
			return res;
		}
		else {
			for (auto y = height - 2; y >= 0; --y) {
				for (auto x = 0; x < width; ++x) {
					switch (state.at(y).at(x)) {
					case State::Empty:
						if (at(x - 1, y + 1) == State::Empty) {
							route.at(y).at(x) += route.at(y + 1).at(x - 1);
						}
						if (at(x + 1, y + 1) == State::Empty) {
							route.at(y).at(x) += route.at(y + 1).at(x + 1);
						}
						if (!(at(x, y + 1) == State::Tree)) { 
							route.at(y).at(x) += route.at(y + 1).at(x);
						}
						break;
					case State::Jump:
						if (!(at(x, y + 2) == State::Tree)) {
							route.at(y).at(x) += route.at(y + 2).at(x);
						}
					}
				}
			}
			res = 0;
			for (const auto &l : route.at(0)) {
				res += l;
			}
			return res;
		}
	}
private:
	State at(const int &x, const int &y) {
		if (x >= 0 && width > x) {
			return state.at(y).at(x);
		}
		else {
			return State::Tree;
		}
	}
	int width, height;
	std::vector<std::vector<int>> route;
	std::vector<std::vector<State>> state;
	int null, res;
};
int main() {
	int x, y;
	std::cin >> x >> y;
	while (x != 0 || y != 0) {
		Ski_run state(x, y);
		std::cout << state.solve() << std::endl;
		std::cin >> x >> y;
	}
	return 0;
}

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<=y;i++){
      for(int j=1;j<=x;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<iostream>
using namespace std;
inline bool isinside(int j, int X){ return 0<=j&&j<X; }
int main()
{
  while(true){
    int X,Y;
    cin >> X >> Y;
    if( X == 0 && Y == 0 ) break;
    int M[Y][X];
    long long int ans[Y+2][X];
    for(int i = 0; i < Y; ++i){
      for(int j = 0; j < X; ++j){
	int c;
	cin >> c;
	M[i][j]=c;
	ans[i][j]=0;
      }
    }
    for(int i = 0; i < X; ++i){
      ans[Y][i] = ans[Y+1][i] = 1;
    }
    const int dx[]={-1,0,1};
    for(int i = Y-1; i >= 0; --i){
      for(int j = 0; j < X; ++j){
	if( M[i][j] == 1 ){
	  ans[i][j] = 0;
	}
	if( M[i][j] == 0 ){
	  for(int k = 0; k < sizeof(dx)/sizeof(*dx); ++k){
	    if( isinside( j + dx[k], X ) ){
	      //if( ans[i][j] == 0 ){
	      //ans[i][j] = ans[i+1][j+dx[k]];
	      //}else{
	      if( M[i+1][j+dx[k]] == 2 && dx[k]!=0 )continue;
		ans[i][j] += ans[i+1][j+dx[k]];
		//}
	    }
	  }
	}
	if( M[i][j] == 2 ){
	  ans[i][j] = ans[i+2][j];
	}
	if( i == Y-1 && ans[i][j] > 0 )ans[i][j] = 1;
	//cout << ans[i][j] << ' ';
      }
      //cout << endl;
    }
    long long int Answer = 0;
    for(int i = 0; i < X; ++i){
      Answer += ans[0][i];
    }
    cout << Answer << endl;
  }
  return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<algorithm>


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

using namespace std;

int x,y;
int c[20][20];
int dp[20][20];

void solve() {
	rep(i,20) rep(j,20) c[i][j]=1;
	rep(i,20) rep(j,20) dp[i][j]=0;

	rep(i,x) rep(j,y) cin>>c[i][j];

	rep(i,20) if(c[0][i]!=1) dp[0][i]=1;
	
	for(int i=0;i<y;i++) {
		for(int j=0;j<x;j++) {
			if(c[i][j]==2) {
				dp[i+2][j] += dp[i][j];
			}
			else if(c[i][j]==0) {
				if(c[i+1][j]!=1) {
					dp[i+1][j] += dp[i][j];
				}
				if(0<=j-1 && c[i+1][j-1]==0) {
					dp[i+1][j-1] += dp[i][j];
				}
				if(j+1 < x && c[i+1][j+1]==0) {
					dp[i+1][j+1] += dp[i][j];
				}
			}
		}
	}



	int ans=0;
	rep(i,x) ans+=dp[y-1][i];
	rep(i,x) ans+=dp[y][i];

	cout<<ans<<endl;

}

int main() {
	while(cin>>x>>y) {
		if(x+y==0) return 0;
		solve();
	}
	return 0;
}

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

int mx,my;
int count;
int field[17][17];//field[y][x];

void init()
{
	for(int i=0;i<17;i++){
		for(int j=0;j<17;j++){
			field[i][j] = 0;
		}
	}
}

void DFS(int x,int y)
{
	if(y >= my-1){
		count++;
		return;
	}
	int dx,dy;
	dx = x-1;dy = y+1;
	if(0<=dx && dx < mx && field[dy][dx] == 0)
		DFS(dx,dy);
	dx = x;dy = y+1;
	if(0<=dx && dx < mx && field[dy][dx] != 1){
		if(field[dy][dx]==2){
			while(field[dy][dx]==2){
				dy+=2;
			}
		}
		DFS(dx,dy);
	}
	dx = x+1;dy = y+1;
	if(0<=dx && dx < mx && field[dy][dx] == 0)
		DFS(dx,dy);
	return;
}

int main()
{
	while(cin >> mx >> my){
		if(mx == 0 && my == 0)
			break;
		for(int i=0;i<my;i++){
			for(int j=0;j<mx;j++){
				cin >> field[i][j];
			}
		}
		count = 0;
		for(int i=0;i<mx;i++){
			if(field[0][i] == 0){
				DFS(i,0);
			}
		}
		cout << count << endl;
	}
	return 0;
}