criyle/codenet-compile-errors huggingface dataset:
Language: C++

import java.io.*;
public class aoj0029 {
   public static void main(String[] args) throws IOException{
	   BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
	   String s;
	   String tmp = "";
	   String sizetmp = "";
	   int cmax = -1;
	   int max = -1;
	   int cnt;
	   s = buf.readLine();
	   String[] data = s.split(" ");
	   for(int i=0;i<data.length;i++){
		   cnt = 1;
		   if(cmax < data[i].length()-1){
			   cmax = data[i].length()-1;
			   sizetmp = data[i];
		   }
		   for(int j=0;j<data.length;j++){
			   if(data[i].equals(data[j]) && i != j) cnt++;
		   }
		   if(max < cnt){
			   tmp = data[i];
			   max = cnt;
		   }
	   }
	   System.out.println(tmp + " " + sizetmp);
   }
}

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.io.*;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: expected unqualified-id before 'public'
    2 | public class aoj0029 {
      | ^~~~~~
Language: C++

#include <iostream>
#include <map>

int main() {
	std::string word, longest, freqest;
	std::map<std::string, int> table;
	//入力
	while (std::cin >> word) ++table[word];
	//演算
	longest = table.begin()->first;
	freqest = table.begin()->first;
	for (std::map<string, int>::iterator it = table.begin(); it != table.end(); ++it) {
		if (longest.length < it->first.length) longest = it;
		if (table[freqest] < it->second) freqest = it;
	}
	//出力
	std::cout << freqest << " " << longest << std::endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:23: error: 'string' was not declared in this scope
   12 |         for (std::map<string, int>::iterator it = table.begin(); it != table.end(); ++it) {
      |                       ^~~~~~
a.cc:12:23: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:12:34: error: template argument 1 is invalid
   12 |         for (std::map<string, int>::iterator it = table.begin(); it != table.end(); ++it) {
      |                                  ^
a.cc:12:34: error: template argument 3 is invalid
a.cc:12:34: error: template argument 4 is invalid
a.cc:12:45: error: expected ';' before 'it'
   12 |         for (std::map<string, int>::iterator it = table.begin(); it != table.end(); ++it) {
      |                                             ^~~
      |                                             ;
a.cc:12:46: error: 'it' was not declared in this scope; did you mean 'int'?
   12 |         for (std::map<string, int>::iterator it = table.begin(); it != table.end(); ++it) {
      |                                              ^~
      |                                              int
a.cc:12:83: error: expected ')' before ';' token
   12 |         for (std::map<string, int>::iterator it = table.begin(); it != table.end(); ++it) {
      |             ~                                                                     ^
      |                                                                                   )
a.cc:12:87: error: 'it' was not declared in this scope; did you mean 'int'?
   12 |         for (std::map<string, int>::iterator it = table.begin(); it != table.end(); ++it) {
      |                                                                                       ^~
      |                                                                                       int
Language: C++

#include <iostream>
#include <string>
#include <map>
using namespace std;
int main(){
	string s,t,u;
	int m=0,l=0;
	map<string,int>m;
	for(;cin>>u;){
		if(++m[u]>m)s=u;
		if(t.size()<u.size())t=u;
	}
	cout<<s<<' '<<t<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:24: error: conflicting declaration 'std::map<std::__cxx11::basic_string<char>, int> m'
    8 |         map<string,int>m;
      |                        ^
a.cc:7:13: note: previous declaration as 'int m'
    7 |         int m=0,l=0;
      |             ^
a.cc:10:23: error: no match for 'operator[]' (operand types are 'int' and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
   10 |                 if(++m[u]>m)s=u;
      |                       ^
Language: C++

#include<iostream>
#include<cstring>
using namespace std;
int const N = 1001;
int main(){
	char str[N][50];
	int num[N],i=0,max=0,l=0;
	while(cin >> str[i]){
		i++;
	}
	for(int j=0;j<i;j++){
		num[j]=0;
	}
	for(int j=0;j<i;j++){
		for(int k=0;k<i;k++){
			if(strcmp(str[j],str[k])==0)
		num[j]++;
		}
		if(num[max] < num[j])
			max = j;
		if(strlen(str[l]) < strlen(str[j]))
			l=j;
	}
	cout << str[max] << " " << str[l] << endl;
}
[tebora@tebora

Compiler output:
a.cc:26:8: error: stray '@' in program
   26 | [tebora@tebora
      |        ^
a.cc:26:1: error: expected unqualified-id before '[' token
   26 | [tebora@tebora
      | ^
Language: C++

#include <iostream>
using namespace std ;

int main()
{
	char get[1000][40] ;
	char mode[40] ;
	char longest[40] ;

	int count = 0 ;
	int lest = -1 ;
	
	int tmp = 0 ;

	int most = 0 ;
	int mnum = -1 ;

	int i = 0 ;

	while( cin >> get[i] )
	{
		if( count < strlen(get[i]) )
		{
			count = strlen(get[i]) ;
			lest = i ;
		}

		for( int j = (i-1) ; j >= 0 ;  j -- )
		{
			if( strcmp( get[i], get[j] ) == 0 )
			{
				tmp ++ ;
			}
		}
		tmp = 0 ;

		if( most < tmp )
		{
			most = tmp ;
			mnum = i ;
		}

		i ++ ;
	}

	cout << get[mnum] << " " << get[lest] ;

	return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:29: error: 'strlen' was not declared in this scope
   22 |                 if( count < strlen(get[i]) )
      |                             ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | using namespace std ;
a.cc:30:29: error: 'strcmp' was not declared in this scope
   30 |                         if( strcmp( get[i], get[j] ) == 0 )
      |                             ^~~~~~
a.cc:30:29: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main()
{
	char s[1000];
	int n=0;
	cin.getline(s,1000);
	string tok[1000];
	char *sep=" ,.";
	char *word;
	word = strtok(s,sep);
	while(word != NULL)
	{
		tok[n] = word;
		n++;
		word=strtok(NULL,sep);
	}
	int f=1,fmax=1;
	string max, freq;
	max=tok[0]; freq=tok[0];
	for(int i=0;i<n;i++)
	{
		if(tok[i].length()>max.length())
			max=tok[i];
		f=1;
		for(int j=i+1;j<n;j++){
			if(tok[i]==tok[j])
				f++;
		}
		if(f>fmax)
		{
			fmax=f; freq=tok[i];
		}
	}
	cout << freq <<" " <<max;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   12 |         char *sep=" ,.";
      |                   ^~~~~
a.cc:14:16: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
   14 |         word = strtok(s,sep);
      |                ^~~~~~
      |                strtoq
Language: C++

#include <iostream>
#include <string>

using namespace std;

int main()
{
	char s[1000];
	int n=0;
	cin.getline(s,1000);
	string tok[1000];
	char *sep=" ,.";
	char *word;
	word = strtok(s,sep);
	while(word != NULL)
	{
		tok[n] = word;
		n++;
		word=strtok(NULL,sep);
	}
	int f=1,fmax=1;
	string max, freq;
	max=tok[0]; freq=tok[0];
	for(int i=0;i<n;i++)
	{
		if(tok[i].length()>max.length())
			max=tok[i];
		f=1;
		for(int j=i+1;j<n;j++){
			if(tok[i]==tok[j])
				f++;
		}
		if(f>fmax)
		{
			fmax=f; freq=tok[i];
		}
	}
	cout << freq <<" " <<max<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:19: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   12 |         char *sep=" ,.";
      |                   ^~~~~
a.cc:14:16: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
   14 |         word = strtok(s,sep);
      |                ^~~~~~
      |                strtoq
Language: C++

#include<stdio.h>
#include<malloc.h>
#include<string.h>
#include<stdlib.h>

typedef struct wordtree{
	struct wordtree *next;
	struct wordtree *prev;
	char *txt;
	int t_num;
	int t_size;
}wordtree;

wordtree *initTree(char *msg,int num,int size){
	wordtree *x;
	x=(wordtree *)malloc(sizeof(wordtree));
	x->prev=NULL;
	x->next=NULL;
	x->txt=(char *)malloc(sizeof(char));
	strcpy(x->txt,msg);
	x->t_num=num;
	x->t_size=size;
	return x;
}
int cnt=0;often=0;length=0;
char *mod2,*mod3;
void graphtree(wordtree *tree,int mode){
	switch(mode){
		case 1:if(tree->txt!="")printf("msg=%s,num=%d,size=%d,depth=%d\n",tree->txt,tree->t_num,tree->t_size,cnt);
		case 2:if(tree->t_num>=often){often=tree->t_num;mod2=tree->txt;}
		case 3:if(tree->t_size>=length){length=tree->t_size;mod3=tree->txt;}
	}
	if(tree->next!=NULL){
		cnt++;
		graphtree(tree->next,mode);
	}
	if(tree->prev!=NULL){
		cnt--;
		graphtree(tree->prev,mode);
	}
	return ;
}
		
void addToTree(char *msg,wordtree *tree){
	wordtree *x;
	x=tree;
	if(strcmp(msg, x->txt)>0){
		if(x->next==NULL){
			x->next=initTree(msg,1,strlen(msg));
			return;
		}else{
			addToTree(msg,x->next);
		}
	}else{
		if(x->prev==NULL){
			x->prev=initTree(msg,1,strlen(msg));
			return;
		}else{
			addToTree(msg,x->prev);
		}
	}
}

wordtree *searchTree(char *msg,wordtree *tree){
	wordtree *x;
	x=tree;
	if(strcmp(msg,x->txt)>0){
		if(x->next==NULL)return NULL;
		else searchTree(msg,x->next);
	}else if(strcmp(msg,x->txt)<0){
		if(x->prev==NULL)return NULL;
		else searchTree(msg,x->prev);
	}else{
		return x;
	}
}

int main(){
	wordtree *r,*p;
	int i,j;
	char txt[1024],s[32];
	memset(s,'\0',sizeof(s));
	r=initTree("nn",0,0);//root
	while(fgets(txt,sizeof(txt),stdin)!=NULL){
		for(i=0,j=0;i<strlen(txt);i++){
			if((65<=txt[i]&&txt[i]<=90)||(97<=txt[i]&&txt[i]<=122)){
				if((65<=txt[i]&&txt[i]<=90))txt[i]+=32;
				s[j]=txt[i]; j++;
			}else{
				j=0;
				p=searchTree(s,r);
				if(p==NULL)	addToTree(s,r);
				else p->t_num++;
				memset(s,'\0',sizeof(s));
			}
		}
		//graphtree(r,1);
		graphtree(r,2);
		graphtree(r,3);
		printf("%s %s\n",mod2,mod3);
	}		
	return 0;	
}

Compiler output:
a.cc:25:11: error: 'often' does not name a type
   25 | int cnt=0;often=0;length=0;
      |           ^~~~~
a.cc:25:19: error: 'length' does not name a type
   25 | int cnt=0;often=0;length=0;
      |                   ^~~~~~
a.cc: In function 'void graphtree(wordtree*, int)':
a.cc:30:40: error: 'often' was not declared in this scope
   30 |                 case 2:if(tree->t_num>=often){often=tree->t_num;mod2=tree->txt;}
      |                                        ^~~~~
a.cc:31:41: error: 'length' was not declared in this scope
   31 |                 case 3:if(tree->t_size>=length){length=tree->t_size;mod3=tree->txt;}
      |                                         ^~~~~~
a.cc: In function 'int main()':
a.cc:83:20: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
   83 |         r=initTree("nn",0,0);//root
      |                    ^~~~
a.cc: In function 'wordtree* searchTree(char*, wordtree*)':
a.cc:76:1: warning: control reaches end of non-void function [-Wreturn-type]
   76 | }
      | ^
Language: C++

#include <map>
#include <iostream>

using namespace std;

/** Problem0029 : English Sentence **/
int main()
{
	map<string, int> sentences;
	pair<string, int> t;
	string tmp, maxLength;
	
	while (cin >> tmp) {
		if (tmp.length() > maxLength.length())
			maxLength = tmp;
		
		if (sentences.count(tmp) == 0) {
			sentences.insert(map<string,int>::value_type(tmp, 1));
		} else {
			sentences[tmp]++;
		}
	}
	
	t = *max_element(sentences.begin(), sentences.end());
	cout << t.first << " " << maxLength << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:14: error: 'max_element' was not declared in this scope
   24 |         t = *max_element(sentences.begin(), sentences.end());
      |              ^~~~~~~~~~~
Language: C++

#include <stdio>
#include <string>

char str[50];
char word[1000][50];
int count[1000];

int main(void)
{
	int i, j, ind, ind2;
	int c, len = 0;
	i = 0;
	
	while (scanf("%s", str) != EOF){
		
		c = 1;
		for (j = 0; j < i; j++){
			
			if (strcmp(str, word[j]) == 0){
				count[j]++;
				c = 0;
			}
		}
		
		if (c == 1){
			strcpy(word[i], str);
			
			if (strlen(word[i]) > len){
				len = strlen(word[i]);
				ind = i;
			}
			i++;
		}
	}
	ind2 = 0;
	
	for (j = 0; j < i; j++){
		
		if (count[ind2] < count[j]){
			ind2 = j;
		}
	}
	
	printf("%s %s\n", word[ind2], word[ind]);
	
	return (0);
}

Compiler output:
a.cc:1:10: fatal error: stdio: No such file or directory
    1 | #include <stdio>
      |          ^~~~~~~
compilation terminated.
Language: Java

import java.util.Scanner;
//AOJ:0030

public class Main {
	int selval;
	int sumval;
	int res = 0;

	void run(){
		Scanner sc = new Scanner(System.in);
		while(true){
			selval = sc.nextInt();
			sumval = sc.nextInt();
			calc(0,0,selval);
			System.out.println(res++);
			res = 0;
		}
	}
	// i:????????????
	// sum:????¨????
	//???n:????±?
	void calc(int i, int sum, int n){
		if(n == 0 && sum == sumval){
			res++;
		}
		
		if(i > 9)return;
		for(int k = i; k <= 9; k++){
			calc(k+1, sum+k,n-1);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

Compiler output:
Main.java:35: error: reached end of file while parsing
	}
	 ^
1 error
Language: Java

import java.io.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
int count:
while(!(line=br.readLine()).equals("0 0")){
String[] value=line.split(" ");
int n=Integer.parseInt(value[0]);
int s=Integer.parseInt(value[1]);
search(0,n,0);
}
}
static void search(int i,int n,int sum){
if(n==0){
if(sum==s){
count++;
return;
}
}
if(i>9){
return;
}
for(int a=i;a<=9;a++){
search(i+1,n-1,sum+a);
}
}
}

Compiler output:
Main.java:7: error: ';' expected
int count:
         ^
1 error
Language: Java

import java.io.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
int count=0;
while(!(line=br.readLine()).equals("0 0")){
String[] value=line.split(" ");
int n=Integer.parseInt(value[0]);
int s=Integer.parseInt(value[1]);
search(0,n,0);
System.out.println(count);
}
}
static void search(int i,int n,int sum){
if(n==0){
if(sum==s){
count++;
return;
}
}
if(i>9){
return;
}
for(int a=i;a<=9;a++){
search(i+1,n-1,sum+a);
}
}
}

Compiler output:
Main.java:18: error: cannot find symbol
if(sum==s){
        ^
  symbol:   variable s
  location: class Main
Main.java:19: error: cannot find symbol
count++;
^
  symbol:   variable count
  location: class Main
2 errors
Language: Java

import java.io.*;

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
int count=0;
while(!(line=br.readLine()).equals("0 0")){
String[] value=line.split(" ");
int n=Integer.parseInt(value[0]);
int s=Integer.parseInt(value[1]);
search(0,n,0,s);
System.out.println(count);
}
}
static void search(int i,int n,int sum,int s){
if(n==0){
if(sum==s){
count++;
return;
}
}
if(i>9){
return;
}
for(int a=i;a<=9;a++){
search(i+1,n-1,sum+a,s);
}
}
}

Compiler output:
Main.java:19: error: cannot find symbol
count++;
^
  symbol:   variable count
  location: class Main
1 error
Language: Java

import java.io.*;

class Main{
int count;
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
while(!(line=br.readLine()).equals("0 0")){
String[] value=line.split(" ");
int n=Integer.parseInt(value[0]);
int s=Integer.parseInt(value[1]);
search(0,n,0,s);
System.out.println(count);
}
}
static void search(int i,int n,int sum,int s){
if(n==0){
if(sum==s){
count++;
return;
}
}
if(i>9){
return;
}
for(int a=i;a<=9;a++){
search(i+1,n-1,sum+a,s,count);
}
}
}

Compiler output:
Main.java:13: error: non-static variable count cannot be referenced from a static context
System.out.println(count);
                   ^
Main.java:19: error: non-static variable count cannot be referenced from a static context
count++;
^
Main.java:27: error: non-static variable count cannot be referenced from a static context
search(i+1,n-1,sum+a,s,count);
                       ^
Main.java:27: error: method search in class Main cannot be applied to given types;
search(i+1,n-1,sum+a,s,count);
^
  required: int,int,int,int
  found:    int,int,int,int,int
  reason: actual and formal argument lists differ in length
4 errors
Language: Java

import java.io.*;

class Main{
static int count;
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line;
while(!(line=br.readLine()).equals("0 0")){
String[] value=line.split(" ");
int n=Integer.parseInt(value[0]);
int s=Integer.parseInt(value[1]);
search(0,n,0,s);
System.out.println(count);
}
}
static void search(int i,int n,int sum,int s){
if(n==0){
if(sum==s){
count++;
return;
}
}
if(i>9){
return;
}
for(int a=i;a<=9;a++){
search(i+1,n-1,sum+a,s,count);
}
}
}

Compiler output:
Main.java:27: error: method search in class Main cannot be applied to given types;
search(i+1,n-1,sum+a,s,count);
^
  required: int,int,int,int
  found:    int,int,int,int,int
  reason: actual and formal argument lists differ in length
1 error
Language: Java

import java.util.*;

public class A{
	private static final Scanner scan = new Scanner(System.in);
	static int count = 0;

	public static void main(String[] args){

		for(;;){
			count = 0;
			int n = scan.nextInt();
			int s = scan.nextInt();
			if(n == 0 && s == 0)break;
			solve(0, n, s);
			System.out.printf("%d\n", count);
		}
	}
	
	// p: ?????\????????°???
	// n: ?????\????????°????????°
	// s: ????¨????????¨????
	private static void solve(int p, int n, int s){
		if(p > 9 || n == 0 || p > s){
			return;
		}
		if(n == 1 && p == s){
			count++;
		}
		solve(p+1, n-1, s-p);
		solve(p+1, n, s);
	}
}

Compiler output:
Main.java:3: error: class A is public, should be declared in a file named A.java
public class A{
       ^
1 error
Language: Java

import java.util.*;

public class Main{
	static ArrayList<Integer[]> fr = new ArrayList<Integer[]>();
	static ArrayList<Integer[]> to = new ArrayList<Integer[]>();
	private static final Scanner scan = new Scanner(System.in);
	static int count = 0;

	public static void main(String[] args){
		
		for(;;){
			int n = scan.nextInt();
			int s = scan.nextInt();
			if(n == 0 && s == 0)break;
			count = 0;

			Integer[] ne = new Integer[3];
			ne[0] = 0;
			ne[1] = n;
			ne[2] = s;
			fr.add(ne);
			for(;;){
				if(fr.size() == 0)break;
				for(Integer[] sd : fr){
					if(sd[0] > 9 || sd[1] == 0 || sd[0] > sd[2]){
						continue;
					}
					if(sa[1] == 1 && sd[0] == sd[2])count++;
					Integer[] ne1 = new Integer[3];
					Integer[] ne2 = new Integer[3];
					ne1[0] = sd[0]+1;
					ne1[1] = sd[1]-1;
					ne1[2] = sd[2] - sd[0];
					ne2[0] = sd[0]+1;
					ne2[1] = sd[1];
					ne2[2] = sd[2];
					to.add(ne1);
					to.add(ne2);
				}
				fr.clear();
				for(Integer[] q : to){
					fr.add(q);
				}
				to.clear();
			}
			System.out.printf("%d\n", count);
		}
	}
}

Compiler output:
Main.java:28: error: cannot find symbol
					if(sa[1] == 1 && sd[0] == sd[2])count++;
					   ^
  symbol:   variable sa
  location: class Main
1 error
Language: Java

import javafx.util.Pair;

import java.util.*;

public class Main {

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        while (true)
        {
            int n = sc.nextInt();
            int s = sc.nextInt();
            if(n==0&&s==0)break;
            System.out.println(answer(n,s,-1));
        }
    }
    static int answer(int n,int s,int p)
    {
        if (n==0)return (s==0)?1:0;
        int ans =0;
        for(p++;p<=Math.min(s,9);p++)
        {
            ans +=answer(n-1,s-p,p);
        }
        return ans;
    }
}

Compiler output:
Main.java:1: error: package javafx.util does not exist
import javafx.util.Pair;
                  ^
1 error
Language: Java

import java.io.*;
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String line = null;
    while (!(line = sc.next()).equals("0 0")) {
      String str[] = line.split(" ", 2);
      int n = Integer.parseInt(str[0]);
      int s = Integer.parseInt(str[1]);
    }
    System.out.println(dfs(n, s, 0));
  }

  private static int dfs(int n, int s, int min) {
    if (n == 0) {
      return s == 0 ? 1 : 0;
    }
    int ret = 0;
    for (int i = min; i <= Math.min(9, s); i++) {
      ret += dfs(n - 1, s - i, i + 1);
    }
    return ret;
  }
}

Compiler output:
Main.java:13: error: cannot find symbol
    System.out.println(dfs(n, s, 0));
                           ^
  symbol:   variable n
  location: class Main
Main.java:13: error: cannot find symbol
    System.out.println(dfs(n, s, 0));
                              ^
  symbol:   variable s
  location: class Main
2 errors
Language: Java

import java.util.Scanner;

public class Main{
  public static int n;
  public static int s;
  public static int count;
  public static int[] a = new int[10];

  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    while(true){
      n = scanner.nextInt();
      s = scanner.nextInt();
      count = 0;
      if(n == 0 && s == 0){break;}
      for (int i = 0; i < 10; i++)
        a[i] = i;

        dfs(0, 0, 0);
        System.out.println(count);
    }
  }


Compiler output:
Main.java:22: error: reached end of file while parsing
  }
   ^
1 error
Language: Java

import java.util.Scanner;

public class AOJ0030 {

	static int num,n,s;
	
	static void dfs(int depth,int begin,int sum)
	{
		if(depth==n)
		{
			if(sum==s)++num;
			return;
		}
		for(int i=begin;i<=9;++i)
		{
			if(sum+i<=s)
			{
				dfs(depth+1,i+1,sum+i);
			}
		}
	}
	
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		
		while(true)
		{
			n=sc.nextInt();
			s=sc.nextInt();
			if(n==0&&s==0)break;
			num=0;
			dfs(0,0,0);
			System.out.println(num);
		}
		
		sc.close();
	}

}

Compiler output:
Main.java:3: error: class AOJ0030 is public, should be declared in a file named AOJ0030.java
public class AOJ0030 {
       ^
1 error
Language: C

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>

int main() {
	int a, b, ans[1024],num[1024];
	for (int i = 0; i < 1024; i++) {
		ans[i] = 0;
		num[i] = 0;
		for (int j = 0; j < 10; j++) {
			int m = 1;
			for (int k = 0; k < j; k++)m *= 2;
			if (i / m % 2 == 1) {
				ans[i] += j;
				num[i]++;
			}
		}
	}
	while (true) {
		scanf("%d %d", &a, &b);
		if (a == 0 && b == 0) {
			int an = 0;
			for (int i = 0; i < 1024; i++) {
				if (ans[i] == b && num[i] == a) {
					an++;
				}
			}
			printf("%d\n", an);
		}
		else {
			break;
		}
	}
}



Compiler output:
main.c: In function 'main':
main.c:19:16: error: 'true' undeclared (first use in this function)
   19 |         while (true) {
      |                ^~~~
main.c:4:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>'
    3 | #include<math.h>
  +++ |+#include <stdbool.h>
    4 | 
main.c:19:16: note: each undeclared identifier is reported only once for each function it appears in
   19 |         while (true) {
      |                ^~~~
Language: C

#include <stdio.h>
void solve(int i,int sum,int n);
int A[]={0,1,2,3,4,5,6,7,8,9};
const int N = sizeof(A[])/sizeof(A[0]);
int Num,Sum,Ans;
int main(void){

	char str[buf];
  
	for( ; ; ){
		Ans=0;
		fgets(str,sizeof(str),stdin);
		sscanf(str,"%d %d",&Num,&Sum);
		if(Num==0 && Sum==0)
			break;
		solve(0,0,0);
		printf("%d\n",Ans);
	}		
	return 0;	
}

void solve(int i,int sum,int n){
	if (sum == Sum && n == Num) 
		Ans++;
	if (i == N || n == Num) 
		return;
	solve(i + 1, sum, n);
	solve(i + 1, sum + A[i], n + 1);
}

Compiler output:
main.c:4:24: error: expected expression before ']' token
    4 | const int N = sizeof(A[])/sizeof(A[0]);
      |                        ^
main.c: In function 'main':
main.c:8:18: error: 'buf' undeclared (first use in this function)
    8 |         char str[buf];
      |                  ^~~
main.c:8:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
void solve(int i,int sum,int n);
int A[100]={0,1,2,3,4,5,6,7,8,9};
const int N = sizeof(A[100])/sizeof(A[0]);
int Num,Sum,Ans;
int main(void){

	char str[buf];
  
	for( ; ; ){
		Ans=0;
		fgets(str,sizeof(str),stdin);
		sscanf(str,"%d %d",&Num,&Sum);
		if(Num==0 && Sum==0)
			break;
		solve(0,0,0);
		printf("%d\n",Ans);
	}		
	return 0;	
}

void solve(int i,int sum,int n){
	if (sum == Sum && n == Num) 
		Ans++;
	if (i == N || n == Num) 
		return;
	solve(i + 1, sum, n);
	solve(i + 1, sum + A[i], n + 1);
}

Compiler output:
main.c: In function 'main':
main.c:8:18: error: 'buf' undeclared (first use in this function)
    8 |         char str[buf];
      |                  ^~~
main.c:8:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include <stdio.h>
void solve(int i,int sum,int n);
int A[]={0,1,2,3,4,5,6,7,8,9};
int N = sizeof(A[])/sizeof(A[0]);
int Num,Sum,Ans;
int main(void){

	char str[buf];
  
	for( ; ; ){
		Ans=0;
		fgets(str,sizeof(str),stdin);
		sscanf(str,"%d %d",&Num,&Sum);
		if(Num==0 && Sum==0)
			break;
		solve(0,0,0);
		printf("%d\n",Ans);
	}		
	return 0;	
}

void solve(int i,int sum,int n){
	if (sum == Sum && n == Num) 
		Ans++;
	if (i == N || n == Num) 
		return;
	solve(i + 1, sum, n);
	solve(i + 1, sum + A[i], n + 1);
}

Compiler output:
main.c:4:18: error: expected expression before ']' token
    4 | int N = sizeof(A[])/sizeof(A[0]);
      |                  ^
main.c: In function 'main':
main.c:8:18: error: 'buf' undeclared (first use in this function)
    8 |         char str[buf];
      |                  ^~~
main.c:8:18: note: each undeclared identifier is reported only once for each function it appears in
Language: C

#include<stdio.h>
int main()
int n,s,count=0;
int digits[10];
void dfs(int cur){
 if(cur==n){
  int sum=0;
  for(int i=0;i<n;i++){
   sum+=digits[i];
  }
  if(sum==s){
    count++;
  }
  return;
  }
  for(int i=0;i<10;i++){
   digits[cur]=i;
   dfs(cur+1);
 }
}


Compiler output:
main.c: In function 'main':
main.c:3:1: error: parameter 'count' is initialized
    3 | int n,s,count=0;
      | ^~~
main.c:5:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    5 | void dfs(int cur){
      |                  ^
main.c:4:5: error: declaration for parameter 'digits' but no such parameter
    4 | int digits[10];
      |     ^~~~~~
main.c:3:9: error: declaration for parameter 'count' but no such parameter
    3 | int n,s,count=0;
      |         ^~~~~
main.c:3:7: error: declaration for parameter 's' but no such parameter
    3 | int n,s,count=0;
      |       ^
main.c:3:5: error: declaration for parameter 'n' but no such parameter
    3 | int n,s,count=0;
      |     ^
main.c:21: error: expected '{' at end of input
Language: C

#include<stdio.h>


	int n,s,count=0;
	int digits[10];

int dfs(int cur){
	if(cur==n){
		int sum=0;
	for(int i==0;i<n;i++){
		sum += digits[i];
	}
	if(sum == s){
		count++;
	}
	return;
	}
	for(int i=start; i<10; i++){
	digits[cur] = i;
	dfs(cur+1 , i+1);
	}
}

int main(void){
	while(scanf("%d %d",&n,&s) != EOF) {
	if(n==0 && s==0)
	break;
	printf("%d\n",&dfs(n,s));
}
	return 0;
}


Compiler output:
main.c: In function 'dfs':
main.c:10:18: error: expected '=', ',', ';', 'asm' or '__attribute__' before '==' token
   10 |         for(int i==0;i<n;i++){
      |                  ^~
main.c:10:22: error: 'i' undeclared (first use in this function)
   10 |         for(int i==0;i<n;i++){
      |                      ^
main.c:10:22: note: each undeclared identifier is reported only once for each function it appears in
main.c:10:25: error: expected ')' before ';' token
   10 |         for(int i==0;i<n;i++){
      |            ~            ^
      |                         )
main.c:16:9: error: 'return' with no value, in function returning non-void [-Wreturn-mismatch]
   16 |         return;
      |         ^~~~~~
main.c:7:5: note: declared here
    7 | int dfs(int cur){
      |     ^~~
main.c:18:19: error: 'start' undeclared (first use in this function)
   18 |         for(int i=start; i<10; i++){
      |                   ^~~~~
main.c:20:9: error: too many arguments to function 'dfs'
   20 |         dfs(cur+1 , i+1);
      |         ^~~
main.c:7:5: note: declared here
    7 | int dfs(int cur){
      |     ^~~
main.c: In function 'main':
main.c:28:24: error: too many arguments to function 'dfs'
   28 |         printf("%d\n",&dfs(n,s));
      |                        ^~~
main.c:7:5: note: declared here
    7 | int dfs(int cur){
      |     ^~~
main.c:28:23: error: lvalue required as unary '&' operand
   28 |         printf("%d\n",&dfs(n,s));
      |                       ^
Language: C

#include <stdio.h>
int n, s, count = 0, digits[10]; // n 個の整数の和がsになる
void dfs(int cur) {              // cur = 0   {}
   if(cur == n) {               // cur = 1   {a}
       int sum = 0;             // cur = 2   {a, b}
       for(int i = 0; i < n; i++) { sum += digits[i]; }
       if(sum == s) { count++; }
       return;
   }
   for(int i = 0; i < 10; i++) {
       digits[cur] = i; // FIXME: 重複を避ける
       dfs(cur+1);  
   }
}
int main(void){
   n = 3; s = 6; count = 0;
   dfs(0);
   printf("%d\n", count);
 scanf("%d",&n);
    scanf("%d",&s);

    func(0,0,0);

    printf("%d",count);
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:22:5: error: implicit declaration of function 'func' [-Wimplicit-function-declaration]
   22 |     func(0,0,0);
      |     ^~~~
Language: C

#include <iostream>using namespace std; int dfs(int n, int s, int x){   int sum=0;   if(n==0 && s==0)   return 1;   if(n>0){       for(int i=x; i<10; i++){           if(s-i>=0) sum+=dfs(n-1, s-i, i+1);       }   }   return sum;} int main(void){   int n, s;   while(cin >> n >> s){       if(n==0 && s==0)   break;       cout << dfs(n, s, 0) << endl;   }   return 0;}


Compiler output:
main.c:1:20: warning: extra tokens at end of #include directive
    1 | #include <iostream>using namespace std; int dfs(int n, int s, int x){   int sum=0;   if(n==0 && s==0)   return 1;   if(n>0){       for(int i=x; i<10; i++){           if(s-i>=0) sum+=dfs(n-1, s-i, i+1);       }   }   return sum;} int main(void){   int n, s;   while(cin >> n >> s){       if(n==0 && s==0)   break;       cout << dfs(n, s, 0) << endl;   }   return 0;}
      |                    ^~~~~
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>using namespace std; int dfs(int n, int s, int x){   int sum=0;   if(n==0 && s==0)   return 1;   if(n>0){       for(int i=x; i<10; i++){           if(s-i>=0) sum+=dfs(n-1, s-i, i+1);       }   }   return sum;} int main(void){   int n, s;   while(cin >> n >> s){       if(n==0 && s==0)   break;       cout << dfs(n, s, 0) << endl;   }   return 0;}
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>
int n,s,count = 0, digits[10];
void dfs(int cur,int start){
    if(cur == n){
        int sum = 0;
        for(int i = 0; i < n; i++){sum += digits[i];}
        if(sum  == s){count++;}
        return;
    }
    for(int i = start; i < 10; i++){
        digits[cur] = i;
        dfs(cur+1,i+1);
    }
int main(void){
    n = 3; s = 6; count = 0;
    dfs(0,0);
    printf("%d\n",count);
    return 0;
}


Compiler output:
main.c: In function 'dfs':
main.c:19:1: error: expected declaration or statement at end of input
   19 | }
      | ^
Language: C

#include <stdio.h>

int combOfSum(int cnt,int sum,int minNum){
	int i;
	int result=0;
	
	if(cnt==0){
/*		printf("C:%d±Å%dÉ·é:%d\n",cnt,sum,(sum==0));
*/		return (sum==0);
	}else if(minNum==9 && cnt==1-){
/*		printf("B:%d±Å%dÉ·é:%d\n",cnt,sum,(sum==minNum));
*/		return (sum==minNum);
	}else if(sum<minNum){
/*		printf("A:%d±Å%dÉ·é:%d\n",cnt,sum,0);
*/		return 0;
	}else {
		
		for(i=minNum;i<=9;i++){
			result+=combOfSum(cnt-1,sum-i,i+1);
		}
		
		return result;
	}
}

int main(){
	int sum,numCnt;
	int result;
	
	while(1){
		scanf("%d %d",&numCnt,&sum);
		if(sum+numCnt==0){
			break;
		}
		
		result=combOfSum(numCnt,sum,0);
		
		printf("%d\n",result);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'combOfSum':
main.c:10:38: error: expected expression before ')' token
   10 |         }else if(minNum==9 && cnt==1-){
      |                                      ^
Language: C

#include <stdio.h>

int count(int odd, int num, int result){
  if(result == 0 && odd == 0) return 1;
  if(x > 9) return 0;
  return (count(odd, num + 1, result) + count(odd - 1, num + 1, result - num));
}

int main(){
  int n, s;

  while(1){
    scanf("%d%d", &n, &s);
    if(!n && !s) return 0;

    printf("%d\n", count(n, 0, s);
  }
}

Compiler output:
main.c: In function 'count':
main.c:5:6: error: 'x' undeclared (first use in this function)
    5 |   if(x > 9) return 0;
      |      ^
main.c:5:6: note: each undeclared identifier is reported only once for each function it appears in
main.c: In function 'main':
main.c:16:34: error: expected ')' before ';' token
   16 |     printf("%d\n", count(n, 0, s);
      |           ~                      ^
      |                                  )
main.c:16:35: error: expected ';' before '}' token
   16 |     printf("%d\n", count(n, 0, s);
      |                                   ^
      |                                   ;
   17 |   }
      |   ~
Language: C++

#include "stdio.h"
#include <vector>
#include <iostream>

using namespace std;

class Puzzle
{
public:
	vector<int> used;


	void input()
	{

	}

	void play()
	{
		int n;
		int s;
		int ans = 0;
		used = vector<int>(10, 0);

		while (1) {
			cin >> n >> s;
			if (n == 0) break;

			ans = try_sum(n, s, 0);
			printf("%d\n",ans);
		}
	}

	int try_sum(int n, int s, int min)
	{
		if (n == 0 && s == 0) return 1;
		if (n == 0 || s <= 0) return 0;
		int ans = 0;

		for (int ni = min; ni < 10; ni++) {
			if (used[ni] == 0 ) {
				used[ni] = 1;
				ans += try_sum(n - 1, s - ni, ni + 1);
				used[ni] = 0;
			}
		}

		return ans;
	}

};


int main()
{
　　　　Puzzle puz;

	puz.play();

    return 0;
}




Compiler output:
a.cc:56:1: error: extended character 　 is not valid in an identifier
   56 | 　　　　Puzzle puz;
      | ^
a.cc:56:1: error: extended character 　 is not valid in an identifier
a.cc:56:1: error: extended character 　 is not valid in an identifier
a.cc:56:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:56:1: error: '\U00003000\U00003000\U00003000\U00003000Puzzle' was not declared in this scope
   56 | 　　　　Puzzle puz;
      | ^~~~~~~~~~~~~~
a.cc:58:9: error: 'puz' was not declared in this scope
   58 |         puz.play();
      |         ^~~
Language: C++

#include <iostream>
using namespace std;

int n, s, cnt;

void dfs(int i, int sum, int n){
	if(sum==s&&!n){
		cnt++;
		return;
	}
	if(i==10||!n) return;
	//使用する3つを探索
	//使用しなければカウントされない
	dfs(i+1,sum,n);
	dfs(i+1,sum+i,n-1);
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'return0' was not declared in this scope
   25 |         return0;
      |         ^~~~~~~
Language: C++

include<iostream>
#include<cstdio>
using namespace std;
int n,s,count,c;

int solve(int i,int sum,int used){
	if(i==10){
		if(s==sum&&used==n){
			
		 count++;c++;
		}
		return count;
	}

	solve(i+1,sum+i,used+1);
	
	solve(i+1,sum,used);
	
	
	return count;
}

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

return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:25:15: error: 'cin' was not declared in this scope
   25 |         while(cin>>n>>s,n&&s){
      |               ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<cstdio>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:28:9: error: 'cout' was not declared in this scope
   28 |         cout<<c<<endl;
      |         ^~~~
a.cc:28:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:28:18: error: 'endl' was not declared in this scope
   28 |         cout<<c<<endl;
      |                  ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<cstdio>
  +++ |+#include <ostream>
    3 | using namespace std;
Language: C++

#include <stdio.h>
int ans=0, n, m;

void dfs(int i, int s, int sum){
    if(sum == m && s == 0){
        ans++;
        return;
    }
    if(i==10 || s == 0) return;
    dfs(i + 1, s, sum);
    dfs(i + 1, s - 1, sum + i);
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:20:28: error: expected ';' before '}' token
   20 |         printf("%d\n", ans)
      |                            ^
      |                            ;
   21 |     }
      |     ~
Language: C++

#include <iostream>

using namespace std;

int rec(int n, int s, int over){
    if (s < 0 || n < 0)
        return 0;
    if (!n && !s)
        return 1;

    int count = 0;
    for (int i = over + 1; i < 10; i++)
        count += rec(n-1, s - i, i);

    return count;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<iostream>
#include<cstdlib>
using namespace std;
int n, s, cnt;
int array[10];
void Sum(int i, int phase){
	array[phase-1] = i;
	if(phase==n){
		for(;i<s;i++){
			int nsum=0;
			for(int j=0;j<phase;j++){
				nsum+=array[j];
			}
			if(nsum==s)cnt++;
		}
	}else{
		for(i++;i<s;i++){
			Sum(i, phase+1);
		}
	}
	return;
}
int main(){
	while(cin>>n>>s,s!=0 && n!=0){
		memset(array, 0, sizeof(array));
		cnt=0;
		Sum(0, 1);
		cout<<cnt<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'void Sum(int, int)':
a.cc:7:9: error: reference to 'array' is ambiguous
    7 |         array[phase-1] = i;
      |         ^~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:5:5: note:                 'int array [10]'
    5 | int array[10];
      |     ^~~~~
a.cc:12:39: error: reference to 'array' is ambiguous
   12 |                                 nsum+=array[j];
      |                                       ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:5:5: note:                 'int array [10]'
    5 | int array[10];
      |     ^~~~~
a.cc: In function 'int main()':
a.cc:25:24: error: reference to 'array' is ambiguous
   25 |                 memset(array, 0, sizeof(array));
      |                        ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:5:5: note:                 'int array [10]'
    5 | int array[10];
      |     ^~~~~
a.cc:25:41: error: reference to 'array' is ambiguous
   25 |                 memset(array, 0, sizeof(array));
      |                                         ^~~~~
/usr/include/c++/14/bits/stl_pair.h:99:12: note: candidates are: 'template<class _Tp, long unsigned int _Nm> struct std::array'
   99 |     struct array;
      |            ^~~~~
a.cc:5:5: note:                 'int array [10]'
    5 | int array[10];
      |     ^~~~~
a.cc:25:17: error: 'memset' was not declared in this scope
   25 |                 memset(array, 0, sizeof(array));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cstdlib>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

int n;
int cnt=0;

void dfs(int depth , int k , int sum ){
	if(depth==n){
		if(k==0){
			cnt++;
			return;
		}
	}
	if(k<0) return;
	for(int i=sum; i<10 ; i++){
		dfs(depth+1 , k-i , i+1);
	}
}

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

Compiler output:
a.cc: In function 'int main()':
a.cc:28:15: error: 'cin' was not declared in this scope
   28 |         while(cin>> n >> s , (n || s)){
      |               ^~~
a.cc:8:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    7 | #include <algorithm>
  +++ |+#include <iostream>
    8 | using namespace std;
a.cc:30:17: error: 'cout' was not declared in this scope
   30 |                 cout << cnt << endl;
      |                 ^~~~
a.cc:30:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#define _USE_MATH_DEFINES
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <stack>
#include <cctype>
#include <cstdlib>
#include <string.h>
#include <utility>
#include <cstdio>
#include <set>
#include <map>
#include <boost/multiprecision/cpp_int.hpp>
#include <assert.h>
using namespace std;
namespace mp = boost::multiprecision;

#define INF (1 << 20)
#define EPS (1e-10)
#define EQ(a,b) (fabs((a)-(b)) < EPS)

#define ll long long
#define LL long long

int flg[10];

int dfs(int n, int s) {
	int ret = 0;
	if (n == 0) return s == 0;
	for (int i = 0; i < 10; ++i) {
		if (flg[i]) continue;
		flg[i]++;
		ret += dfs(n-1, s-i);
		flg[i]--;
	}
	return ret;
}

int main() {
	int n, s;
	while (cin >> n >> s) {
		if (n == 0) break;
		int res = dfs(n, s);
		while (n != 0) res /= n--;
		cout << res << endl;
	}
	return 0;
}

Compiler output:
a.cc:17:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   17 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

class Node
  attr_accessor :state, :depth, :path_cost
  attr_reader :parent

  def initialize(state, parent)
    @state = state
    @parent = parent
    @depth = parent.nil? ? 0 : parent.depth + 1
  end

  def goal?(limit, max)
    nums.size == limit && sum == max
  end

  def bad_end?(limit, max)
    nums.length > limit || sum > max
  end

  def nums
    parent.nil? ? [state] : parent.nums << state
  end

  def sum
    nums.inject(:+)
  end
end


  STDIN.read.split("\n").each do |line|
    limit, max = line.split.map(&:to_i)

    next if limit == 0 && max == 0

    goals = []
    10.times do |i|
      init_node = Node.new(i, nil)
      queue = [init_node]
      black_list = [init_node.nums.sort]

      loop do
        break if queue.empty?

        elem = queue.shift

        goals << elem if elem.goal?(limit, max)

        next if elem.bad_end?(limit, max)

        10.times do |j|
          next if elem.nums.include?(j)
          new_node = Node.new(j, elem)
          new_nums = new_node.nums.sort
          next if black_list.include?(new_nums)
          black_list << new_nums
          queue << new_node
        end
      end
    end

    puts goals.map { |e| e.nums.sort }.uniq.size
  end

Compiler output:
a.cc:6:5: error: stray '@' in program
    6 |     @state = state
      |     ^
a.cc:7:5: error: stray '@' in program
    7 |     @parent = parent
      |     ^
a.cc:8:5: error: stray '@' in program
    8 |     @depth = parent.nil? ? 0 : parent.depth + 1
      |     ^
a.cc:2:17: error: found ':' in nested-name-specifier, expected '::'
    2 |   attr_accessor :state, :depth, :path_cost
      |                 ^
      |                 ::
a.cc:2:3: error: 'attr_accessor' has not been declared
    2 |   attr_accessor :state, :depth, :path_cost
      |   ^~~~~~~~~~~~~
a.cc:2:18: error: aggregate 'Node state' has incomplete type and cannot be defined
    2 |   attr_accessor :state, :depth, :path_cost
      |                  ^~~~~
a.cc:2:25: error: expected unqualified-id before ':' token
    2 |   attr_accessor :state, :depth, :path_cost
      |                         ^
a.cc:60:39: error: expected unqualified-id before '.' token
   60 |     puts goals.map { |e| e.nums.sort }.uniq.size
      |                                       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int N,S;
int dfs(int n,int t,int sum){
    if(n==10)return 0;
    if(t==N){
          if(sum==S)return 1;
          else return 0;
    }
    return dfs(n+1,t,r)+dfs(n+1,t+1,r+p);
}
int main(){
    while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int dfs(int, int, int)':
a.cc:11:22: error: 'r' was not declared in this scope
   11 |     return dfs(n+1,t,r)+dfs(n+1,t+1,r+p);
      |                      ^
a.cc:11:39: error: 'p' was not declared in this scope
   11 |     return dfs(n+1,t,r)+dfs(n+1,t+1,r+p);
      |                                       ^
a.cc: In function 'int main()':
a.cc:14:21: error: 'n' was not declared in this scope
   14 |     while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
      |                     ^
a.cc:14:24: error: 's' was not declared in this scope
   14 |     while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int N,S;
int dfs(int n,int t,int sum){
    if(n==10)return 0;
    if(t==N){
          if(sum==S)return 1;
          else return 0;
    }
    return dfs(n+1,t,r)+dfs(n+1,t+1,r+n);
}
int main(){
    while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int dfs(int, int, int)':
a.cc:11:22: error: 'r' was not declared in this scope
   11 |     return dfs(n+1,t,r)+dfs(n+1,t+1,r+n);
      |                      ^
a.cc: In function 'int main()':
a.cc:14:21: error: 'n' was not declared in this scope
   14 |     while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
      |                     ^
a.cc:14:24: error: 's' was not declared in this scope
   14 |     while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
      |                        ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int N,S;
int dfs(int n,int t,int sum){
    if(n==10)return 0;
    if(t==N){
          if(sum==S)return 1;
          else return 0;
    }
    return dfs(n+1,t,sum)+dfs(n+1,t+1,sum+n);
}
int main(){
    while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:21: error: 'n' was not declared in this scope
   14 |     while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
      |                     ^
a.cc:14:24: error: 's' was not declared in this scope
   14 |     while(cin>>N>>S,n||s)cout<<dfs(0,0,0)<<endl;
      |                        ^