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 ans = 0;
void dfs(int n,int s,int depth){
	//if (s < 0) return;  //
	if (s == 0 and n == 0){ // ?§£??????????????£??????
		ans++;
		return;
	}
	if (n == 0) return;	

	d++;
	if (depth == 10)return;
	//???????????´???
	dfs(n-1,s-depth,depth);
	//?????°????????£?????´???
	dfs(n,s,depth);
return;
}

int main(){
	while(1){
		ans = 0;
		int n,s; cin >> n >> s;
		if (n + s == 0)	break;
		dfs(n,s,-1);
		cout << ans << endl;
	}

return 0;
}

C++: #include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <utility>

#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cstdint>

using namespace std;

typedef long long ll;

inline int sm(unsigned int a) {
	int ret = 0;
	for(int i = 0;i < 10;i++)
		if((a>>i)&1) ret += i;
	return ret;
}

inline int cnt(unsigned int a) {
	int ret = 0;
	for(int i = 0;i < 10;i++)
		if((a>>i)&1) ret += 1;
	return ret;
}

int main(int argc,char** argv) {
	int n,s;
	cin >> n >> s;
	while(n | s) {
		unsigned int r = 1<<10;
		int c = 0;
		for(unsigned int i = 0;i < r;i++)
			if(sm(i) == s && cnt(i) == n) c++;
		cout << c << endl;
		cin >> n >> s;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int cnt,sum,ans;
int n,s;
void dfs(int sum,int k,int cnt){
	if(sum==s&&k<=
			10&&cnt==n){
		ans++;
		return;
	}
	if(sum>s||k==10||cnt>n)return;
	dfs(sum+k,k+1,cnt+1);
	dfs(sum,k+1,cnt);
}

int main() {

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

C++: #include<iostream>
using namespace std;
int n, s, o;
void rec(int d, int k, int x){
  if(d > n) return;
  else if(d == n){
    if(x == s) ++o;
  }else{
    for(int i = k+1; i <= 9;++i){
      rec(d + 1, i, x + i);
    }
  }
}
int main(){
  cin >> n >> s;
  while(n != 0){
    o = 0;
    rec(0, -1, 0);
    cout << o << endl;
    cin >> n >> s;
  }
  return 0;
}

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

int A[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int cnt = 0;


void deep(int n, int s,int i){

	if (n == 0 && s == 0) {
		cnt++;
		return;
	}
	else if (n == 0) return;
	else if (s == 0) return;
	else if (i == 10) return;


	deep(n - 1, s - A[i], i++);
	deep(n, s, i++);

}

int main(){
	int n, s;
	while (cin >> n >> s, n, s){
		deep(n, s, 0);
		cout << cnt << endl;
		cnt = 0;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int n, s, cnt;

void dfs(int i, int sum, int depth) {
    if (sum == s && depth == n) {
        cnt++;
        return;
    }

    if (i > 9 || depth > n) return;

    dfs(i+1, sum, depth);
    dfs(i+1, sum + i, depth + 1);
}

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

C++: #include<bits/stdc++.h>
using namespace std;
void func(int nn,int mm);
int n,s;
int box[10];
int sum,cnt;
int main(void){
	int i;
	
	for(i=0;i<=9;i++)	box[i]=i;
	while(1){
		cin>>n>>s;
		if(n==0&&s==0)	break;
		sum=0;
		cnt=0;
		func(0,0);
		cout<<cnt<<endl;
	}
	return 0;
}
void func(int nn,int mm){
	int i;
	if(mm==n){
		if(sum==s)	cnt++;
	}
	else{
		if(nn<=9){
			sum+=box[nn];
			func(nn+1,mm+1);
			sum-=box[nn];
			func(nn+1,mm);
		}
	}
}

C++: #include<iostream>
int count=0;

int method(int n,int s,int k){
  if(n==0){
    if(s==0){
      count++;
    }
    return 0;
  }
  if(n<0||s<0){
    return 0;
  }
  if(k>9){
    return 0;
  }
  method(n-1,s-k,k+1);
  method(n,s,k+1);
  return 0;
}

int main(){
  int n,s;
  while(std::cin >> n >> s){
    if(n==0&&s==0){
      break;
    }
    count =0;
    method(n,s,0);

    std::cout << count << std::endl;
  }
}

C++: #include<iostream>
using namespace std;
int ans, s, n;
void solve(int i, int sum, int n)
{
	if (sum == s&&!n)
	{
		ans++;
		return;
	}
	if (i = 10 || !n)return;
	solve(i + 1, sum, n);
	solve(i + 1, sum + i, n - 1);
}
int main()
{
	while (cin >> n >> s, n != 0 || s != 0)
	{
		ans = 0;
		solve(0, 0, n);
		cout << ans << "\n";
	}
	return 0;
}

C++: #include <iostream>
#include <cstring>

using namespace std;

int dp[10][10][101];

int dfs(int now, int use, int sum)
{
    if (use == 0 && sum == 0)
    {
        return 1;
    }
    if (use == 0 || now == 10 || sum < now)
    {
        return 0;
    }
    if (~dp[now][use][sum])
        return dp[now][use][sum];
    return dp[now][use][sum] = dfs(now + 1, use, sum) + dfs(now + 1, use - 1, sum - now);
}

int main()
{
    int n, s;
    memset(dp, -1, sizeof dp);
    while (cin >> n >> s && n)
    {
        cout << dfs(0, n, s) << "\n";
    }
}

C++: //まともに使い方を理解していないくせにincludeしまくる人間のクズ
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <iostream>


//using namespace stdしないと表記がめんどくさいからね、仕方ないね
using namespace std;

//可読性を上げるためのdefineが仇となる典型的パターン
#define FOR(x) for(int i = 0; i < x; i++)

//ローカル変数とグローバル変数は使い分けよう！
stack<short> x, y;
short a[10], n, j, i, m, ans;

//関数って楽しいよね！（魔王スマイル）
void solve(short c, short sum, short cnt){
	if(cnt == n){
		if(sum == m) ans++;
		return;
	}
	if(cnt < n && c > 9) return;
	solve(c + 1, sum + c, cnt + 1);
	solve(c + 1, sum, cnt);
	return;
}

int main(){
	while(true){
		scanf("%d %d", &n, &m);
		if(n == 0 && m == 0) return 0;
		ans = 0;
		solve(0, 0, 0);
		printf("%d\n", ans);
	}
}

C++: #include<iostream>

using namespace std;

int dfs(int x,int n,int s){
  
  if(n==0)
    return (s==0);
  if(x==10)
    return 0;
  
  int res=0;
  
  for(int i=x;i<=9;++i){
    res+=dfs(i+1,n-1,s-i);
  }
  return res;
}

int main(){
  int n,s;

  while(cin>>n>>s,n,s){
    cout<<dfs(0,n,s)<<endl;
  }

}

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));
}

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

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int, int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[] = { 1, 0, -1, 0 }, DY[] = { 0, -1, 0, 1 };

int combination(int a, int n,int s){
	if (a == 10){
		return s == 0 && n == 0;
	}
	else
		return combination(a + 1, n - 1, s - a) + combination(a + 1, n, s);
}

int main(){
	int n, s;

	while(cin >> n >> s && n){

		cout << combination(0, n, s) << endl;
	
	}

	return 0;
}