Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)

func solve(a, b, c int) int {
	if a == 1 && b >= c && b < 10 {
		return 1
	}
	if a == 1 {
		return 0
	}
	ret := 0
	for i := c; i < 10 && i < b; i++ {
		ret += solve(a-1, b-i, i+1)
	}
	return ret
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	for {
		scanner.Scan()
		a, _ := strconv.Atoi(scanner.Text())
		if a == 0 {
			break
		}
		scanner.Scan()
		b, _ := strconv.Atoi(scanner.Text())
		fmt.Println(solve(a, b, 0))
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll; 
typedef pair<ll, ll> PL;

int n, s;
bool d[10];
vector< vector<int> > C;

void dfs(int i, int sum){
	if (i == n&&sum == s){
		vector<int> vi;
		if (C.empty()){
			REP(j, 10){
				if (d[j] == 1){
					vi.push_back(j);
				}
			}
			C.push_back(vi);
			return;
		}
		bool f = 1;
		REP(j, C.size()){
			int co = 0;
			REP(k, n){
				if (d[C[j][k]] == 1) co++;
			}
			if (co == n){
				f = 0;
				break;
			}
		}
		if (f){
			REP(j, 10){
				if (d[j] == 1){
					vi.push_back(j);
				}
			}
			C.push_back(vi);
		}
	}

	for (int j = 0; j < 10; j++){
		if (d[j] == 0){
			d[j] = 1;
			dfs(i + 1, sum + j);
			d[j] = 0;
		}
	}
	return;
}

int main(){
	while (cin >> n >> s&&n&&s){
		dfs(0, 0);
		cout << C.size() << endl;
		C.clear();
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
 
int N,S;
int dfs(int n,int t,int sum){
if(n==10)return 0;if(t==N){if(sum==S)return 1;else return 0;}
    return dfs(n+1,t,sum)+dfs(n+1,t+1,sum+n);
}
int main(){
    while(cin>>N>>S,N||S)cout<<dfs(0,0,0)<<endl;
    return 0;
}

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

int main()
{
  int n, s;
  int i, ,j, tmp;
  int sum, count;
  int ans;

  while(cin>>n){
    cin>>s;
    if(n+s==0) break;

    ans=0;
    for(i=0; i<1024; i++){
      tmp=i; sum=0; count=0;
      for(j=0; j<10; j++){
        if(tmp%2==1){
          sum+=j;
          count++;
        }
        tmp/=2;
      }
      if(count==n && sum==s) ans++;
    }
    printf("%d\n", ans);
  }

  reutrn 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<utility>

using namespace std;

int n, s;

int cal(int a, int b, int c)
{
	int hoge = 0;

	if (a == 1 && b >= c && b < 10)
	{
		return 1;
	}
	else if (a == 1)
	{
		return 0;
	}

	for (int i = c; i < 10 && i < b; i++)
	{
		hoge += cal(a - 1, b - i, i + 1);
	}

	return hoge;


}

int main(void)
{
	while (cin >> n >> s, n&&s)
	{
		cout << cal(n, s, 0) << endl;
	}

	return 0;
}

C++: #include <iostream>using namespace std; int dfs(int n, int s, int x){   int sum=0;   if(n==0 && s==0)   return 1;   if(n>0){       for(int i=x; i<10; i++){           if(s-i>=0) sum+=dfs(n-1, s-i, i+1);       }   }   return sum;} int main(void){   int n, s;   while(cin >> n >> s){       if(n==0 && s==0)   break;       cout << dfs(n, s, 0) << endl;   }   return 0;}

C++: #include<bits/stdc++.h>
using namespace std;
int vis[20];int n,s;int ans ;


void dfs(int step,int cur,int sum)
{
    if(step == n && sum == s){
        ans++;
        return ;
    }
    if(step == n || sum > s) return;
    for(int i = cur; i <= 9 ; i++){
        if(!vis[i] && sum + i <= s){
            vis[i] = 1;dfs(step + 1,i + 1,sum + i);vis[i] = 0;
        }
    }
}





int main()
{
    ios::sync_with_stdio(0);
    while(cin >> n >> s){
        if(n == 0 && s == 0) break;
        if(s > 45) {
            cout << 0 << endl;continue;
        }
        memset(vis,0,sizeof(vis));ans = 0;
        dfs(0,0,0);cout << ans << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
 
int a[10] = { 0,1,2,3,4,5,6,7,8,9 };
int n, s,r;
 
void dfs(int i, int sum,int n) {
    if (n==0&&sum == s) {
        r++;
        return;
    }
    if (i == 10 || !n)return;
    dfs(i + 1, sum,n);
    dfs(i + 1, sum + a[i],n-1);
    return;
}
 
int main() {
    while (cin >> n >> s, n, s) {
        r = 0;
        dfs(0, 0,n);
        cout <<r << endl;
    }
    return 0;
 
}

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

int func(int num, int rest, int before){
	//if(before + 1 < 0) return 0;
	if(num == 0){
		if(rest == 0){
			//cout << before << endl;
			return 1;
		}
		return 0;
	}
	int res = 0;
	for(int i = 0; i <= rest && i <= before; ++i){
		int a = func(num - 1, rest - i, i - 1);
		if(a != 0){
			res += a;
		}
	}
	return res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, s;
	while(cin >> n >> s && n != 0 && s != 0){
		cout << func(n, s, 9) << endl;
	}
	
	return 0;
}

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

int r(int n, int max, int s){
    int sum = 0;
    if(n == 1){
        if(max <= s && s <= 9) return 1;
        return 0;
    }
    for(int i = max; i <= 9; i++){
        sum += r(n-1, i+1, s-i);
    }
    return sum;
}

int main(){
    int n, s;
    while(cin >> n >> s){
        if(n == 0 && s == 0) break;
        cout << r(n, 0, s) << endl;
    }
    return 0;
}

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

using namespace std;

typedef long long ll;

int main() {
	int N, S;
	ll dp[11][11][101] = {0}; dp[0][0][0] = 1;
	for (int i = 0; i < 10; ++i) {
		for (int j = 0; j <= 10; ++j) {
			for (int k = 0; k <= 100; ++k) {
				if (dp[i][j][k]) {
					dp[i+1][j][k] += dp[i][j][k];
					int nj = j + 1;
					int nk = k + i;
					if (nj <= 10 && nk <= 100) {
						dp[i+1][nj][nk] += dp[i][j][k];
//						cout << i+1 << " " << nj << " " << nk << endl;
					}
				}
			}
		}
	}
	while (cin >> N >> S, N || S) {
		cout << dp[10][N][S] << endl;
	}
}

C++: #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define EXIST(v,i) (find(all(v), i) != (v).end())
#define ERASE(v,i) (v).erase(remove(all(v), i), (v).end())
#define INDEX(v,i) (find(all(v), i) - (v).begin())
#define rep(i,n) for(int i = 0; i < (int)n; ++i)
#define debug(x) cerr << #x << " = " << (x) << endl;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

const int INF = 100000000;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;

int s, d;

int dfs(int next, int depth, int sum) {
	if(depth == d) {
		return sum == s ? 1 : 0;
	} else {
		int ans = 0;
		for(int i = next; i <= 9; i++) {
			ans += dfs(i + 1, depth + 1, sum + i);
		}
		return ans;
	}
}

int main() {
	for(; cin >> d >> s && d && s;)
		cout << dfs(0, 0, 0) << endl;
	return 0;
}