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

void func(int start,int num,int current);
int s,res;
vector<int> ans;

int main(void){
  int n;
  cin >> n; cin >> s;
  while(n!=0 && s!=0){
    res = 0;
    func(0,n,0);
    ans.push_back(res);
    cin >> n; cin >> s;
  }
  for(vector<int>::iterator it=ans.begin(),it_e=ans.end();
      it!=it_e;++it)
    cout << *it << endl;
  return 0;
}
  
void func(int start,int num,int current){
  int temp=0;
  for(int i=start; i<10; i++){
    if(current+i<=s) temp = current+i;
    else break;
    if(num!=1) func(i+1,num-1,temp);
    else if(temp==s) {
      res++;
    }
    temp=0;
  }
}

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

int hoge(int b, int n, int s) {
    if (n == 1)
        return (0 <= s && s <= 9 && b <= s)? 1 : 0;
    int sum = 0;
    for (int i = b; i <= 9; ++i)
        sum += hoge(i+1, n-1, s-i);
    return sum;
}

int main(void) {
    int n, s;
    while (cin >> n >> s && (n!=0 || s!=0)) {
        cout << hoge(0, n, s) << endl;
    }
    return 0;
}

C++: #include<iostream>
int n,s,c;int r(int i,int t){for(c+=!n&t==s;i++<9;r(i,t+i))n--;n++;}main(){for(;std::cin>>n>>s,n;printf("%d\n",c))r(-1,c=0);}

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

int main(){
  int n,s;
  while(cin >> n >> s, n+s){
    bool arr[10];
    for(int i=0; i<n; i++)
      arr[9-i] = 1;
    for(int i=n; i<10; i++)
      arr[9-i] = 0;
    int c = 0;
    do{
      int S = 0;
      for(int i=0; i<10; i++){
	if(arr[i]) S+= i;
      }
      if(S == s) c++;
    }while(next_permutation(arr,arr+10));
    cout << c << endl;
  }
  return 0;
}

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

int main(){
	int n,s;
	while(cin >> n >> s){
		if(n == 0 && s == 0)break;
		int num = 0;
		for(int zero = 0; zero <= 1; zero++){
			for(int one = 0; one <= 1; one++){
				for(int two = 0; two <= 1; two++){
					for(int three = 0; three <= 1; three++){
						for(int four = 0; four <= 1; four++){
							for(int five = 0; five <= 1; five++){
								for(int six = 0; six <= 1; six++){
									for(int seven = 0; seven <= 1; seven++){
										for(int eight = 0; eight <= 1; eight++){
											for(int nine = 0; nine <= 1; nine++){
												if(zero + one + two + three + four + five + six + seven + eight + nine == n && one + two * 2 + three * 3 + four * 4 + five * 5 + six * 6 + seven * 7 + eight * 8 + nine * 9 == s)num++;
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
		cout << num << endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
vector<int> sum[10][50];
 
int main()
{
//	cut here before submit 
//	freopen ("testcase.sum_of_integers", "r", stdin );
	int n, s;
	while (scanf ("%d %d", &n, &s ) ){
		if (n == 0 && s == 0 ) break;
		rep (i, 10 )rep (j, 50 ) sum[i][j].clear();

		rep (i, 10 ){
			sum[0][i].push_back (1<<i);
		} // end rep

		for (int i = 1; i < n; i++ ){
			for (int j = 0; j < 50; j++ ){
				if (!sum[i-1][j].empty() ){
					rep (k, sum[i-1][j].size() ){
						rep (num, 10 ){
							if (!(sum[i-1][j][k] & (1<<num) ) && j+num < 50 ){
								sum[i][j+num].push_back (sum[i-1][j][k] | (1<<num) );
							} // end if
						} // end rep
					} // end rep
				} // end if
			} // end for
		} // end for

		set<int> ans; ans.clear();
		rep (i, sum[n-1][s].size() ){
			ans.insert (sum[n-1][s][i] );
		} // end rep
		int res = ans.size();
		printf ("%d\n", res );
	} // end loop
		
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<map>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define EPS (1e-10)
using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int memo[50][12][12];

int search(int s, int n, int p){
  if(s == 0 && n == 0)
    return 1;
  if(n == 0 || s < 0 || p == 10)
    return 0;
  if(memo[s][n][p]!=-1)
    return memo[s][n][p];
  return memo[s][n][p] = search(s,n,p+1) + search(s-p,n-1,p+1);
}

int main(){
  int n,s;
  memset(memo,-1,sizeof(memo));
  while(cin>>n>>s,n+s){
    if(s >= 50 || n >= 12)
      cout << 0 << endl;
    else
      cout << search(s,n,0) << endl;
  }
  return 0;
}

C++: // 2019/05/02 Tazoe

#include <iostream>
using namespace std;

int cnt;

void DFS(int n, int s, int m)
{
	if(n==0 && s==0){
		cnt++;
		return;
	}

	if(n<=0)
		return;
	if(s<=0)
		return;
	if(m>9)
		return;

	DFS(n-1, s-m, m+1);
	DFS(n, s, m+1);

	return;
}


int main()
{
	while(true){
		int n, s;
		cin >> n >> s;

		if(n==0 && s==0)
			break;

		cnt = 0;

		DFS(n, s, 0);

		cout << cnt << endl;
	}

	return 0;
}

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

using namespace std;

typedef long long int lli;

int n, s;

bool used[10];

lli dfs(bool used[10], int now, int sum)
{
	if (sum > s) return 0;

	if (now == n) {
		if (sum == s) return 1;
		return 0;
	}

	int res = 0;

	for (int i = 0; i < 10; ++i) {
		if (used[i]) continue;
		used[i] = true;
		res += dfs(used, now + 1, sum + i);
		used[i] = false;
	}

	return res;
}

lli fact(int n)
{
	if (n <= 1) return 1;
	return n * fact(n - 1);
}

int main()
{
	while (cin >> n >> s, n || s) {
		memset(used, false, sizeof(used));
		cout << dfs(used, 0, 0) / fact(n) << endl;
	}
}

C++: #include<string>
#include<vector>
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

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


int n,s,c=0;

void f(int i,int sum,int t){

if(0<=i && i<=9){
sum+=i;
t++;
}

if(t==n)
if(sum==s) c++;

if(0<=i && i<=8){
REP(j,i+1,9) f(j,sum,t);
}


}

int main(){

while(true){

cin >> n >> s;
if(n==0 && s==0) break;


REP(i,0,9) f(i,0,0);

cout << c << endl;

c=0;

}

	return 0;
}