Language: C++

#include<cmath>
using namespace std;
int main(){
	int n,s;
	while(cin>>n>>s,n&&s){
		if(n>10||s<3||s>45){
			cout<<0<<endl;
			continue;
		}
		int min = (int)pow(10.0,n-2);
		int lim = (int)pow(10.0,n);
		stack<int> st;
		vector<int> res;
		vector<bool> vis(lim,false);
		st.push(0);
		vis[0]=true;
		while(!st.empty()){
			int top = st.top();
			int tmp=top;
			int cur=0;
			while(tmp>0){
				cur+=tmp%10;tmp/=10;
			}
			st.pop();
			if(top>min&&cur==s){
				res.push_back(top);
			}else{
				if(top*10>=lim) continue;
				for(int i=top%10+1;i<10;++i){
					if(!vis[top*10+i]){
						vis[top*10+i]=true;
						st.push(top*10+i);
					}
				}
			}
		}
		cout<<res.size()<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:15: error: 'cin' was not declared in this scope
    5 |         while(cin>>n>>s,n&&s){
      |               ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include<cmath>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:7:25: error: 'cout' was not declared in this scope
    7 |                         cout<<0<<endl;
      |                         ^~~~
a.cc:7:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:34: error: 'endl' was not declared in this scope
    7 |                         cout<<0<<endl;
      |                                  ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include<cmath>
  +++ |+#include <ostream>
    2 | using namespace std;
a.cc:12:17: error: 'stack' was not declared in this scope
   12 |                 stack<int> st;
      |                 ^~~~~
a.cc:2:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
    1 | #include<cmath>
  +++ |+#include <stack>
    2 | using namespace std;
a.cc:12:23: error: expected primary-expression before 'int'
   12 |                 stack<int> st;
      |                       ^~~
a.cc:13:17: error: 'vector' was not declared in this scope
   13 |                 vector<int> res;
      |                 ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include<cmath>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:13:24: error: expected primary-expression before 'int'
   13 |                 vector<int> res;
      |                        ^~~
a.cc:14:24: error: expected primary-expression before 'bool'
   14 |                 vector<bool> vis(lim,false);
      |                        ^~~~
a.cc:15:17: error: 'st' was not declared in this scope; did you mean 's'?
   15 |                 st.push(0);
      |                 ^~
      |                 s
a.cc:16:17: error: 'vis' was not declared in this scope
   16 |                 vis[0]=true;
      |                 ^~~
a.cc:26:33: error: 'res' was not declared in this scope
   26 |                                 res.push_back(top);
      |                                 ^~~
a.cc:37:17: error: 'cout' was not declared in this scope
   37 |                 cout<<res.size()<<endl;
      |                 ^~~~
a.cc:37:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:37:23: error: 'res' was not declared in this scope
   37 |                 cout<<res.size()<<endl;
      |                       ^~~
a.cc:37:35: error: 'endl' was not declared in this scope
   37 |                 cout<<res.size()<<endl;
      |                                   ^~~~
a.cc:37:35: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'