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.h>
using namespace std;

int memo[10][1000][20];
//3,2,1
int dfs(int c,int h,int m)//c:選んだ回数、h:残りの数字、m以下の数字から選ぶ
{
	if(c==0&&h==0)
		return 1;
	if(h<0||m<0||c<0)
		return 0;
	if(memo[c][h][m] != -1)
		return memo[c][h][m];
	int res = 0;
	for(int i=0;i<=m;++i){
		res += dfs(c-1,h-i,i-1);
	}
	memo[c][h][m] = res;
	return res;
}

int main(void)
{
	while(1){
		int n,s;
		cin >> n >> s;
		if(n==0&&s==0)
			return 0;
		memset(memo,-1,sizeof(memo));
		cout << dfs(n,s,9) << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;

int solve(int n, int s, int pre) {
    if(n == 0) {
        return s == 0;
    }
    if(9*n < s) {
        return 0;
    }
    int res = 0;
    for(int i=pre+1; i<=min(s, 9); ++i) {
        res += solve(n-1, s-i, i);
    }
    return res;
}

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

C++: #include <iostream>

using namespace std;
int no,total,ans;

void dfs(int sum,int depth,int last){
	if(sum>total)return;
	if(depth==no){
		if(sum==total)ans++;
		return;
	}
	for(int i=last+1;i<10;i++){
		dfs(sum+i,depth+1,i);
	}
}
int main(){
	while(1){
		ans=0;
		cin>>no>>total;
		if(no+total==0)break;
		dfs(0,0,-1);
		cout<<ans<<endl;
	}
}

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

int po10[]={1,10,100,1000,10000,100000,1000000,10000000,100000000,1000000000};

int n,s;
int dp[20][110];
int main(){
	dp[0][0]=dp[1][0]=1;
	for(int i=1;i<=9;i++){
		for(int j=9;j>=1;j--){
			for(int k=100;k>=i;k--){
				dp[j][k]+=dp[j-1][k-i];
			}
		}
	}
	while(true){
		int res=0;
		cin>>n>>s;
		if(n==0&&s==0) break;
		cout<<dp[n][s]<<endl;
	}
	return 0;
}

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 main() {
	for(int n, s; cin >> n >> s && n && s;) {
		int ret = 0;
		for(int i = 0; i < (1<<10); i++) {
			int sum = 0;
			if(__builtin_popcount(i) != n) continue;
			for(int j = 0; j < 10; j++) {
				if((1 << j) & i) sum += j;
			}
			if(sum == s) ret++;
		}
		cout << ret << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int solve(int n,int k,int m) {
	int i,s=0;
	if (n==0) { if (k==0) return 1; else return 0;}
	for (i=m;i<11-n;i++) s+=solve(n-1,k-i,i+1);
    return s;
}
int main() {
  int n,k;
  while(cin >> n >> k) {
	if (n==0 && k==0) break;  
    cout << solve(n,k,0) << endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int n,s,count;

int solve(int i,int sum,int used){
	
	if(i==10){
		if(s==sum&&used==n){
		 count++;
		}
		return count;
	}
	solve(i+1,sum+i,used+1);
	
	solve(i+1,sum,used);
	
	return count;
}

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

return 0;
}

C++: #include <iostream>

int search(int i, int left, int count){
	if(i == 10){
		return left == 0 && count == 0;
	}
	return search(i + 1, left, count) + search(i + 1, left - i, count - 1);
}

int main(){
	int n, s;

	while(scanf("%d%d", &n, &s), n + s){
		std::cout << search(0, s, n) << std::endl;
	}

	return 0;
}

C++: ///Sum of integers
#include<stdio.h>

int N,S;

int f(int n,int m,int s){
    if(m==10){
        if(S==s&&N==n)return 1;
        return 0;
    }

    return f(n,m+1,s)+f(n+1,m+1,s+m);
}
int main(void){
    while(1){
        scanf("%d%d",&N,&S);
        if(N==0&&S==0)break;

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

C++: #include<iostream>
#include<cstdio>
using namespace std;
int n,s,count,c;

int solve(int i,int sum,int used){
	if(i==10){
		if(s==sum&&used==n){
			
		 count++;c++;
		}
		return count;
	}

	solve(i+1,sum+i,used+1);
	
	solve(i+1,sum,used);
	
	
	return count;
}

int main(){
	
	while(cin>>n>>s,n&&s){
	count=0;c=0;
	solve(0,0,0);
	cout<<c<<endl;
	}

return 0;
}

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

using namespace std;

#define TEMP_T template<typename T>
TEMP_T void sort(T& v){ sort(v.begin(), v.end()); }
TEMP_T void revs(T& v){ reverse(v.begin(), v.end()); }
TEMP_T void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end())); }
TEMP_T void show(T& v, char delim=' ', char end='\n'){ for(int i=0; i<v.size()-1; i++) cout << v[i] << delim; cout << v[v.size()-1] << end; }
TEMP_T T    cums(T& v){ T r; r.push_back(v[0]); for(int i=1; i<v.size(); i++) r.push_back(r[i-1] + v[i]); return r; }
TEMP_T void maxe(T& v, T m){ v = max(v, m); }
TEMP_T void mine(T& v, T m){ v = min(v, m); }

static inline int in(){ int x; scanf("%d", &x); return x; }

struct Solver {
  int pattern[64];
  int n;
  Solver(int n) : n(n) {
    memset(pattern, 0, sizeof(pattern));
  }
  void solve(int it=0, int c=0, int s=0){
    if (it <= 10){
      if (c == n){
        pattern[s]++;
      }
      return;
    }
    
    solve(it + 1, c + 1, s + it);
    solve(it + 1, c, s);
  }
};

int main()
{
  int n, s;
  while (n = in(), s = in(), n != 0 && s != 0){
    Solver solver(n);
    solver.solve();
    if (s < 64){
      printf("%d\n", solver.pattern[s]);
    }
    else puts("0");
  }

  return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define alint(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

lint n,s,ans=0;

void solve(lint n,lint sum,lint max){
	if(n){
		rep(i,max+1,10){
			solve(n-1,sum+i,i);
		}
	}else if(sum==s){
		ans++; return;
	}
	return;
}


int main(){
	while(1){
		cin>>n>>s;
		if(n==0 && s==0) break;
		ans=0;
		solve(n,0,-1);
		o(ans);
	}
}