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

#include<stdio.h>

int main(void)
{
int i.j,n,max,min,t,ii,k;
int num[8];
int tem[8];

scanf("%d",&n);
for(k=0;k<n;k++){

max=0;
min=0;
ii=1;

for(i=0;i<8;i++){
scanf("%d",&num[i]);
tem[i]=num[i];
}
for(i=0;i<8;i++){
for(j=i;j<7;j++){
if(tem[j]>tem[j+1]){
t=tem[j];
tem[j]=tem[j+1];
tem[j+1]=t;

if(num[j]<num[j+1]){
t=num[j];
num[j]=num[j+1];
num[j+1]=t;
}
}

for(i=0;i<8;i++){
max+=tem[i]*ii;
min+=num[i]*ii;
ii*=10;
}

printf("%d\n",max-min);
}

return 0;
}

Compiler output:
main.c: In function 'main':
main.c:5:6: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    5 | int i.j,n,max,min,t,ii,k;
      |      ^
main.c:5:6: error: expected expression before '.' token
main.c:5:9: error: 'n' undeclared (first use in this function)
    5 | int i.j,n,max,min,t,ii,k;
      |         ^
main.c:5:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:5:11: error: 'max' undeclared (first use in this function)
    5 | int i.j,n,max,min,t,ii,k;
      |           ^~~
main.c:5:15: error: 'min' undeclared (first use in this function); did you mean 'main'?
    5 | int i.j,n,max,min,t,ii,k;
      |               ^~~
      |               main
main.c:5:19: error: 't' undeclared (first use in this function)
    5 | int i.j,n,max,min,t,ii,k;
      |                   ^
main.c:5:21: error: 'ii' undeclared (first use in this function)
    5 | int i.j,n,max,min,t,ii,k;
      |                     ^~
main.c:5:24: error: 'k' undeclared (first use in this function)
    5 | int i.j,n,max,min,t,ii,k;
      |                        ^
main.c:16:5: error: 'i' undeclared (first use in this function)
   16 | for(i=0;i<8;i++){
      |     ^
main.c:21:5: error: 'j' undeclared (first use in this function)
   21 | for(j=i;j<7;j++){
      |     ^
main.c:44:1: error: expected declaration or statement at end of input
   44 | }
      | ^
main.c:44:1: error: expected declaration or statement at end of input
Language: C

#include<stdio.h>

int main(void)
{
int i,j,n,max,min,t,ii,k;
int num[8];
int tem[8];

scanf("%d",&n);
for(k=0;k<n;k++){

max=0;
min=0;
ii=1;

for(i=0;i<8;i++){
scanf("%d",&num[i]);
tem[i]=num[i];
}
for(i=0;i<8;i++){
for(j=i;j<7;j++){
if(tem[j]>tem[j+1]){
t=tem[j];
tem[j]=tem[j+1];
tem[j+1]=t;

if(num[j]<num[j+1]){
t=num[j];
num[j]=num[j+1];
num[j+1]=t;
}
}

for(i=0;i<8;i++){
max+=tem[i]*ii;
min+=num[i]*ii;
ii*=10;
}

printf("%d\n",max-min);
}

return 0;
}

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

#include <stdio.h>
using namespace std;
#include <iostream> 

int main(void){
  int n, i, j, k;
  int num[50], high[50], low[50];
  char str[50][10], tmp;

  scanf("%d", &n);

  for (i=0;i<n;i++) {
    scanf("%s",str[i]);
  }

  for (k=0;k<n;k++) {
    for (i=0;i<7;i++) {
      for ( j=7;j>i;j--) {
        if (str[k][j-1] > str[k][j]) {
        	tmp = str[k][j-1];
        	str[k][j-1] = str[k][j];
        	str[k][j] = tmp;
        }
      }
    }
    low[k]= atoi(str[k]);
    //printf("%d\n",low[k]);
  }

  for (k=0;k<n;k++) {
    for (i=0;i<7;i++) {
      for ( j=7;j>i;j--) {
        if (str[k][j-1] < str[k][j]) {
        	tmp = str[k][j-1];
        	str[k][j-1] = str[k][j];
        	str[k][j] = tmp;
        }
      }
    }
    high[k]= atoi(str[k]);
    //printf("%d\n",high[k]);
  }

  for(i=0;i<n;i++)
  printf("%d\n", high[i]-low[i]);

  return 0;
}


Compiler output:
main.c:2:1: error: unknown type name 'using'
    2 | using namespace std;
      | ^~~~~
main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
    2 | using namespace std;
      |                 ^~~
main.c:3:10: fatal error: iostream: No such file or directory
    3 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
void swap(int *x,int *y){
int k;
k=*x;
*x=*y;
*y=k;
}
int func(int a){
int i,j,x[8],max,min;
x[0]=a%10;
x[1]=a/10%10;
x[2]=a/100%10;
x[3]=a/1000%10;
x[4]=a/10000%10;
x[5]=a/100000%10;
x[6]=a/1000000%10;
x[7]=a/10000000%10;
for(j=0;j<8;j++)
for(i=0;i<7;i++)
if(x[i]<x[i+1])swap(&x[i],&x[i+1])
min=10000000*x[7]+1000000*x[6]+100000*x[5]+10000*x[4]+1000*x[3]+100*x[2]+10*x[1]+x[0];
max=10000000*x[0]+1000000*x[1]+100000*x[2]+10000*x[3]+1000*x[4]+100*x[5]+10*x[6]+x[7];
return max-min;
}
int main(){
int n,a;
scanf("%d",&n);
while(n-->0){
scanf("%d",&a);
printf("%d\n",func(a));
}
return 0;
}

Compiler output:
main.c: In function 'func':
main.c:20:35: error: expected ';' before 'min'
   20 | if(x[i]<x[i+1])swap(&x[i],&x[i+1])
      |                                   ^
      |                                   ;
   21 | min=10000000*x[7]+1000000*x[6]+100000*x[5]+10000*x[4]+1000*x[3]+100*x[2]+10*x[1]+x[0];
      | ~~~
Language: C

#include <stdio.h>

int ten(int);
int main(void)
{
	char a[8],tmp;
	int s,i,j,n,c,max,min;
	scanf("%d",&n);
	for(c=0;c<n;c++){
		scanf("%s",&a);
		for(i=0;i<8;i++){
			for(j=i;j<8;j++){
				if(a[i]<a[j]){
					tmp=a[i];
					a[i]=a[j];
					a[j]=tmp;
				}
			}
		}
		max=min=0;
		for(i=0;i<8;i++){2
			max+=(a[i]-48)*ten(7-i);
			min+=(a[7-i]-48)*ten(7-i);
		}

		printf("%d\n",max-min);
	}
	return 0;
}
int ten(int n)
{
	int i,v=1;
	for(i=0;i<n;i++)
		v*=10;
	return v;
}

Compiler output:
main.c: In function 'main':
main.c:21:35: error: expected ';' before 'max'
   21 |                 for(i=0;i<8;i++){2
      |                                   ^
      |                                   ;
   22 |                         max+=(a[i]-48)*ten(7-i);
      |                         ~~~
Language: C

#include <algorithm>
#include <cstdio>

#define N 8

using namespace std;

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int n;
  int i;

  for ( scanf ( "%d", &n ); n--; )
  {
    char digs[ N ];
    int max = 0, min = 0;

    scanf ( " %c%c%c%c%c%c%c%c",
              digs, digs + 1, digs + 2, digs + 3,
              digs + 4, digs + 5, digs + 6, digs + 7 );

    for ( i = 0; i < N; ++i )
    {
      digs[ i ] -= '0';
    }
    sort ( digs, digs + N );
    for ( i = 0; i < N; ++i )
    {
      max = max * 10 + digs[ N - i - 1 ];
      min = min * 10 + digs[ i ];
    }
    printf ( "%d\n", max - min );
  }

  return ( 0 );
}

Compiler output:
main.c:1:10: fatal error: algorithm: No such file or directory
    1 | #include <algorithm>
      |          ^~~~~~~~~~~
compilation terminated.
Language: C

/*
AizuOnline A0051
Differential II
*/
#include <stdio.h>
#include <stdlib.h>

compare_char(char *a,char *b)
{return(*a-*b);
}
compare_char_r(char *a,char *b)
{return(*b-*a);
}

main()
{
  char n8[];
  int n;
  
  long int maxval,minval;

  scanf("%d",&n);
  while(n--)
    {
      scanf("%s",n8);
      qsort(n8,8,1,compare_char);
      sscanf(n8,"%ld",&minval);
      qsort(n8,8,1,compare_char_r);
      sscanf(n8,"%ld",&maxval);

      printf("%ld\n",maxval-minval);
    }

return(0);
}

Compiler output:
main.c:8:1: error: return type defaults to 'int' [-Wimplicit-int]
    8 | compare_char(char *a,char *b)
      | ^~~~~~~~~~~~
main.c:11:1: error: return type defaults to 'int' [-Wimplicit-int]
   11 | compare_char_r(char *a,char *b)
      | ^~~~~~~~~~~~~~
main.c:15:1: error: return type defaults to 'int' [-Wimplicit-int]
   15 | main()
      | ^~~~
main.c: In function 'main':
main.c:17:8: error: array size missing in 'n8'
   17 |   char n8[];
      |        ^~
main.c:26:20: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   26 |       qsort(n8,8,1,compare_char);
      |                    ^~~~~~~~~~~~
      |                    |
      |                    int (*)(char *, char *)
In file included from main.c:6:
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(char *, char *)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
main.c:28:20: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
   28 |       qsort(n8,8,1,compare_char_r);
      |                    ^~~~~~~~~~~~~~
      |                    |
      |                    int (*)(char *, char *)
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(char *, char *)'
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
Language: C++

n = input()
for _ in xrange(n):
    x = list(raw_input())
    x.sort()
    mi = int("".join(x))
    ma = int("".join(reversed(x)))
    print ma - mi

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n = input()
      | ^
Language: C++

#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


int stoi(string a){
	int ret = 0;
	int sc = 1;
	rep(i,a.size()){
		ret += (a[a.size()-1-i]-'0')*sc;
		sc*=10;
	}
	return ret;
}

int main(){
	
	int n;
	cin>>n;
	
	rep(lp, n){
		string a;
		cin>>a;
		
		sort(a.begin(),a.end());
		
		string b = a;
		
		reverse(a.begin(),a.end());
		
		string c = a;
		
		printf("%d\n",stoi(c)-stoi(b));
	}
	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:35: error: call of overloaded 'stoi(std::string&)' is ambiguous
   46 |                 printf("%d\n",stoi(c)-stoi(b));
      |                               ~~~~^~~
a.cc:19:5: note: candidate: 'int stoi(std::string)'
   19 | int stoi(string a){
      |     ^~~~
In file included from /usr/include/c++/14/string:54,
                 from a.cc:4:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
a.cc:46:43: error: call of overloaded 'stoi(std::string&)' is ambiguous
   46 |                 printf("%d\n",stoi(c)-stoi(b));
      |                                       ~~~~^~~
a.cc:19:5: note: candidate: 'int stoi(std::string)'
   19 | int stoi(string a){
      |     ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <functional>
using namespace std;

int solve(int in){
	char mozi[9] = {};
	int max, min;
	_itoa(in, mozi, 10);

	sort(mozi, mozi + 8);
	min = atoi(mozi);

	sort(mozi, mozi + 8, greater<int>());
	max = atoi(mozi);
	
	return abs(max - min);
}


int main(){
	int n,in;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> in;
		cout << solve(in) << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:12:9: error: '_itoa' was not declared in this scope
   12 |         _itoa(in, mozi, 10);
      |         ^~~~~
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <functional>
using namespace std;

int solve(int in){
	char mozi[9] = {};
	int max, min;
	itoa(in, mozi, 10);

	sort(mozi, mozi + 8);
	min = atoi(mozi);

	sort(mozi, mozi + 8, greater<int>());
	max = atoi(mozi);
	
	return abs(max - min);
}


int main(){
	int n,in;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> in;
		cout << solve(in) << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:12:9: error: 'itoa' was not declared in this scope
   12 |         itoa(in, mozi, 10);
      |         ^~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main()
{
    int n , max , min , sa;
    string s , t;
    cin >> n;
    while(n--){
        cin >> s:
        t=s;
        sort(s.begin() , s.end());
        reverse(t.begin() , t.end());
        sa=atoi(s.c_str())-atoi(t.c_str);
        cout << sa << endl;
        }
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:17: error: found ':' in nested-name-specifier, expected '::'
   12 |         cin >> s:
      |                 ^
      |                 ::
a.cc:12:16: error: 's' is not a class, namespace, or enumeration
   12 |         cin >> s:
      |                ^
a.cc:16:35: error: invalid use of non-static member function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   16 |         sa=atoi(s.c_str())-atoi(t.c_str);
      |                                 ~~^~~~~
In file included from /usr/include/c++/14/string:54,
                 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/basic_string.h:2640:7: note: declared here
 2640 |       c_str() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc: At global scope:
a.cc:20:9: error: expected unqualified-id before 'return'
   20 |         return 0;
      |         ^~~~~~
a.cc:21:1: error: expected declaration before '}' token
   21 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include<cstdlib>
using namespace std;

int main()
{
    int n , sa;
    string s , t;
    cin >> n;
    while(n--){
        cin >> s:
        t=s;
        sort(s.begin() , s.end());
        reverse(t.begin() , t.end());
        sa=atoi(s.c_str())-atoi(t.c_str);
        cout << sa << endl;
        }
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: found ':' in nested-name-specifier, expected '::'
   13 |         cin >> s:
      |                 ^
      |                 ::
a.cc:13:16: error: 's' is not a class, namespace, or enumeration
   13 |         cin >> s:
      |                ^
a.cc:17:35: error: invalid use of non-static member function 'const _CharT* std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::c_str() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
   17 |         sa=atoi(s.c_str())-atoi(t.c_str);
      |                                 ~~^~~~~
In file included from /usr/include/c++/14/string:54,
                 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/basic_string.h:2640:7: note: declared here
 2640 |       c_str() const _GLIBCXX_NOEXCEPT
      |       ^~~~~
a.cc: At global scope:
a.cc:21:9: error: expected unqualified-id before 'return'
   21 |         return 0;
      |         ^~~~~~
a.cc:22:1: error: expected declaration before '}' token
   22 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include<cstdlib>
using namespace std;

int main()
{
    int n , max , min , sa;
    string s;
    cin >> n;
    while(n--){
        cin >> s:
        sort(s.begin() , s.end());
        min=atoi(s.c_str());
        reverse(s.begin() , s.end());
        max=atoi(s.c_str());
        sa=max-min;
        cout << sa << endl;
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: found ':' in nested-name-specifier, expected '::'
   13 |         cin >> s:
      |                 ^
      |                 ::
a.cc:13:16: error: 's' is not a class, namespace, or enumeration
   13 |         cin >> s:
      |                ^
Language: C++

for(j=1;c=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/)[j++];)a=c.split(''),console.log(a.sort(function(x,y){return y-x}).join('')-a.sort().join(''));

Compiler output:
a.cc:1:66: error: stray '\' in program
    1 | for(j=1;c=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/)[j++];)a=c.split(''),console.log(a.sort(function(x,y){return y-x}).join('')-a.sort().join(''));
      |                                                                  ^
a.cc:1:87: error: empty character constant
    1 | for(j=1;c=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/)[j++];)a=c.split(''),console.log(a.sort(function(x,y){return y-x}).join('')-a.sort().join(''));
      |                                                                                       ^~
a.cc:1:142: error: empty character constant
    1 | for(j=1;c=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/)[j++];)a=c.split(''),console.log(a.sort(function(x,y){return y-x}).join('')-a.sort().join(''));
      |                                                                                                                                              ^~
a.cc:1:160: error: empty character constant
    1 | for(j=1;c=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/)[j++];)a=c.split(''),console.log(a.sort(function(x,y){return y-x}).join('')-a.sort().join(''));
      |                                                                                                                                                                ^~
a.cc:1:1: error: expected unqualified-id before 'for'
    1 | for(j=1;c=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/)[j++];)a=c.split(''),console.log(a.sort(function(x,y){return y-x}).join('')-a.sort().join(''));
      | ^~~
a.cc:1:9: error: 'c' does not name a type
    1 | for(j=1;c=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/)[j++];)a=c.split(''),console.log(a.sort(function(x,y){return y-x}).join('')-a.sort().join(''));
      |         ^
a.cc:1:76: error: expected unqualified-id before ')' token
    1 | for(j=1;c=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/)[j++];)a=c.split(''),console.log(a.sort(function(x,y){return y-x}).join('')-a.sort().join(''));
      |                                                                            ^
a.cc:1:135: error: expected unqualified-id before ')' token
    1 | for(j=1;c=require("fs").readFileSync("/dev/stdin","utf8").split(/\s/)[j++];)a=c.split(''),console.log(a.sort(function(x,y){return y-x}).join('')-a.sort().join(''));
      |                                                                                                                                       ^
Language: C++

#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    string a;
    int n,x;
    cin>>n;
    while(n--){
        cin>>a;
        sort(a.begin(),a.end());
        x=atoi(a.c_str());
        reverse(a.begin(),a.end());
        cout<<atoi(a.c_str())-x<<endl;
    }
        
    
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 |         sort(a.begin(),a.end());
      |         ^~~~
      |         short
a.cc:12:9: error: 'reverse' was not declared in this scope
   12 |         reverse(a.begin(),a.end());
      |         ^~~~~~~
Language: C++

#include <iostream>
#include <sstream>
#include <cstdlib>
using namespace std;
int main(void){
    // Here your code !
    string a;
    int n,x;
    cin>>n;
    while(n--){
        cin>>a;
        sort(a.begin(),a.end());
        x=atoi(a.c_str());
        reverse(a.begin(),a.end());
        cout<<atoi(a.c_str())-x<<endl;
    }
        
    
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   12 |         sort(a.begin(),a.end());
      |         ^~~~
      |         short
a.cc:14:9: error: 'reverse' was not declared in this scope
   14 |         reverse(a.begin(),a.end());
      |         ^~~~~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int n, o = 0, ma, mi;
	string s;
	cin >> n;

	for (; n-- > 0;) {
		cin >> s;

		vector<int> v;
		for (int i = 0; i < s.size(); i++) {
			v.push_back(s[i] - '0');
		}
		sort(v.begin(), v.end());

		o = s.size();
		ma = 0;
		mi = 0;
		for (int i = 0; i < o; i++) {
			ma += v[o - i - 1] * pow(10, i);
			mi += v[i] * pow(10, i);
		}
		cout << mi - ma << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:46: error: 'pow' was not declared in this scope
   25 |                         ma += v[o - i - 1] * pow(10, i);
      |                                              ^~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int n, o = 0, ma, mi;
	string s;
	cin >> n;

	for (; n-- > 0;) {
		cin >> s;

		vector<int> v;
		for (int i = 0; i < s.size(); i++) {
			v.push_back(s[i] - '0');
		}
		sort(v.begin(), v.end());

		o = s.size();
		ma = 0;
		mi = 0;
		for (int i = 0; i < o; i++) {
			ma += v[o - i - 1] * pow(10, i);
			mi += v[i] * pow(10, i);
		}
		cout << (mi - ma) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:46: error: 'pow' was not declared in this scope
   25 |                         ma += v[o - i - 1] * pow(10, i);
      |                                              ^~~
Language: C++

#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main(){
  int n;
  char buff[10];
  scanf("%d",&n);
  for(int cas=0;cas<n;cas++){
    cin >> buff;
    sort(buff,buff+8);
    //cout << buff << endl;
    int maxs,mins;
    maxs = mins = 0;
    for(int i=0;i<8;i++){
      maxs*= 10;
      mins*= 10;
      maxs += buff[7-i];
      mins += buff[i];
    }
    cout << maxs-mins << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   11 |     sort(buff,buff+8);
      |     ^~~~
      |     short
Language: C++

#include<stdio.h>
int main(void) {
   int n, i, l, 
   scanf("%d", &n);
   while ( n ) {
      scanf("%d", a);
      A[8] = a / 10000000; b[8] = a[8];
      A[7] = ( a % 10000000 ) / 1000000;
      if ( b)
      A[6] = ( a % 1000000 ) / 100000;
      A[5] = ( a % 100000 ) / 10000;
      A[4] = ( a % 10000 ) / 1000;
      A[3] = ( a % 1000 ) / 100;
      A[2] = ( a % 100 ) / 10;
      A[1] = a % 10;

   return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:18: error: expression list treated as compound expression in initializer [-fpermissive]
    4 |    scanf("%d", &n);
      |                  ^
a.cc:4:18: error: invalid conversion from 'int*' to 'int' [-fpermissive]
    4 |    scanf("%d", &n);
      |                  ^
      |                  |
      |                  int*
a.cc:6:19: error: 'a' was not declared in this scope
    6 |       scanf("%d", a);
      |                   ^
a.cc:6:20: error: 'scanf' cannot be used as a function
    6 |       scanf("%d", a);
      |                    ^
a.cc:7:7: error: 'A' was not declared in this scope
    7 |       A[8] = a / 10000000; b[8] = a[8];
      |       ^
a.cc:7:28: error: 'b' was not declared in this scope
    7 |       A[8] = a / 10000000; b[8] = a[8];
      |                            ^
a.cc:18:2: error: expected '}' at end of input
   18 | }
      |  ^
a.cc:2:16: note: to match this '{'
    2 | int main(void) {
      |                ^
Language: C++

(gets.to_i).times do
  n = gets.chomp.split("")
  min = n.sort.join
  max = n.sort.reverse.join

  puts max.to_i - min.to_i
end



Compiler output:
a.cc:1:6: error: expected ')' before '.' token
    1 | (gets.to_i).times do
      | ~    ^
      |      )
Language: C++

#include<iostream>
#include<array>
int main()
{
	int n;
	std::cin >> n;
	std::array<int, 8>num_array;
	for (int i = 0; i < n; i++)
	{
		int num;
		std::cin >> num;
		for (int i = 0; i < 8; i++)
		{
			num_array[i] = num_array[i] = num % 10;
			num /= 10;
		}
	}
	std::sort(num_array.begin(), num_array.end());
	const int maximum =
		num_array[0] +
		num_array[1] * 10 +
		num_array[2] * 100 +
		num_array[3] * 1000 +
		num_array[4] * 10000 +
		num_array[5] * 100000 +
		num_array[6] * 1000000 +
		num_array[7] * 10000000,
		minimum =
		num_array[0] * 10000000 +
		num_array[1] * 1000000 +
		num_array[2] * 100000 +
		num_array[3] * 10000 +
		num_array[4] * 1000 +
		num_array[5] * 100 +
		num_array[6] * 10 +
		num_array[7];
	std::cout << maximum - minimum << std::endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   18 |         std::sort(num_array.begin(), num_array.end());
      |              ^~~~
      |              qsort
Language: C++

#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
  int N;
  scanf("%d ", &N);
  for (int i = 0 ;i < N; i++) {
    char num[8];
    for (int j = 0; j < 8; j++) {
      scanf("%c", &num[j]);
      num[j] = num[j] - '0';
    }
    vector<int> v(8);
    for (int j = 0; j < 8; j++) {
      v[i] = i;
    }
    int mx = -1, mn = 10000000;
    do {
      int n = 0;
      for (int j = 0; j < 8; j++) {
	n = n * 10 + num[v[j]];
      }
      mx = max(n, mx);
      mn = min(n, mn);
    } while (next_permutation(v.begin(), v.end())); 
    printf("%d\n", mx - mn);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'vector' was not declared in this scope
   16 |     vector<int> v(8);
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <cstdio>
  +++ |+#include <vector>
    3 | 
a.cc:16:12: error: expected primary-expression before 'int'
   16 |     vector<int> v(8);
      |            ^~~
a.cc:18:7: error: 'v' was not declared in this scope
   18 |       v[i] = i;
      |       ^
a.cc:24:26: error: 'v' was not declared in this scope
   24 |         n = n * 10 + num[v[j]];
      |                          ^
a.cc:28:31: error: 'v' was not declared in this scope
   28 |     } while (next_permutation(v.begin(), v.end()));
      |                               ^
a.cc:28:14: error: 'next_permutation' was not declared in this scope
   28 |     } while (next_permutation(v.begin(), v.end()));
      |              ^~~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
  int N;
  scanf("%d ", &N);
  for (int i = 0 ;i < N; i++) {
    char num[8];
    for (int j = 0; j < 8; j++) {
      scanf("%c ", &num[j]);
      num[j] = num[j] - '0';
    }
    for (int j = 0; j < 8; j++) {
      /*      printf("%d", num[j]);
      }
      printf("\n");*/
    vector<int> v(8);
    for (int j = 0; j < 8; j++) {
      v[j] = j;
    }
    int mx = -1, mn = 100000000;
    do {
      int n = 0;
      for (int j = 0; j < 8; j++) {
	n = n * 10 + num[v[j]];
      }
      //printf("%d\n", n);
      mx = max(n, mx);
      mn = min(n, mn);
    } while (next_permutation(v.begin(), v.end())); 
    printf("%d\n", mx - mn);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:2: error: expected '}' at end of input
   38 | }
      |  ^
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
Language: C++

#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <memory.h>
#include <cassert>

using namespace std;


#define all(c) ((c).begin()), ((c).end())
#define debug(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)

#define mp make_pair
#define fst first
#define snd second
#define pb push_back


const double EPS = 1e-10;


typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef complex<double> P;


int main() {
	int n; cin >> n;
	while (n--) {
		string s; cin >> s;
		sort(all(s));
		int ma = 0, mi = 1000000000;
		do {
			int a = atoi(s.c_str());
			ma >?= a;
			mi <?= a;
		} while(next_permutation(all(s)));
		cout << ma - mi << endl;
	}
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:29: error: expected primary-expression before '?' token
   54 |                         ma >?= a;
      |                             ^
a.cc:54:30: error: expected primary-expression before '=' token
   54 |                         ma >?= a;
      |                              ^
a.cc:54:33: error: expected ':' before ';' token
   54 |                         ma >?= a;
      |                                 ^
      |                                 :
a.cc:54:33: error: expected primary-expression before ';' token
a.cc:55:29: error: expected primary-expression before '?' token
   55 |                         mi <?= a;
      |                             ^
a.cc:55:30: error: expected primary-expression before '=' token
   55 |                         mi <?= a;
      |                              ^
a.cc:55:33: error: expected ':' before ';' token
   55 |                         mi <?= a;
      |                                 ^
      |                                 :
a.cc:55:33: error: expected primary-expression before ';' token
Language: C++

#include <iostream>
#include <algorithm>
#include <functional>
#include <cstdio>
using namespace std;
int main()
{
	int n, i;
	char c[9], mx[9] = "", mn[9] = "";
	while (cin >> n)
	{
		if (cin.eof()) return 0;
		for (i = 0; i < n; i++)
		{
			scanf("%s", &c);
			strcpy(mx, c);
			sort(mx, mx+8, greater<int>());
			strcpy(mn, c);
			sort(mn, mn+8);
			printf("%d", atoi(mx) - atoi(mn));
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: 'strcpy' was not declared in this scope
   16 |                         strcpy(mx, c);
      |                         ^~~~~~
a.cc:5:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <cstdio>
  +++ |+#include <cstring>
    5 | using namespace std;
Language: C++

#include <algorithm>
using namespace std;

int tonum(char *s) {
	int ret = 0;
	for (int i = 0; i < 8; i++)
		ret = ret*10 + s[i] - '0';
	return ret;
}

int main() {
	int n; cin >> n;
	char s[9];
	for (int i = 0; i < n; i++) {
		cin >> s;
		sort(s, s+8);
		int a = tonum(s);
		sort(s, s+8, greater<char>());
		int b = tonum(s);
		cout << (b-a) << endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:16: error: 'cin' was not declared in this scope
   12 |         int n; cin >> n;
      |                ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <algorithm>
  +++ |+#include <iostream>
    2 | using namespace std;
a.cc:18:30: error: 'greater' was not declared in this scope
   18 |                 sort(s, s+8, greater<char>());
      |                              ^~~~~~~
a.cc:18:38: error: expected primary-expression before 'char'
   18 |                 sort(s, s+8, greater<char>());
      |                                      ^~~~
a.cc:20:17: error: 'cout' was not declared in this scope
   20 |                 cout << (b-a) << endl;
      |                 ^~~~
a.cc:20:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:20:34: error: 'endl' was not declared in this scope
   20 |                 cout << (b-a) << endl;
      |                                  ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    1 | #include <algorithm>
  +++ |+#include <ostream>
    2 | using namespace std;
Language: C++

#include <algorithm>
#include <deque>
#include <functional>
#include <iostream>

using namespace std;

int main() {

	int n, max, min;
	char s[8];
	deque<int> x;

	cin >> n;
	while(1) {
		if(!n)
			break;

		x.clear();
		max=min=0;
		cin >> s;
		for(int i=0; i<8; i++) {
			x.push_back((s[i]-48));
		}

		sort(x.begin(), x.end(), greater<int>());
		for(int i=0; i<8; i++) {
			max+=x[i]*pow(10, (double)(7-i));
		}
		sort(x.begin(), x.end());
		for(int i=0; i<8; i++) {
			min+=x[i]*pow(10, (double)(7-i));
		}

		cout << max-min << endl;
		n--;
	}

	return 0;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:35: error: 'pow' was not declared in this scope
   28 |                         max+=x[i]*pow(10, (double)(7-i));
      |                                   ^~~
a.cc:32:35: error: 'pow' was not declared in this scope
   32 |                         min+=x[i]*pow(10, (double)(7-i));
      |                                   ^~~
Language: C++

#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(){
	
	int n,diff;
	char cdiff[8];
	string keta,max_kazu,min_kazu;
	
	cin>>n;
	
	for(int i=0;i<n;i++){
		
		cin>>keta;
		
		min_kazu=keta;
		max_kazu=keta;
		
		//昇順ソート
		stable_sort(min_kazu.begin(),min_kazu.end());
		//降順ソート
		stable_sort(max_kazu.begin(),max_kazu.end(),greater<char>());
		
		for(int j=7;j>=0;j--){
			if((max_kazu[j]-min_kazu[j])<0){
				diff=(10+(max_kazu[j]-'0'))-(min_kazu[j]-'0');
				max_kazu[j-1]--;
			}
			else{
				diff=(max_kazu[j]-'0')-(min_kazu[j]-'0');
			}
			cdiff[j]=diff+'0';
		}
		
		cout<<cdiff<<endl;
		
		//string 型の初期化
		keta=""; 
		max_kazu="";
		min_kazu="";
		memset(cdiff,'\0',sizeof(cdiff));
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:17: error: 'memset' was not declared in this scope
   44 |                 memset(cdiff,'\0',sizeof(cdiff));
      |                 ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<algorithm>
  +++ |+#include <cstring>
    3 | #include<string>
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include <functional>
using namespace std;

int main(void){
	char buf[255];
	int num;
	int n;

	cin >> n;
	gets(buf);
	for(int i=0; i<n; i++){
		char str1[8],str2[8];
		gets(str1);

		strcpy(str2,str1);
		cout << str1 << " " << str2 << endl;
		sort(&str1[0],&str1[8]);
		sort(&str2[0],&str2[8],greater<char>());
		
		num = atoi(str1) - atoi(str2);
		if(num<0) num*=(-1);

		cout << num << endl;
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   14 |         gets(buf);
      |         ^~~~
      |         getw
a.cc:19:17: error: 'strcpy' was not declared in this scope
   19 |                 strcpy(str2,str1);
      |                 ^~~~~~
a.cc:6:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <functional>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
#include <functional>

using namespace std;

int main() {
	string row;
	int minNum=INT32_MAX, maxNum=0, buf, n;
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>row;
		sort(row.begin(), row.end());
		istringstream istr1(row);
		istr1>>buf;
		maxNum = max(maxNum, buf);
		sort(row.begin(), row.end(), greater<char>());
		istringstream istr2(row);
		istr2>>buf;
		minNum = min(minNum, buf);
		cout<<(maxNum-minNum)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:20: error: 'INT32_MAX' was not declared in this scope
   12 |         int minNum=INT32_MAX, maxNum=0, buf, n;
      |                    ^~~~~~~~~
a.cc:7:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    6 | #include <functional>
  +++ |+#include <cstdint>
    7 | 
a.cc:13:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   13 |         cin>>n;
      |              ^
      |              yn
a.cc:18:24: error: 'buf' was not declared in this scope
   18 |                 istr1>>buf;
      |                        ^~~
a.cc:19:17: error: 'maxNum' was not declared in this scope; did you mean 'minNum'?
   19 |                 maxNum = max(maxNum, buf);
      |                 ^~~~~~
      |                 minNum
Language: C++

#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
#include <functional>
#include <limits>

using namespace std;

int main() {
	string row;
	int minNum=INT32_MAX, maxNum=0, buf, n;
	cin>>n;
	for(int i=0; i<n; i++){
		cin>>row;
		sort(row.begin(), row.end());
		istringstream istr1(row);
		istr1>>buf;
		maxNum = max(maxNum, buf);
		sort(row.begin(), row.end(), greater<char>());
		istringstream istr2(row);
		istr2>>buf;
		minNum = min(minNum, buf);
		cout<<(maxNum-minNum)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:20: error: 'INT32_MAX' was not declared in this scope
   13 |         int minNum=INT32_MAX, maxNum=0, buf, n;
      |                    ^~~~~~~~~
a.cc:7:1: note: 'INT32_MAX' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
    6 | #include <functional>
  +++ |+#include <cstdint>
    7 | #include <limits>
a.cc:14:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   14 |         cin>>n;
      |              ^
      |              yn
a.cc:19:24: error: 'buf' was not declared in this scope
   19 |                 istr1>>buf;
      |                        ^~~
a.cc:20:17: error: 'maxNum' was not declared in this scope; did you mean 'minNum'?
   20 |                 maxNum = max(maxNum, buf);
      |                 ^~~~~~
      |                 minNum
Language: C++

#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
#include <functional>
#include <limits>

#define INT32_MAX (2147483647)

using namespace std;

int main() {
	string row;
	cin>>n;
	for(int i=0; i<n; i++){
		int minNum=INT32_MAX, maxNum=0, buf, n;
		cin>>row;
		sort(row.begin(), row.end(), greater<char>());
		istringstream istr1(row);
		istr1>>buf;
		maxNum = max(maxNum, buf);
		sort(row.begin(), row.end());
		istringstream istr2(row);
		istr2>>buf;
		minNum = min(minNum, buf);
		cout<<(maxNum-minNum)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   15 |         cin>>n;
      |              ^
      |              yn
Language: C++

#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
#include <functional>
#include <limits>

#define INT32_MAX (2147483647)

using namespace std;

int main() {
	string row;
	cin>>n;
	for(int i=0; i<n; i++){
		int minNum=INT32_MAX, maxNum=0, buf;
		cin>>row;
		sort(row.begin(), row.end(), greater<char>());
		istringstream istr1(row);
		istr1>>buf;
		maxNum = max(maxNum, buf);
		sort(row.begin(), row.end());
		istringstream istr2(row);
		istr2>>buf;
		minNum = min(minNum, buf);
		cout<<(maxNum-minNum)<<endl;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:14: error: 'n' was not declared in this scope; did you mean 'yn'?
   15 |         cin>>n;
      |              ^
      |              yn
Language: C++

#include<iostream>
#include<string>

using namespace std;

long long int solve(string s)
{
	for(int i=0;i<s.length();i++)
	{
		int min=i;
		for(int j=i;j<s.length();j++)
		{
			if(s[min]-'0'>s[j]-'0')
			{
				min=j;
			}
		}
		char tmp=s[i];
		s[i]=s[min];
		s[min]=tmp;
	}
	long long int min,max;
	min=max=0;
	for(int i=0;i<s.length();i++)
	{
		max+=(long long int)pow(10.0,i)*(s[i]-'0');
		min+=(long long int)pow(10.0,i)*(s[s.length()-i-1]-'0');
	}
	return max-min;
}

int main(void)
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		cout<<solve(s)<<endl;;
	}
}

Compiler output:
a.cc: In function 'long long int solve(std::string)':
a.cc:26:37: error: 'pow' was not declared in this scope
   26 |                 max+=(long long int)pow(10.0,i)*(s[i]-'0');
      |                                     ^~~
Language: C++

#include<iostream>
#include<string>

using namespace std;

long long int solve(string s)
{
	for(int i=0;i<s.length();i++)
	{
		int min=i;
		for(int j=i;j<s.length();j++)
		{
			if(s[min]-'0'>s[j]-'0')
			{
				min=j;
			}
		}
		char tmp=s[i];
		s[i]=s[min];
		s[min]=tmp;
	}
	long long int min,max;
	min=max=0;
	for(int i=0;i<s.length();i++)
	{
		max+=(long long int)pow(10.0,i)*(s[i]-'0');
		min+=(long long int)pow(10.0,i)*(s[s.length()-i-1]-'0');
	}
	return max-min;
}

int main(void)
{
	int n;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		string s;
		cin>>s;
		cout<<solve(s)<<endl;;
	}
	return 0;
}

Compiler output:
a.cc: In function 'long long int solve(std::string)':
a.cc:26:37: error: 'pow' was not declared in this scope
   26 |                 max+=(long long int)pow(10.0,i)*(s[i]-'0');
      |                                     ^~~
Language: C++

#include <iostream>
#include <functional>
#include <algorithm>
#include <cmath>
#include <stdlib.h>
using namespace std;
int n,num1[8],m,M;

int henkan()
{
  int num = 0;
  for(int i = 0;i < 8 ;i++){
    num+=num1[i]*pow(10,7-i);
  }
  return num;
}


int main(){

  char num;
  cin >> n;
  for(int i = 0; i < n ; i++ ){

Compiler output:
a.cc: In function 'int main()':
a.cc:23:32: error: expected '}' at end of input
   23 |   for(int i = 0; i < n ; i++ ){
      |                               ~^
a.cc:23:32: error: expected '}' at end of input
a.cc:19:11: note: to match this '{'
   19 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;

int StrtoInt(char *s){
	int num = 0;
	while(*s!='\0'){
		if( *s >= '0' && *s <= '9' ){
			num = num*10 + *s - '0';
			++s;
		}
	}
	return num;
}
void UpBabbleSort(char *r, const char *s){
	strcpy(r,s);

	for(int j=0;j<8;++j){
		for(int i=0;i<8-j;++i){
			if( r[i] <= r[i+1] ){
				char t = r[i];
				r[i] = r[i+1];
				r[i+1] = t;
			}
		}
	}
}

void DownBabbleSort(char *r, const char *s){
	UpBabbleSort(r,s);
	char temp[8+1];

	for(int i=0;i<8;++i)
		temp[i] = r[7-i];

	temp[8] = '\0';
	r = temp;
}



int main(){
	int n;
	char s[8+1];
	int max, min;
	char smax[9];
	char smin[9];

	cin >> n;
	for(int i=0;i<n;++i){
		cin >> s;


		UpBabbleSort(smax,s);
		max = StrtoInt(smax);

		DownBabbleSort(smin,s);
		min = StrtoInt(smin);

		cout << max-min << endl;

	}



}

Compiler output:
a.cc: In function 'void UpBabbleSort(char*, const char*)':
a.cc:15:9: error: 'strcpy' was not declared in this scope
   15 |         strcpy(r,s);
      |         ^~~~~~
a.cc:2:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include<iostream>
#include<string>
using namespace std;

int StrtoInt(char *s){
	int num = 0;
	while(*s!='\0'){
		if( *s >= '0' && *s <= '9' ){
			num = num*10 + *s - '0';
			++s;
		}
	}
	return num;
}
void UpBabbleSort(char *r, const char *s){
	strcpy(r,s);

	for(int j=0;j<8;++j){
		for(int i=0;i<8-j;++i){
			if( r[i] <= r[i+1] ){
				char t = r[i];
				r[i] = r[i+1];
				r[i+1] = t;
			}
		}
	}
}

void DownBabbleSort(char *r, const char *s){
	UpBabbleSort(r,s);
	char temp[8+1];

	for(int i=0;i<8;++i)
		temp[i] = r[7-i];

	temp[8] = '\0';
	r = temp;
}



int main(){
	int n;
	char s[8+1];
	int max, min;
	char smax[9];
	char smin[9];

	cin >> n;
	for(int i=0;i<n;++i){
		cin >> s;


		UpBabbleSort(smax,s);
		max = StrtoInt(smax);

		DownBabbleSort(smin,s);
		min = StrtoInt(smin);

		cout << max-min << endl;

	}



}

Compiler output:
a.cc: In function 'void UpBabbleSort(char*, const char*)':
a.cc:16:9: error: 'strcpy' was not declared in this scope
   16 |         strcpy(r,s);
      |         ^~~~~~
a.cc:2:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<string>
Language: Java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Factorial II
 */
public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = "";

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			int n = Integer.parseInt(line);
			if (n == 0) {
				break;
			}

			int two = 0;
			int five = 0;

			for (int i = 0; i < n / 2 + 1; i++) {
				for (int j = 0; j < n / 5 + 1; j++) {
					int k = 2 * i + 5 * j, l;
					if ((i | j) > 0) {
						l = k;
						while (l % 2 == 0) {
							two++;
							l /= 2;
						}
						if (j > 0) {
							l = k;
							while (l % 5 == 0) {
								five++;
								l /= 5;
							}
						}
					}
				}
				System.out.println(two < five ? two : five);
			}
		}
	}

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

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n==0)break;
			int c = 0;
			while(n>=5){
				c += n/5;
                                n= n/5
			}
			System.out.println(c);
		}
	}
}

Compiler output:
Main.java:13: error: ';' expected
                                n= n/5
                                      ^
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")){
int n=Integer.parseInt(line);
count=0;
for(int i=1;i<=6;i++){
int d=Math.pow(5,i);
if(n<d){
break;
}
count+=(int)(n/d);
}
System.out.println(count);
}
}
}

Compiler output:
Main.java:1: error: ';' expected
import java.io*;
              ^
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")){
int n=Integer.parseInt(line);
count=0;
for(int i=1;i<=6;i++){
int d=Math.pow(5,i);
if(n<d){
break;
}
count+=(int)(n/d);
}
System.out.println(count);
}
}
}

Compiler output:
Main.java:12: error: incompatible types: possible lossy conversion from double to int
int d=Math.pow(5,i);
              ^
1 error
Language: Java

import java.util.*;
import java.math.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String args[]) {
		while(true) {
			int N = sc.nextLong();
			if(N == 0) break;

			BigInteger bi = new BigInteger("1");
			for(int i = 2; i <= N; i++) {
				bi = bi.multiply(new BigInteger(Integer.toString(i)));
			}

			int ans = 0;
			String to_s = bi.toString();
			for(int i = to_s.length() - 1; i >= 0; i--) {
				if(to_s.charAt(i) == '0') ans++;
				else break;
			}
			System.out.println(ans);
		}
	}
}

Compiler output:
Main.java:8: error: incompatible types: possible lossy conversion from long to int
			int N = sc.nextLong();
			                   ^
1 error
Language: Java

#include <iostream>
using namespace std;

int main(){
  int n;
  int ans = 0;
  while(1){
    ans = 0;
    cin >> n;
    if(n == 0)break;
    while(n){
      n = n/5;
      ans += n;
    }
    cout << ans << endl;

  }
}

Compiler output:
Main.java:1: error: illegal character: '#'
#include <iostream>
^
Main.java:1: error: class, interface, enum, or record expected
#include <iostream>
         ^
Main.java:9: error: not a statement
    cin >> n;
        ^
Main.java:15: error: not a statement
    cout << ans << endl;
                ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
int main(){
^
  (use --enable-preview to enable unnamed classes)
5 errors