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

import java.util.Scanner;

class Main{

    public static void main(String[] args){
	Scanner scan = new Scanner(System.in);

	while(true){

	    String data = scan.next();

	    if(data.equals("apple")){
		System.out.print("peach ");
	    }else if(data.equals("peach")){
		System.out.print("apple ");
	    }else{
		int length = data.length();

		if(data.charAt(length-1)=='.'){
		    if(data.substring(0, length-1).equals("apple")){
			System.out.print("peach");
		    }else if(data.substring(0, length-2).equals("paech")){
			System.out.print("apple");
		    }
		    System.out.println(".");
		    break;
		}

		System.out.print(data + " ");
	    }
	}
    }
}

Compiler output:
main.c:1:1: error: unknown type name 'import'
    1 | import java.util.Scanner;
      | ^~~~~~
main.c:1:12: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
    1 | import java.util.Scanner;
      |            ^
main.c:3:1: error: unknown type name 'class'
    3 | class Main{
      | ^~~~~
main.c:3:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    3 | class Main{
      |           ^
Language: C

#include <stdio.h>

int problem0050(){
	int start_apple[200],start_peach[200],flag1=0,flag2=0,judge1=0,judge2=0,i,j,k;
	char alternative[]="pop'n";
	char apple[]="apple";
	char peach[]="peach";
	char buf[1001];
	fgets(buf,1000,stdin);
	for(i=0;i<996;i++){
		for(j=0;j<5;j++){
			if(buf[i+j]==apple[j]){judge1++;}
			if(buf[i+j]==peach[j]){judge2++;}
		}
		if(judge1==5){start_apple[flag1]=i; flag1++; judge1=0; judge2=0;}
			else if(judge2==5){start_peach[flag2]=i; flag2++; judge1=0; judge2=0;}
			else{judge1=0; judge2=0;}
	}
		for(j=0;j<5;j++){
			for(k=0;k<flag1;k++){
				if(start_apple[0]==0&&flag1==0)break;
				buf[start_apple[k]+j]=peach[j];
			}
			for(k=0;k<flag2;k++){
				if(start_peach[0]==0&&flag2==0)break;
				buf[start_peach[k]+j]=apple[j];
			}
		}
		buf[1000]='\n';
	printf("%s",buf);
	return 0;
}

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 <stdio.h>
#include <string.h>

int main(){
  char str[2000];
  int i, j;
  fgets(str, 2000, stdin);
  for(i = 0;i < strlen(str);i++){
    if(strncmp(&str[i], "apple", 5) == 0)strncpy(&str[i], "peach", 5);
    else if(strncmp(&str[i], "peach", 5) == 0) strncpy(&str[i],"apple", 5);
    printf("%s ", str);
  }
  puts("%s", str);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:13:3: error: too many arguments to function 'puts'
   13 |   puts("%s", str);
      |   ^~~~
In file included from main.c:1:
/usr/include/stdio.h:714:12: note: declared here
  714 | extern int puts (const char *__s);
      |            ^~~~
Language: C

int main(void)
{
	char str[1000];
	const char *apple = "apple";
	const char *peach = "peach";
	int i;

	fgets(str, 1000, stdin);
	for (i = 0; str[i] != 0; i++){
		if (strncmp(&str[i], apple, 5) == 0){
			strncpy(str + i, peach, 5);
		}
		else if (strncmp(&str[i], peach, 5) == 0){
			strncpy(str + i, apple, 5);
		}
	}
	puts(str);

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:8:9: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration]
    8 |         fgets(str, 1000, stdin);
      |         ^~~~~
main.c:8:26: error: 'stdin' undeclared (first use in this function)
    8 |         fgets(str, 1000, stdin);
      |                          ^~~~~
main.c:1:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
  +++ |+#include <stdio.h>
    1 | int main(void)
main.c:8:26: note: each undeclared identifier is reported only once for each function it appears in
    8 |         fgets(str, 1000, stdin);
      |                          ^~~~~
main.c:10:21: error: implicit declaration of function 'strncmp' [-Wimplicit-function-declaration]
   10 |                 if (strncmp(&str[i], apple, 5) == 0){
      |                     ^~~~~~~
main.c:1:1: note: include '<string.h>' or provide a declaration of 'strncmp'
  +++ |+#include <string.h>
    1 | int main(void)
main.c:10:45: warning: 'strncmp' argument 3 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   10 |                 if (strncmp(&str[i], apple, 5) == 0){
      |                                             ^
<built-in>: note: built-in 'strncmp' declared here
main.c:11:25: error: implicit declaration of function 'strncpy' [-Wimplicit-function-declaration]
   11 |                         strncpy(str + i, peach, 5);
      |                         ^~~~~~~
main.c:11:25: note: include '<string.h>' or provide a declaration of 'strncpy'
main.c:11:25: warning: incompatible implicit declaration of built-in function 'strncpy' [-Wbuiltin-declaration-mismatch]
main.c:11:25: note: include '<string.h>' or provide a declaration of 'strncpy'
main.c:13:50: warning: 'strncmp' argument 3 type is 'int' where 'long unsigned int' is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   13 |                 else if (strncmp(&str[i], peach, 5) == 0){
      |                                                  ^
<built-in>: note: built-in 'strncmp' declared here
main.c:14:25: warning: incompatible implicit declaration of built-in function 'strncpy' [-Wbuiltin-declaration-mismatch]
   14 |                         strncpy(str + i, apple, 5);
      |                         ^~~~~~~
main.c:14:25: note: include '<string.h>' or provide a declaration of 'strncpy'
main.c:17:9: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration]
   17 |         puts(str);
      |         ^~~~
main.c:17:9: note: include '<stdio.h>' or provide a declaration of 'puts'
Language: C

#include<stdio.h>
int main(void){
   int i,j,n,m;
   char a[1000];
   gets(a);
   for(i=0;i<1000;i++){
      int f=0;
      if(a[i]=='p'
      if(a[i+1]=='e')if(a[i+2]=='a')if(a[i+3]=='c')a[i+4]=='h')f=1;

      if(f==1){
         a[i]='a';
         a[i+1]='p';
         a[i+2]='p';
         a[i+3]='l';
         a[i+4]='e';
         i+=4;
         continue;
      }
       if(a[i]=='a')if(a[i+1]=='p')if(a[i+2]=='p')if(a[i+3]=='l')if(a[i+4]=='e')f=1;
      if(f==1){
         a[i]='p';
         a[i+1]='e';
         a[i+2]='a';
         a[i+3]='c';
         a[i+4]='h';
         i+=4;
      }
   }
   printf("%s",a);

   return 0;

}

Compiler output:
main.c: In function 'main':
main.c:5:4: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
    5 |    gets(a);
      |    ^~~~
      |    fgets
main.c:8:19: error: expected ')' before 'if'
    8 |       if(a[i]=='p'
      |         ~         ^
      |                   )
    9 |       if(a[i+1]=='e')if(a[i+2]=='a')if(a[i+3]=='c')a[i+4]=='h')f=1;
      |       ~~
Language: C++

#include "pch.h"
#include <iostream>
#include <string>

using namespace std;

int main()
{
	string x;
	string a = "apple";
	string b = "peach";
	string c = "apple.";
	string d = "peach.";

	cin >> x;
	if (x == a) { string x = "peach"; }
	if (x == b) { string x = "apple"; }
	if (x == c) { string x = "peach."; }
	if (x == d) { string x = "apple."; }
	cout << x;

	while (cin >> x) {
		if (x == a) { string x = "peach"; }
		if (x == b) { string x = "apple"; }
		if (x == c) { string x = "peach."; }
		if (x == d) { string x = "apple."; }
		cout << " " << x;
	}
   cout << endl; 
}



Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

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

int main(){
	char input[1001];
	cin.getline(input, 1000);
	for (int i = 0; input[i] != '\n'; i++){
		if (!strncmp(&input[i], "apple", 5)){
			strncpy(&input[i], "peach", 5);
		}
		else if (!strncmp(&input[i], "peach", 5)){
			strncpy(&input[i], "apple", 5);
		}
	}
	printf("%s\n", input);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: 'strncmp' was not declared in this scope
   11 |                 if (!strncmp(&input[i], "apple", 5)){
      |                      ^~~~~~~
a.cc:5:1: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
a.cc:12:25: error: 'strncpy' was not declared in this scope
   12 |                         strncpy(&input[i], "peach", 5);
      |                         ^~~~~~~
a.cc:12:25: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:15:25: error: 'strncpy' was not declared in this scope
   15 |                         strncpy(&input[i], "apple", 5);
      |                         ^~~~~~~
a.cc:15:25: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

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

int main(){
	char input[2000];
	cin.getline(input, 1000);
	for (int i = 0; input[i] != '\0'; i++){
		if (!strncmp(&input[i], "apple", 5)){
			strncpy(&input[i], "peach", 5);
		}
		else if (!strncmp(&input[i], "peach", 5)){
			strncpy(&input[i], "apple", 5);
		}
	}
	printf("%s\n", input);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:22: error: 'strncmp' was not declared in this scope
   11 |                 if (!strncmp(&input[i], "apple", 5)){
      |                      ^~~~~~~
a.cc:5:1: note: 'strncmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include<algorithm>
  +++ |+#include <cstring>
    5 | using namespace std;
a.cc:12:25: error: 'strncpy' was not declared in this scope
   12 |                         strncpy(&input[i], "peach", 5);
      |                         ^~~~~~~
a.cc:12:25: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:15:25: error: 'strncpy' was not declared in this scope
   15 |                         strncpy(&input[i], "apple", 5);
      |                         ^~~~~~~
a.cc:15:25: note: 'strncpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

int main() {
        string str;
        getline(cin, str);
        stringstream ss(str);

        while (!ss.eof()) {
                ss >> str;
                int n = str.length() - 1;
                char last = str[n];
                if (!isalpha(last)) {
                        str.erase(n);
                }
                else {
                        last = '\0';
                }
                if (str == "apple") {
                        cout << "peach";
                }
                else if (str == "peach") {
                        cout << "apple";
                }
                else {
                        cout << str;
                }
                if (last) {
                        cout << last;
                }
                cout << (!ss.eof() ? ' ' : '\n');
        }
        return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:9: error: 'string' was not declared in this scope
    2 |         string str;
      |         ^~~~~~
a.cc:3:17: error: 'cin' was not declared in this scope
    3 |         getline(cin, str);
      |                 ^~~
a.cc:3:22: error: 'str' was not declared in this scope; did you mean 'std'?
    3 |         getline(cin, str);
      |                      ^~~
      |                      std
a.cc:3:9: error: 'getline' was not declared in this scope
    3 |         getline(cin, str);
      |         ^~~~~~~
a.cc:4:9: error: 'stringstream' was not declared in this scope
    4 |         stringstream ss(str);
      |         ^~~~~~~~~~~~
a.cc:6:17: error: 'ss' was not declared in this scope
    6 |         while (!ss.eof()) {
      |                 ^~
a.cc:10:22: error: 'isalpha' was not declared in this scope
   10 |                 if (!isalpha(last)) {
      |                      ^~~~~~~
a.cc:17:25: error: 'cout' was not declared in this scope
   17 |                         cout << "peach";
      |                         ^~~~
a.cc:20:25: error: 'cout' was not declared in this scope
   20 |                         cout << "apple";
      |                         ^~~~
a.cc:23:25: error: 'cout' was not declared in this scope
   23 |                         cout << str;
      |                         ^~~~
a.cc:26:25: error: 'cout' was not declared in this scope
   26 |                         cout << last;
      |                         ^~~~
a.cc:28:17: error: 'cout' was not declared in this scope
   28 |                 cout << (!ss.eof() ? ' ' : '\n');
      |                 ^~~~
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main(){
string n;
while(cin>>n){
if(n=="peach")cout<<"apple"
else if(n=="apple")cout<<"peach";
else cout<<n;
if(n[n.size()-1]=='.')cout<<endl;
else cout<<" ";
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:28: error: expected ';' before 'else'
    7 | if(n=="peach")cout<<"apple"
      |                            ^
      |                            ;
    8 | else if(n=="apple")cout<<"peach";
      | ~~~~
Language: C++

#include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<functional>
using namespace std;
int stoi(string x){stringstream ss;ss<<x;int tmp;ss>>tmp;return tmp;}
string itos(int x){stringstream ss;ss<<x;return ss.str();}
int main(){
string n,tmp;
getline(cin,n);
for(int i=0;i<n.size();i++){
	if(n[i]=='a'&&n[i+1]=='p'&&n[i+2]=='p'&&n[i+3]=='l'&&n[i+4]=='e'){
	cout<<"peach";
	i+=5;
	}
	else if(n[i]=='p'&&n[i+1]=='e'&&n[i+2]=='a'&&n[i+3]=='c'&&n[i+4]=='h'){
	cout<<"apple";
	i+=t;
	}
	else cout<<n[i];
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:12: error: 't' was not declared in this scope
   23 |         i+=t;
      |            ^
Language: C++

ans = gets.chomp.split(/([' '.])/).map(&:to_s).map{ |s|
	if s == 'apple'
		s = 'peach'
	elsif s == 'peach'
		s = 'apple'
	else
		s = s
	end
}.join('')

puts ans

Compiler output:
a.cc:2:17: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    2 |         if s == 'apple'
      |                 ^~~~~~~
a.cc:3:21: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    3 |                 s = 'peach'
      |                     ^~~~~~~
a.cc:4:20: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    4 |         elsif s == 'peach'
      |                    ^~~~~~~
a.cc:5:21: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    5 |                 s = 'apple'
      |                     ^~~~~~~
a.cc:9:8: error: empty character constant
    9 | }.join('')
      |        ^~
a.cc:1:1: error: 'ans' does not name a type
    1 | ans = gets.chomp.split(/([' '.])/).map(&:to_s).map{ |s|
      | ^~~
a.cc:9:2: error: expected unqualified-id before '.' token
    9 | }.join('')
      |  ^
Language: C++

str = gets.gsub(/apple/, 'spade')
str.gsub!(/peach/, 'apple')
str.gsub!(/spade/, 'peach')
puts str

Compiler output:
a.cc:1:26: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    1 | str = gets.gsub(/apple/, 'spade')
      |                          ^~~~~~~
a.cc:2:20: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    2 | str.gsub!(/peach/, 'apple')
      |                    ^~~~~~~
a.cc:3:20: warning: multi-character literal with 5 characters exceeds 'int' size of 4 bytes
    3 | str.gsub!(/spade/, 'peach')
      |                    ^~~~~~~
a.cc:1:1: error: 'str' does not name a type
    1 | str = gets.gsub(/apple/, 'spade')
      | ^~~
Language: C++

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

int main(){

string st;
string app="apple";
string pea="peach";
string t;
bool f=false;
while(cin>>st){

if(st.size()>=5)
{
if(f==true)cout<<" ";
for(int i=0;i<5;i++)
t[i]=st[i];

if(t=="apple"){
for(int i=0;i<5;i++)
st[i]=pea[i];
}
cout<<st;
f=truel;
}
cout<<endl;
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:3: error: 'truel' was not declared in this scope
   26 | f=truel;
      |   ^~~~~
a.cc:30:2: error: expected '}' at end of input
   30 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<stdio.h>

int main(){

char cx[1024];
char px[10]="peach",ax[10]="apple";
char y[6];

while(scanf("%s",cx)!=EOF){

for(int i=0;i<5;i++){
y[i]=cx[i];
}

if(y[0]=='p'&&y[1]=='e'&&y[2]=='a'&&y[3]=='c'&&y[4]=='h'){
for(int i=0;i<5;i++)
cx[i]=ax[i];

else if(y[0]=='a'&&y[1]=='p'&&y[2]=='p'&&y[3]=='l'&&y[4]=='e'){
for(int i=0;i<5;i++)
cx[i]=px[i];

printf("%s",cx);
}
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:1: error: expected '}' before 'else'
   19 | else if(y[0]=='a'&&y[1]=='p'&&y[2]=='p'&&y[3]=='l'&&y[4]=='e'){
      | ^~~~
a.cc:15:58: note: to match this '{'
   15 | if(y[0]=='p'&&y[1]=='e'&&y[2]=='a'&&y[3]=='c'&&y[4]=='h'){
      |                                                          ^
a.cc:26:2: error: expected '}' at end of input
   26 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include <cstdio>
using namespace std;

int main(){
	char str[1000];
	char app[5] = "apple", pea[5] = "peach";
	bool output, first;
	
	first = true;
	while((scanf("%s", str)) != EOF){
		output = false;
		if(!first) printf(" ");
		first = false;
		
		
		for(int i = 0; i < 5; i++){
			if(app[i] != str[i]) break;
			
			if(i + 1 == 5 && (str[5] == 0 || str[5] == '.')){
				printf("%s", pea);
				if(str[5] == '.') printf(".");
				output = true;
			}
		}
		if(!output){
			for(int i = 0; i < 5; i++){
				if(pea[i] != str[i]) break;
				
				if(i + 1 == 5 && (str[5] == 0 || str[5] == '.')){
					printf("%s", app);
					if(str[5] == '.') printf(".");
					output = true;
				}
			}
		}
		if(!output){
			printf("%s", str);
		}
	}
	printf("\n");
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:23: error: initializer-string for 'char [5]' is too long [-fpermissive]
    6 |         char app[5] = "apple", pea[5] = "peach";
      |                       ^~~~~~~
a.cc:6:41: error: initializer-string for 'char [5]' is too long [-fpermissive]
    6 |         char app[5] = "apple", pea[5] = "peach";
      |                                         ^~~~~~~
Language: C++

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
	Scanner input=new Scanner(System.in);
	String str;
	String res="";
	while(input.hasNext()){
	    str=input.next();
	    for(int i=0;i<str.length()-4;i++){
		if((str.substring(i,i+5)).equals("apple"))
		    str=str.replaceAll("apple","peach");
		else if((str.substring(i,i+5)).equals("peach"))
		    str=str.replaceAll("peach","apple");
	    }
	    res=res.concat(str+" ");
	}
	System.out.println(res.trim());
	input.close();
    }
}

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

#include<iostream>
#include<strring>
using namespace std;
int main() {
	string s;
	getline(cin, s);
	
	string::size_type pos1,pos2, begin;
	
	while(1){
		pos1 = s.find("apple", begin);
		pos2 = s.find("peach", begin);
		
		if( pos1 == string::npos && pos2 == string::npos ) 
			break;
		
		if( pos1 < pos2 ){
			s.replace( pos1, 5, "peach" );
			i = pos1 + 5;
		}else{
			s.replace( pos2, 5, "apple" );
			i = pos2 + 5;
		}
	
	}
	cout << s << endl;
}

Compiler output:
a.cc:2:9: fatal error: strring: No such file or directory
    2 | #include<strring>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<string>
using namespace std;
int main() {
	string s;
	getline(cin, s);
	
	string::size_type pos1,pos2, begin;
	
	while(1){
		pos1 = s.find("apple", begin);
		pos2 = s.find("peach", begin);
		
		if( pos1 == string::npos && pos2 == string::npos ) 
			break;
		
		if( pos1 < pos2 ){
			s.replace( pos1, 5, "peach" );
			i = pos1 + 5;
		}else{
			s.replace( pos2, 5, "apple" );
			i = pos2 + 5;
		}
	
	}
	cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:25: error: 'i' was not declared in this scope
   19 |                         i = pos1 + 5;
      |                         ^
a.cc:22:25: error: 'i' was not declared in this scope
   22 |                         i = pos2 + 5;
      |                         ^
Language: C++

#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;

char ary[1010];
int main(){
	gets(ary);
	int n=strlen(ary);
	stack<int> pe,ap;
	for(int i=0;i<n-4;i++){
		if(ary[i]=='a'&&ary[i+1]=='p'&&ary[i+2]=='p'&&ary[i+3]=='l'&&ary[i+4]=='e') ap.push(i);
		else if(ary[i]=='p'&&ary[i+1]=='e'&&ary[i+2]=='a'&&ary[i+3]=='c'&&ary[i+4]=='h') pe.push(i);
	}
	while(!ap.empty()){
		int tmp=ap.top();ap.pop();
		ary[tmp]='p';
		ary[tmp+1]='e';
		ary[tmp+2]='a';
		ary[tmp+3]='c';
		ary[tmp+4]='h';
	}
	while(!pe.empty()){
		int tmp=pe.top();pe.pop();
		ary[tmp]='a';
		ary[tmp+1]='p';
		ary[tmp+2]='p';
		ary[tmp+3]='l';
		ary[tmp+4]='e';
	}
	printf("%s\n",ary);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    8 |         gets(ary);
      |         ^~~~
      |         getw
Language: C++

#include<stdio.h>
#include<string.h>
int main()
{
	int c;
	char str[1024];
	gets(str);
	for(c=0;c<strlen(str);c++){
		if(strncmp(&str[c],"apple",5)==0){
			str[c]='p';
			str[c+1]='e';
			str[c+2]='a';
			str[c+3]='c';
			str[c+4]='h';
		}else if(strncmp(&str[c],"peach",5)==0){
			str[c]='a';
			str[c+1]='p';
			str[c+2]='p';
			str[c+3]='l';
			str[c+4]='e';
		}
	}
	printf("%s\n",str);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |         gets(str);
      |         ^~~~
      |         getw
Language: C++

#include <stdio.h>
int main(){
char c[1000],now=0;
for(int i=0;i<1000;i++)c[i]='\0';
while(scanf("%c",&c[now])!=EOF)now++;

for(int i=0;c[i]!='\0';i++){
if(c[i]=='p'&&c[i+1]=='e'&&c[i+2]=='a'&&c[i+3]=='c'&&c[i+4]=='h'){
c[i]=a;
c[i+1]=p;
c[i+2]=p;
c[i+3]=l;
c[i+4]=e;
}
if(c[i]=='a'&&c[i+1]=='p'&&c[i+2]=='p'&&c[i+3]=='l'&&c[i+4]=='e'){
c[i]=p;
c[i+1]=e;
c[i+2]=a;
c[i+3]=c;
c[i+4]=h;
}
printf("%c",c[i]);
}
printf("\n");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:6: error: 'a' was not declared in this scope
    9 | c[i]=a;
      |      ^
a.cc:10:8: error: 'p' was not declared in this scope
   10 | c[i+1]=p;
      |        ^
a.cc:12:8: error: 'l' was not declared in this scope
   12 | c[i+3]=l;
      |        ^
a.cc:13:8: error: 'e' was not declared in this scope
   13 | c[i+4]=e;
      |        ^
a.cc:16:6: error: 'p' was not declared in this scope
   16 | c[i]=p;
      |      ^
a.cc:17:8: error: 'e' was not declared in this scope
   17 | c[i+1]=e;
      |        ^
a.cc:18:8: error: 'a' was not declared in this scope
   18 | c[i+2]=a;
      |        ^
a.cc:19:8: error: invalid conversion from 'char*' to 'char' [-fpermissive]
   19 | c[i+3]=c;
      |        ^
      |        |
      |        char*
a.cc:20:8: error: 'h' was not declared in this scope
   20 | c[i+4]=h;
      |        ^
Language: C++

#include <stdio.h>
int main(){
char c[1000];
int now=0;
for(int i=0;i<1000;i++)c[i]='\0';
while(scanf("%c",&c[now])!=EOF)now++;

for(int i=0;c[i]!='\0';i++){
if(c[i]=='p'&&c[i+1]=='e'&&c[i+2]=='a'&&c[i+3]=='c'&&c[i+4]=='h'){
c[i]=a;
c[i+1]=p;
c[i+2]=p;
c[i+3]=l;
c[i+4]=e;
}
if(c[i]=='a'&&c[i+1]=='p'&&c[i+2]=='p'&&c[i+3]=='l'&&c[i+4]=='e'){
c[i]=p;
c[i+1]=e;
c[i+2]=a;
c[i+3]=c;
c[i+4]=h;
}
printf("%c",c[i]);
}
printf("\n");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:6: error: 'a' was not declared in this scope
   10 | c[i]=a;
      |      ^
a.cc:11:8: error: 'p' was not declared in this scope
   11 | c[i+1]=p;
      |        ^
a.cc:13:8: error: 'l' was not declared in this scope
   13 | c[i+3]=l;
      |        ^
a.cc:14:8: error: 'e' was not declared in this scope
   14 | c[i+4]=e;
      |        ^
a.cc:17:6: error: 'p' was not declared in this scope
   17 | c[i]=p;
      |      ^
a.cc:18:8: error: 'e' was not declared in this scope
   18 | c[i+1]=e;
      |        ^
a.cc:19:8: error: 'a' was not declared in this scope
   19 | c[i+2]=a;
      |        ^
a.cc:20:8: error: invalid conversion from 'char*' to 'char' [-fpermissive]
   20 | c[i+3]=c;
      |        ^
      |        |
      |        char*
a.cc:21:8: error: 'h' was not declared in this scope
   21 | c[i+4]=h;
      |        ^
Language: C++

#include<stdio.h>
#include <string.h>
int main(void){
  char str[1000];
  int i,l;
   
  fgets(str,1000,stdin);
  l=strlen(str);
  for(i=0;i<l;i++){
    if(str[i]=='p' && str[i+1]=='e'&&str[i+2]=='a'&&str[i+3]=='c'&&str[i+4]=='h'){
      str[i]='a';
      str[i+1]='p';
      str[i+2]='p';
      str[i+3]='l';
      str[i+4]='e';
      i=i+4;
}else if(str[i]=='a' && str[i+1]=='p'&&str[i+2]=='p'&&str[i+3]=='l'&&str[i+4]=='e'){
      str[i]='p';
      str[i+1]='e';
      str[i+2]='a';
      str[i+3]='c';
      str[i+4]='h';
 ??????i=i+4;
    }
     
  }
    printf("%s",str);
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:2: error: expected primary-expression before '?' token
   23 |  ??????i=i+4;
      |  ^
a.cc:23:3: error: expected primary-expression before '?' token
   23 |  ??????i=i+4;
      |   ^
a.cc:23:4: error: expected primary-expression before '?' token
   23 |  ??????i=i+4;
      |    ^
a.cc:23:5: error: expected primary-expression before '?' token
   23 |  ??????i=i+4;
      |     ^
a.cc:23:6: error: expected primary-expression before '?' token
   23 |  ??????i=i+4;
      |      ^
a.cc:23:7: error: expected primary-expression before '?' token
   23 |  ??????i=i+4;
      |       ^
a.cc:23:13: error: expected ':' before ';' token
   23 |  ??????i=i+4;
      |             ^
      |             :
a.cc:23:13: error: expected primary-expression before ';' token
a.cc:23:13: error: expected ':' before ';' token
   23 |  ??????i=i+4;
      |             ^
      |             :
a.cc:23:13: error: expected primary-expression before ';' token
a.cc:23:13: error: expected ':' before ';' token
   23 |  ??????i=i+4;
      |             ^
      |             :
a.cc:23:13: error: expected primary-expression before ';' token
a.cc:23:13: error: expected ':' before ';' token
   23 |  ??????i=i+4;
      |             ^
      |             :
a.cc:23:13: error: expected primary-expression before ';' token
a.cc:23:13: error: expected ':' before ';' token
   23 |  ??????i=i+4;
      |             ^
      |             :
a.cc:23:13: error: expected primary-expression before ';' token
a.cc:23:13: error: expected ':' before ';' token
   23 |  ??????i=i+4;
      |             ^
      |             :
a.cc:23:13: error: expected primary-expression before ';' token
Language: C++

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

int main() {
  int n = 0;
  string a[1000];
  while(cin >> a[n]){
    if(a[n] == "apple"){
      a[n] = "peach";
    }else if (a[n] == "peach"){
      a[n] = "apple";
    }else if(a[n] == "apple."){
      a[n] = "peach.";
    }else if (a[n] == "peach."){
      a[n] = "apple.";
    }
      n++;
  }
  for(int i=0; i<n-2; i++){
    cout << a[i] <<" ";
  }
  cout << a[i-1] <<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:13: error: 'i' was not declared in this scope
   23 |   cout << a[i-1] <<endl;
      |             ^
Language: C++

#include <cstdio>
#include <cstring>

using namespace std;

int main(void){
  char buf[1024],*p;
  
  gets(buf);
  while(p=strstr(buf,"apple")){
    strncpy(p,"*****", 5);
  }
  while(p=strstr(buf,"peach")){
    strncpy(p,"apple",5);
  }
  while(p=strstr(buf,"*****")){
    strncpy(p,"peach",5);
  }
  puts(buf);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: 'gets' was not declared in this scope; did you mean 'getw'?
    9 |   gets(buf);
      |   ^~~~
      |   getw
Language: C++

#include <cstdio>
#include <cstring>

using namespace std;

int main(void){
  char buf[1024],*p;
  
  fgets(buf, 1024, stdin);
  while(p=strstr(buf,"apple")){
    strncpy(p,"*****", 5);
  }
  while(p=strstr(buf,"peach")){
    strncpy(p,"apple",5);
  }
  while(p=strstr(buf,"*****")){
    strncpy(p,"peach",5);
  }
  strrchr(buf,10)=0;
  puts(buf);
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: lvalue required as left operand of assignment
   19 |   strrchr(buf,10)=0;
      |   ~~~~~~~^~~~~~~~
Language: C++

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

int main(){
	char ss[2000],out[2000],temp[2000];
	int i,j,k;
	
	while(NULL!=gets(ss)){
		j=0;
		for(i=0;i<1800;i++){
			if(ss[i]=='a' && ss[i+1]=='p' && ss[i+2]=='p' && ss[i+3]=='l' && ss[i+4]=='e'){
				out[j]='p';
				out[j+1]='e';
				out[j+2]='a';
				out[j+3]='c';
				out[j+4]='h';
				out[j+5]='@';
				j+=6;
				i+=4;
				continue;
			}
			out[j]=ss[i];
			++j;
		}
		j=0;
		for(i=0;i<1800;i++){
			if(out[i]=='p' && out[i+1]=='e' && out[i+2]=='a' && out[i+3]=='c' && out[i+4]=='h' && out[i+5]!='@'){
				ss[j]='a';
				ss[j+1]='p';
				ss[j+2]='p';
				ss[j+3]='l';
				ss[j+4]='e';
				j+=5;
				i+=4;
				continue;
			}
			ss[j]=out[i];
			++j;
		}
		j=0;
		
		while(0!=ss[j]){
			if(ss[j]=='@'){
				++j;
				continue;
			}
			printf("%c",ss[j]);
			++j;
		}
		printf("\n");
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:21: error: 'gets' was not declared in this scope; did you mean 'getw'?
    8 |         while(NULL!=gets(ss)){
      |                     ^~~~
      |                     getw
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

int main(){
  char buff[2000];
  while(gets(buff)){
    int len = strlen(buff);
    REP(i,len-5)
      if(strncmp(buff+i, "apple", 5) == 0) strncpy(buff+i, "peach", 5);
      else if(strncmp(buff+i, "peach", 5) == 0) strncpy(buff+i, "apple", 5);
    puts(buff);
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
   27 |   while(gets(buff)){
      |         ^~~~
      |         getw
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <iomanip>
using namespace std;
int main(){
  string s,a="apple",p="peach";
  vector<string> v;
  while(cin>>s){
    if(s.size()>=5){
      if(!(a.compare(s.substr(0,5))))s="peach";
      if(!(p.compare(s.substr(0,5))))s="apple";
    }
    v.push_back(s);
    if(s[s.size()-1]=="."{
    vector<string>::iterator it = v.begin();
    while(it!=v.end()){
    cout<<*it;
    (it+1==v.end())?cout<<endl:cout<<" ";
    it++;
    }
    return 0}
  }
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   19 |     if(s[s.size()-1]=="."{
a.cc:19:26: error: expected ')' before '{' token
   19 |     if(s[s.size()-1]=="."{
      |       ~                  ^
      |                          )
a.cc:27:3: error: expected primary-expression before '}' token
   27 |   }
      |   ^
a.cc: At global scope:
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <iomanip>
using namespace std;
int main(){
  string s,a="apple",p="peach";
  vector<string> v;
  while(cin>>s){
    if(s.size()>=5){
      if(!(a.compare(s.substr(0,5))))s="peach";
      if(!(p.compare(s.substr(0,5))))s="apple";
    }
    v.push_back(s);
    if(s[s.size()-1]=='.'){
    vector<string>::iterator it = v.begin();
    while(it!=v.end()){
    cout<<*it;
    (it+1==v.end())?cout<<endl:cout<<" ";
    it++;
    }
    return 0}
  }
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: expected ';' before '}' token
   26 |     return 0}
      |             ^
      |             ;
a.cc: At global scope:
a.cc:30:1: error: expected declaration before '}' token
   30 | }
      | ^
Language: C++

import java.util.*;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		ArrayList<String> al = new ArrayList<String>();
		while(sc.hasNext()) {
			String s = sc.next();
			if(s.contains("apple")) {
				al.add(s.replace("apple", "peach"));
			} else if(s.contains("peach")) {
				al.add(s.replace("peach", "apple"));
			} else {
				al.add(s);
			}
		}
		System.out.print(al.get(0));
		for(int i = 1, n = al.size(); i < n; i++) {
			System.out.print(" " + al.get(i));
		}
		System.out.println();
	}
}

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

#include<iostream>
#include<string>
#include<vector>

using namespace std;

vector<string> split(string&);
void StringHandle(string&);
bool space(char);
bool not_space(char);

int main(){
  string str;
  vector<string> Str;

  getline(cin, str);
  Str = split(str);

  for(string::size_type i=0; i<Str.size(); ++i){
    if(Str[i] == "apple")
      Str[i] = "peach";
    else if(Str[i] == "peach")
      Str[i] = "apple";
  }

  for(string::size_type i=0; i<Str.size()-2; ++i)
    cout << Str[i] << " ";
  cout << Str[Str.size()-2] << "." << endl;

  return 0;
}

vector<string> split(string& str){
  string _str;
  vector<string> Str;
  string::iterator i, j;

  j = str.begin();
  while(i < str.end() || j < str.end()){
    i = find_if(j, str.end(), not_space);
    j = find_if(i, str.end(), space);
    copy(i, j, back_inserter(_str));
    StringHandle(_str);
    Str.push_back(_str);
    _str.clear();
  }
  return Str;
}

void StringHandle(string& s){
  if(s[s.size()-1] < 'a' || s[s.size()-1] > 'z')
    s = s.substr(0, s.size()-1);
}

bool space(char c){
  return (isspace(c));
}

bool not_space(char c){
  return (!isspace(c));
}

Compiler output:
a.cc: In function 'std::vector<std::__cxx11::basic_string<char> > split(std::string&)':
a.cc:40:9: error: 'find_if' was not declared in this scope
   40 |     i = find_if(j, str.end(), not_space);
      |         ^~~~~~~
Language: C++

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

int main(void){
	char s[1001];
	char* p;
	char* a;
	gets(s);

	p = strstr(s, "peach");
	a = strstr(s, "apple");
	while(1){
		if(p == NULL && a == NULL) break;
		if(a == NULL || p < a && p != NULL){
			p[0] = 'a';
			p[1] = 'p';
			p[2] = 'p';
			p[3] = 'l';
			p[4] = 'e';
			p = strstr(p, "peach");
		}else if(p == NULL || a < p && a != NULL){
			a[0] = 'p';
			a[1] = 'e';
			a[2] = 'a';
			a[3] = 'c';
			a[4] = 'h';
			a = strstr(a, "apple");
		}
	}
	printf("%s\n", s);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    8 |         gets(s);
      |         ^~~~
      |         getw
Language: C++

#include<cstdio>

int main()
{
	char map[2][6]={"apple","peach"};
	char c[1005]={0};
	gets(c);
	for(int i=0;i<1000;i++)
	{
		if(c[i]=='\0')break;
		int a=0,p=0;
		for(int j=0;j<5;j++)
		{
			if(map[0][j]==c[i+j])a++;
			if(map[1][j]==c[j+i])p++;
		}
		if(a==5)
		{
			printf("peach");
			i+=4;
		}
		if(p==5)
		{
			printf("apple");
			i+=4;
		}
		else printf("%c",c[i]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |         gets(c);
      |         ^~~~
      |         getw
Language: C++

#include<cstdio>

int main()
{
	char map[2][6]={"apple","peach"};
	char c[10000]={0};
	gets(c);
	for(int i=0;i<1000;i++)
	{
		if(c[i]=='\0')break;
		int a=0,p=0;
		for(int j=0;j<5;j++)
		{
			if(map[0][j]==c[i+j])a++;
			if(map[1][j]==c[j+i])p++;
		}
		if(a==5)
		{
			printf("peach");
			i+=4;
		}
		if(p==5)
		{
			printf("apple");
			i+=4;
		}
		else printf("%c",c[i]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:9: error: 'gets' was not declared in this scope; did you mean 'getw'?
    7 |         gets(c);
      |         ^~~~
      |         getw
Language: C++

import java.io.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class aoj0050 {
   public static void main(String[] args) throws IOException{
	   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	   String s,ans;
	   s = br.readLine();
	   Matcher m = Pattern.compile("apple").matcher(s);
	   s = m.replaceAll("tmp");
	   Matcher ms = Pattern.compile("peach").matcher(s);
	   s = ms.replaceAll("apple");
	   Matcher mf = Pattern.compile("tmp").matcher(s);
	   s = mf.replaceAll("peach");
	   System.out.println(s);
   }
}

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: 'import' does not name a type
    2 | import java.util.regex.Pattern;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.regex.Matcher;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: expected unqualified-id before 'public'
    4 | public class aoj0050 {
      | ^~~~~~
Language: C++

using System;

namespace _0050
{
    class Program
    {
        static void Main(string[] args)
        {
            var modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach");
            Console.WriteLine(modifyTexts);
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:7:26: error: 'string' has not been declared
    7 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:7:35: error: expected ',' or '...' before 'args'
    7 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:12:6: error: expected ';' after class definition
   12 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void _0050::Program::Main(int*)':
a.cc:9:13: error: 'var' was not declared in this scope
    9 |             var modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach");
      |             ^~~
a.cc:10:13: error: 'Console' was not declared in this scope
   10 |             Console.WriteLine(modifyTexts);
      |             ^~~~~~~
a.cc:10:31: error: 'modifyTexts' was not declared in this scope
   10 |             Console.WriteLine(modifyTexts);
      |                               ^~~~~~~~~~~
Language: C++

using System;

namespace _0050
{
    class Program
    {
        static void Main(string[] args)
        {
            string modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach");
            Console.WriteLine(modifyTexts);
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:7:26: error: 'string' has not been declared
    7 |         static void Main(string[] args)
      |                          ^~~~~~
a.cc:7:35: error: expected ',' or '...' before 'args'
    7 |         static void Main(string[] args)
      |                                   ^~~~
a.cc:12:6: error: expected ';' after class definition
   12 |     }
      |      ^
      |      ;
a.cc: In static member function 'static void _0050::Program::Main(int*)':
a.cc:9:13: error: 'string' was not declared in this scope
    9 |             string modifyTexts = Console.ReadLine().Replace("apple", "apple_").Replace("peach", "apple").Replace("apple_", "peach");
      |             ^~~~~~
a.cc:10:13: error: 'Console' was not declared in this scope
   10 |             Console.WriteLine(modifyTexts);
      |             ^~~~~~~
a.cc:10:31: error: 'modifyTexts' was not declared in this scope
   10 |             Console.WriteLine(modifyTexts);
      |                               ^~~~~~~~~~~
Language: Java

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

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
int maxValue;
int minValue;
int dif;
int[] num=new int[8];
int n=Integer.parseInt(br.readLine());
for(int p=0;p<n;p++){
line=br.readLine();
maxValue=0;
minValue=0;
dif=0;
for(int i=0;i<num.length;i++){
num[i]=(int)(line.charAt(i)-'0');
}
Arrays.sort(num);
for(int i=0;i<num.length;i++){
maxValue+=num[i]*Math.pow(i);
minValue+=num[i]*Math.pow(7-i);
}
dif=maxValue-minValue;
System.out.println(dif)
}
}
}

Compiler output:
Main.java:27: error: ';' expected
System.out.println(dif)
                       ^
1 error
Language: Java

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

class Main{
public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line="";
int maxValue;
int minValue;
int dif;
int[] num=new int[8];
int n=Integer.parseInt(br.readLine());
for(int p=0;p<n;p++){
line=br.readLine();
maxValue=0;
minValue=0;
dif=0;
for(int i=0;i<num.length;i++){
num[i]=(int)(line.charAt(i)-'0');
}
Arrays.sort(num);
for(int i=0;i<num.length;i++){
maxValue+=num[i]*Math.pow(i);
minValue+=num[i]*Math.pow(7-i);
}
dif=maxValue-minValue;
System.out.println(dif);
}
}
}

Compiler output:
Main.java:23: error: method pow in class Math cannot be applied to given types;
maxValue+=num[i]*Math.pow(i);
                     ^
  required: double,double
  found:    int
  reason: actual and formal argument lists differ in length
Main.java:24: error: method pow in class Math cannot be applied to given types;
minValue+=num[i]*Math.pow(7-i);
                     ^
  required: double,double
  found:    int
  reason: actual and formal argument lists differ in length
2 errors
Language: Java

import java.io.*;
class Main
{
    public static void main(String args[])throws IOException
    {
	BufferedReader input=new BufferedReader(new InputStreamReader(System.in));
	int n=Integer.parseInt(input.readLine());
	for(int i=0;i<n;i++)
	    {
		String str=input.readLine();
		String str_ary[]=new String[8];
		int a[]=new int[8];
		int b[]=new int[8];
		for(int j=0;j<8;j++)
		    {
			a[j]=Integer.parseInt(str.charAt(j)+"");
			b[j]=Integer.parseInt(str.charAt(j)+"");
		    }
		
		for(int j=0;j<8;j++)
		    {
			
			
			int max=a[j],x=j;
			for(int k=j;k<8;k++)
			    {
				if(max<a[k])
				    {
					max=a[k];
					x=k;
					
				    }
			    }
			
			int tmp=a[j];
			a[j]=max;
			a[x]=tmp;
		    }
		
		for(int j=0;j<8;j++)
		    {
			int mini=b[j],x=j;
			for(int k=j;k<8;k++)
			    {
				if(mini>b[k])
				    {
					mini=b[k];
					x=k;
					
				    }
			    }
			
			int tmp=b[j];
			b[j]=mini;
			b[x]=tmp;
			
		    }
		String stra="";
		for(int l=0;l<8;l++)
		    {
			stra+=Integer.toString(a[l]);
		    }
		int max=Integer.parseInt(stra);
		String strb="";
		for(int l=0;l<8;l++)
		    {
			if(b[l]==0)
			else if(b[l]!=0)strb+=Integer.toString(b[l]);
		    }
		int mini=Integer.parseInt(strb);
		System.out.println(max-mini);
	    }
    }
}

Compiler output:
Main.java:68: error: 'else' without 'if'
			else if(b[l]!=0)strb+=Integer.toString(b[l]);
			^
1 error
Language: Java

import java.util.Arrays;
import java.util.Scanner;


public class Test {
	public static void main(String[] args){
		Scanner scan = null;
		try{
			scan = new Scanner(System.in);
			int n = scan.nextInt();
			for(int i = 0 ; i < n;i++){
				char[] data = scan.next().toCharArray();
				int[] num = new int[data.length];
				for(int j = 0 ; j < data.length;j++){
					num[j] = Integer.parseInt(String.valueOf(data[j]));
				}
				Arrays.sort(num);
				int ans = 0;
				for(int j = 0 ;j < num.length;j++){
					ans += num[j] * Math.pow(10, j);
					ans -= num[j] * Math.pow(10, 7 -j);
				}
				System.out.println(ans);
			}
		}finally{
			if(scan !=null)scan.close();
		}
	}
}

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

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

int main(void)
{
	char num[9];
	int array[8];
	int n;
	int i;
	int j;
	int array2[8];
	int max = 0;
	int min = 0;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%s", num);
		for (j = 0; j < 8; j++){
			array[j] = num[j] - '0';
		}
		sort(array, array + 8);
		for (j = 0; j < 8; j++){
			array2[j] = array[j];
		}
		reverse(array, array + 8);
		for (j = 0; j < 8; j++){
			max = max * 10 + array[j];
			min = min * 10 + array2[j];
		}
		max -= min;
		
		printf("%d\n", max);
	}
	
	return 0;
}

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

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

int main(void)
{
	char num[9];
	int array[8];
	int n;
	int i;
	int j;
	int array2[8];
	int num_max;
	int num_min;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		num_max = 0;
		num_min = 0;
		scanf("%s", num);
		for (j = 0; j < 8; j++){
			array[j] = num[j] - '0';
		}
		sort(array, array + 8);
		for (j = 0; j < 8; j++){
			array2[j] = array[j];
		}
		reverse(array, array + 8);
		for (j = 0; j < 8; j++){
			num_max = num_max * 10 + array[j];
			num_min = num_min * 10 + array2[j];
		}
		num_max -= num_min;
		
		printf("%d\n", num_max);
	}
	
	return 0;
}

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