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

#include<iostream>
using namespace std;

int main(){
    string s;
    cin>>s;
    int n=s.length();
    if(n<26){
        for(char c='a';c<='z';c++){
            if(find(s.begin(),s.end(),c)==s.end()){
                cout<<s+c<<endl;
                return 0;
            }
        }
    }else{
        if(s=="zyxwvutsrqponmlkjihgfedcba"){
            cout<<-1<<endl;
            return 0;
        }
        for(int i=0;i<25;i++){
            if(s[25-i]>s[24-i]){
                for(int j=0;j<24-i;j++) cout<<s[j];
                for(int j=25;j>=25-i;j--){
                    if(s[j]>s[24-i]){
                        cout<<s[j];
                        break;
                    }
                }
                break;
            }
        }
        cout<<endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:20: error: no matching function for call to 'find(std::__cxx11::basic_string<char>::iterator, std::__cxx11::basic_string<char>::iterator, char&)'
   10 |             if(find(s.begin(),s.end(),c)==s.end()){
      |                ~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
                 from /usr/include/c++/14/bits/basic_ios.h:37,
                 from /usr/include/c++/14/ios:46,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
  435 |     find(istreambuf_iterator<_CharT> __first,
      |     ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
a.cc:10:20: note:   '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' is not derived from 'std::istreambuf_iterator<_CharT>'
   10 |             if(find(s.begin(),s.end(),c)==s.end()){
      |                ~~~~^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <string>

using namespace std;

int main(){
  string s;
  cin >> s;
  if(s.size()!=26){
    vector<int> alphabet(26, 0);
    for (auto c : s)｛
      alphabet[c-'a'］=1;
      ｝
     for (int i=0;i<26;i++)｛
       if(alphabet[i]==0)｛
          s.push_back('a'+i);
          cout << s <<"\n";
          return 0;
       ｝
      ｝
    ｝
   
  return 0;
  ｝

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> s;
      |   ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    1 | #include <string>
  +++ |+#include <iostream>
    2 | 
a.cc:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> alphabet(26, 0);
      |     ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <string>
  +++ |+#include <vector>
    2 | 
a.cc:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> alphabet(26, 0);
      |            ^~~
a.cc:10:21: error: '\U0000ff5b' was not declared in this scope
   10 |     for (auto c : s)｛
      |                     ^~
a.cc:12:7: error: '\U0000ff5d' was not declared in this scope
   12 |       ｝
      |       ^~
a.cc:13:19: error: 'i' was not declared in this scope
   13 |      for (int i=0;i<26;i++)｛
      |                   ^
a.cc:16:11: error: 'cout' was not declared in this scope
   16 |           cout << s <<"\n";
      |           ^~~~
a.cc:16:11: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:18:10: error: expected ';' before '\U0000ff5d'
   18 |        ｝
      |          ^
      |          ;
   19 |       ｝
      |       ~~  
a.cc:23:5: error: expected ';' at end of input
   23 |   ｝
      |     ^
      |     ;
a.cc:23:5: error: expected '}' at end of input
a.cc:8:19: note: to match this '{'
    8 |   if(s.size()!=26){
      |                   ^
a.cc:23:5: error: expected '}' at end of input
   23 |   ｝
      |     ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    string s;
    cin >> s;
    int n = s.size();
    if (n != 26) {
        vector<bool> flg(26, false);
        rep(i, n) flg[s[i]-'a'] = true; 
        cout << s;
        rep(i, 26) {
            if (!flg[i]) {
                cout << (char)(i + 'a') << endl;
                return 0;
            }
        }
    }
    else {
        string t = s;
        if (!next_permutation(t.begin(), t.end())) {
            cout << -1 << endl;
            break;
        }
        rep(i, n) {
            cout << t[i];
            if (t[i] != s[i]) {
                cout << endl;
                break;
            } 
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:13: error: break statement not within loop or switch
   38 |             break;
      |             ^~~~~
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef long long ll;
const int N = 2e5 + 10, OO = 0x3f3f3f3f, mod = 1e9 + 7;

#define PI acos(-1)
#define clr(arr, val) memset(arr, val, sizeof(arr))
#define loop(i, n) for (int i = 0; i < int(n); i++)
#define rloop(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define xloop(i, a, b) for (int i = int(a); i <= int(b); i++)
#define ALL(v) ((v).begin()), ((v).end())
#define SZ(v) ((int)((v).size()))
//int dx[] = {1, 0, -1, 0};
//int dy[] = {0, 1, 0, -1}; //4 Direction
//int dx[] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; //8 direction
int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction

//-- "كلٌّ من يسعى لابد يصل .. كلٌّ من يسعى مضمون له الوصول" --//



int main()
{
    //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	string s;
	cin >> s;
	int len = s.size();
	int vis[26] = {};
	for(int i = 0 ; i < len ; ++i)
		vis[s[i]-'a']++;
	if(len < 26){
		for(int i = 0; i < 26 ; ++i)
			if(!vis[i]){
				char x = i + 'a';
				s += x;
				return cout << s << "\n" , 0;
				 
			}
	}
	else{ // len = 26
		string temp = "";
		for(int i = 0 ; i < 26 ; ++i)
			temp += char('a' + i);
		if(temp == s){
			for(int i = 0 ; i < 26 ; ++i){
				if(i == 24)
					cout << char('z');
				else if(i == 25)
					cout << char('y');
				else 
					cout << char('a' + i) ;
			}
			cout << "\n";
			return 0;
		}
		reverse(ALL(temp));
		if(temp == s)
			return cout << "-1\n" , 0;
		bool ok = 1;
		string ans = "";
		for(int i = 0 ; i < 26 ; ++i){
			if((s[i]-'a') == i)
				ans += s[i];
			else{
				if(SZ(ans)
					ans.pop_back();
				ans += char(i + 'a');
				break;
			}
		}
		cout << ans << "\n";
	}
	
	
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:72:41: error: expected ';' before 'ans'
   72 |                                         ans.pop_back();
      |                                         ^~~
a.cc:73:53: error: expected ')' before ';' token
   73 |                                 ans += char(i + 'a');
      |                                                     ^
      |                                                     )
a.cc:71:35: note: to match this '('
   71 |                                 if(SZ(ans)
      |                                   ^
a.cc:73:37: error: could not convert 'ans.std::__cxx11::basic_string<char>::operator+=(((int)((char)(i + 97))))' from 'std::__cxx11::basic_string<char>' to 'bool'
   73 |                                 ans += char(i + 'a');
      |                                 ~~~~^~~~~~~~~~~~~~~~
      |                                     |
      |                                     std::__cxx11::basic_string<char>
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)


int main(){
    string S; cin >> S;
    set<char> st;
    vector<char> v(26);
    rep(i,26){
        st.insert('a'+i);
        v[i] = 'a'+i;
    }
    rep(i,S.size()){
        st.erase(S[i]);
    }

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

    if(S.size() < 26){

        cout << S + *st.begin() << endl;
        return 0;

    }else{

        char cur = S[25], tar;
        int p;

        for(int i=1;i<26;i++){
            tar = S[25-i];

            if(cur > tar){
                p = 26-i;
                char ch = '{';
                for(int j=p;j<26;j++){
                    ch = min(ch, S[j]);
                }
                S[p-1] = ch;
                rep(j,p){
                    cout << S[j];
                }
                cout << endl;
                return 0;
            }
            cur = tar;
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: could not convert 'S.std::__cxx11::basic_string<char>::operator=(((const char*)"zyxwvutsrqponmlkjihgfedcba"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   19 |     if(S = "zyxwvutsrqponmlkjihgfedcba"){
      |        ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |          |
      |          std::__cxx11::basic_string<char>
Language: C++

    /*
    author : seryu
    title : AGC022A_"Diverse Word"
    */
    #include <bits/stdc++.h>
    using namespace std;
    #define rep(i,n) for(int i = 0; i < n; i++)
    #define reps(i,n) for(int i = 1; i <= n; i++)
    #define rrep(i,n) for(int i = n-1; i >= 0; i--)
    #define rreps(i,n) for(int i = n; i >= 1; i--)
    #define mrep(i,from,n) for(int i = from; i < n; i++)
    #define mreps(i,from,n) for(int i = from; i <= n; i++)
    #define all(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
    typedef long long ll;
    typedef pair<ll, ll> P;
    template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
    template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
    ll MOD = 1000000007;

    void solve()
    {	
        string s;
        cin >> s;
        string last_word = "";
        rep(i, 26)last_word.push_back('z'-i);
        if(s == last_word)
        {
            cout << -1 << endl;
            return;
        }
        reverse(all(last_word));
        if(s == last_word)
        {
            cout << last_word.substr(0,24)+"z" << endl;
            return;        
        }
        int n = sz(s);
        if(n < 26)
        {
            bool a[26] = {false};
            rep(i, n)
            {
                a[s[i]-'a'] = true;ATOMIC_BOOL_LOCK_FREE
            }
            string ans = s;
            rep(i, 26)
            {
                if(!a[i])
                {
                    ans.push_back('a'+i);
                    cout << ans << endl;
                    return;
                }
            }
        }
        else
        {
            int k = n-1;
            while (true)
            {
                if(s[k-1] < s[k])break;
                k--;
            }
            bool a[26] = {false};
            rep(i, k)a[s[i]-'a'] = true;
            k--;
            mrep(i, s[k]-'a'+1,26)
            {
                if(!a[i])
                {
                    string ans = s.substr(0, k);
                    ans.push_back('a'+i);
                    cout << ans << endl;
                    return;
                }    
            }
        }
        
        return;
    }

    int main()
    {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        solve();
        return 0;
    }



Compiler output:
a.cc: In function 'void solve()':
a.cc:46:13: error: expected ';' before '}' token
   46 |             }
      |             ^
Language: C++

string S;
cin >> S;
vector<bool> F(128);

int N = sz(S);
int A = 0;
rep(i, N - 1)A |= S[i] < S[i + 1];

if (N == 26) {
    if(!A)cout << -1 << endl;
    else {
        string T = S;
        next_permutation(all(S));
        rep(i, N) {
            cout << S[i];
            if (S[i] != T[i])break;
        }
        cout << endl;
    }
} else {
    rep(i, N) {
        F[S[i]] = 1;
    }
    for (char c = 'a'; c <= 'z'; ++c)if (!F[c]) {
        S += c;
        cout << S << endl;
        break;
    }
}

Compiler output:
a.cc:1:1: error: 'string' does not name a type
    1 | string S;
      | ^~~~~~
a.cc:2:1: error: 'cin' does not name a type
    2 | cin >> S;
      | ^~~
a.cc:3:1: error: 'vector' does not name a type
    3 | vector<bool> F(128);
      | ^~~~~~
a.cc:5:12: error: 'S' was not declared in this scope
    5 | int N = sz(S);
      |            ^
a.cc:5:9: error: 'sz' was not declared in this scope
    5 | int N = sz(S);
      |         ^~
a.cc:7:4: error: expected constructor, destructor, or type conversion before '(' token
    7 | rep(i, N - 1)A |= S[i] < S[i + 1];
      |    ^
a.cc:9:1: error: expected unqualified-id before 'if'
    9 | if (N == 26) {
      | ^~
a.cc:20:3: error: expected unqualified-id before 'else'
   20 | } else {
      |   ^~~~
Language: C++

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

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


bool used[256];
int cnt;

void solve(){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
		used[s[i]-'a'] = true;
		cnt++;
	}
    if(cnt < 26){
		for(int i = 0; i < 26; i++){
			if(!used[i]){
				cout << s + (char)('a' + i) << endl;
				return 0;
			}
		}
	}
    string t = s;
	if(next_permutation(s.begin(), s.end())){
		for(int i = 0; i < s.size(); i++){
			cout << s[i];
			if(s[i] != t[i]) break;
		}
		cout << endl;
	}else{
		cout << -1 << endl;
	}
   
}

int main(){
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:28:40: error: return-statement with a value, in function returning 'void' [-fpermissive]
   28 |                                 return 0;
      |                                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const ll MOD2=998244353;
const double PI=acos(-1);
const ll INF=1e18;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  ll n;
  cin >> n;
  rep(i,min((ll)15000,n)){
    cout << 2*(i+1) << " ";
  }
  rep(i,max((ll)0,(n-15000)){
    cout << 6*i+3 << " ";
  }
}


Compiler output:
a.cc:26:2: error: unterminated argument list invoking macro "rep"
   26 | }
      |  ^
a.cc: In function 'int main()':
a.cc:23:3: error: 'rep' was not declared in this scope
   23 |   rep(i,max((ll)0,(n-15000)){
      |   ^~~
a.cc:23:6: error: expected '}' at end of input
   23 |   rep(i,max((ll)0,(n-15000)){
      |      ^
a.cc:17:12: note: to match this '{'
   17 | int main() {
      |            ^
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;



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

    int num = S.size();
    vector<bool> check(26);
    rep(i, num) {
        check[S[i]-'a'] = true;
    }

    if(num != 26) {
        cout << S;
        int i;
        rep(i_, num+1) {
            if(!check[i_]) {
                i = i_;
                break;
            }
        }
        char x = 'a'+i;
        cout << x << endl;
    } else {
        for(int i = num-1; i>0; --i) {
            if(S[i] > S[i-1]) {
                string h = S.substr(i);
                reverse(all(h));
                string::iterator itr = lower_bound(all(h), S[i-1]);
                cout << S.substr(0, i-1) << *itr << endl; 
                break;
            }
            if(i == 1) {
                cout << -1 << endl;
            }
        }
    }
}
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;



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

    int num = S.size();
    vector<bool> check(26);
    rep(i, num) {
        check[S[i]-'a'] = true;
    }

    if(num != 26) {
        cout << S;
        int i;
        rep(i_, num+1) {
            if(!check[i_]) {
                i = i_;
                break;
            }
        }
        char x = 'a'+i;
        cout << x << endl;
    } else {
        for(int i = num-1; i>0; --i) {
            if(S[i] > S[i-1]) {
                string h = S.substr(i);
                reverse(all(h));
                string::iterator itr = lower_bound(all(h), S[i-1]);
                cout << S.substr(0, i) << *itr << endl; 
                break;
            }
            if(i == 1) {
                cout << -1 << endl;
            }
        }
    }
}

Compiler output:
a.cc:62:5: error: redefinition of 'int main()'
   62 | int main() {
      |     ^~~~
a.cc:20:5: note: 'int main()' previously defined here
   20 | int main() {
      |     ^~~~
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;



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

    int num = S.size();
    vector<bool> check(26);
    rep(i, num) {
        check[S[i]-'a'] = true;
    }

    if(num != 26) {
        cout << S;
        int i;
        rep(i_, num+1) {
            if(!check[i_]) {
                i = i_;
                break;
            }
        }
        char x = 'a'+i;
        cout << x << endl;
    } else {
        for(int i = num-1; i>0; --i) {
            if(S[i] > S[i-1]) {
                string h = S.substr(i);
                reverse(all(h));
                string::iterator itr = lower_bound(all(h), s[i]);
                cout << S.substr(0, i) << *itr << endl; 
                break;
            }
            if(i == 1) {
                cout << -1 << endl;
            }
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:60: error: 's' was not declared in this scope
   40 |                 string::iterator itr = lower_bound(all(h), s[i]);
      |                                                            ^
Language: C++

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

int main(){
 
  string S,ans;
  cin >> S;
  
  if (S == zyxwvutsrqponmlkjihgfedcba) ans = "-1";
  else{
    if (S.length()<26){
      for(int i='a';i<'z'+1;i++){
      for(auto &v:S){
        
      } 
      }
      
    }
    
    
    
  }
  
  cout << ans << endl;
  
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:12: error: 'zyxwvutsrqponmlkjihgfedcba' was not declared in this scope
    9 |   if (S == zyxwvutsrqponmlkjihgfedcba) ans = "-1";
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

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

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

	bool sein[26] = { false };

　　　　//26文字よりも短い場合は末尾にSに含まれない最小の文字を付加する

	if (S.length() < 26) {
		for (char c : S) sein[c - 'a'] = true;
		cout << S;
		for (int i = 0; i < 26; i++) {
			if (!sein[i]) {
				cout << (char)('a' + i) << endl;
				break;
			}
		}
	}
	else {
		if (S == "zyxwvutsrqponmlkjihgfedcba") {
			cout << -1 << endl;
			return 0;
		}
		string origin = S;
		next_permutation(S.begin(), S.end());
		for (int i = 0; i < S.length(); i++) {
			cout << S.at(i);
			if (origin.at(i) != S.at(i)) break;
		}
		cout << endl;
	}
}


Compiler output:
a.cc:10:1: error: extended character 　 is not valid in an identifier
   10 | 　　　　//26文字よりも短い場合は末尾にSに含まれない最小の文字を付加する
      | ^
a.cc:10:1: error: extended character 　 is not valid in an identifier
a.cc:10:1: error: extended character 　 is not valid in an identifier
a.cc:10:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'int main()':
a.cc:10:1: error: '\U00003000\U00003000\U00003000\U00003000' was not declared in this scope
   10 | 　　　　//26文字よりも短い場合は末尾にSに含まれない最小の文字を付加する
      | ^~~~~~~~
a.cc:22:9: error: 'else' without a previous 'if'
   22 |         else {
      |         ^~~~
Language: C++

//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll> >vvl;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> T;
const ll MOD=1000000007LL;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(){
  string s;cin>>s;
  if(s=="zyxwvutsrqponmlkjihgfedcba"){
    cout<<-1<<endl;
    return 0;
  }
  ll n=s.size();
  if(n==26){
    ll i=25;
    while(){
      for(ll j=24;j>=0;j--){
        if(s[i]>s[j]){
          rep(k,j)cout<<s[k];
          cout<<s[i]<<endl;
          return 0;
        }
      }
      i--;
    }
  }
  else {
    rep(i,26){
      bool exist=false;
      rep(j,n){
        if(abc[i]==s[j])exist=true;
      }
      if(!exist){
        s+=abc[i];
        cout<<s<<endl;
        return 0;
      }
    }
  }
}
    
    


Compiler output:
a.cc: In function 'int main()':
a.cc:26:11: error: expected primary-expression before ')' token
   26 |     while(){
      |           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}

int main(){
  string s; cin>>s;
  int N = s.size();
  
  
  string ans = "-1";
  if(N<26){
    map<char,int> mp;
    REP(i,N){ ++mp[s[i]]; }
    for(char c='a'; c<='z'; ++c){
      if(mp[c]==0){ ans = s + (char)c; break;}
    }
  }else{
    bool no = true;
    for(int i=N-2; i>=0; --i){
      if(s[i]<s[i+1]){
        map<char,int> mp;  for(int j=0;j<=i){ ++mp[s[j]]; }
        for(char c=s[i]+1; c<'z'; ++c){
          if(mp[c]==0){ ans = s.substr(0,i) + (char)c; break;}
        }
        no = false;
        break;
      }
    }
  }
  cout << ans<< "\n";  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:44: error: expected ';' before ')' token
   42 |         map<char,int> mp;  for(int j=0;j<=i){ ++mp[s[j]]; }
      |                                            ^
      |                                            ;
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;cin>>S;
  if(S.size()==26){
    if(S=="zyxwvutsrqponmlkjihgfedcba")cout<<"-1"<<endl;
    else{
      char a=S.at(25);int i=25;
      while(S.at(i)==a)i--,a++;
      string T=S.substr(0,i);a='a';
      sort(T.begin(),T.end());
      while(T.binary_search(a)||S.at(i)>=a)a++;
      cout<<S.substr(0,i)+a<<endl;
    }
  }
  else{
    string T=S;
    sort(S.begin(),S.end());
    char a='a';
    while(a-'a'<S.size()&&S.at(a-'a')==a)a++;
    cout<<T+a<<endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'binary_search'
   12 |       while(T.binary_search(a)||S.at(i)>=a)a++;
      |               ^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    int a[26]={};
    for(int i=0;i<s.size();i++) a[s[i]-'a']++;
    for(int i=0;i<26;i++){
        if(a[i]==0){
            cout << s+char(i+'a') << endl;
            return 0;
        }
    }
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
        return 0;
    } 
    vector<int> elst(26);
    int i=25,flag = 1;
    while(0<i&&flag){
        elst[s[i]-'a']=1;
        s.erase(i);
        for(int j=s[i-1]-'a';j<26;j++){
            if(elst[j]){
                s[i-1]=j+'a';
                flag = 0;
                break;
            }    
        }
        i--;
    }
    else cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:32:5: error: 'else' without a previous 'if'
   32 |     else cout << s << endl;
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  string S;　cin>>S;
  int N=S.size();
  if(N==26){
    if(S=="zyxwvutsrqponmlkjihgfedcba") S="-1";
    else{
      REP(o,2,N){
        int i=N-o;
        int memo=-1;
        char X;
        rep(j,i+1,N){
          if(S[i]<S[j]){
            if(memo==-1||X>S[j]){
              memo=j;
              X=S[j];
            }
          }
        }
        if(memo!=-1){
          swap(S[i],S[j]);
          sort(S.begin()+i+1,S.end());
          break;
        }
      }
    }
  }
  else{
    vector<bool> F(26,1);
    rep(i,0,N) F[S[i]-'a']=0;
    rep(i,0,26){
      if(F[i]){
        S+=i+'a';
        break;
      }
    }
  }
  cout<<S<<endl;
  }


Compiler output:
a.cc:20:12: error: extended character 　 is not valid in an identifier
   20 |   string S;　cin>>S;
      |            ^
a.cc: In function 'int main()':
a.cc:20:12: error: '\U00003000cin' was not declared in this scope
   20 |   string S;　cin>>S;
      |            ^~~~~
a.cc:38:23: error: 'j' was not declared in this scope
   38 |           swap(S[i],S[j]);
      |                       ^
Language: C++

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

using namespace std;

int main()
{
    string s;
    cin>>s;
    set<char> c;
    for(int i=0;i<26;i++)
        c.insert((char)i+97);
    for(int i=0;i<s.size();i++)
        c.erase(s[i]);
    if(c.size()==0)
    {
        int len=s.size()-2;
        while(len>-1&&s[len]>s[len+1])
            len--;
        if(len==-1)
            cout<<-1;
        else
        {
            char str=s[len+1];
            int k=len+1;
            while(k<s.size())
            {
                if(s[k]>s[len]&&s[k]<str)
                str=s[k++];
            }
            cout<<s.substr(0,len)<<str;
        }    
    }
    else
    cout<<s<<*(c.begin());
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'set' was not declared in this scope
   11 |     set<char> c;
      |     ^~~
a.cc:3:1: note: 'std::set' is defined in header '<set>'; this is probably fixable by adding '#include <set>'
    2 | #include<algorithm>
  +++ |+#include <set>
    3 | #include<string>
a.cc:11:9: error: expected primary-expression before 'char'
   11 |     set<char> c;
      |         ^~~~
a.cc:13:9: error: 'c' was not declared in this scope
   13 |         c.insert((char)i+97);
      |         ^
a.cc:15:9: error: 'c' was not declared in this scope
   15 |         c.erase(s[i]);
      |         ^
a.cc:16:8: error: 'c' was not declared in this scope
   16 |     if(c.size()==0)
      |        ^
Language: C++

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

int main(){
  string s; cin>>s;
  string base="abcdefghijklmnopqrstuvwxyz";
  vector<bool> flag(26,true);
  for(int i=0;i<s.size();i++){
    flag[s[i]-'a']=false;
  }
  if(s=="zyxwvutsrqponmlkjihgfedcba"){
     cout<<-1<<endl;
     return 0;
  }
  if(s.size()!=26){
    cout<<s;
    for(int i=0;i<26;i++){
      if(flag[i]){
        cout<<base[i]<<endl;
        return 0;
      }
    }
  }else{
    for(int i=25;i>0;i--){
      if(s[i]>s[i-1]){
        flag[i]=true;
        cout<<s.substr(0,i-1);
        for(int j=s[i-1]-'a'+1;i<26;i++){
          cout<<base[j]<<endl;
          return 0;
        }
      }else{
        flag[i]=true;
    }
  }
}

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

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

const int N=55, mod=1e9+7;
inline int add(int x,int y) {return (x+y>=mod) ? (x+y-mod) : (x+y);}
inline int mul(int x,int y) {return (LL)x*y%mod;}

inline void add1(int &x,int y) {x=add(x,y);}

int n,f[N][N],c[N][N],g[N][N];

int main() {
    cin>>n;
    f[1][0]=f[1][1]=1;
    for(int i=0;i<=n;i++) c[i][0]=1;
    for(int i=1;i<=n;i++)
        for(int j=1;j<=i;j++)
            c[i][j]=add(c[i-1][j-1],c[i-1][j]);
    for(int i=1;i<n;i++)
        for(int j=0;j<=i;j++) if(f[i][j]) 
            for(int x=0;x+i<=n;++x)
                for(int y=0;x+y+i<=n;++y) if((x+y) && (x+y>=j) && (!((x+y-j)&1)))
                    add1(f[i+x+y][abs((x+y-j)/2+j-x)],mul(f[i][j],mul(c[i+x+y][x+y],c[x+y][x])));
    cout<<f[n][0]<<'\n';
}
————————————————
版权声明：本文为CSDN博主「DZYO」的原创文章，遵循 CC 4.0 BY-SA 版权协议，转载请附上原文出处链接及本声明。
原文链接：https://blog.csdn.net/qq_35649707/article/details/80918287

Compiler output:
a.cc:27:1: error: extended character — is not valid in an identifier
   27 | ————————————————
      | ^
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:27:1: error: extended character — is not valid in an identifier
a.cc:28:1: error: extended character 「 is not valid in an identifier
   28 | 版权声明：本文为CSDN博主「DZYO」的原创文章，遵循 CC 4.0 BY-SA 版权协议，转载请附上原文出处链接及本声明。
      | ^
a.cc:28:1: error: extended character 」 is not valid in an identifier
a.cc:28:63: error: extended character 。 is not valid in an identifier
   28 | 版权声明：本文为CSDN博主「DZYO」的原创文章，遵循 CC 4.0 BY-SA 版权协议，转载请附上原文出处链接及本声明。
      |                                                               ^
a.cc:27:1: error: '\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014\U00002014' does not name a type
   27 | ————————————————
      | ^~~~~~~~~~~~~~~~
Language: C++

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

int main()
{
  string S;
  cin >> S;
  string ans;
  if (S.size() < 26)
  {
    set<char> st;
    for (int i = 0; i < S.size(); i++)
    {
      st.insert(S[i]);
    }
    for (int i = 0; i < 26; i++)
    {
      char c = 'a' + i;
      if (st.find(c) == st.end())
      {
        ans = S + c;
        break;
      }
    }
    cout << ans << endl;
  }
  else
  {
    int point;
    set<char> st2;
    bool max = true;
    for (int i = S.size() - 2; i >= 0; i--)
    {
      if (S[i] - S[i - 1] != 1)
      {
        point = i;
        S.erase(i - 1);
        auto itr = st2.begin();
        ans = S + *itr;
        max = false;
        break;
      }
      st2.insert(S[i]);
    }
    if (max)
      cout << -1 << endl;
    else
      cout << ans << ensl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:48:22: error: 'ensl' was not declared in this scope
   48 |       cout << ans << ensl;
      |                      ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  string s;
  cin>>s;
  bool flag[26]={0};
  rep(i,s.size() ){
    flag[s[i]-'a']=true;
  }
  rep(i,26){
    if(!flag[i]){
      s+=i+'a';
      break;
    }else if(i==25){cout<<_1<<endl;return 0;}
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:27: error: '_1' was not declared in this scope; did you mean 'std::placeholders::_1'?
   31 |     }else if(i==25){cout<<_1<<endl;return 0;}
      |                           ^~
      |                           std::placeholders::_1
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/functional:301:48: note: 'std::placeholders::_1' declared here
  301 |     _GLIBCXX_PLACEHOLDER const _Placeholder<1> _1;
      |                                                ^~
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;




int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////

string s;
cin >> s;
int flg=0;
if(s=="zyxwvutsrqponmlkjihgfedcba"){
    cout << -1 << endl;
    return 0;
}
if(s=325+'a'*26){
    for(int i=0;i<s.length();i++){
        if(i!=s[i]-'a'){
            s[i] == 'a'+i;
            s.erase(i+1);
            cout << s << endl;
            return 0;
        }
    }
}
for(int i=0;;i++){
    for(int j=0;j<s.length();j++){
        if(s.find('a'+i) == string::npos){
            flg=1;
            s+='a'+i;
        }
        if(flg==1) break;
    }
    if(flg==1) break;
}

cout << s << endl;

//////////////////////////////////////////////////////
return 0;}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:9: warning: overflow in conversion from 'int' to 'char' changes value from '2847' to '31' [-Woverflow]
   58 | if(s=325+'a'*26){
      |      ~~~^~~~~~~
a.cc:58:5: error: could not convert 's.std::__cxx11::basic_string<char>::operator=(((int)((char)(325 + (97 * 26)))))' from 'std::__cxx11::basic_string<char>' to 'bool'
   58 | if(s=325+'a'*26){
      |    ~^~~~~~~~~~~
      |     |
      |     std::__cxx11::basic_string<char>
Language: C++

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  string s;
  cin>>s;
  int a[40]={0};
  for (int i(0);i<s.size();i++){
    a[s[i]-'a']++;
  }
  for (int i(0);i<26;i++){
    if (a[i]==0){
      s+='a'+(char)i;
      cout << s << endl;
      return 0;
    }
  }
  string si;
  for (int i(0);i<s.size();i++){
    if (s[i]=='z'&&i!=0){
      si[i-1]=(char)(si[i-1]+1);
      cout << si << endl;
      return 0;
    }
    si+=s[i];
  }
  cout << -1 << endl;
  return 0;
}

atcoderb
atcoderb


Compiler output:
a.cc:33:1: error: 'atcoderb' does not name a type
   33 | atcoderb
      | ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
bool chk[30];

int main()
{
    int n,m,k,a,b,x,y,q;
    int sum = 0;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    int cur = 0, idx = -1;
    int tc;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string S,T;

    cin>>S;

    n = strlen(S);

    for(int i=0;i<n;i++)
        chk[S[i]-'a'] = true;

    if(n==26){
        T = S;
        bool judge = next_permutation(S.begin(),S.end());

        if(!judge){
            cout<<"-1\n";
        }

        for(int i=0;i<n;i++){
            cout<<S[i];
            if(T[i]!=S[i])break;
        }

        return 0;
    }

    cout<<S;

    char c;

    for(int i=0;i<26;i++)
        if(!chk[i]){
            c = 'a'+i;
            cout<<c<<"\n";
            break;
        }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:16: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   42 |     n = strlen(S);
      |                ^
      |                |
      |                std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/string.h:407:35: note:   initializing argument 1 of 'size_t strlen(const char*)'
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
Language: C++

#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <cmath>

using namespace std;

bool appeared[26];
bool appeared_before_z[26];
int main(){
   string S;
   cin >> S;
   for(int i = 0; i < S.size(); i++){
     appeared[S[i] - 'a'] = true;
   }
   for(int i = 0; i < 26; i++){
     if(!appeared[i]){
       S.push_back(i + 'a');
       cout << S << endl;
       return 0;
     }
   }

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

   int z_ind;
   for(int i = 0; i < S.size(); i++){
     if(S[i] == 'z'){
       z_ind = i;
       break;
     }
     appeared_before_z[S[i] - 'a'] = true;
   }

   string ans = S.substr(0, z_ind + 1);
   for(int i = 0; i < 26; i++){
     if(!appeared_before_z[i]){
       ans[z_ind] = i + 'a';
       cout << ans << endl;
       break;
     }
   }
   return 0;
}abcdefghijklmnopqrstuvwzyx
abcdefghijklmnopqrstuvx

Compiler output:
a.cc:54:2: error: 'abcdefghijklmnopqrstuvwzyx' does not name a type
   54 | }abcdefghijklmnopqrstuvwzyx
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
	string s; cin >> s;
	int n = s.length();
	string ans(s);

	if (n==26) {
		if (s=="zyxwvutsrqponmlkjihgfedcba") {
			cout << -1 << endl;
			return 0;
		}
		vector<bool> used(26,false);

		for (int i = n-1; i > 0; --i) {
			if (s[i-1]<s[i]) {
				char under = s[i-1];
				used[(int)(s[i]-'a')]=true;
				ans.pop_back();
				ans.pop_back();
				rep(j,26) {
					if (used[j] &&  under<(char)(j+'a')) {
						ans.push_back((char)(j+'a'));
						break;
					}
				}
				break;
			}
			else {
				used[(int)(s[i]-'a')]=true;
				ans.pop_back();
			}
		}
	}
	else {
		vector<int> b(26);
		rep(i,n) b[(int)(s[i]-'a')]++;
		rep(i,26) if (b[i]==0) {
			ans.push_back(i+'a');
			break;
		}
	}
	cout << ans << endl;

	return 0;
}
	if (n==26) {
		if (s=="zyxwvutsrqponmlkjihgfedcba") {
			cout << -1 << endl;
			return 0;
		}
		vector<bool> used(26,false);

		for (int i = n-1; i > 0; --i) {
			if (s[i-1]<s[i]) {
				used[(int)(s[i]-'a')]=true;
				ans.pop_back();
				ans.pop_back();
				rep(j,26) {
					if (used[j]) {
						ans.push_back((char)(j+'a'));
						break;
					}
				}
				break;
			}
			else {
				used[(int)(s[i]-'a')]=true;
				ans.pop_back();
			}
		}
	}
	else {
		vector<int> b(26);
		rep(i,n) b[(int)(s[i]-'a')]++;
		rep(i,26) if (b[i]==0) {
			ans.push_back(i+'a');
			break;
		}
	}
	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc:58:9: error: expected unqualified-id before 'if'
   58 |         if (n==26) {
      |         ^~
a.cc:84:9: error: expected unqualified-id before 'else'
   84 |         else {
      |         ^~~~
a.cc:92:9: error: 'cout' does not name a type
   92 |         cout << ans << endl;
      |         ^~~~
a.cc:94:9: error: expected unqualified-id before 'return'
   94 |         return 0;
      |         ^~~~~~
a.cc:95:1: error: expected declaration before '}' token
   95 | }
      | ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fo(a,b) for(int a=0;a<b;a++)
#define Sort(a) sort(a.begin(),a.end())
#define rev(a) reverse(a.begin(),a.end())
 int wari(int a,int b) {
   if(a%b==0)
     return a/b;
   else
     return a/b+1;
 }
 int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
 bool prime(int a){
   if(a<2)
     return false;
   else if(a==2)
     return true;
   else if(a%2==0)
     return false;
   double b=sqrt(a);
    for(int i=3;i<=b;i+=2){
      if(a%i==0){
        return false;
      }
    }
   return true;
 }
signed main(){
  string a;
  cin>>a;
  if(a.size()==26){
    char b=a[a.size()-1];
    if(a=="zyxwvutsrqponmlkjihgfedcba")
      cout<<-1<<endl;
    else{
      for(int i=1;i<=26;i++){
        if(a[a.size()-i]<b){
          a.erase(a.begin()+a.size()-i+1,a.end());
          for(char j='z';1;j--;){
            if

Compiler output:
a.cc: In function 'int main()':
a.cc:84:31: error: expected ')' before ';' token
   84 |           for(char j='z';1;j--;){
      |              ~                ^
      |                               )
a.cc:84:32: error: expected primary-expression before ')' token
   84 |           for(char j='z';1;j--;){
      |                                ^
a.cc:85:15: error: expected '}' at end of input
   85 |             if
      |               ^
a.cc:82:28: note: to match this '{'
   82 |         if(a[a.size()-i]<b){
      |                            ^
a.cc:85:15: error: expected '}' at end of input
   85 |             if
      |               ^
a.cc:81:29: note: to match this '{'
   81 |       for(int i=1;i<=26;i++){
      |                             ^
a.cc:85:15: error: expected '}' at end of input
   85 |             if
      |               ^
a.cc:80:9: note: to match this '{'
   80 |     else{
      |         ^
a.cc:85:15: error: expected '}' at end of input
   85 |             if
      |               ^
a.cc:76:19: note: to match this '{'
   76 |   if(a.size()==26){
      |                   ^
a.cc:85:15: error: expected '}' at end of input
   85 |             if
      |               ^
a.cc:73:14: note: to match this '{'
   73 | signed main(){
      |              ^
Language: C

#include <stdio.h>
#include <string.h>
int main()
{
  char S[28];
  int len;
  int f[28] ={0};
  int tmp = -1;
  char ng_w[1];

  scanf("%s", S);
  len = strlen(S);

  if(strcmp(S,"zyxwvutsrqponmlkjihgfedcba")==0)
  {
    puts("-1");
    return 0;
  }

  if(len == 26)
  {
    //----------------------------------------------------
    //len==26
    //----------------------------------------------------
    // printf("len:%d\n", len);
    for (int i = len - 1; i > 0; i--)
    {
      if (S[i - 1] < S[i] && i)
      {
        tmp = i - 1;
        ng_w[0] = S[i - 1];
        printf("NG at [%d]\n", tmp);
        printf("NG word is %c\n", ng_w[0]);
        break;
      }
    }
    for (int i = 0; i < tmp; i++)
    {
      f[S[i] - 'a'] = 1;
      // printf("f[%d]:%d\n", S[i] - 'a', f[S[i] - 'a']);
    }
    for (int i = ((ng_w[0] - 'a') + 1); i < 28; i++)
    {
      if (f[i] == 0)
      {
        S[tmp] = 'a' + i ;
        printf("S[%d]:%c\n",tmp, S[tmp]);
        S[tmp + 1] = '\0';
        break;
      }
    }
  }

  //----------------------------------------------------
  //len<26
  //----------------------------------------------------
  else if(len<26)
  {
    for (int i = 0; S[i] != '\0'; i++)
    {
      f[S[i] - 'a'] = 1;
      // printf("f[%d]:%d\n", S[i] - 'a', f[S[i] - 'a']);
    }
    
    for (int i = 0; i < 28; i++)
    {
      if (f[i] == 0)
      {
        // printf("i:%d\n",i);
        S[len] = 'a' + i ;
        S[len + 1] = '\0';
        // printf("S[len]:%c\n", S[len]);
        // printf("S[]:%s\n", S);
        break;
      }
    }
  }

  // printf("S[]:%s\n", S);
  printf(%s\n", S);

  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:80:10: error: expected expression before '%' token
   80 |   printf(%s\n", S);
      |          ^
main.c:80:12: error: stray '\' in program
   80 |   printf(%s\n", S);
      |            ^
main.c:80:14: warning: missing terminating " character
   80 |   printf(%s\n", S);
      |              ^
main.c:80:14: error: missing terminating " character
   80 |   printf(%s\n", S);
      |              ^~~~~~
main.c:82:12: error: expected ';' before '}' token
   82 |   return 0;
      |            ^
      |            ;
   83 | }
      | ~