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>

using namespace std;

int n, s, cont, cost;

void dps(int sum, int i, int cost);

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

    return 0;
}

void dps(int sum, int i, int cost)
{
	if(cost == n && sum == s)	cont++;
	if(i == 10 || cost == n)	return;
	dps(sum+i, i+1, cost+1);
	dps(sum, i+1, cost);
}

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

int memo[11][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));
		if(n>10 || s>100)
			cout << 0 << endl;
		cout << dfs(n,s,9) << endl;
	}
	return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, int> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e5) + 5;
const double EPS = 1e-8;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)

int rec(int i, int j, int k){
    if(i==0){
        if(k==0)return 1;
        else return 0;
    }
    int res = 0;
    for (int x = j+1;x<=min(9,k);x++){
        res += rec(i-1,x,k-x);
    }
    return res;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int serch(int i,int j,int n,int co)
{
    if(i==10)return 0;
    else if(co==n&&j==0)return 1;
    else if(j<0||co==n||j<i)return 0;
    return serch(i+1,j-i,n,co+1)+serch(i+1,j,n,co);
}
int main()
{
    int n,s,num;
    while(cin>>n>>s&&n!=0&&s!=0){
        num=serch(0,s,n,0);
        cout<<num<<endl;
    }
}

C++: #include <stdio.h>

int now = 0, n, s, ans, be;

int saiki(int a) {
  if(now > s) return 0;
  if(a == n) {
    if(s - now < 10 && s - now > be) ++ans;
    return 0;
  }
  int i, t = be + 1;
  for(i = t; i < 10; ++i) {
    now += i, be = i;
    saiki(a + 1);
    now -= i, be = t - 1;
  }
  return 0;
}

int main(void) {
  int i, j, k;
  while( 1 ) {
    now = 0, ans = 0, be = -1;
    scanf("%d%d", &n, &s);
    if(!n && !s) break;
    saiki(1);
    printf("%d\n", ans);
  }
  return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int n,s;
int sum(int S) {
    int res = 0;
    rep(i,10) if((S>>i)&1) res+=i;
    return res;
}
int dfs(int S,int cnt) {
    if(cnt==n) {
        if(sum(S)==s) return 1;
        else return 0;
    }
    int res=0;
    rep(i,10) {
        if(!(S>>i)&1) {
            res+=dfs(S|(1<<i),cnt+1);
        }
    }

    return res;
}
void solve() {
    cout<<dfs(0,0)<<endl;
}
int main() {
    while(cin>>n>>s) {
        if(n+s==0) break;
        solve();
    }
    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
 
using namespace std;
 
const double eps=1e-10;
 
int main()
{
	int n,s;
	while(cin>>n>>s,n){
		int res=0;
		for(int i=0;i<(1<<10);i++){

			int sum=0,bit=0;
			for(int j=0;j<10;j++){
				if( i & (1<<j) ){
					bit++;
					sum+=j;
				}
			}

			if(sum==s && bit==n) res++;

		}

		cout<<res<<endl;
	}

	return 0;
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
constexpr int MOD = 1000000007;
constexpr int INF = 2000000000;
using namespace std;

int n, s;
int ans = 0;

void dfs(int pos, int sum,int count) {
	if (count == n) {
		if (sum == s) {
			ans++;
			return;
		}
	}
	if (pos > 9)return;
	if (sum > s)return;
	dfs(pos + 1, sum + pos,count+1);
	dfs(pos + 1, sum,count);
}

int main() {
	while (cin >> n >> s&&n != 0 && s != 0) {
		ans = 0;
		dfs(0, 0, 0);
		cout << ans << endl;
	}
}

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

int fact(int n){
	if (n == 0){
		return 1;
	}
	else{
		return n * (fact(n - 1));
	}
}

int main()
{
	int n, s;
	vector <int> v;
	vector <int>::iterator vi;
	for (int i = 0; i <= 9; i++){
		v.push_back(i);
	}
	while (cin >> n >> s, n || s){
		int repeat = fact(10 - n);
		int counter = 0;
		int anscounter = 0;
		do{
			counter++;
			if (counter % repeat != 0){
				continue;
			}
			int sum = 0;
			vi = v.begin();
			for (int i = 0; i < n; i++, vi++){
				sum += *vi;
			}
			if (sum == s){
				anscounter++;
				vi = v.begin();
			}
		} while (next_permutation(v.begin(), v.end()));
		cout << anscounter / fact(n)<< endl;
	}
	return 0;
}

C++: #include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
long long int fie[110][11][1100];
int main(){
    while(1){
        memset(fie,0,sizeof(fie));
        int N,S;
        cin>>N>>S;
        if(N==0&&S==0)break;
        fie[1][0][0]=1;fie[1][1][1]=1;
        for(int i=1;i<100;i++){
            for(int j=0;j<10;j++){
                for(int k=0;k<=1000;k++){
                    fie[i+1][j][k]+=fie[i][j][k];
                    fie[i+1][j+1][k+i+1]+=fie[i][j][k];
                }
            }
        }
        cout<<fie[100][N][S]+fie[100][N-1][S]<<endl;
    }
    return 0;
}