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

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

int main(int argc, const char * argv[]) {
    int n, l;
    string s;
    vector<string> v;
    
    cin >> n >> l;
    for (int i=0; i<n; i++) {
        cin >> s;
        v.push_back(s);
    }
    
    sort(v.begin(), v.end());
    for (int i=0; i<n; i++) {
        cout << v[i];
    }
    cout << endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:16:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   16 |     sort(v.begin(), v.end());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>
#define eol '\n'
using namespace std;

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

  int N,L;
  cin >> N >> L;
  
  vector<string> list(N);
  for (int i = 0; i < N; i++) {
    cin >> list[i];
  }
  
  sort(list.begin(), list.end());

  for (int i = 0; i < N; i++) {
    cout << list[i];
  }
  cout << eol;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |   sort(list.begin(), list.end());
      |   ^~~~
      |   short
Language: Java

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int L = sc.nextInt();
        String [] S = new String [N];
        for(int i=0; i<N; i++){
            S[i] = sc.next();
        }
        Arrays.sort(S);
        String ans="";
        for(int i=0; i<N; i++){
            ans=ans+S[i]
        }
        System.out.println(ans);
    }
}

Compiler output:
Main.java:15: error: ';' expected
            ans=ans+S[i]
                        ^
1 error
Language: Java

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

public class Atcoder42bb {

	public static void main(String[] args) throws IOException {
		BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
		String[] line = b.readLine().split(" ");

		int N = Integer.parseInt(line[0]);
		int L = Integer.parseInt(line[1]);

		String[] S = new String[N];

		for (int i = 0; i < N; i++) {
			S[i] = b.readLine();
		}
		Arrays.sort(S);
		for (int i = 0; i < N; i++) {
			System.out.print(S[i]);
		}
		
	}

}

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

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

public class Easy {
	static Cara c[];
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int l = sc.nextInt();
		c = new Cara[l];
		for(int i = 0;i < n;i++){
			c[i] = new Cara(sc.next(), l);
		}

		Arrays.sort(c, new Comparator<Cara>(){
			public int compare(Cara a, Cara b){
				int i = 0;
				while(i < l){
					if(a.a[i] > b.a[i]){
						return 1;
					}else if(a.a[i] < b.a[i]){
						return -1;
					}
					i++;
				}
				return 0;
			}
		});

		String answer = "";
		for(int i = 0;i < c.length;i++){
			answer += c[i].a1;
		}

		System.out.println(answer);
	}
}

class Cara{
	char []a;
	String a1;

	Cara(String a,int length){
		this.a = new char[length];
		this.a1 = a;
		this.a = a.toCharArray();
	}
}

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

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

using namespace std;

int main(){
	int N,L;
	cin >> N >> L;
	vector<string> mozi(N);
	vector<string> sum(1);

	for(int i=0;i < N;i++){
		cin >> mozi[i];
	}

	qsort(mozi.begin(),mozi.end());
	for(int i=0;i < N;i++){
		sum[0] += mozi[i];
	}
	cout << sum[0] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:25: error: cannot convert 'std::vector<std::__cxx11::basic_string<char> >::iterator' to 'void*'
   18 |         qsort(mozi.begin(),mozi.end());
      |               ~~~~~~~~~~^~
      |                         |
      |                         std::vector<std::__cxx11::basic_string<char> >::iterator
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 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/stdlib.h:970:26: note:   initializing argument 1 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
  970 | extern void qsort (void *__base, size_t __nmemb, size_t __size,
      |                    ~~~~~~^~~~~~
Language: C++

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

using namespace std;

int main(){
	int N,L;
	cin >> N >> L;
	vector<string> mozi(N);
	vector<string> sum(1);

	for(int i=0;i < N;i++){
		cin >> mozi[i];
	}

	qsort(mozi.begin(),mozi.end());
	for(int i=0;i < N;i++){
		sum[0] += mozi[i];
	}
	cout << sum[0] << endl;
	return 0;
}

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

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

using namespace std;

int main(){
	int N,L;
	cin >> N >> L;	//入力
	vector<string> mozi(N); //比較する文字の数
	vector<string> sum(1);  //文字を足したやつ

	for(int i=0;i < N;i++){ //文字入力
		cin >> mozi[i];
	}

	qsort(mozi.begin(),mozi.end()); //文字列の最初から最後までをクイックソート
	for(int i=0;i < N;i++){ //文字を合体させる処理
		sum[0] += mozi[i];
	}
	cout << sum[0] << endl; //出力
	return 0;
}

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

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            int n = sc.nextInt();
            int l = sc.nextInt();

            String[] array = new String[n];
            for (int i = 0; i < n; i++) {
              array[i] = sc.next();
            }

            Arrays.sort(array);
            
            System.out.println(String.join("", array));

        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}


Compiler output:
Main.java:28: error: cannot find symbol
            Arrays.sort(array);
            ^
  symbol:   variable Arrays
  location: class Main
Main.java:50: warning: [removal] finalize() in Object has been deprecated and marked for removal
        protected void finalize() throws Throwable {
                       ^
Main.java:52: warning: [removal] finalize() in Object has been deprecated and marked for removal
                super.finalize();
                     ^
1 error
2 warnings
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>


int main() {
  int N, L;
  std::cin >> N >> L;
  
  std::vector<std::string> a;
  for (int i = 0; i < N; i++) {
    std::string tmp;
    std::cin >> tmp;
    a.push_back(tmp);
  }

  std::sort(a.begin(), a.end());

  std::string result("");
  for (int i = 0; i < N; i++) {
    result += a[i];
  }
  std::cout << result << std::endl;

  return 0;
}


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

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <cmath>


int main() {
  int N, L;
  std::cin >> N >> L;
  
  std::vector<std::string> a;
  for (int i = 0; i < N; i++) {
    std::string tmp;
    std::cin >> tmp;
    a.push_back(tmp);
  }

  std::cout << "hoge" << std::endl;
  std::sort(a.begin(), a.end());
  std::cout << "hoge" << std::endl;

  std::string result("");
  for (int i = 0; i < N; i++) {
    result += a[i];
  }
  std::cout << result << std::endl;

  return 0;
}


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

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    REP(i,n) cin >> s[i];
    sort(s.clear(),s.end());
    REP(i,n) cout << s[i];
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:17: error: invalid use of void expression
   32 |     sort(s.clear(),s.end());
      |          ~~~~~~~^~
Language: C++

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

using namespace std;

int main() {
  int n, l;
  vector<string> lines;
  cin >> n >> l;
  for(int i = 0; i < n; i++) {
    string line;
    cin >> line;
    lines.push_back(line);
  }
  sort(lines.begin(), lines.end());
  for(int i = 0; i < n; i++) {
    cout << lines[i];
  }
  cout << endl;
}


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

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

char a[100][101];
int n, l;

void swap(int x, int y) {
    char t;
    for(int i=0; i<l; i++) {
        t=a[x][i];
        a[x][i]=a[y][i];
        a[y][i]=t;
    }
}

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

char a[100][101];
int n, l;

void swap(int x, int y) {
    char t;
    for(int i=0; i<l; i++) {
        t=a[x][i];
        a[x][i]=a[y][i];
        a[y][i]=t;
    }
}


int main(void) {
    scanf("%d%d", &n, &l);
    
    for(int i=0; i<n; i++)
        scanf("%s", a[i]);
    
    for(int k=l-1; k>-1; k--) {
        for(int i=0; i<n-1; i++) {
            for(int j=i+1; j<n; j++) {
                if(a[i][k]>=a[j][k]) {
                    swap(i, j);
                }
            }
        }
        //        prn();
    }
    
    for(int i=0; i<n; i++)
        printf("%s", a[i]);
    
    return 0;
}            }
        }
    }
    
    for(int i=0; i<n; i++)
        printf("%s", a[i]);
    
    return 0;
}

*/

int main(void) {
    scanf("%d%d", &n, &l);
    
    for(int i=0; i<n; i++)
        scanf("%s", a[i]);
    
    for(int k=l-1; k>-1; k--) {
        for(int i=0; i<n-1; i++) {
            for(int j=i+1; j<n; j++) {
                if(a[i][k]>=a[j][k]) {
                    swap(i, j);
                }
            }
        }
        prn();
    }
    
    for(int i=0; i<n; i++)
        printf("%s", a[i]);
    
    return 0;
}

Compiler output:
a.cc:19:6: error: redefinition of 'char a [100][101]'
   19 | char a[100][101];
      |      ^
a.cc:4:6: note: 'char a [100][101]' previously declared here
    4 | char a[100][101];
      |      ^
a.cc:20:5: error: redefinition of 'int n'
   20 | int n, l;
      |     ^
a.cc:5:5: note: 'int n' previously declared here
    5 | int n, l;
      |     ^
a.cc:20:8: error: redefinition of 'int l'
   20 | int n, l;
      |        ^
a.cc:5:8: note: 'int l' previously declared here
    5 | int n, l;
      |        ^
a.cc:22:6: error: redefinition of 'void swap(int, int)'
   22 | void swap(int x, int y) {
      |      ^~~~
a.cc:7:6: note: 'void swap(int, int)' previously defined here
    7 | void swap(int x, int y) {
      |      ^~~~
a.cc:53:14: error: expected declaration before '}' token
   53 | }            }
      |              ^
a.cc:54:9: error: expected declaration before '}' token
   54 |         }
      |         ^
a.cc:55:5: error: expected declaration before '}' token
   55 |     }
      |     ^
a.cc:57:5: error: expected unqualified-id before 'for'
   57 |     for(int i=0; i<n; i++)
      |     ^~~
a.cc:57:18: error: 'i' does not name a type
   57 |     for(int i=0; i<n; i++)
      |                  ^
a.cc:57:23: error: 'i' does not name a type
   57 |     for(int i=0; i<n; i++)
      |                       ^
a.cc:60:5: error: expected unqualified-id before 'return'
   60 |     return 0;
      |     ^~~~~~
a.cc:61:1: error: expected declaration before '}' token
   61 | }
      | ^
a.cc:63:2: error: expected unqualified-id before '/' token
   63 | */
      |  ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int n,l;
    char S[100][100];

    cin >> n >> l;

    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            cin >> S[i][j];
        }
    }

    for(int i=0;i<n;i++){
        sort(S[i],S[i]+l);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            cout << S[i][j];

        }
    }
    couｔ<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'cou\U0000ff54' was not declared in this scope
   27 |     couｔ<<endl;
      |     ^~~~~
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int n,l;
    char S[100][100];

    cin >> n >> l;

    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            cin >> S[i][j];
        }
    }

    for(int i=0;i<n;i++){
        sort(S[i],S[i]+l);
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<l;j++){
            cout << S[i][j];

        }
    }
    cou<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:5: error: 'cou' was not declared in this scope
   27 |     cou<<endl;
      |     ^~~
Language: Java

import java.util.*;
 
public class Main{
 
public static void main(String[] args){
 
Scanner x = new Scanner(System.in);
 
int num=x.nextInt();
int length=x.nextInt();
 
String[] arr = new String[num];
 
for(int i = 0;i<num;i++){
arr[i]=x.next();
}
Arrays.sort(arr);
String result="";
for(int i = 0;i<num;i++){
result += arr[i];
}
 
return result;
}
 
}

Compiler output:
Main.java:23: error: incompatible types: unexpected return value
return result;
       ^
1 error
Language: C++

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

int main()
{
  vector<int> in(3);
  map<int,int> mp;

  int N, L;

  cin >> N;
  cin >> L;

  vector<string> S;
  S.resize(N);
  for(auto &s: S)
    cin >> s;

  sort(S.begin(), S.end());

  for(auto s: S)
    cout << s;
  cout << endl;

  return 0;
}


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

import java.util.*;


public class Main {
  static int N, L;
  static String[] S;

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

    N = sc.nextInt();
    L = sc.nextInt();

    S = new String[N];
    for(int i = 0; i < N; i++) {
      S[i] = sc.next();
    }

    Arrays.sort(S);

    for(int i = 0; i < N; i++) {
      System.out.print(S[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:4:1: error: expected unqualified-id before 'public'
    4 | public class Main {
      | ^~~~~~
Language: C++

#include<stdio.h>
//#include<cstdio>
#include<iostream>
#include<fstream>
#include<string.h>
#include<algorithm>
#include<functional>
using namespace std;

int main(void){

	int L, N;
	string S[101];

	ifs >> L >> N;

	for (int i = 0; i < N; i++)cin >> S[i];
	sort(S, S + N);
	for (int i = 0; i < N; i++)cout << S[i];
	cout << endl;
	

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:9: error: 'ifs' was not declared in this scope; did you mean 'ffs'?
   15 |         ifs >> L >> N;
      |         ^~~
      |         ffs
Language: C++

//gcc -std=gnu11 -O2 -o a.out Main.c -lm

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

int sortFunc(const void *str1, const void *str2){
	return strcmp(str1, str2);
}

int main(void)
{
	
	int n, l, i;
	char str[100][101];
	int ret;
	
	ret = scanf("%d %d", &n, &l);
	for(i = 0 ; i < n ; i++){
		ret = scanf("%s", str[i]);
	}
	
	qsort(str, n, sizeof(str[0]), sortFunc);
	
	for(i = 0 ; i < n ; i++){
		printf("%s", str[i]);
	}
	printf("\n");
	
	return 0;
}


Compiler output:
a.cc: In function 'int sortFunc(const void*, const void*)':
a.cc:8:23: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive]
    8 |         return strcmp(str1, str2);
      |                       ^~~~
      |                       |
      |                       const void*
In file included from a.cc:4:
/usr/include/string.h:156:32: note:   initializing argument 1 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                    ~~~~~~~~~~~~^~~~
a.cc:8:29: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive]
    8 |         return strcmp(str1, str2);
      |                             ^~~~
      |                             |
      |                             const void*
/usr/include/string.h:156:50: note:   initializing argument 2 of 'int strcmp(const char*, const char*)'
  156 | extern int strcmp (const char *__s1, const char *__s2)
      |                                      ~~~~~~~~~~~~^~~~
Language: C++

#include <iostream>
#include <string>
using namespace std;
 
string tab[101];
int main() {
cin >> n >> l;
for (int i = 0; i < n; i++) cin >> tab[i];
sort(tab, tab+n);
for (int i = 0; i < n; i++) cout <<tab[i];
cout <<"\n";
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: 'n' was not declared in this scope
    7 | cin >> n >> l;
      |        ^
a.cc:7:13: error: 'l' was not declared in this scope
    7 | cin >> n >> l;
      |             ^
a.cc:9:1: error: 'sort' was not declared in this scope; did you mean 'short'?
    9 | sort(tab, tab+n);
      | ^~~~
      | short
Language: Java

/* Filename: ABC042B.java
 * Author: Mushiyo
 */

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

public class ABC042B {

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

		while (input.hasNext()) {
			int N = input.nextInt();
			int L = input.nextInt();
			String[] S = new String[N];
			
			for(int i = 0; i < S.length; ++i){
				S[i] = input.next();
			}
			
			Arrays.sort(S);
			
			StringBuilder sol = new StringBuilder();
			for(int i = 0; i < S.length; ++i){
				sol.append(S[i]);
			}
			
			System.out.println(sol);
		}
	}

}


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

#include <iostream>
#include <vector>
using namespace std;
int main (){
	int N,L;
	string T,U;
	cin >> N >> L;
	vector<string> s;
	cin.ignore();	
	for(int i = 0; i < N; ++i)
	{
		cin >> T;
		s.push_back(T);
	}
	sort(s.begin(),s.end());
	for(int i = 0; i < N; ++i)
	{
		U = U + s[i];
	}
	cout << U << "\n";
	return 0;
}

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

#include "iostream"
#include "vector"
using namespace std;

int main(int argc, char const *argv[])
{
	int N,L;
	cin >> N >> L;
	vector<string> S;
	cin.ignore();
	string s;
	for (int i = 0; i < N; ++i)
	{
		cin >> s;
		S.push_back(s); 
	}

	sort(S.begin(), S.end());
	s = "";
	for (int i = 0; i < N; ++i)
	{
		s += S[i];
	}

	cout << s << endl;
	return 0;
}

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

#include <iostream>
#include <vector>
#include <string>
#include <algorithm
using namespace std;
 
int main()
{
    size_t n,t; cin>>n;cin>>t;
    vector<string> v(n);
    for(auto&& str : v)
        cin >> str;
    sort(v.begin(), v.end());
    cout << v[0] << v[1] << endl;
}

Compiler output:
a.cc:4:20: error: missing terminating > character
    4 | #include <algorithm
      |                    ^
Language: C++

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

int main()
{
    size_t n,t; cin>>n;cin>>t;
    vector<string> v(n);
    for(auto&& str : v)
        cin >> str;
    sort(v.begin(), v.end());
    cout << v[0] << v[1] << endl;
}

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

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

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int l = in.nextInt();
        String[] s = new String[n];
        for(int i=0; i<n; i++) {
            s[i] = in.nextInt();
        }
        Arrays.sort(s);
        for(int i=0; i<n; i++) {
            System.out.print(s[i]);
        }
        System.out.println();

        in.close();
    }
}


Compiler output:
Main.java:11: error: incompatible types: int cannot be converted to String
            s[i] = in.nextInt();
                             ^
1 error
Language: C++

#include <cstdio>
#include <vector>
#include <string>
using namespace std;

int main(){
	int n, l;
	scanf("%d %d", &n, &l);
	vector<string> s;
	for(int i=0; i<n; i++){
		char tmp[l+1];
		scanf("%s", tmp);
		s.push_back(tmp);
	}
	sort(s.begin(), s.end());

	for(int i=0; i<n; i++){
		printf("%s", s[i].c_str());
	}
	printf("\n");

	return 0;
}

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

import java.util.Scanner;
import java.util.Comparator;
 
public class Main{
public static void main(String[] args){
Scanner sc =new Scanner(System.in);
int n=sc.nextInt();
String[] s=new String[n];
for(int i=0; i<n; i++){
s[i]=sc.next();}
 
Arrays.sort(s);
 
for(int i=0; i<n; i++){
System.out.println(s[i]);}
 
 
}}


Compiler output:
Main.java:12: error: cannot find symbol
Arrays.sort(s);
^
  symbol:   variable Arrays
  location: class Main
1 error
Language: C++

#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(void){
    int n,l; cin>>n>>l;
    vector<string> s(n);
    for(int i=0;i<n;i++) cin>>s[i];
    sort(s.begin(),s.end());
    for(int i=0;i<n;i++) cout<<s[i];
    cout<<endl;
}


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

import java.util.Scanner;
import java.util.Comparator;

public class Main{
public static void main(String[] args){
Scanner sc =new Scanner(System.in);
int n=sc.nextInt();
String[] s=new String[n];
for(int i=0; i<s.length; i++){
s[i]=sc.next();}

for(int i=0; i<s.length-1; i++){
}
Arrays.sort(s);

for(int i=0; i<s.length; i++){
System.out.println(s[i]);}


}}

Compiler output:
Main.java:14: error: cannot find symbol
Arrays.sort(s);
^
  symbol:   variable Arrays
  location: class Main
1 error
Language: Java


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int L = sc.nextInt();
    List<String> slist = new ArrayList<>();
    
		// 文字列の入力
    for(int i=0; i<N; i++){
      slist.add(sc.next());
    }
    List<String> subList = slist.subList(1, teamsName.size());
    Collections.sort(slist);
    StringBuffer sb = new StringBuffer(L * N);
    for(String s: slist){
     sb.append(s);
    }
    System.out.println(sb);
	}
}


Compiler output:
Main.java:15: error: cannot find symbol
    List<String> subList = slist.subList(1, teamsName.size());
                                            ^
  symbol:   variable teamsName
  location: class Main
1 error
Language: C++

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

using namespace std;

int main() {
	int a,b;
	cin >> a >> b;
	string c[100];
	for(int i=0;i<a;i++){
		cin >> c[i];
		
	}
	sort(c,c+a);
	
	for(int j=0;j<a;j++){
		cout << c[j];
	}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: expected '}' at end of input
   19 |         }
      |          ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^
Language: C++

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

int main() {
    int N, L;
    cin >> N >> L;
    vector <string> Sset;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        Sset.push_back(s);
        s.clear();
    }
    sort(Sset.begin(), Sset.end());
    string answer;
    answer = null;
    for (int i = 0; i< N; i++) {
        answer += Sset[i];
    }
    cout << answer << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:14: error: 'null' was not declared in this scope
   19 |     answer = null;
      |              ^~~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N, L;
    cin >> N >> L;
    vector <string> Sset;
    for (int i = 0; i < N; i++) {
        string s;
        cin >> s;
        Sset.push_back(s);
        s.clear();
    }
    sort(Sset.begin(), Sset.end())
    string answer;
    answer = null;
    for (int i = 0; i< N; i++) {
        answer += Sset[i];
    }
    cout << answer << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:35: error: expected ';' before 'string'
   17 |     sort(Sset.begin(), Sset.end())
      |                                   ^
      |                                   ;
   18 |     string answer;
      |     ~~~~~~                         
a.cc:19:5: error: 'answer' was not declared in this scope
   19 |     answer = null;
      |     ^~~~~~
a.cc:19:14: error: 'null' was not declared in this scope
   19 |     answer = null;
      |              ^~~~
Language: Java


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int L = sc.nextInt();
    List<String> slist = new ArrayList<>();
    
		// 文字列の入力
    for(int i=0; i<N; i++){
      slist.add(sc.nextInt());
    }
    Collections.sort(slist);
    StringBuffer sb = new StringBuffer(L * N);
    for(String s: slist){
    sb.append(s);
    }
	}
}


Compiler output:
Main.java:13: error: incompatible types: int cannot be converted to String
      slist.add(sc.nextInt());
                          ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

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

char S[101][101];
char *ans[101];

int main (void) {
	int N, L;
	char *tmp;
	cin.tie(0);
	ios::sync_with_stdio(false);

	cin >> N >> L;
	for (int i = 0; i < N; i++) {
		cin >> S[i];
		ans[i] = S[i];
	}

	for (int i = 1; i < N; i++) {
		if (strcmp(ans[i-1], ans[i]) > 0) {
			tmp = ans[i-1];
			ans[i-1] = ans[i];
			ans[i] = tmp;
		}
	}
	for (int i = 0; i < N; i++) cout << ans[i];
	cout << endl;
	
	return 0;
}
yuta@yuta-HP-P

Compiler output:
a.cc:34:5: error: stray '@' in program
   34 | yuta@yuta-HP-P
      |     ^
a.cc:34:1: error: 'yuta' does not name a type
   34 | yuta@yuta-HP-P
      | ^~~~
Language: Java


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		int L = sc.nextInt();
    List<String> slist = new ArrayList<>;
    
		// 文字列の入力
    for(int i=0; i<N; i++){
      slist.add(sc.nextInt());
    }
    Collections.sort(slist);
    StringBuffer sb = new StringBuffer(L * N);
    for(String s: slist){
    sb.append(s);
    }
	}
}


Compiler output:
Main.java:9: error: '(' or '[' expected
    List<String> slist = new ArrayList<>;
                                        ^
1 error
Language: Java

import java.util.ArrayList;
import java.util.Collections;
import java.io.*;
import java.util.Scanner;

class Main{
    public static void main(String[] args)throws IOException{
	BufferedReader br = new	BufferedReader(new InputStreamReader(System.in)\
);
        ArrayList<String> list = new ArrayList<String>();
	
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
	int L = scan.nextInt();
        for(int i=0;i<N;i++){
            list.add(br.readLine());
	}
	String allStr = "";
        Collections.sort(list);
        for(String str : list){
            allStr += str;
        }
        System.out.println(allStr.replaceAll("\n",""));
    }
}

Compiler output:
Main.java:8: error: illegal character: '\'
	BufferedReader br = new	BufferedReader(new InputStreamReader(System.in)\
	                       	                                               ^
1 error
Language: C++

typedef vector<VI> VVI;

#define MAX(x,y) ( (x) > (y) ? (x) : (y) )
#define MIN(x, y) ( (x) < (y) ? (x) : (y) )
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
#define IVFOR(p,a) for(vector<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ILFOR(p,a) for(list<int>::iterator p = (a).begin(); p!=(a).end(); p++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define CHECK(x)  cout << #x << " = " << (x) << endl
#define FINA(y) cout << (y) << endl

int main(){

  int n, l;

  cin >> n >> l;

  vector<string> v(n);

  REP(i,n){
    cin >> v[i];
  }
  SORT(v);

  REP(i,n){
    cout << v[i];
  }

  cout << endl;
    

 return 0;
}

Compiler output:
a.cc:1:9: error: 'vector' does not name a type
    1 | typedef vector<VI> VVI;
      |         ^~~~~~
a.cc: In function 'int main()':
a.cc:18:3: error: 'cin' was not declared in this scope
   18 |   cin >> n >> l;
      |   ^~~
a.cc:20:3: error: 'vector' was not declared in this scope
   20 |   vector<string> v(n);
      |   ^~~~~~
a.cc:20:10: error: 'string' was not declared in this scope
   20 |   vector<string> v(n);
      |          ^~~~~~
a.cc:20:18: error: 'v' was not declared in this scope
   20 |   vector<string> v(n);
      |                  ^
a.cc:10:17: error: 'sort' was not declared in this scope; did you mean 'short'?
   10 | #define SORT(c) sort((c).begin(),(c).end())
      |                 ^~~~
a.cc:25:3: note: in expansion of macro 'SORT'
   25 |   SORT(v);
      |   ^~~~
a.cc:28:5: error: 'cout' was not declared in this scope
   28 |     cout << v[i];
      |     ^~~~
a.cc:31:3: error: 'cout' was not declared in this scope
   31 |   cout << endl;
      |   ^~~~
a.cc:31:11: error: 'endl' was not declared in this scope
   31 |   cout << endl;
      |           ^~~~
Language: Java

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class B {
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int[] a = strToIntArray(br.readLine());

			List<String> SList = new ArrayList<String>();
			for (int i = 0; i < a[0]; i++) {
				SList.add(br.readLine());
			}

			Collections.sort(SList);

			StringBuilder sb = new StringBuilder("");

			for (String string : SList) {
				sb.append(string);
			}
			System.out.println(sb.toString());
		} catch (Exception e) {
			System.err.println("Error:" + e.getMessage());
		}
	}

	// Stringで読みこんでスペースで分割されている数字を配列に入れるやつ
	// 利用法 int[] A = strTointArray(br.readLine());
	static int[] strToIntArray(String S) {
		String[] strArray = S.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}
}


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

#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#include<cmath>
#include<cstdint>


     
#define INF 1e9
#define LINF 1e19
#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 VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()
#define chmin(a, b) a = min(a, b)
#define chmax(a, b) a = max(a, b)
#define pb push_back
#define sz size()
     
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<ll, ll>;

     
const ll MOD = 1e9 + 7;
const ll ZER = 0;

int d[3] = {-1, 0, 1};
int main(){
    string s;
    int k;
    cin >> s >> k;
    bool f = false;
    vector<int> d(10, 0);
    char mi = '', ma;
    rep(i, k){
        int a;
        cin >> a;
        d[a] = 1;
    }
    rep(i, 10){
        if(d[i])continue;
        if(mi == '')mi = (char)(i + '0');
        ma = (char)(i + '0');
    }
    string t = "";
    if(s[0] > ma){
        rep(i, s.sz + 1)cout << mi;
        cout << endl;
        return 0;
    }
    rep(i, s.sz){
        int si = s[i] - '0';
        if(f){
          t += mi;
          continue;
        }
        rep(j, 10){
            if(d[j])continue;
            if(si == j){
                t += (char)(j + '0');
              	break;
            }
            if(si < j){
                f = true;
                t += (char)(j + '0');
                break;
            }
        }
        
    }
    cout << t << endl;
}





Compiler output:
a.cc:51:15: error: empty character constant
   51 |     char mi = '', ma;
      |               ^~
a.cc:59:18: error: empty character constant
   59 |         if(mi == '')mi = (char)(i + '0');
      |                  ^~
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;
string to_string(int i){
        string S;
        while(i){
          int d = i%10;
          i /= 10;
          S += d+'0';    
        }
        reverse(S.begin(), S.end());
        return S;
}
int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int N, K;
  cin >> N >> K;
  vector<char> D;
  int ar[10];
  memset(ar, 0, sizeof(ar));
  for (int i = 0; i < K; i++){
    int A;
    cin >> A;
    ar[A]++;
  }
  int Ans;
  for (int i = 0; i <=9; i++)
    if (ar[i] == 0)
      D.push_back(i+'0');
  for (int i = N; ; i++){
    string S = to_string(i);
    bool use = true;
    for (int j = 0; j < S.size(); j++){
      bool ok = false;
      for (int k = 0; k < D.size(); k++){
        if (D[k] == S[j])
          ok = true;
      }
      if (ok == false)
        use = false;
    }
    if (use){
      Ans = i;
      break;   
    }
  }
  cout << Ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:25: error: call of overloaded 'to_string(int&)' is ambiguous
   32 |     string S = to_string(i);
      |                ~~~~~~~~~^~~
a.cc:4:8: note: candidate: 'std::string to_string(int)'
    4 | string to_string(int i){
      |        ^~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4240:3: note: candidate: 'std::string std::__cxx11::to_string(int)'
 4240 |   to_string(int __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4259:3: note: candidate: 'std::string std::__cxx11::to_string(unsigned int)'
 4259 |   to_string(unsigned __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4275:3: note: candidate: 'std::string std::__cxx11::to_string(long int)'
 4275 |   to_string(long __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4294:3: note: candidate: 'std::string std::__cxx11::to_string(long unsigned int)'
 4294 |   to_string(unsigned long __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4310:3: note: candidate: 'std::string std::__cxx11::to_string(long long int)'
 4310 |   to_string(long long __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4327:3: note: candidate: 'std::string std::__cxx11::to_string(long long unsigned int)'
 4327 |   to_string(unsigned long long __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4401:3: note: candidate: 'std::string std::__cxx11::to_string(float)'
 4401 |   to_string(float __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4411:3: note: candidate: 'std::string std::__cxx11::to_string(double)'
 4411 |   to_string(double __val)
      |   ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4421:3: note: candidate: 'std::string std::__cxx11::to_string(long double)'
 4421 |   to_string(long double __val)
      |   ^~~~~~~~~
Language: C++

class Solution{

public:
    int handMoney(int N, const vector<bool>& dislikes){

        int smallestlike = 0;
        for(;dislikes[smallestlike];smallestlike ++);

        vector<int> num;
        while(N) num.push_back(N % 10), N /= 10;

        int carry = 0;
        for(int i = 0; i < num.size(); i ++){
            int d = num[i] + carry;
            for(; d < 10; d ++)
                if(!dislikes[d]) break;

            if(d != 10){
                if(d > num[i]) for(int j = 0; j < i; j ++) num[j] = smallestlike;
                num[i] = d, carry = 0;
            }
            else num[i] = smallestlike, carry = 1;
        }
        if(carry) num.push_back(1);

        int res = 0;
        for(int i = num.size() - 1; i >= 0; i --)
            res = res * 10 + num[i];
        return res;
    }
};

Compiler output:
a.cc:4:32: error: 'vector' does not name a type
    4 |     int handMoney(int N, const vector<bool>& dislikes){
      |                                ^~~~~~
a.cc:4:38: error: expected ',' or '...' before '<' token
    4 |     int handMoney(int N, const vector<bool>& dislikes){
      |                                      ^
a.cc: In member function 'int Solution::handMoney(int, int)':
a.cc:7:14: error: 'dislikes' was not declared in this scope
    7 |         for(;dislikes[smallestlike];smallestlike ++);
      |              ^~~~~~~~
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<int> num;
      |         ^~~~~~
a.cc:9:16: error: expected primary-expression before 'int'
    9 |         vector<int> num;
      |                ^~~
a.cc:10:18: error: 'num' was not declared in this scope; did you mean 'enum'?
   10 |         while(N) num.push_back(N % 10), N /= 10;
      |                  ^~~
      |                  enum
a.cc:13:28: error: 'num' was not declared in this scope; did you mean 'enum'?
   13 |         for(int i = 0; i < num.size(); i ++){
      |                            ^~~
      |                            enum
a.cc:16:21: error: 'dislikes' was not declared in this scope
   16 |                 if(!dislikes[d]) break;
      |                     ^~~~~~~~
a.cc:24:19: error: 'num' was not declared in this scope; did you mean 'enum'?
   24 |         if(carry) num.push_back(1);
      |                   ^~~
      |                   enum
a.cc:27:21: error: 'num' was not declared in this scope; did you mean 'enum'?
   27 |         for(int i = num.size() - 1; i >= 0; i --)
      |                     ^~~
      |                     enum
Language: Java

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class MainC {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int cost = scanner.nextInt();
        int numDigits = scanner.nextInt();
        boolean[] badDigits = new boolean[10];
        
        for (int i=0; i<numDigits; i++) {
            int badDigit = scanner.nextInt();
            badDigits[badDigit] = true;
        }
        
        // we can have possible change of 1 to 100,000
        // In case we can't pay the initial amount with x digits we pad one more digit.
        
        for (int change=cost; change<100000; change++) {
            // give up on change amount if she hates a digit
            int currChange = change;
            while (currChange > 0) {
                int currDigit = currChange % 10;
                if (badDigits[currDigit])
                    break;
                else {
                    currChange /= 10;
                }
            }
            // currChange = 0 OR we had a bad digit
            if (currChange == 0) {
                System.out.println(change);
                break;
            }
            
        }
        scanner.close();
    }
}


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

#include <iostream>

using namespace std;

int invalidDigit[10];
int res = 1 << 30;
int n;

void findMinNumber(int now)
{
	if (now >= n)
	{
		res = fminl(now, res);
		return;
	}

	for (int i = 0; i < 10; i++)
	{
		if (!invalidDigit[i])
		{
			if (now == 0 && i == 0)
			{
				continue;
			}

			findMinNumber(10 * now + i);
		}
	}
}

int main()
{	
	int k; cin >> n >> k;
	for (int i = 0; i < k; i++)
	{
		int x; cin >> x;
		invalidDigit[x] = true;
	}

	findMinNumber(0);

	cout << res;
	return 0;
}

Compiler output:
a.cc: In function 'void findMinNumber(int)':
a.cc:13:23: error: 'fminl' was not declared in this scope
   13 |                 res = fminl(now, res);
      |                       ^~~~~
Language: C++

#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    int d[10];
    memset(d,0,sizeof(d));
    for(int i=0;i<k;i++)
    {
        int x;
        cin>>x;
        d[x]=1;
    }
    for(int i=n;i<=10000;i++)
    {
        bool p=true;
        int a[10];
        memset(a,0,sizeof(a));
        while(i>0)
        {
            int t=i%10;
            i/=10;
            a[t]++;
        }
        for(int j=0;j<=9;j++)
        {
            if(t[i]>0 && d[i]>0)
            {
                p=false;
                break;
            }
        }
        if(p)
        {
            cout<<i;
            break;
        }
    }
    return 0;
}







Compiler output:
a.cc: In function 'int main()':
a.cc:31:16: error: 't' was not declared in this scope
   31 |             if(t[i]>0 && d[i]>0)
      |                ^
Language: C

#include<stdio.h>
int search(int d,int arr,int k){
  int i,flag=0;
  for(i=0;i<k;i++){
    if(d==arr[i]){
      flag=1;
      break;
    }
  }
  return flag;
}
int main(){
  int n,k;
  scanf("%d %d\n",&n,&k);
  int m=1,d,i;
  int arr[k];
  for(i=0;i<k;i++){
    scanf("%d ",&arr[i]);
  }
  while(m!=0){
    while(n!=0){
      d=n%10;
      m= search(d,arr,k);
      if(m==1) {break;}
      n= n/10;
    }
    n++;
  }
  printf("%d\n",n);
  return 0;
}

Compiler output:
main.c: In function 'search':
main.c:5:14: error: subscripted value is neither array nor pointer nor vector
    5 |     if(d==arr[i]){
      |              ^
main.c: In function 'main':
main.c:23:19: error: passing argument 2 of 'search' makes integer from pointer without a cast [-Wint-conversion]
   23 |       m= search(d,arr,k);
      |                   ^~~
      |                   |
      |                   int *
main.c:2:22: note: expected 'int' but argument is of type 'int *'
    2 | int search(int d,int arr,int k){
      |                  ~~~~^~~
Language: C++

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	string s;
      	cin>>s;
      	int k;
      	cin>>k;
      	bool n[10];
      	int index;
      	for(int i=0;i<k;i++){
        	cin>>index;
            n[index]=true;
        }
      	int min;
      	for(index =0;index<10;index++){
        	if(n[index]==false){
              min = index;
              break;
            }
        }
      	for(int i=0;i<n.length();i++){
        	if(n[s[i]]==true){
            	n[s[i]]=index;
            }
        }
      cout<<s;
    }

Compiler output:
a.cc: In function 'int main()':
a.cc:21:25: error: request for member 'length' in 'n', which is of non-class type 'bool [10]'
   21 |         for(int i=0;i<n.length();i++){
      |                         ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
	string n;
  	cin>>n;
  	int k;
  	cin>>k;
  	bool n[10];
  	int index;
  	for(int i=0;i<k;i++){
    	cin>>index;
        n[index]=true;
    }
  	int min;
  	for(index =0;index<10;index++){
    	if(n[index]==false){
          min = index;
          break;
        }
    }
  	for(int i=0;i<n.length();i++){
    	if(n[s[i]]==true){
        	n[s[i]]=index;
        }
    }
  cout<<s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: conflicting declaration 'bool n [10]'
    8 |         bool n[10];
      |              ^
a.cc:4:16: note: previous declaration as 'std::string n'
    4 |         string n;
      |                ^
a.cc:22:14: error: 's' was not declared in this scope
   22 |         if(n[s[i]]==true){
      |              ^
a.cc:26:9: error: 's' was not declared in this scope
   26 |   cout<<s;
      |         ^