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<cstdio>

int main(){
	int a,b;
	scanf("%d %d", &a, &b);
	int c[9];
	while(a || b){
		int count = 0;
		if(b < 46){
			for(int i = 0; i < 10; i++){
				for(int j = i + 1; j < 10; j++){
					for(int k = j + 1; k < 10; k++){
						for(int l = k + 1; l < 10; l++){
							for(int m = l + 1; m < 10; m++){
								if(a == 5){
									if(i + j + k + l + m == b){
										count++;
									}
								}
							}
							if(a == 4){
								if(i + j + k + l == b){
									count++;
								}
							}else if(a == 6){
								if(i + j + k + l == 45 - b){
									count++;
								}
							}
						}
						if(a == 3){
							if(i + j + k == b){
								count++;
							}
						}else if(a == 7){
							if(i + j + k == 45 - b){
								count++;
							}
						}
					}
					if(a == 2){
						if(i + j == b){
							count++;
						}
					}else if(a == 8){
						if(i + j == 45 - b){
							count++;
						}
					}
				}
				if(a == 1){
					if(i == b){
						count++;
					}
				}else if(a == 9){
					if(i == 45 - b){
						count++;
					}
				}
			}
		}
		printf("%d\n", count);
		scanf("%d %d", &a, &b);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int dfs(int x,int y,int k){
	if(y==0)
		return x==0?1:0;
	if(x<=0)
		return 0;
	int ans=0;
	for(int i=k+1;i<10;i++)
		ans+=dfs(x-i,y-1,i);
	return ans;
}
signed main(void){
	ios::sync_with_stdio(false);
	int x,y;
	while(cin>>y>>x&&(x||y))
		cout<<dfs(x,y,-1);
}

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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

typedef vector<int> vi;

int n, s;

//p????????¶ c???????????°??? sum????¨?
int dfs(int p, int c, int sum) {
	if (c > 100) return 0;
	if (p == n) return sum == s;
	return dfs(p + 1, c + 1, sum + c) + dfs(p, c + 1, sum);
}

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

C++: #include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
#include<cmath>
using namespace std;
int main(){
	int n,s;
	while(cin>>n>>s,n&&s){
		if(n>10||s<3||s>45){
			cout<<0<<endl;
			continue;
		}
		int min = (int)pow(10.0,n-2);
		int lim = (int)pow(10.0,n);
		stack<int> st;
		vector<int> res;
		vector<bool> vis(lim,false);
		st.push(0);
		vis[0]=true;
		while(!st.empty()){
			int top = st.top();
			int tmp=top;
			int cur=0;
			while(tmp>0){
				cur+=tmp%10;tmp/=10;
			}
			st.pop();
			if(top>min&&cur==s){
				res.push_back(top);
			}else{
				if(top*10>=lim) continue;
				for(int i=top%10+1;i<10;++i){
					if(!vis[top*10+i]){
						vis[top*10+i]=true;
						st.push(top*10+i);
					}
				}
			}
		}
		cout<<res.size()<<endl;
	}
	return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <cassert>

using namespace std;


int dfs(int n, int s, int k){
	if(n==0 && s==0){
		return 1;
	}
	if(n==0) return 0;
	if(s<=0) return 0;
	if(k>9 || k>s) return 0;
	int res1 = dfs(n-1, s-k, k+1);
	int res2 = dfs(n, s, k+1);
	return res1 + res2;
}

bool solve(){
	int n,s;
	while(1){
		cin>> n>> s;
		if(n==0 && s==0) break;
		int res = dfs(n,s,0);
		cout<< res<< endl;
	}

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

C++: #include <iostream>

int n, s;
int num[10]={0,1,2,3,4,5,6,7,8,9};
int ans=0;
int func(int de, int k, int sum){
	int res = 0;
	if(de == n){
		if(sum == s)ans++;
		return 0;
	}
	if(sum > s)return 0;
	for(int i = k; i < 10 && de<n && sum+i<=s; ++i){
		res += func(de + 1, i + 1, sum + i);
		//res += func(de, i + 1, sum);
	}
	return res;
}

int main(){
	while(std::cin >> n >> s, n, s){
		ans=0;
		func(0, 0, 0);
		std::cout << ans << std::endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int n, s;
int c = 0;
int i = 0;
int j = 0;
int q = 0;
int date[15] = { 0 };



int sub(int start,int n,int x){
	if (x == n){
		for (int i = 0; i < n; i++){
			j = i - 1;
			/*cout << date[i];*/
			if (j>0){
				date[i] += date[j];
			}
			if (i == n - 1&&date[i]==s){
				q++;
			}
		}
		return 0;
	}

	for (int i = start; i < 10;i++){

		date[x] = i;

		sub(i + 1, n, x + 1);
	
	}


}



int main(){

	n = 0;
	while (true){
		cin >> n >> s;
		sub(0, n, 0);


		cout << q << endl;
		q = 0;
	}
}

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

int dp[10001][10001], n, s;

void set(){
    for(int i = 0; i <= 10000; i++){
        dp[1][i] = 1;
    }
    for(int i = 1; i < 10000; i++){
        for(int j = 0; j <= 10000; j++){
            dp[i+1][j] = 0;
            if( j >= i ) dp[i+1][j] += dp[i][j-i];
            if( j > i ) dp[i+1][j] += dp[i+1][j-i-1];
        }
    }
}

int main(){
    set();
    while(true){
        cin >> n >> s;
        if(n == 0 && s == 0) break;
        cout << dp[n][s] << endl;
    }
    return 0;
}

C++: //!
///

/**============= Approach =================**
@Author: A Asif Khan Chowdhury
@Category:
/**========================================**/


/**................ Headers ................**/
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <list>
#include <queue>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <sstream>
#include <bitset>
#include <set>

using namespace std;

/**................ Macros ................**/
#define Set(N, j) (N|(1<<j))
#define reset(N, j) (N&~(1<<j))
#define Check(N, j) (bool)(N&(1<<j))
#define toggle (N, j) (N^(1<<j))
#define turnOff(N, j) (N & ~(1<<j))
#define CLEAR(A, x) ( memset(A,x,sizeof(A)) )
#define pi 3.141592653589793
#define pii pair <int, int>
#define pb push_back
#define pf printf
#define S(x) scanf("%d", &x)
#define SL(x) scanf("%ld", &x)
#define out(C) printf("Case %d: ", C);
#define FOR(i, x, y) for(int i=x; i<=y; i++)
#define open freopen("E:/a.txt", "r", stdin);
#define write freopen("E:/b.txt","w", stdout);
#define MAX (1+(1<<5))
#define inf 0x7fffffff
#define ll long long
#define mod 100000007
#define mx 100010

///**==========Global Variables ===========**///

///**======================================**///

int gcd(int a, int b) { return b?gcd(b,a%b):a; }
//bool taken[12];
int bt (int make, int left, int till){
    if(make==0 and left==0) return 1;
    if(make<=0 or left<=0) return 0;
    int ans=0;
    for(int i=till; i<10 ; i++){
        //if(!taken[i])
        {
            //taken[i]=true;
            ans+=bt(make-i, left-1, i+1);
           // taken[i]=0;
        }
    }

//    cout<<make<<" "<<left<<" "<<ans<<endl;
    return ans;
}


int main()
{
	cin.tie(NULL);
//	open
    int test;
    int a, b;
    while(cin>>a>>b){
            if(a==0 and b==0)break;
       // CLEAR(taken,0);
        cout<<bt(b, a, 0)<<endl;

    }
    return 0;
}

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

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

int main() {
  int n,s;
  while(cin>>n>>s, n||s) {
    cout<<rec(n,s,-1)<<endl;
  }
}

C++: #include<iostream>

int n,s,count=0;

void  func(int c,int sum,int max){
	if(c==n){
		if(sum==s)
			++count;
	}
	else{
		for(int i=max+1;i<=9;++i){
			sum+=i;
			func(++c,sum,i);
		}
	}
}

int main(){
	while(1){
		std::cin>>n>>s;
		if(n==0&&s==0)
			break;
		func(0,0,0);
		std::cout<<count<<std::endl;
	}
    return 0;
}