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 <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, s;

signed main() {
	while (1) {
		cin >> n >> s;
		if (n==0) break;
		int res = 0;
		rep(i,1<<10) if (__builtin_popcount(i)==n) {
			int sum = 0;
			rep(j,10) if (i>>j&1) sum += j;
			if (sum==s) res++;
		}
		cout << res << endl;
	}
}

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

int saiki(int n, int s, int i, int *result){
    if(s <= 0){
        if(n == 0){
            *result += 1;
        }
    }else{
        for(int j=i;j<10;j++){
            saiki(n-j,s-1,j+1,result);
        }
    }
}
int main(){
    int n, s;
    int result;
    cin >> n >> s;
    while(n || s){
        result = 0;
        saiki(n, s, 0, &result);
        cout << result << endl;
        cin >> n >> s;
    }
    return 0;
}

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

int count;

void func(int n, int s, int tmp, int num)
{
	if(tmp == s && n == 0){
		count++;
		return ;
	}

	for(int i = num; (i+tmp) <= s; i++){
		if(i == tmp){
			break;
		}
		func(n-1, s, i+tmp, num+1);
	}
	
	return ;
}

int main(int argc, char **argv){
	int n, s;
	
	while(1){
		cin >> n >> s;
		
		if(n == 0 && s == 0){
			break;
		}
		count = 0;
		
		for(int i = 0; i <= (s-n); i++){
			func(n-1, s, i, 1);
		}
		
		cout << count << endl;
	}
	
	return 0;
}

C++: #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>
using namespace std;
int n,s,c;
void f(int m,int a,int t){
	if(a == n){
		if(t == s) ++c;
	}
	else {
		for(int i = m;i < 10;++i){
			f(i + 1,a + 1,t + i);
		}
	}
	return;
}
int main(){
	while(cin >> n >> s && (n != 0 && s != 0)){
		c = 0;
		f(0,0,0);
		cout << c << endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
#include<map>
using namespace std;

int main(){
    int mod=1000000007;
    int n,s,ans;
    for (;;) {
        scanf("%d %d",&n,&s);
        ans=0;
        if (n==0 && s==0) break;
        for (int a=0;a<10-n+1;a++) {
            if (n==1 && a==s) ans++;
            if (n>1){
                for (int b=a+1;b<10-n+2;b++) {
                    if (n==2 && a+b==s) ans++;
                    if (n>2) {
                        for (int c=b+1;c<10-n+3;c++) {
                            if (n==3 && a+b+c==s) ans++;
                            if (n>3) {
                                for (int d=c+1;d<10-n+4;d++) {
                                    if (n==4 && a+b+c+d==s) ans++;
                                    if (n>4) {
                                        for (int e=d+1;e<10-n+5;e++) {
                                            if (n==5 && a+b+c+d+e==s) ans++;
                                            if (n>5) {
                                                for (int f=e+1;e<10-n+6;f++) {
                                                    if (n==6 && a+b+c+d+e+f==s) ans++;
                                                    if (n>6) {
                                                        for (int g=f+1;e<10-n+7;g++) {
                                                            if (n==7 && a+b+c+d+e+f+g==s) ans++;
                                                            if (n>7) {
                                                                for (int h=g+1;e<10-n+8;h++) {
                                                                    if (n==8 && a+b+c+d+e+f+g+h==s) ans++;
                                                                    if (n>8) {
                                                                        for (int i=h+1;e<10-n+9;i++) {
                                                                            if (n==9 && a+b+c+d+e+f+g+h+i==s) ans++;
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        printf("%d\n",ans);    
    }
    return 0;
}

C++: #include<stdio.h>
int n,m;

int f(int depth, int sum, int s)
{
    if(depth == 10)
    {
        if(sum == n && s == m)return 1;
        return 0;
    }
    else return f(depth+1,sum+1,s+depth) + f(depth+1,sum,s);
}
int main()
{

    scanf("%d%d",&n,&m);
    printf("%d\n",f(0,0,0));
    return 0;
}