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<stdio.h>
#include<math.h>
using namespace std;

int main()
{
    double K,L,M,H,N,A[120],B[120],C,D,R;
    int I;
    while(scanf("%lf",&N)&&N){
      for(I=1;I<=N;I++){
        scanf("%lf %lf",&A[I],&B[I]);
      }
      scanf("%lf",&R);
      bool Flag=1;
      /*for(I=1;I<N&&Flag;I++){
            if(B[I]==B[I+1]){
                H=(A[I+1]+A[I])/2;
                K=(A[I]*A[I])-(2*A[I]*H)+(H*H)+(B[I]*B[I])-(R*R);
                K=(2*B[I]*2*B[I])-(4*K);
                K=K+0.000000001;
                if(K<0) Flag=0;
            }
            else{
                C=-(A[I]*A[I])+(A[I+1]*A[I+1])-(B[I]*B[I])+(B[I+1]*B[I+1])/(2*(B[I+1]-B[I]));
                D=(A[I+1]-A[I])/(B[I+1]-B[I]);
                M=(A[I]*A[I])+(B[I]*B[I])-(2*B[I]*C)+(C*C)-(R*R);
                L=(2*B[I]*D)-(2*A[I])-(2*C*D);
                H=(L*L)-(4*((D*D)+1)*M);
                printf("%lf\n",H);
                H=H+0.000000001;
                //||(D*D+1)==0
                if(H<0||(D*D+1)==0) Flag=0;
            }
        }*/
        if(B[I]==B[I+1]){
                H=(A[I+1]+A[I])/2;
                K=(A[I]*A[I])-(2*A[I]*H)+(H*H)+(B[I]*B[I])-(R*R);
                K=((2*B[I]*2*B[I])-(4*K));
                K=K+0.000000001;
                if(K<0) Flag=0;
                else{
                    K=sqrt(K);
                    K=(2*B[I]+K)/2;
                }
            }
            else{
                C=-(A[I]*A[I])+(A[I+1]*A[I+1])-(B[I]*B[I])+(B[I+1]*B[I+1])/(2*(B[I+1]-B[I]));
                D=(A[I+1]-A[I])/(B[I+1]-B[I]);
                M=(A[I]*A[I])+(B[I]*B[I])-(2*B[I]*C)+(C*C)-(R*R);
                L=(2*B[I]*D)-(2*A[I])-(2*C*D);
                H=((L*L)-(4*((D*D)+1)*M));
                printf("%lf\n",H);
                H=H+0.000000001;
                //||(D*D+1)==0
                if(H<0||(D*D+1)==0) Flag=0;
                else{
                    H=sqrt(H);
                    H=(-1*(L)+H)/(2*(D*D+1));
                    K=C-(H*D);
                }
            }
            for(I=1;I<N&&Flag;I++){
                M=(A[I]-H)*(A[I]-H)+(B[I]-K)*(B[I]-K);
                L=R*R;
                if(M>L) Flag=0;
            }
        if(Flag)
        printf("The polygon can be packed in the circle.\n");
        else
        printf("There is no way of packing that polygon.\n");
    }
    return 0;
}

C++: #include <stdio.h>
#include <string.h>

int dp[20][55][20];

int cnt_sum(int n, int s, int x){
  if(n < 0 || s < 0){
    return 0;
  }
  if(dp[n][s][x] != -1){
    return dp[n][s][x];
  }
  if(n == 0 && s == 0){
    return (1);
  }
  if(x>9){
    return (0);
  }
   
  return dp[n][s][x] = (cnt_sum(n-1, s-x, x+1) + cnt_sum(n, s, x+1));
}
int main(){
  int n, s;
  memset(dp,-1,sizeof(dp));
  while(1){
    scanf("%d %d", &n, &s);
    if(n == 0 && s == 0){
      break;
    }
    if(n >= 11 || s >= 46) printf("0\n");
    else printf("%d\n", cnt_sum(n, s, 0));
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int ans;
int n, s;
//cnt := ??????????????????
void bfs(int cnt, int sum, int times){
    if(cnt == n){
        if(sum == s){
            ans++;
        }
        return;
    }
    if(times == 10){
    	return;
    }
    bfs(cnt+1, sum+times, times+1);
    bfs(cnt, sum, times+1);
}
int main(void){
    while(cin >> n >> s && n+s != 0){
        ans = 0;
        bfs(0,0,0);
        cout << ans << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int cnt;
int n,sum;
void dfs(int n, int i , int s){

  if(s == sum && n == 0){
    cnt++;
    return; 
  }

  if(i == 10 || n == 0 ){
    return; 
  }

  dfs(n-1,i + 1,s + i);  
  dfs(n,i + 1,s);

}

int main(){

  while( cin >> n >> sum, n + sum){
    cnt = 0;
    dfs(n,0,0);
    cout << cnt << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstring>
using namespace std;
int n,s,flag[10] = { 0 },c;
void f(int m,int a,int t){
	if(a == n){
		if(t == s) ++c;
		return;
	}
	else {
		if(t > s) return;
		for(int i = m;i < 10;++i){
			if(flag[i] == 0){
				flag[i] = 1;
				f(i + 1,a + 1,t + i);
				if(a != 0) flag[i] = 0;
			}
		}
	}
	return;
}
int main(){
	while(cin >> n >> s && (n != 0 && s != 0)){
		memset(flag,'\0',sizeof(int));
		c = 0;
		f(0,0,0);
		cout << c << endl;
	}
	return 0;
}

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

int n, s;
int num[10];
int dfs(int sum, int i, int j) {
    if(sum == s && j == 0) return 1;
    if(i > 9 || j<= 0) return 0;
    return dfs(sum+num[i], i+1, j-1) + dfs(sum, i+1, j);
}


int main() {
    for(int i=0;i<10;i++) num[i] = i;
    while(true) {
        cin >> n >> s;
        if(!n && !s) break;
        int ans = dfs(0, 0, n);
        cout << ans << endl;
    }
}

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

int s;
int cmb;
void count( int n ,int k,int sa ){
  if( DEBUG )
    cout << "n="<<n<<" k="<< k << " sa="<<sa 
	 << " cmb="<<cmb << endl;


  if( n<1 && sa==s ) ++cmb;
  --n;
  for( int i=k;i<=9;i++ ){
    if( sa+i > s)
      break;
    if( DEBUG )
      cout << " i="<<i<<endl;
    count( n,i+1, sa+i );
  }
}


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

  return 0;
}

C++: #include "bits/stdc++.h"

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define INF 999999999
#define PI 3.14159265358979

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

//================================================
int func(int n, int s, int c) {
	if (n == 0 && s == 0) return 1;
	
	if ((s > 0 && n == 0) || (n >= 2 && s <= 0) || c < 0){
		return 0;
	}

	if (c > s) {
		return func(n, s, c - 1);
	} else {
		return func(n - 1, s - c, c - 1) + func(n, s, c - 1);
	}
}


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n, s;
	while (cin >> n >> s) {
		if (n == 0 && s == 0 ) break;
		cout << func(n, s, 9) << "\n";
	}
	return 0;
}

C++: #include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>
#include<map>
#include<queue>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)
#define in(i,j,k) ((i)>=(j)&&(i)<=(k))

int main(){
	int n,s,l,a,c;
	vector<int> v;
	for(;;){
		scanf("%d%d",&n,&s);
		if(n==0 && s==0)break;
		l=min(10,s);
		v.clear();
		rep(i,l)v.push_back(i<n);
		c=0;
		do{
			a=0;
			rep(i,l)a+=i*v[i];
			c+=(s==a);
		}while(prev_permutation(v.begin(),v.end()));
		printf("%d\n",c);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int ans,n,s;

void search(int num,int sum,int st)
{
	if(num==0)
	{
		if(sum==s)
			ans++;
		return;
	}
	for(int i=st;i<10;i++)
	{
		search(num-1,sum+i,i+1);
	}
	return;
}

int main()
{
	for(;;)
	{
		cin >> n >> s;
		if(n==0 && s==0)
			break;
		ans=0;
		search(n,0,0);
		cout << ans << endl;
	}
}