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

#include <bits/stdc++.h>
using namespace std;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)

typedef long long ll;

int main()
{
    string s;
    cin >> s;
    vector<bool> a(26);
    if(s.size()==26)
        cout << "-1" << endl;
    else{
        rep(i, s.size()) a[s[i] - 'a']=true;
        char x=a;
        rep(i, s.size()) if (a[i] == true) x += i;
        cout << s << x << endl;
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:17:16: error: cannot convert 'std::vector<bool>' to 'char' in initialization
   17 |         char x=a;
      |                ^
      |                |
      |                std::vector<bool>
Language: C++

// AGC22-A-cpp.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main()
{
	string s;
	cin >> s;
	unordered_map<char, bool> m;
	for (size_t i = 0; i < 26; i++)
	{
		m['a' + i] = true;
	}
	for (size_t i = 0; i < s.size(); i++)
	{
		m[s[i]] = false;
	}
	if (s.size() < 26)
	{	
		for (size_t i = 0; i < 26; i++)
		{
			if (m['a' + i])
			{
				cout << s << char('a' + i) << endl;
				return 0;
			}
		}
	}
	else {
		for (size_t i = 25; i > 0; i--)
		{
			if (s[i] > s[i-1])
			{
				cout << s.substr(0, i) << char(s[i - 1] + 1) << endl;
				return 0;
			}
		}
	}
	cout << -1 << endl;

    return 0;
}



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

// AGC22-A-cpp.cpp : アプリケーションのエントリ ポイントを定義します。
//

#include "stdafx.h"
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main()
{
	string s;
	cin >> s;
	unordered_map<char, bool> m;
	for (size_t i = 0; i < 26; i++)
	{
		m['a' + i] = true;
	}
	for (size_t i = 0; i < s.size(); i++)
	{
		m[s[i]] = false;
	}
	if (s.size() < 26)
	{	
		for (size_t i = 0; i < 26; i++)
		{
			if (m['a' + i])
			{
				cout << s << char('a' + i) << endl;
				return 0;
			}
		}
	}
	else {
		for (size_t i = 0; i < 25; i++)
		{
			if (s[i+1] < s[i]) {
				if (i == 0) break;
				char si = s[i];
				
				
				for (size_t j = 0; j < 26-i; j++)
				{
					m[s[i + j ]] = true;
				}
				s = s.substr(0, i - 1);
				for (size_t j = 0; j < 26; j++)
				{
					if (m['a' + j])
					{
						cout << s << char('a' + j) << endl;
						return 0;
					}
				}
			}

		}
	}
	cout << -1 << endl;

    return 0;
}



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

#include <cstdio>
#include <string>

using namespace std;

int main() {
  int i;
  char S[30];
  bool used[26];
  scanf("%s", S);
  int N = strlen(S);
  for (i = 0; i < N; i++) {
    int alphabet = (int)S[i] - 97;
    used[alphabet] = true;
  }
  if (N < 26) {
    int not_used;
    for (i = 0; i < 26; i++) {
      if (!used[i]) {
	not_used = i + 97;
	break;
      }
    }
    string ans = string(S);
    ans += (char)not_used;
    const char* ans_char = ans.c_str();
    printf("%s", ans_char);
  } else {
    int gyakuten = 0;
    for (i = 25; i >= 1; i--) {
      if (S[i] > S[i-1]) {
	gyakuten = i;
	break;
      }
    }
    //printf("gyakuten:%d\n", gyakuten);
    if (gyakuten == 0) {
      printf("-1");
    } else {
      for (i = gyakuten; i < 26; i++) {
	int alphabet = (int)S[i] - 97;
	used[alphabet] = false;
      }
      /*for (i = 0; i < 26; i++) {
	printf("(%d:%d) ", i, used[i]);
	}*/
      int not_used;
      for (i = 0; i < 26; i++) {
	if (!used[i] && i+97 > (int)S[gyakuten-1]) {
	  not_used = i + 97;
	  break;
	}
      }
      //printf("not_used = %d\n", not_used);
      string ans = string(S);
      ans.erase(ans.begin() + gyakuten - 1, ans.begin() + 26);
      ans += (char)not_used;
      const char* ans_char = ans.c_str();
      printf("%s", ans_char);
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:11: error: 'strlen' was not declared in this scope
   11 |   int N = strlen(S);
      |           ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <string>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main(){
	string words;
	string alphabet = "abcdefghijklmnopqrstuvwxyz";
	cin>>words;
	
	if(words == "zyxwvutsrqponmlkjihgfedcba"){
		cout<<-1<<endl;
		return 0;
	}
	
	for(int i= 0;i<26;i++){
		alphabet.erase(words[i]);
	}

	if(state){
		words += alphabet[0];
		cout<<words<<endl;
		return 0;
	}

	return 0;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:12: error: 'state' was not declared in this scope; did you mean 'static'?
   20 |         if(state){
      |            ^~~~~
      |            static
Language: C++

#include<iostream>
#include<string>

using namespace std;

int main(){
	string words;
	string alphabet = "abcdefghijklmnopqrstuvwxyz";
	bool state = false;
	cin>>words;
	
	if(words == "zyxwvutsrqponmlkjihgfedcba"){
		cout<<-1<<endl;
		return 0;
	}
	
	for(int i= 0;i<26;i++){
		if(alphabet.find(words[i] == string::npos){
			state = false;
		}
		alphabet.erase(words[i]);
	}

	if(state){
		words += alphabet[0];
		cout<<words<<endl;
		return 0;
	}else{
		cout<<-1<<endl;
		return 0;
	}

	return 0;	
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:59: error: expected ';' before '{' token
   18 |                 if(alphabet.find(words[i] == string::npos){
      |                                                           ^
      |                                                           ;
a.cc:18:33: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::find(_CharT, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   18 |                 if(alphabet.find(words[i] == string::npos){
      |                    ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2758:7: note: declared here
 2758 |       find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT;
      |       ^~~~
a.cc:21:41: error: expected ')' before ';' token
   21 |                 alphabet.erase(words[i]);
      |                                         ^
      |                                         )
a.cc:18:19: note: to match this '('
   18 |                 if(alphabet.find(words[i] == string::npos){
      |                   ^
a.cc:21:31: error: could not convert 'alphabet.std::__cxx11::basic_string<char>::erase(((std::__cxx11::basic_string<char>::size_type)words.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))), ((std::__cxx11::basic_string<char>::size_type)std::__cxx11::basic_string<char>::npos))' from 'std::__cxx11::basic_string<char>' to 'bool'
   21 |                 alphabet.erase(words[i]);
      |                 ~~~~~~~~~~~~~~^~~~~~~~~~
      |                               |
      |                               std::__cxx11::basic_string<char>
Language: C++

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

using namespace std;

int main()
{
	int i = 0, a;
	int f[26];
	string in, out;
	for (int j = 0; j < 26; j++)
	{
		f[j] = 0;
	}
	cin >> in;
	
	while (in[i] != '\0')
	{
		for(int j = 0; j < 26; j++)
		{
			if (in[i] == (char)('a' + j))
			{
				f[j] = i+1;
			}
		}
		i++;
	}

	if (i < 25) {
		for (int j = 0; j < 25; j++) 
		{
			if (f[j] == 0) {
				out = in + (char)('a' + j);
				break;
			}
		}
	}
	else {
		if (in == "zyxwvutsrqponmlkjihgfedcba")
		{
			out = "-1";
		}
		else {
			for (int j = 25; j > 0; j--) {
				if (in[j] != (char)(in[j-1] - 1))
				{
					string str = in.substr(0, j);
					out = str + in[25];
					break;
				}
			}
		}
	}

/*	for (int l = 0; l < 26; l++)
	{
		cout << f[l];
	}
*/
	cout << out;
	return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:68:18: error: expected '}' at end of input
   68 |         return 0;
      |                  ^
a.cc:14:1: note: to match this '{'
   14 | {
      | ^
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>

#define MAX_N 64

char S[MAX_N];

bool X[MAX_N];

int main()
{
	scanf("%s", S);

	memset(X, 0, sizeof(X));

	int i = 0;
	for (i = 0; S[i] != '\0'; ++i) {
		X[S[i] - 'a'] = true;
	}

	if (i != 26) {
		printf("%s", S);
		int j = 0;
		for (; X[j]; ++j);
		printf("%c\n", ('a' + j));
	} else {
		int j = 25;
		for (; j > 0; --j) {
			if (S[j] > S[j - 1]) {
				break;
			}
		}
		if (j == 0) {
			printf("-1\n");
		} else {
			//printf("S[j-1]:%c\n",S[j-1]);
			for (int k = i - 1; k >= 0; --k) {
				if (S[j - 1] < S[k]) {
					S[j - 1] = S[k];
					break;
				}
			}
			S[j] = '\0';
			printf("%s\n", S);
		}
	}

	scanf("%s",S);

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'memset' was not declared in this scope
   16 |         memset(X, 0, sizeof(X));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 |
Language: C++

#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>

#define MAX_N 64

char S[MAX_N];

bool X[MAX_N];

int main()
{
	scanf("%s", &S);

	memset(X, 0, sizeof(X));

	int i = 0;
	for (i = 0; S[i] != '\0'; ++i) {
		X[S[i] - 'a'] = true;
	}

	if (i != 26) {
		printf("%s", S);
		int j = 0;
		for (; X[j]; ++j);
		printf("%c\n", ('a' + j));
	} else {
		int j = 25;
		for (; j > 0; --j) {
			if (S[j] > S[j - 1]) {
				break;
			}
		}
		if (j == 0) {
			printf("-1\n");
		} else {
			S[j-1] = S[i - 1];
			S[j] = '\0';
			printf("%s\n", S);
		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: 'memset' was not declared in this scope
   16 |         memset(X, 0, sizeof(X));
      |         ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    4 | #include <algorithm>
  +++ |+#include <cstring>
    5 |
Language: C++

#include <bits/stdc++.h>
using namespace std;

bool cek[30];

int main(){
    string s;
    cin >> s;
    
    int n = s.length();
    for(int i = 0; i < n; i++){
        cek[s[i]-'a']= true;
    }
    if(n != 26){
        cout << s;
        for(int i = 0; i < 26; i++){
            if(cek[i]) continue;
            cout << i + 'a' << endl;
            break;
        }
        return 0;
    }
    string s2 = s;
    if(!next_permutation(a, a + n)) return cout << "-1" << endl;
    
    for(int i = 0; i < n; i++){
        cout << s2[i];
        if(s2[i] != s[i])break;
    }
    cout << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:26: error: 'a' was not declared in this scope
   24 |     if(!next_permutation(a, a + n)) return cout << "-1" << endl;
      |                          ^
a.cc:24:57: error: cannot convert 'std::basic_ostream<char>::__ostream_type' {aka 'std::basic_ostream<char>'} to 'int' in return
   24 |     if(!next_permutation(a, a + n)) return cout << "-1" << endl;
      |                                            ~~~~~~~~~~~~~^~~~~~~
      |                                                         |
      |                                                         std::basic_ostream<char>::__ostream_type {aka std::basic_ostream<char>}
Language: C++

#include<cstdio>
#include <bits/stdc++.h>
using namespace std;
string p;
int n, v[30];

int main()
{
    int ck = 0;
    cin >> p;
    for (int i = 0; p[i]; i++)
    {
        v[p[i] - 'a'] = 1;
        if (p[i] + i != 'z')
        {
            ck = 1;
        }
    }
    n = p.length();
    if (n != 26) {
        for (int i = 0; i < 26; i++)if (!v[i])break;
        p[n] = i + 'a';
        cout << p << endl;
        return 0;
    }
    if (ck == 0) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < 26; j++)v[j] = 0;
        for (int j = 0; j < i; j++) {
            v[p[j] - 'a'] = 1;
        }
        for (int j = p[i] - 'a' + 1; j < 26; j++) {
            if (!v[j]) {
                v[j] = 1;
                p[i] = 'a' + j;
                p[i + 1] = 0;
                cout << p << endl;
                return 0;
            }
        }
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: 'i' was not declared in this scope
   22 |         p[n] = i + 'a';
      |                ^
Language: C++

#include<cstdio>
#include <bits/stdc++.h>
using namespace std;
string p;
int n, v[30];

int main()
{
    int ck = 0;
    cin >> p;
    for (int i = 0; p[i]; i++)
    {
        v[p[i] - 'a'] = 1;
        if (p[i] + i != 'z')
        {
            ck = 1;
        }
    }
    n = i;
    if (n != 26) {
        for (int i = 0; i < 26; i++)if (!v[i])break;
        p[n] = i + 'a';
        cout << p << endl;
        return 0;
    }
    if (ck == 0) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < 26; j++)v[j] = 0;
        for (int j = 0; j < i; j++) {
            v[p[j] - 'a'] = 1;
        }
        for (int j = p[i] - 'a' + 1; j < 26; j++) {
            if (!v[j]) {
                v[j] = 1;
                p[i] = 'a' + j;
                p[i + 1] = 0;
                cout << p << endl;
                return 0;
            }
        }
    }
}


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

#include<cstdio>
#include<algorithm>
using namespace std;
string p;
int n, v[30];

int main()
{
    int ck = 0;
    cin >> p;
    for (int i = 0; p[i]; i++)
    {
        v[p[i] - 'a'] = 1;
        if (p[i] + i != 'z')
        {
            ck = 1;
        }
    }
    n = i;
    if (n != 26) {
        for (int i = 0; i < 26; i++)if (!v[i])break;
        p[n] = i + 'a';
        cout << p << endl;
        return 0;
    }
    if (ck == 0) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = n - 1; i >= 0; i--) {
        for (int j = 0; j < 26; j++)v[j] = 0;
        for (int j = 0; j < i; j++) {
            v[p[j] - 'a'] = 1;
        }
        for (int j = p[i] - 'a' + 1; j < 26; j++) {
            if (!v[j]) {
                v[j] = 1;
                p[i] = 'a' + j;
                p[i + 1] = 0;
                cout << p << endl;
                return 0;
            }
        }
    }
}


Compiler output:
a.cc:4:1: error: 'string' does not name a type; did you mean 'stdin'?
    4 | string p;
      | ^~~~~~
      | stdin
a.cc: In function 'int main()':
a.cc:10:5: error: 'cin' was not declared in this scope
   10 |     cin >> p;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include<algorithm>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:10:12: error: 'p' was not declared in this scope
   10 |     cin >> p;
      |            ^
a.cc:19:9: error: 'i' was not declared in this scope
   19 |     n = i;
      |         ^
a.cc:23:9: error: 'cout' was not declared in this scope
   23 |         cout << p << endl;
      |         ^~~~
a.cc:23:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:23:22: error: 'endl' was not declared in this scope
   23 |         cout << p << endl;
      |                      ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include<algorithm>
  +++ |+#include <ostream>
    3 | using namespace std;
a.cc:27:9: error: 'cout' was not declared in this scope
   27 |         cout << -1 << endl;
      |         ^~~~
a.cc:27:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:23: error: 'endl' was not declared in this scope
   27 |         cout << -1 << endl;
      |                       ^~~~
a.cc:27:23: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
a.cc:40:17: error: 'cout' was not declared in this scope
   40 |                 cout << p << endl;
      |                 ^~~~
a.cc:40:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:40:30: error: 'endl' was not declared in this scope
   40 |                 cout << p << endl;
      |                              ^~~~
a.cc:40:30: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

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

int main() {
    string in; cin >> in;
    int check[26] = {0};
    int n = in.size();
    for (int i = 0; i < n; i++)
        check[in[i] - 'a'] = true;

    if (n != 26) {
        for (int i = 0; i < 26; i++) {
            if (check[i]) continue;
            cout << in + char(i + 'a') << endl;
            break;
        }
    } else {
        string in2 = in;
        int permutable  = next_permutation(in2.begin(), in2.end());
        if (!permutable) {
            cout << -1 << endl;
        } else {
            for (int i=0; i<n; i++) {
                if (in[i] == in2[i]) {
                    cout << in[i];
                } else {
                    cout << in2[i] << endl;
                    break;
                }
            }
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:27: error: 'next_permutation' was not declared in this scope
   21 |         int permutable  = next_permutation(in2.begin(), in2.end());
      |                           ^~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

char S[27];
int N,t[27];

int main()
{
	gets(S);
	N=strlen(S);
		for(int i=0;i<N;i++)
			if(t[S[i]-'a'])return puts("-1"),0;
			else t[S[i]-'a']++;
	if(N==26){
		for(int i=N-2;~i;i--){
			if(S[i]<S[i+1]){
				for(int j=0;j<i;j++)putchar(S[j]);
				putchar(S[N-1]);
				return 0;
			}
		}
		puts("-1");
		return 0;
	}
		for(int i=0;i<26;i++)
			if(!t[i])
				return printf("%s",S),putchar('a'+i),0;
	puts("-1");
	return 0;
}
//abcdefghijklmnopqrstuvwzyx
//abcdefghijklmnopqrstuvx

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

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

char S[27];
int N,t[27];

int main()
{
	gets(S);
	N=strlen(S);
		for(int i=0;i<N;i++)
			if(t[S[i]-'a'])return puts("-1"),0;
			else t[S[i]-'a']++;
	if(N==26){
		for(int i=N-2;~i;i--){
			if(S[i]<S[i+1]){
				for(int j=0;j<i;j++)putchar(S[j]);
				putchar(S[N-1]);
				return 0;
			}
		}
		puts("-1");
		return 0;
	}
		for(int i=0;i<26;i++)
			if(!t[i])
				return printf("%s",S),putchar('a'+i),0;
	puts("-1");
	return 0;
}
//abcdefghijklmnopqrstuvwzyx
//abcdefghijklmnopqrstuvx

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

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

char S[27];
int N,t[27];

int main()
{
	gets(S);
	N=strlen(S);
		for(int i=0;i<N;i++)
			if(t[S[i]-'a'])return puts("-1"),0;
			else t[S[i]-'a']++;
	if(N==26){
		for(int i=N-2;~i;i--){
			if(S[i]<S[i+1]){
				for(int j=0;j<i;j++)putchar(S[j]);
				putchar(S[N-1]);
				return 0;
			}
		}
		puts("-1");
		return 0;
	}
		for(int i=0;i<26;i++)
			if(!t[i])
				return printf("%s",S),putchar('a'+i),0;
	puts("-1");
	return 0;
}
//abcdefghijklmnopqrstuvwzyx
//abcdefghijklmnopqrstuvx

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

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<utility>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cctype>
#include<cmath>
#include<cassert>
#include<deque>
using namespace std;
int main()
{
	int sum=-1;
	string s;
	cin >> s;
	if(s.size()>26)
	{
		cout << "-1";
		return 0;
	}
	while(s.size()!=0)
		for(char a='a';a<='z';a+='b'-'a')
		{
			for(int j=0;j<s.size();j++)
			{
				if(s[j]==a)
				{
					sum=0;
					break;
				}
			}
			if(sum==-1)
			{
				cout << s << a;
				return 0;
			}
		}
		s.pop_back();
	}
	cout << -1;
	return 0;
}

Compiler output:
a.cc:47:9: error: 'cout' does not name a type
   47 |         cout << -1;
      |         ^~~~
a.cc:48:9: error: expected unqualified-id before 'return'
   48 |         return 0;
      |         ^~~~~~
a.cc:49:1: error: expected declaration before '}' token
   49 | }
      | ^
Language: C++

#include<cstdio>
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<utility>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cctype>
#include<cmath>
#include<cassert>
#include<deque>
using namespace std;
int main()
{
	int sum=-1;
	string s;
	cin >> s;
	if(s.size()>26)
	{
		cout << "-1";
		return 0;
	}
	while(s.size()!=0)
		for(char a='a';a<='z';a+='b'-'a')
		{
			for(int j=0;j<s.size();j++)
			{
				if(s[j]==a)
				{
					sum=0;
					break;
				}
			}
			if(sum==-1)
			{
				cout << s << a;
				return 0;
			}
		}
		s.pop_back();
	}
	cout << -1;
	return 0;
}

Compiler output:
a.cc:48:9: error: 'cout' does not name a type
   48 |         cout << -1;
      |         ^~~~
a.cc:49:9: error: expected unqualified-id before 'return'
   49 |         return 0;
      |         ^~~~~~
a.cc:50:1: error: expected declaration before '}' token
   50 | }
      | ^
Language: C++

#include<cstdio>
#include<bits/stdc++.h>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<utility>
#include<vector>
#include<queue>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cctype>
#include<cmath>
#include<cassert>
#include<deque>
using namespace std;
int main()
{
	int sum=-1;
	string s;
	cin >> s;
	if(s.size()>26)
	{
		cout << '-1';
		return 0;
	}
	while(s.size()!=0)
		for(char a='a';a<='z';a+='b'-'a')
		{
			for(int j=0;j<s.size();j++)
			{
				if(s[j]==a)
				{
					sum=0;
					break;
				}
			}
			if(sum==-1)
			{
				cout << s << a;
				return 0;
			}
		}
		s.pop_back();
	}
	cout << -1;
	return 0;
}

Compiler output:
a.cc:26:25: warning: multi-character character constant [-Wmultichar]
   26 |                 cout << '-1';
      |                         ^~~~
a.cc:48:9: error: 'cout' does not name a type
   48 |         cout << -1;
      |         ^~~~
a.cc:49:9: error: expected unqualified-id before 'return'
   49 |         return 0;
      |         ^~~~~~
a.cc:50:1: error: expected declaration before '}' token
   50 | }
      | ^
Language: C++

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

bitset <200> used;

bool check(string s, char last) {
	for (int i = 'a'; i <= 'z'; ++i) {
		used[i] = false;
	}
	for (char c : s) {
		used[c] = true;
	}
	for (int i = last + 1; i <= 'z'; ++i) {
		if (!used[i]) {
			cout << s << (char)i << "\n";
			exit(0);
		}
	}
}

int main()
{
	string s;
	cin >> s;
	char last = ' ';
	while (s > "") {
		check(s, last);
		last = s.back;
		s.pop_back();
	}
	cout << -1;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:26: error: cannot resolve overloaded function 'back' based on conversion to type 'char'
   30 |                 last = s.back;
      |                          ^~~~
a.cc: In function 'bool check(std::string, char)':
a.cc:21:1: warning: control reaches end of non-void function [-Wreturn-type]
   21 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n,m;
map<string,int> mp;
int main()
{
 scanf("%d",&n);
 for (int i=1;i<=n;i++)
 {
 string s;
 cin>>s;
 mp[s]++;
 }
 scanf("%d",&m);
 for (int i=1;i<=m;i++)
 {
 string s;
 cin>>s;
 mp[s]--;
 }
 int ans=0;
1
 for (map<string,int>::iterator it=mp.begin();it!=mp.end();it++)
 ans=max(ans,it->second);
 cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected ';' before 'for'
   22 | 1
      |  ^
      |  ;
   23 |  for (map<string,int>::iterator it=mp.begin();it!=mp.end();it++)
      |  ~~~
a.cc:23:47: error: 'it' was not declared in this scope; did you mean 'int'?
   23 |  for (map<string,int>::iterator it=mp.begin();it!=mp.end();it++)
      |                                               ^~
      |                                               int
Language: C++

#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
char s[30];
int vis[300];
int main(){
	cin>>s;
	for(int i = 0; i < strlen(s); i++){
		vis[s[i]] = 1;
	}
	if(strlen(s) < 26){
		if(vis['z']) {cout<<"-1"<<endl;break;}
		cout<<s;
		for(int i = 'a'; i <= 'z'; i++)
			if(!vis[i]) {printf("%c\n",i); break;}
	}
	else  {
		int t = 0;
		for(int i = 0; i < strlen(s); i++){
			if(s[i] == 'z') {t = i;break;}
		}
		if(t == 0) {cout<<"-1"<<endl; return 0;}
		for(int i = t; i < strlen(s); i++){
			vis[s[i]] = 0;
		}
		for(int i = 0; i < t-1; i++) cout<<s[i];
		for(int i = 'a'; i <= 'z'; i++)
			if(!vis[i]) {printf("%c\n",i);break;}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:48: error: break statement not within loop or switch
   16 |                 if(vis['z']) {cout<<"-1"<<endl;break;}
      |                                                ^~~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<string> 
#include<map>
#include<set>
#include<vector>
#include<string.h> 
#include<math.h>
#include<stdio.h> 
#include<queue>
using namespace std; 
int main()
{string s;cin>>s;string t="abcdefghijklmnopqrstuvwxyz";
for(int i=0;i<s.size();i++)
for(int j=0;j<26;j++)if(s[i]==t[j])pop.back(t[j]);
for(int i=s.size()-1;i>=0;i--)
for(int j=0;j<t.size();j++)if(t[j]>s[i]){
	cout<<s+t[j];return 0;
}
cout<<"-1";
system("pause");
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:36: error: 'pop' was not declared in this scope; did you mean 'pow'?
   15 | for(int j=0;j<26;j++)if(s[i]==t[j])pop.back(t[j]);
      |                                    ^~~
      |                                    pow
Language: C++

#include<iostream>
#include<stdio.h>
#include<string>
using namespace std;
bool a[26];
int main() {
	char s[30];
	cin >> s;
	int len = strlen(s);
	for (int i = 0; i < len; ++i) {
		int t = s[i] - 'a';
		a[t] = true;
	}
	if (len != 26) {
		cout << s;
		for (int i = 0; i < 26; ++i) {
			if (!a[i]) {
				printf("%c", i + 'a');
				break;
			}
		}
		return 0;
	}
	bool f = false;
	for (int i = len - 1; i >= 0; --i) {
		for (int j = s[i] - 'a' + 1; j < 26; ++j) {
			if (!a[j]) {
				f = true;
				s[i] = '\0';
				cout << s;
				printf("%c", j + 'a');
				break;
			}
		}
		if (f) {
			break;
		}
		a[s[i] - 'a'] = false;
		s[i] = '\0';
	}
	if (!f) {
		cout << -1 << endl;
	}
	//system("pause");
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:19: error: 'strlen' was not declared in this scope
    9 |         int len = strlen(s);
      |                   ^~~~~~
a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | #include<stdio.h>
Language: C++

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

int main() {
	string s;
	cin >> s;
	if(s.size() < 26) {
		vector<bool> vis(26);
		for(char &ch: s) {
			vis[ch - 'a'] = true;
		}
		int idx = -1;
		for(int i = 0; i < 26; i++) {
			if(vis[i] == false) {
				idx = i; break;
			}
		}
		assert(idx != -1);
		s.push_back(idx + 'a');
	} else {
		int idx = -1;
		set<char> S;
		S.insert(s.back());
		for(int i = s.size() - 2; i >= 0; i--) {
			S.insert(s[i]);
			if(s[i] < s[i + 1]) {
				idx = i;
				break;
			}
		}
		if(idx == -1) s = "-1";
		else {
			s[idx] = *S.upper_bound(s[idx]);
			S.erase(s[idx]);
			for(int i = idx + 1; i < s.size(); i++) {
				s[i] = *S.begin();
				S.erase(s[i]);
			}
		}
	}
	cout << s << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'set' was not declared in this scope
   24 |                 set<char> S;
      |                 ^~~
a.cc:4:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    3 | #include <cassert>
  +++ |+#include <set>
    4 | using namespace std;
a.cc:24:21: error: expected primary-expression before 'char'
   24 |                 set<char> S;
      |                     ^~~~
a.cc:25:17: error: 'S' was not declared in this scope
   25 |                 S.insert(s.back());
      |                 ^
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	string s;
	cin>>s;
	if(s.size==26){
		next_permutation(s.begin(),s.end());
		cout<<s<<endl;
	}else{
		for(char c='a';c<='z';c++){
			if(all_of(s.begin(),s.end(),[&](char e){
				return e!=c;
			})){
				cout<<s<<c<<endl;
				break;
			}
		}
	}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
    8 |         if(s.size==26){
      |            ~~^~~~
      |                  ()
Language: C++

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

bool Exists[26] = {false,};

int main() {
    string s;
    cin >> s;

    if(s.size() == 26){
        if(s == "zyxwvutsrqponmlkjihgfedcba"){
            cout << "-1" << endl;
            return 0;
        for(int i = 0; i < 26; i++){
            if(s[i] != char(i+'a')){
                for(int j = 0; j < i+1; j++){
                    cout << char(j+'a');
                }
                cout << endl;
                return 0;
            }
        }
    }else{
        for(int i = 0; i < s.size(); i++){
            Exists[s[i]-'a'] = true;
        }
        for(int i = 0; i < 26; i++){
            if(Exists[i] == false){
                cout << s + char(i+'a') << endl;
                return 0;
            }
        }
    }

    return 0;
}


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

#include<iostream>
#include<string.h> 
#include<map>
#include<math.h>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<stdio.h>
using namespace std;
int main;(){
int a,b;
cin>>a;
for(char j='a';j<=a.size();j++){
  for(int ciMP\);
  cout<<b;
system("pause");
return 0;
}


Compiler output:
a.cc:15:15: error: stray '\' in program
   15 |   for(int ciMP\);
      |               ^
a.cc:11:5: error: cannot declare '::main' to be a global variable
   11 | int main;(){
      |     ^~~~
a.cc:11:11: error: expected unqualified-id before ')' token
   11 | int main;(){
      |           ^
Language: C++

#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>

#define BIT(a) (1 << (a))

using namespace std;

long long MOD = 1000000007;


long long mod_pow(long long x, long long n){
    long long res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

int ascii[300];
int ascii2[300];

int main(void){
	char s[30];
	cin >> s;
	int len = strlen(s);
	int start = 'a';
	int end = 'z';
	for (int i = 0; i < len; i++){
		ascii[s[i]] = 1;
	}
	for (int i = start; i <= end; i++){
		if (!ascii[i]){
			s[len] = (char)i;
			s[len+1] = '\0';
			printf("%s\n", s);
			return 0;
		}
	}
	for (int i = len-1; i >= 0; i--){
		if (i == len-1){
			ascii2[s[i]] = 1;
			continue;
		}
		if (ascii2[s[i] + 1]){
			s[i]++;
			s[i+1] = '\0';
			printf("%s\n", s);
			return 0;
		}else{
			ascii2[s[i]] = 1;
		}
	}

	printf("-1\n");


	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:40:19: error: 'strlen' was not declared in this scope
   40 |         int len = strlen(s);
      |                   ^~~~~~
a.cc:17:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   16 | #include <cctype>
  +++ |+#include <cstring>
   17 |
Language: Java

import java.util.*;
public class Main {
	  public static void main(String[] args){
		    Scanner sc = new Scanner(System.in);
        String abc = "abcdefghijklmnopqrstuvwxyz";
        char[] abcd = abc.toCharArray();
        String cba = "zyxwvutsrqponmlkjihgfedcba";
        char[] dcba = cba.toCharArray();
        String word = sc.nextLine();
        if(word == cba){
            System.out.println(-1);
        }
        else{
            if(word.length() != 26){
                int i;
                for(i=0;word.indexOf(abcd[i]) != -1;i++){
                }
                System.out.println(word + abcd[i]);
            }
            else{
                char[] word2 =word.toArray();
                for(j=25;j != 0;--j){
                    if(word[j] != dcba[j]){
                        char lw = word.charAt(j + 1);
                        int slw = abc.indexOf(lw) - 1;
                        word.substring(0,slw - 1);
                        System.out.println(word + lw);
                        break;
                    }
                }
            }
        }
    }
}


Compiler output:
Main.java:21: error: cannot find symbol
                char[] word2 =word.toArray();
                                  ^
  symbol:   method toArray()
  location: variable word of type String
Main.java:22: error: cannot find symbol
                for(j=25;j != 0;--j){
                    ^
  symbol:   variable j
  location: class Main
Main.java:22: error: cannot find symbol
                for(j=25;j != 0;--j){
                         ^
  symbol:   variable j
  location: class Main
Main.java:22: error: cannot find symbol
                for(j=25;j != 0;--j){
                                  ^
  symbol:   variable j
  location: class Main
Main.java:23: error: cannot find symbol
                    if(word[j] != dcba[j]){
                            ^
  symbol:   variable j
  location: class Main
Main.java:23: error: array required, but String found
                    if(word[j] != dcba[j]){
                           ^
Main.java:23: error: cannot find symbol
                    if(word[j] != dcba[j]){
                                       ^
  symbol:   variable j
  location: class Main
Main.java:24: error: cannot find symbol
                        char lw = word.charAt(j + 1);
                                              ^
  symbol:   variable j
  location: class Main
8 errors
Language: Java

import java.util.*;
public class Main {
	  public static void main(String[] args){
		    Scanner sc = new Scanner(System.in);
        String abc = "abcdefghijklmnopqrstuvwxyz";
        char[] abcd = abc.toCharArray();
				String word = sc.nextLine();
        if(word == zyxwvutsrqponmlkjihgfedcba){
            System.out.println(-1);
        }
        else{
            if(word.length() != 26){
                int i;
                for(i=0;word.indexOf(abcd[i]) != -1;i++){
                }
                System.out.println(word + abcd[i]);
            }
            else{
                char lw = word.charAt(26);
                int slw = abc.indexOf(lw) - 1;
                word.substring(0,slw - 1);
                System.out.println(word + lw);
            }
        }
    }
}


Compiler output:
Main.java:8: error: cannot find symbol
        if(word == zyxwvutsrqponmlkjihgfedcba){
                   ^
  symbol:   variable zyxwvutsrqponmlkjihgfedcba
  location: class Main
1 error
Language: C++

#include<iostream>
#include<cstdio>
#include <cstring>
#include <cstdlib> 
using namespace std;
int main()
{
     char w[101];
     bool a[100001];
     memset(a,true,sizeof(a));
     gets(w);
    int len;
    len=strlen(w);
	for (int i=0; i<len;++i)
	{
		int num;
		num=w[i];
	    a[num]=false;
	}
	    int total=0;
	    int p;
	for (int i=97; i<=122; ++i)
	{
		int num;
		num=w[0];
	    if ((a[i]==true)&&(i>num))
		{
			
			 ++total;
			 for(int j=0;j<len;++j) cout<<w[j];
			 char c;
			 c=i;
			 cout<<c<<endl;
		     break;
		} 
	}
	char c;
	if(total==0)	
	for (int i=len-1;i>=0;--i)
	{
		int num;
		num=w[i];
	       for (int j=97; j<=122;++j)
	             if ((a[j]==true)&&(j>num))
	             {
	                 ++total;
	                 p=i;
	                 c=j;
	                 break;
				  }
				  else
				  a[num]=true;
		if (total!=0) break;
	}
	if (total==1)
	{
	  for (int i=0;i<=p-1;++i)
	        cout<<w[i];
       cout<<c<<endl;
	  }
	if (total==0)
	    cout<<-1<<endl;
} 

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

#include<iostream>
#include<cstdio>
#include <cstring> 
using namespace std;
int main()
{
     char w[101];
     bool a[100001];
     memset(a,true,sizeof(a));
     gets(w);
    int len;
    len=strlen(w);
	for (int i=0; i<len;++i)
	{
		int num;
		num=w[i];
	    a[num]=false;
	}
	    int total=0;
	    int p;
	for (int i=97; i<=122; ++i)
	{
		int num;
		num=w[0];
	    if ((a[i]==true)&&(i>num))
		{
			
			 ++total;
			 for(int j=0;j<len;++j) cout<<w[j];
			 char c;
			 c=i;
			 cout<<c<<endl;
		     break;
		} 
	}
	char c;
	if(total==0)	
	for (int i=len-1;i>=0;--i)
	{
		int num;
		num=w[i];
	       for (int j=97; j<=122;++j)
	             if ((a[j]==true)&&(j>num))
	             {
	                 ++total;
	                 p=i;
	                 c=j;
	                 break;
				  }
				  else
				  a[num]=true;
		if (total!=0) break;
	}
	if (total==1)
	{
	  for (int i=0;i<=p-1;++i)
	        cout<<w[i];
       cout<<c<<endl;
	  }
	if (total==0)
	    cout<<-1<<endl;
} 

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

// ------------------------------------
// Date:2018/ 3/31
// Problem:_ _ _ a.cpp
//
// ------------------------------------

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

int cnt[26];

int main()
{

  bool check = false;
  memset(cnt, 0, sizeof(cnt));
  string s;
  cin >> s;

  if (s == "zyxwvutsrqponmlkjihgfedcba") {
    // 下がりっぱなしのとき
    cout << -1 << endl;
    return 0;
  }
  
  int last = INF;
  // state: 0:increse / 1:decrease
  int state = -1;
  cnt[s[0] - 97]++;
  FOR(i, 1, s.size()) {
    cnt[s[i] - 97]++;
    if (s[i] > s[i - 1]) {
      if (state != 0) {
	state = 0;
	last = i;
      }
    } else {
      if (state != 1) {
	state = 1;
	last = i;
      }
      if (s[i - 1] - s[i] > 1) last = i;
    }
  }
  
  REP(i, 26) {
    if (cnt[i] == 0) {
      // 使ってないもじが会った時
      cout << s;
      printf("%c\n", i + 97);
      return 0;
    }
    if (i == 25) {
      string tmp = s;
      do {
	if (tmp > s) {
	  cout << tmp << endl;
	  break;
	}
      } while(next_permutation(ALL(tmp)))
    }
  }
  

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:84:42: error: expected ';' before '}' token
   84 |       } while(next_permutation(ALL(tmp)))
      |                                          ^
      |                                          ;
   85 |     }
      |     ~
Language: C++

#include <iostream>
using namespace std;

int main()
{
	string str;
	cin >> str;


	int max = 26; 

	bool flag[max] = {false};

	if(str == "zyxwvutsrqponmlkjihgfedcba")
	{
		cout << -1 << endl;
		return 0;
	}

	for(int i = 0; i < str.length(); i++)
	{
		if(!flag[str[i]-'a']) flag[str[i]-'a'] = true;
	}

	if(str.length() != max)
	{
		for(int i = 0; i < max; i++)
		{
			if(!flag[i])
			{
				cout << str+(char)('a'+i) << endl;
				return 0;
			}
		}
	}

	char tar = str[max-1];
	int tarnum = 0;
	for(int i = max-1; i >= 0; i--)
	{
		if(tar > str[i])
		{
			tar = str[i];
			tarnum = i;
			i = -1;
		}
	}

	bool flag2[max] = {false};
	for(int i = tarnum; i >= 0; i--)
	{
		flag2[str[i]-'a'] = true;
	}

	for(int i = 0; i < max; i++)
	{
		if(!flag2[i])
		{
			string str2 = str.substr(0, tarnum);
			string str3 = (char)('a'+i);
			str2 += str3;
			cout << str2 << endl;
			return 0;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:60:39: error: conversion from 'char' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
   60 |                         string str3 = (char)('a'+i);
      |                                       ^~~~~~~~~~~~~
Language: C++

#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
using namespace std;
#define MAX_N 1000


int main() {
	string s;
	string al = "abcdefghijklmnopqrstuvwxyz";
	string rl = "zyxwvutsrqponmlkjihgfedcba";
	cin >> s;
	if (s == rl) {
		cout << -1 << endl;
		return 0;
	}
	if (s == "zyxwvutsrqponmlkjihgfedcba") {
		cout << rl << endl;
		return 0;
	}
	if (s.length() < 26) {
		for (int i = 0; i < 26; i++) {
			if (s.find(al[i]) == string::npos) {
				cout << s + al[i] << endl;
				return 0;
			}
		}
	}
	else {
		char aa = s[s.length-1];

		for (int i = 24; i > 0; i--) {
			if (s[i] < s[i + 1]) {
				string t = s.substr(0, i);
				t += aa;
				cout << t << endl;
				return 0;

			}
			else {
				if (aa > s[i]) {
					aa = s[i];
				}
			}

		}
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:31: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
   40 |                 char aa = s[s.length-1];
      |                             ~~^~~~~~
      |                                     ()
Language: Java

import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Main m = new Main();
    }
  
  	public Main(){
      System.out.println("abcdefghijklmnopqrstuvx");
}

Compiler output:
Main.java:10: error: reached end of file while parsing
}
 ^
1 error
Language: C++

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int main()
{
    char s[30];
    int i,l,j;
    int flag=1;
    gets(s);
    l=strlen(s);
    if(l!=26)
    {
        for(i=0;i<l;i++)
        {
            s[l]=s[i]+1;
            for(j=0;j<l;j++)
            {
                if(j!=i)
                {
                    if(s[l]==s[j])
                        {
                            flag=0;
                            break;
                        }
                }
            }
            if(flag==1)
            {
                s[l+1]='\0';
                break;
            }
        }
        for(i=0;i<l+1;i++)
            printf("%c",s[i]);
    }
    else
    {
            for(i=l-1;i>=0;i--)
    {
        if(s[i]>s[i-1])
            break;
    }
    if(i==0)
    {
        printf("-1\n");
    }
    else
    {
        for(j=l-1;j>i;j--)
        {
            if(s[j]>s[j-1])
            {
                break;
            }
        }
        if(j==i)
        {
            s[i-1]=s[i-1]+1;
            s[i]='\0';
            for(j=0;j<i;j++)
                printf("%c",s[j]);
        }
        else
        {
            next_permutation(s,s+strlen(s));
            puts(s);
        }
    }


}return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int used[30];
    bool used2[30];
    memset(used,0,sizeof used);
    memset(used2,0,sizeof used2);
    string s;
    cin>>s;
    for(int i=0; i<s.length(); i++)
        used2[s[i]-'a']=1;
    string temp=s;
    bool f=0;
    vector<string>v;
    int j=0;
    if(s.length()<26)
    {
        for(int i=0; i<26; i++)
        {
            if(!used2[i])
            {
                temp+='a'+i;
                v.push_back(temp);
                f=1;
                break;
            }
        }
    }
    if(!f)
    {
        string tt;
        char prev=s[0];
        tt+=s[0];
        bool rr=0;
        used[s[0]-'a']=1;
        for(int i=1;!rr and i<s.length();i++)
        {
            for(int j=prev-'a';j<s[i]-'a';j++)
            {
                if(!used[j])
                {
                    tt[tt.length()-1]=j+'a';
                    rr=1;
                    f=1;
                    v.push_back(tt);
                }
            }
            if(rr)
                break;
            used[s[i]-'a']=1;
            tt+=s[i];
            prev=s[i];
        }
    }
//    if(!f)
//    {
//        string tx;
//        bool fx=0;
//        for(int i=s.length()-1;i>-1;i--)
//        {
//            if(!fx and i>0 and s[i]>s[i-1])
//            {
//                tx+=s[i];
//                f=1;
//                fx=1;
//                i--;
//            }
//            else
//            {
//                tx+=s[i];
//            }
//        }
//        if(f){
//            reverse(tx.begin(),tx.end());
//            v.push_back(tx);
//        }
    }
    sort(v.begin(),v.end());
    if(f)
        cout<<v[0]<<endl;
    else
        cout<<-1<<endl;
}


Compiler output:
a.cc:79:9: error: expected constructor, destructor, or type conversion before '(' token
   79 |     sort(v.begin(),v.end());
      |         ^
a.cc:80:5: error: expected unqualified-id before 'if'
   80 |     if(f)
      |     ^~
a.cc:82:5: error: expected unqualified-id before 'else'
   82 |     else
      |     ^~~~
a.cc:84:1: error: expected declaration before '}' token
   84 | }
      | ^