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

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define print(s) cout << s << endl
#define acc(v) accumulate(v.begin(), v.end(), 0)
#define cinv(n,v) rep(i,n) cin >> v[i]
using namespace std;
const int INF = 1e9;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;
int x_pos[4] = {1,0,-1,0}, y_pos[4] = {0,1,0,-1};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

char upper(char c){
	return c-0x20;
}

char lower(char c){
	return c+0x20;
}

void unique_vector(vector<int>& v){
	sort(all(v));
	v.erase(unique(all(v)), v.end());
}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x%y);
}

int main() {
    string s;cin>>s;
    int cnt[30];
    rep(i,26)cnt[i]=0;
    if(s.size()!=26){
        char x;
        rep(i,s.size())cnt[s[i]-'a']++;
        rep(i,26){
            if(cnt[i]==0){
                x='a'+i;
                break;
            }
        }
        cout << s << x << endl;
        return 0;
    }else{
        for(int i = 24; i >= 0;i--){
            if(s[i] < s[i+1]){
                rep(j,i){
                    cout << s[j];
                }
                char x = s[i]+1;
                while(1){
                    bool can = true;
                    rep(j,i){
                        if(x==s[j]){
                            x++;
                            can = false;
                            break;
                        }
                        if(cna)break;
                    }
                }
                cout << x << endl;
                return 0;
            }
        }
    }
    cout << -1 << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:79:28: error: 'cna' was not declared in this scope; did you mean 'can'?
   79 |                         if(cna)break;
      |                            ^~~
      |                            can
Language: C++

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

int main() {
 	string s; cin >> s;
  	if (s == "zyxwvutsrqponmlkjihgfedcba") cout << -1 << endl;
  	else {
  		if (s.length()=26) {
        	for (int i = 25; i >= 0; i--) if (s[i] < s[25]) {
				swap(s[i],s[25]);
              	s = s.substr(0,i+1);
              	break;
            }
        } else {
          char c = 'a';
          bool found = 1;
          while (found) {
            found = 0;
			for (char o : s) if (o == c) found = 1;
            if (found) c++;
          }
          s += c;
        }
      cout << s << endl;
  	}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:29: error: lvalue required as left operand of assignment
    8 |                 if (s.length()=26) {
      |                     ~~~~~~~~^~
Language: C++

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

int main() {
 	string s; cin >> s;
  	if (s == "zyxwvutsrqponmlkjihgfedcba") cout << -1 << endl;
  	else {
  		if (s.length()=26) {
        	for (int i = 25; i >= 0; i--) if (a[i] < a[25]) {
				swap(a[i],a[25]);
              	s = s.substr(0,i+1);
              	break;
            }
        } else {
          char c = 'a';
          bool found = 1;
          while (found) {
            found = 0;
			for (char o : s) if (o == c) found = 1;
            if (found) c++;
          }
          s += c;
        }
      cout << s << endl;
  	}
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:29: error: lvalue required as left operand of assignment
    8 |                 if (s.length()=26) {
      |                     ~~~~~~~~^~
a.cc:9:51: error: 'a' was not declared in this scope
    9 |                 for (int i = 25; i >= 0; i--) if (a[i] < a[25]) {
      |                                                   ^
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    string S; cin >> S;
    if(S == "zyxwvutsrqponmlkjihgfedcba") {
        cout << -1 << endl;
        return 0;
    }
    map<char, int> mp;
    int N = S.size();
    for(int i = 0; i < S.size(); i++) {
        mp[S[i]] ++;
    }
    if(N != 26) {
        rep(i, 26) {
            if(mp['a' + i] == 0) {
                S += ('a' + i);
                break;
            }
        }
        cout << S << endl;
        return 0;
    } else {
        per(i, N) {
            vector<char> s;
            if(S[i] < S[i - 1]) {
                s.pb(S[i]);
            } else {
                s.pb(S[i]);
                string t;
                rep(k, i - 1) {
                    t += S[k];
                }
                sort(all(s));
                char u = lower_bound(all(s), S[i - 1]);
                t += u;
                cout << t << endl;
                return 0;
            }
        }
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:87:37: error: cannot convert '__gnu_cxx::__normal_iterator<char*, std::vector<char> >' to 'char' in initialization
   87 |                 char u = lower_bound(all(s), S[i - 1]);
      |                          ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
      |                                     |
      |                                     __gnu_cxx::__normal_iterator<char*, std::vector<char> >
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
const ll INF = 1e+14;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back

void Yes(){
	cout<<"Yes"<<endl;
	exit(0);
}
 
void No(){
	cout<<"No"<<endl;
	exit(0);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
    string S; cin >> S;
    if(S == "zyxwvutsrqponmlkjihgfedcba") {
        cout << -1 << endl;
        return 0;
    }
    map<char, int> mp;
    int N = S.size();
    for(int i = 0; i < S.size(); i++) {
        mp[S[i]] ++;
    }
    if(N != 26) {
        rep(i, 26) {
            if(mp['a' + i] == 0) {
                S += ('a' + i);
                break;
            }
        }
        cout << S << endl;
        return 0;
    } else {
        set<pair<char, int>> s;
        per(i, N) {
            if(S[i] < S[i - 1]) {
                s.insert(pair<char, int> (S[i], i));
            } else {
                S[i] = *(s.begin()).fr;
                S[*(s.begin()).sc] = S[i];
                cout << S << endl;
                return 0;
            }
        }
    }
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:12: error: 'std::set<std::pair<char, int> >::iterator' {aka 'std::_Rb_tree<std::pair<char, int>, std::pair<char, int>, std::_Identity<std::pair<char, int> >, std::less<std::pair<char, int> >, std::allocator<std::pair<char, int> > >::const_iterator'} has no member named 'first'
   38 | #define fr first
      |            ^~~~~
a.cc:81:37: note: in expansion of macro 'fr'
   81 |                 S[i] = *(s.begin()).fr;
      |                                     ^~
a.cc:39:12: error: 'std::set<std::pair<char, int> >::iterator' {aka 'std::_Rb_tree<std::pair<char, int>, std::pair<char, int>, std::_Identity<std::pair<char, int> >, std::less<std::pair<char, int> >, std::allocator<std::pair<char, int> > >::const_iterator'} has no member named 'second'
   39 | #define sc second
      |            ^~~~~~
a.cc:82:32: note: in expansion of macro 'sc'
   82 |                 S[*(s.begin()).sc] = S[i];
      |                                ^~
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    if(s == zyxwvutsrqponmlkjihgfedcba) {
        cout << -1 << endl;
        return 0;
    }
    string ans = s;

    if(n < 26) {
        for(char c = 'a'; c <= 'z'; c++) {
            int k = 0;
            rep(i, n) {
                if(s[i] == c) {
                    k++;
                }
            }
            if(k == 0) {
                ans += c;
            }
        }
    }
    
    cout << ans;
    
    cout << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:13: error: 'zyxwvutsrqponmlkjihgfedcba' was not declared in this scope
   15 |     if(s == zyxwvutsrqponmlkjihgfedcba) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  string s;
  cin >> s;
  if(s=="zyxwvutsrqponmlkjihgfedcba"){
    cout << -1 << endl;
    return 0;
  }
  for(char c='a';c<='z';c++){
    bool flag=true;
    rep(i,s.size()){
      if(s[i]==c)flag=false;
    }
    if(flag){
      cout << s+c << endl;
      return 0;
    }
  }
  string t,r;
  int temp=0;
  for(int i=0;i<s.size();i++){
    if(s[i]=='z'){
      temp=i;
      rep(j,i-1)t+=s[j];
    }
  }
  for(char c=s[temp-1];c<='z';c++){
    bool flag=true;
    rep(i,t.size()){
      if(t[i]==c)flag=false;
    }
    if(flag){
      c++;
      cout << t+c << endl;
      return 0;
    }
  }
return 0;

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

#include <bits/stdc++.h>
using namespace std;
 
int alphabet_pos(char c){
  if('a' <= c && c <= 'z') return (c-'a'+1);
  return -1;
}
 
int main() {
  vector<char> c{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  vector<int> a;
  int d;
  string S;
  cin >> S;
  for(int i=0;i<26;i++){
    a[i]=alphabet_pos(S[i]);
  }
  sort(a.begin(),a.end());
  if(S.length()==0){
    if(S=="zyxwvutsrqponmlkjihgfedcba"){
      cout << -1 <<endl;
    }
    else{
      for(int i=0;true;i++){
        if(i==a[i]-1){
          cout << c[i];
        }
        else{
          cout << c[i];
          break;
        }
      }
    }
  }
  else{
    for(int i=0;true;i++){
        if(i==a[i]-1)continue;
        else{
          d=i;
          break;
        }
    }
    cout << S << c[d];
}

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

#include <bits/stdc++.h>
using namespace std;
 
int alphabet_pos(char c){
  if('a' <= c && c <= 'z') return (c-'a'+1);
  return -1;
}
 
int main() {
  vector<char> c{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  vector<int> a;
  int d;
  string S;
  cin >> S;
  for(int i=0;i<26;i++){
    a[i]=alphabet_pos(S[i])
  }
  sort(a.begin(),a.end());
  if(S.length()==0){
    if(S=="zyxwvutsrqponmlkjihgfedcba"){
      cout << -1 <<endl;
    }
    else{
      for(int i=0;true;i++){
        if(i==a[i]-1){
          cout << c[i];
        }
        else{
          cout << c[i];
          break;
        }
      }
    }
  }
  else{
    for(int i=0;true;i++){
        if(i==a[i]-1)continue;
        else{
          d=i;
          break;
        }
    }
    cout << S << c[d];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: expected ';' before '}' token
   16 |     a[i]=alphabet_pos(S[i])
      |                            ^
      |                            ;
   17 |   }
      |   ~                         
a.cc:44:2: error: expected '}' at end of input
   44 | }
      |  ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int alphabet_pos(char c){
  if('a' <= c && c <= 'z') return (c-'a'+1);
  return -1;
}
 
int main() {
  vector<char> c{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  vector<int> a;
  int d;
  string S;
  cin >> S;
  for(int i=0;i<26;i++){
    a[i]=alphabet_pos(S[i])
  }
  sort(data.begin(),data.end());
  if(S.length()==0){
    if(S=="zyxwvutsrqponmlkjihgfedcba"){
      cout << -1 <<endl;
    }
    else{
      for(int i=0;true;i++){
        if(i==a[i]-1){
          cout << c[i];
        }
        else{
          cout << c[i];
          break;
        }
      }
    }
  }
  else{
    for(int i=0;true;i++){
        if(i==a[i]-1)continue;
        else{
          d=i;
          break;
        }
    }
    cout << S << c[d];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:28: error: expected ';' before '}' token
   16 |     a[i]=alphabet_pos(S[i])
      |                            ^
      |                            ;
   17 |   }
      |   ~                         
a.cc:18:13: error: overloaded function with no contextual type information
   18 |   sort(data.begin(),data.end());
      |             ^~~~~
a.cc:18:26: error: overloaded function with no contextual type information
   18 |   sort(data.begin(),data.end());
      |                          ^~~
a.cc:44:2: error: expected '}' at end of input
   44 | }
      |  ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int alphabet_pos(char c){
  if('a' <= c && c <= 'z') return (c-'a'+1);
  return -1;
}
 
int main() {
  vector<char> c{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  vector<int> a;
  int d;
  string S;
  cin >> S;
  for(i=0;i<26;i++){
    a[i]=alphabet_pos(S[i])
  }
  sort(data.begin(),data.end());
  if(S.length()==0){
    if(S=="zyxwvutsrqponmlkjihgfedcba"){
      cout << -1 <<endl;
    }
    else{
      for(i=0;true;i++){
        if(i==a[i]-1){
          cout << c[i];
        }
        else{
          cout << c[i];
          break;
        }
      }
    }
  }
  else{
    for(i=0;true;i++){
        if(i==a[i]-1)continue;
        else{
          d=i;
          break;
        }
    }
    cout << S << c[d];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:7: error: 'i' was not declared in this scope
   15 |   for(i=0;i<26;i++){
      |       ^
a.cc:18:13: error: overloaded function with no contextual type information
   18 |   sort(data.begin(),data.end());
      |             ^~~~~
a.cc:18:26: error: overloaded function with no contextual type information
   18 |   sort(data.begin(),data.end());
      |                          ^~~
a.cc:24:11: error: 'i' was not declared in this scope
   24 |       for(i=0;true;i++){
      |           ^
a.cc:36:9: error: 'i' was not declared in this scope
   36 |     for(i=0;true;i++){
      |         ^
a.cc:44:2: error: expected '}' at end of input
   44 | }
      |  ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int alphabet_pos(char c){
  if('a' <= c && c <= 'z') return (c-'a'+1);
  return -1;
}
 
int main() {
  vector<char> c{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}
  vector<int> a,d;
  string S;
  cin >> S;
  for(i=0;i<26;i++){
    a[i]=alphabet_pos(S[i])
  }
  sort(data.begin(),data.end());
  if(S.length()==0){
    if(S=="zyxwvutsrqponmlkjihgfedcba"){
      cout << -1 <<endl;
    }
    else{
      for(i=0;true;i++){
        if(i==a[i]-1){
          cout << c[i];
        }
        else{
          cout << c[i];
          break;
        }
      }
    }
  }
  else{
    for(i=0;true;i++){
        if(i==a[i]-1)continue;
        else{
          d=i;
          break;
        }
    }
    cout << S << c[d];
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:3: error: expected ',' or ';' before 'vector'
   11 |   vector<int> a,d;
      |   ^~~~~~
a.cc:14:7: error: 'i' was not declared in this scope
   14 |   for(i=0;i<26;i++){
      |       ^
a.cc:15:5: error: 'a' was not declared in this scope
   15 |     a[i]=alphabet_pos(S[i])
      |     ^
a.cc:17:13: error: overloaded function with no contextual type information
   17 |   sort(data.begin(),data.end());
      |             ^~~~~
a.cc:17:26: error: overloaded function with no contextual type information
   17 |   sort(data.begin(),data.end());
      |                          ^~~
a.cc:23:11: error: 'i' was not declared in this scope
   23 |       for(i=0;true;i++){
      |           ^
a.cc:24:15: error: 'a' was not declared in this scope
   24 |         if(i==a[i]-1){
      |               ^
a.cc:35:9: error: 'i' was not declared in this scope
   35 |     for(i=0;true;i++){
      |         ^
a.cc:36:15: error: 'a' was not declared in this scope
   36 |         if(i==a[i]-1)continue;
      |               ^
a.cc:38:11: error: 'd' was not declared in this scope
   38 |           d=i;
      |           ^
a.cc:42:20: error: 'd' was not declared in this scope
   42 |     cout << S << c[d];
      |                    ^
a.cc:43:2: error: expected '}' at end of input
   43 | }
      |  ^
a.cc:9:12: note: to match this '{'
    9 | int main() {
      |            ^
Language: C

S = raw_input()

flag = [0 for i in range(26)]

for i in range(len(S)):
    for j in range(97,97+26):
        if S[i] == chr(j):
            flag[j-97] = 1


if len(S) == 26:
    ans = []
    flag = [0 for i in range(26)]
    for i in range(len(S)-1):
        if S[i] < S[i+1]:
            for j in range(97,97+26):
                if S[i] == chr(j):
                    flag[j-97] = 1
                    ans.append(S[i])
                    break
            else:
                break
    if len(ans) == 0:
        print -1
    else:
        del ans[-1]
        for i in range(26):
            if flag[i] == 0:
                ans += chr(i+97)
                break
        ans = ''.join(ans)
        print ans
else:
    for i in range(26):
        if flag[i] == 0:
            S += chr(i+97)
            break
    print S

Compiler output:
main.c:1:1: warning: data definition has no type or storage class
    1 | S = raw_input()
      | ^
main.c:1:1: error: type defaults to 'int' in declaration of 'S' [-Wimplicit-int]
main.c:1:5: error: implicit declaration of function 'raw_input' [-Wimplicit-function-declaration]
    1 | S = raw_input()
      |     ^~~~~~~~~
main.c:1:5: error: initializer element is not constant
main.c:3:1: error: expected ',' or ';' before 'flag'
    3 | flag = [0 for i in range(26)]
      | ^~~~
main.c:31:15: error: empty character constant
   31 |         ans = ''.join(ans)
      |               ^~
Language: C++

#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include<climits>
#include<map>
#include<queue>
#include<functional>
#include<stack>
#include<iomanip>
#include<cstdint>
#include<bits/stdc++.h>
using namespace std;

#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPL(i,a,n) for(ll i=a;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"
#define SORTVG(v) sort(v.begin(),v.end(),greater<>())
#define SORTV(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define INF LLONG_MAX/2

typedef long long ll;
typedef tuple<int,int,bool> Tb;
typedef pair<int,int> Pii;
typedef vector<int> Vi;

template<class T> void chmax(T& a, T b) {if(a < b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a > b){a=b;}}
template<class T> void YesNo(T& a) {if(a){cout << "Yes" << ENT;}else{cout << "No" << ENT;}}
template<class T> void YESNO(T& a) {if(a){cout << "YES" << ENT;}else{cout << "NO" << ENT;}}
template<class T> void AorB(T& a, string A,string B) {if(a){cout << A << ENT;}else{cout << B << ENT;}}

int gcd(int a,int b){
    int r;
    if(a<b) swap(a,b);
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

int atcoder(){
    string s;
    cin>>s;
    if(s="zyxwvutsrqponmlkjihgfedcba") {cout<<-1<<ENT;return 0;}
    int n=(int)s.length();
    if(n<26){
        Vi alph(26,0);
        REP(i,0,n){
            alph[s[i]-'a']++;
        }
        REP(i,0,26){
            if(alph[i]==0){
                s.push_back('a'+i);
                break;
            }
        }
    }else{
        string t;
        reverse(ALL(s));
        Vi alph(26,0);
        alph[s[0]-'a']++;
        REP(i,1,n){
            alph[s[i]-'a']++;
            REP(j,s[i]-'a'+1,26) if(alph[j]==1) {s[i]='a'+j;t=s.substr(i);goto out;}
        }
    out:
        reverse(ALL(t));
        s=t;
    }
    cout<<s<<ENT;
    return 0;
}


signed main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    atcoder();
    return 0;
}


Compiler output:
a.cc: In function 'int atcoder()':
a.cc:55:9: error: could not convert 's.std::__cxx11::basic_string<char>::operator=(((const char*)"zyxwvutsrqponmlkjihgfedcba"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   55 |     if(s="zyxwvutsrqponmlkjihgfedcba") {cout<<-1<<ENT;return 0;}
      |        ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         |
      |         std::__cxx11::basic_string<char>
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

//modしながら塁乗
ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){
  string s;
  cin>>s;
  if(s == "zyxwvutsrqponmlkjihgfedcba"){
    cout<<-1<<endl;
    return 0;
  }
  bool count[26];
  REP(i,26){
    count[i] = false;
  }

  int temp = 0;
  while(temp<s.length()){
    if(s.length()==26)break;
    if(s.length()==26&&s[temp+1]=='z')break;
    cout<<s[temp];
    count[s[temp]-'a'] = true;
    temp++;
  }
  REP(i,26){
    if(s.length()==26)break;
    if(count[i]==false){
      char c = 'a' + i;
      cout<<c<<endl;
      break;
    }
  }
  if(s.length()==26){
    int p = 25;
    for(int i=24;i>=0;i--){
      if(s[i] - s[i+1]<0){
        p = i;
        break;
      }
    }
    REP(i,p){
      cout<<s[i];
      count[s[i]-'a'] = true;
    }
    for(int i=s[q]-'a'+1;i<26;i++){
      if(count[i]==false){

        cout<<(char)('a'+i)<<endl;
        break;
      }
    }

  }

 

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:81:17: error: 'q' was not declared in this scope
   81 |     for(int i=s[q]-'a'+1;i<26;i++){
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)  
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

//modしながら塁乗
ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){
  string s;
  cin>>s;
  if(s = "zyxwvutsrqponmlkjihgfedcba"){
    cout<<-1<<endl;
    return 0;
  }
  bool count[26];
  REP(i,26){
    count[i] = false;
  }
  REP(i,s.length()){
   count[s[i]-'a'] = true;
  }
  int temp = 0;
  while(temp<s.length()){
    if(s.length()==26&&s[temp]==z)break;
    cout<<s[temp];
    temp++;
  }
  REP(i,26){
    if(count[i]==false){
      char c = 'a' + i;
      cout<<c<<endl;
    }
  }

 

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:8: error: could not convert 's.std::__cxx11::basic_string<char>::operator=(((const char*)"zyxwvutsrqponmlkjihgfedcba"))' from 'std::__cxx11::basic_string<char>' to 'bool'
   44 |   if(s = "zyxwvutsrqponmlkjihgfedcba"){
      |      ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |        |
      |        std::__cxx11::basic_string<char>
a.cc:57:33: error: 'z' was not declared in this scope
   57 |     if(s.length()==26&&s[temp]==z)break;
      |                                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int i,j,l,c=0,f=0; string s,t,u; cin>>s; int n=s.length();
  if(n!=26){
    for(j=0;j<26;j++){
      c=0; f=0;
   	 for(i=0;i<n && f==0;i++){
   	  if('a'+j-s[i]==0){
		c++;
        f=1;
      }
     }
      if(c==0 && f==0){
        t='a'+j;
        cout<<s+t<<endl;
       break;
      }
    }
  }else if(s=="zyxwvutsrqponmlkjihgfedcba"){
	cout<<-1<<endl;
  }else if(s=="abcdefghijklmnopqrstuvwxyz"){
    	cout<<"b"<<endl;
  }else{
	for(i=0;i<26 &&g==0;i++){
      g=0;
      if('a'+i-s[i]!=0){
		s[i]+=1;
        l=i;
        g=1;
      }
    }
      for(i=0;i<=l && g==0;i++){
        cout<<s[i];
        break;
      }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:24: error: 'g' was not declared in this scope
   25 |         for(i=0;i<26 &&g==0;i++){
      |                        ^
a.cc:33:23: error: 'g' was not declared in this scope
   33 |       for(i=0;i<=l && g==0;i++){
      |                       ^
Language: C++

include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF=1e18,MOD=1e9+7;
int main(){
	string s,no="zyxwvutsrqponmlkjihgfedcba",ans="";
	cin>>s;
	map<char,ll>check;
	int itr;
	for(int i=0;i<s.length();i++){
		check[s[i]]++;
	}
	char key='#';
	for(int i=0;i<='z'-'a';i++){
		if(check['a'+i]==0){
			key='a'+i;
			break;
		}
	}
	if(key=='#'){
	string cmp=s;
	next_permutation(s.begin(),s.end());
		for(int i=0;i<s.length();i++){
			if(cmp[i]!=s[i]){
				ans+=s.substr(0,i+1);
				break;
			}
			
		}
	}
	else{
		ans=s+key;
	}
	cout<<ans<<endl;	
}


Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:9: error: 'string' was not declared in this scope
    6 |         string s,no="zyxwvutsrqponmlkjihgfedcba",ans="";
      |         ^~~~~~
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin>>s;
      |         ^~~
a.cc:7:14: error: 's' was not declared in this scope
    7 |         cin>>s;
      |              ^
a.cc:8:9: error: 'map' was not declared in this scope
    8 |         map<char,ll>check;
      |         ^~~
a.cc:8:13: error: expected primary-expression before 'char'
    8 |         map<char,ll>check;
      |             ^~~~
a.cc:11:17: error: 'check' was not declared in this scope
   11 |                 check[s[i]]++;
      |                 ^~~~~
a.cc:15:20: error: 'check' was not declared in this scope
   15 |                 if(check['a'+i]==0){
      |                    ^~~~~
a.cc:21:15: error: expected ';' before 'cmp'
   21 |         string cmp=s;
      |               ^~~~
      |               ;
a.cc:22:9: error: 'next_permutation' was not declared in this scope
   22 |         next_permutation(s.begin(),s.end());
      |         ^~~~~~~~~~~~~~~~
a.cc:24:28: error: 'cmp' was not declared in this scope
   24 |                         if(cmp[i]!=s[i]){
      |                            ^~~
a.cc:25:33: error: 'ans' was not declared in this scope
   25 |                                 ans+=s.substr(0,i+1);
      |                                 ^~~
a.cc:32:17: error: 'ans' was not declared in this scope
   32 |                 ans=s+key;
      |                 ^~~
a.cc:34:9: error: 'cout' was not declared in this scope
   34 |         cout<<ans<<endl;
      |         ^~~~
a.cc:34:15: error: 'ans' was not declared in this scope
   34 |         cout<<ans<<endl;
      |               ^~~
a.cc:34:20: error: 'endl' was not declared in this scope
   34 |         cout<<ans<<endl;
      |                    ^~~~
Language: C

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

int main(void){
	char s[27];
	scanf("%s",s);
	int i,j,len=strlen(s),memo[26]={0};
	if(len < 26){
		for(i=0;i<len;i++)memo[(s[i]-'a')] = 1;
		for(i=0;memo[i];i++){
			s[len] = 'a'+i;
			s[len+1]='\0';
			printf("%s",s);
			return 0;
		}
	}else{
		for(i=len-1;i>=;i--){
			memo[s[i]-'a'] = 1;
			for(j=s[i]-'a'+1;j<26&& !memo[j];j++);
			if(j<26){
				s[i] = 'a'+j;
				s[i+1] = '\0';
				printf("%s",s);
				return 0;
			}
		}
	}
	printf("-1");
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:18:32: error: expected expression before ';' token
   18 |                 for(i=len-1;i>=;i--){
      |                                ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<58;
 
 
int main(){
    string S; cin >> S;
  	string temp = S;
  	sort(temp.begin(), temp.end());
  	if(S.size() < 26){
      for(int i = 0; i < S.size(); ++i){
        if(temp[i] != 'a' + i){
          S.push_back('a' + i);
          cout << S << endl;
          return 0;
        }
        if(i == S.size()-1 && temp[i] == 'a' + i){
          	S.push_back('a' + (i + 1));
        	cout << S << endl;
          	return 0;
        }
      }
    }
  else{
    int i=s.size()-1;
    while(i>=1 and s[i-1]>s[i]) i--;
    if(i==0){
        cout<<-1<<endl;
        return 0;
    }
    for(int i = 0; i < S.size(); ++i){
        if(S[i] != 'a' + i){
          S.erase(i, S.size() - i + 1);
          S[i-1] += 1;	
          break;
        }
      }
    cout << S << endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:11: error: 's' was not declared in this scope
   41 |     int i=s.size()-1;
      |           ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<58;
 
int main(){
    string S; cin >> S;
  	string temp = S;
  	sort(temp.begin(), temp.end());
  	if(S.size() < 26){
      for(int i = 0; i < S.size(); ++i){
        if(temp[i] != "a" + i) cout << S + ("a" + i) << endl;
      }
    }
  else{
    for(int i = 0; i < S.size(); ++i){
        if(S[i] != "a" + i){
          S[i] = '\0';
          S[i-1] += 1;	
          break;
        }
      }
    cout << S << endl;
  }
  
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   27 |         if(temp[i] != "a" + i) cout << S + ("a" + i) << endl;
a.cc:32:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   32 |         if(S[i] != "a" + i){
Language: Java

public class Main {
    private static java.util.Scanner scanner = new java.util.Scanner(System.in);

    public static void main(String[] args) {
        String s = scanner.next();
        if (s.equals("zyxwvutsrqponmlkjihgfedcba")) {
            System.out.println(-1);
        } else if (s.length() < 26) {
            for (char c = 'a'; c <= 'z'; c++) {
                if (s.indexOf(c) == -1) {
                    System.out.println(s + c);
                    return;
                }
            }
        } else {
            char[] c = s.toCharArray();
            char last = c[25], use = c[25];

            for (int i = c.length - 2; i >= 0; i--) {
                Util.println(last, use, c[i]);
                if (last < c[i]) {
                    use = (char)Math.min(use, last = c[i]);
                } else {
                    System.out.println(s.substring(0, i) + use);
                    return;
                }
            }
        }
    }
}

Compiler output:
Main.java:20: error: cannot find symbol
                Util.println(last, use, c[i]);
                ^
  symbol:   variable Util
  location: class Main
1 error
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <math.h>
#include <array>
#include <list>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
set <int> st;
set <char> stc;
string s;
int buc[26];
int main(int argc,char const* argv[])
{
  memset(buc,0,sizeof(buc));
  cin >> s;
  if(s=="zyxwvutsrqponmlkjihgfedcba")
    {
      cout << -1 << endl;
      return 0;
    }
  if(int(s.size())!=26)
    {
      for(int i=0;i<int(s.size());i++)
	{
	  buc[int(s[i]-'a')]++;
	}
      for(int i=0;i<26;i++)
	{
	  if(buc[i]==0)
	    {
	      s+=char('a'+i);
	      break;
	    }
	}
      cout << s << endl;
      return 0;
    }
  else
    {
      int index;
      for(int i=25;i>0;i--)
	{
	  if(s[i]<s[i-1])index=i-1;
	}
      string parts=s.substr(index);
      s=s.substr(0,index);
      sort(parts.begin(),parts.end());
      s[int(s.size()-1)]=parts[0];
      cout << s << endl;
      return 0;
    }
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:24:3: error: 'memset' was not declared in this scope
   24 |   memset(buc,0,sizeof(buc));
      |   ^~~~~~
a.cc:12:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   11 | #include <list>
  +++ |+#include <cstring>
   12 | #include <set>
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int a[26]={0};
  for(int i=0; i<s.size(); i++){
    a[(int)(s[i]-'a')]++;
  }
  for(int i=0; i<26; ++i){
    if(a[i]==0) break;
  }
  if(i<26) cout << s[i] + (string)('a'+i) << endl;
  else cout << -1 << endl;
  return 0;
}


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

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

int main(){
	string S;
	cin >> S;
	
	vector<bool> exist(26,false);
	
	if(S.size()==26){
		if(S=="zyxwvutsrqponmlkjihgfedcba")cout << "-1" << endl;
		else{
			for(int i=25;i>0;i--){
				exist[S[i]-'a']=true;
				if(S[i-1]<S[i]){
					for(int j=0;;j++){
						if(exist[j]){
							S[i-1]='a'+j;
							break;
						}
					}
					S.erase(S.begin()+i,S.end());
					break;
				}
			}
			cout << S << endl;
		}
		cout << aaaaa << endl;
		return 0;
	}
	
	for(int i=0;i<S.size();i++)exist[S[i]-'a']=true;
	char add;
	for(int i=0;;i++){
		if(!exist[i]){
			add='a'+i;
			break;
		}
	}
	cout << S << add << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:25: error: 'aaaaa' was not declared in this scope
   28 |                 cout << aaaaa << endl;
      |                         ^~~~~
Language: C++

#include <iostream>
#include <set>
using namespace std;
string s;
int main()
{
	string s;
	cin>>s;
	int N=s.length();
	if(N<26){
        for(char i='a';char<='z';i++){
            if(s.find(i)==-1){
                cout<<s<<i;
                return 0;
            }
        }
	}
	else{
        set<char>x;
        while(!s.empty()){
            char p=s.back();
            s.pop_back();
            x.insert(p);
            if(*x.rbegin()!=p){
                cout<<s<<*x.upper_bound(p);
                return 0;
            }
        }
	}
	cout<<-1;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:28: error: expected unqualified-id before '<=' token
   11 |         for(char i='a';char<='z';i++){
      |                            ^~
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define vvvel vector<vvel>
void mmin(int &a, int b) { a = min(a, b); }
void mmax(int &a, int b) { a = max(a, b); }
void sor(vel &v) { sort(v.begin(), v.end()); }
int zero() { return 0; }
int gcd(int a, int b) {
	if (a < b) return gcd(b, a);
	if (b == 0) return a;
	int r = a % b;
	return gcd(b, r);
}
int ord(int a,int p) {
	if (a%p != 0) return 0;
	return 1 + ord(a / p,p);
}
int rui(int a, int n) {
	if (n == 0) {
		return 1;
	}
	return a * rui(a, n - 1);
}
signed main() {
	string s;
	cin >> s;
	int n = s.size();
	string mo = "abcdefghijklmnopqrstuvwxyz";
	if (s == mo) {
		cout << -1 << endl;
	}
	else {
		vel t(n);
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < 26; j++) {
				if (s[i] == mo[j]) {
					t[n - i - 1] = j;
				}
			}
		}
		int i = 0;
		while (t[i] == 25 - i) {
			i++;
		}
		t[i] = 0;
		for(int j=0;j<)
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:52:31: error: expected primary-expression before ')' token
   52 |                 for(int j=0;j<)
      |                               ^
a.cc:52:31: error: expected ';' before ')' token
   52 |                 for(int j=0;j<)
      |                               ^
      |                               ;
a.cc:53:9: error: expected primary-expression before '}' token
   53 |         }
      |         ^
Language: C++

#include<iostream>
using namespace std;
int len=0;
char s[30];
bool flag[300];
char c;

int findDec()
{
    for (int i=len-1; i>=0; --i)
    {
        if (i==0) return -1;
        if (s[i-1]>s[i]) continue;
        if (s[i-1]<s[i]) return i-1;
    }
    return -1;
}

void geneLoc(int loc)
{
    memset(flag,0,sizeof(flag));
    for (int i=0; i<loc; ++i)
    {
        cout<<s[i];
        flag[s[i]]=1;
    }
    for (char c=s[loc]+1; c<='z'; ++c)
        if (flag[c]==0)
        {
            cout<<c<<endl;
            break;
        }
}


int main()
{
    while (scanf("%c",&c)!=EOF)
    {
        if (c>='a' && c<='z')
            s[len++]=c;
        else break;
        flag[c]=1;
    }
    if (len<26)
    {
        cout<<s;
        for (char c='a'; c<='z'; ++c)
            if (flag[c]==0)
            {
                cout<<c<<endl;
                break;
            }
    }
    if (len==26)
    {
        int loc=findDec();
        if (loc==-1)
        {
            cout<<loc<<endl;
        }else
        {
            geneLoc(loc);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'void geneLoc(int)':
a.cc:21:5: error: 'memset' was not declared in this scope
   21 |     memset(flag,0,sizeof(flag));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<iostream>
  +++ |+#include <cstring>
    2 | using namespace std;
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
typedef long long ll;


int main(){
  string S;
  cin >> S;
  vector<bool> alph(26,false);
  if(S.size() < 26){
    rep(i,S.size()) alph[S[i] - 'a'] = true;
    rep(i,26){
      if(alph[i] == false){
        cout << S << (char)(i+'a') << endl;
        return 0;
      }
    }
  }
  vector<string> ans;
  for(int i = S.size()-1; i >= 0; i--){
    for(int j = i-1; j >= 0; j--){
      if(S[i] > S[j]){
        char tmp = S[i];
        S[i] = S[j];
        S[j] = tmp;
        ans.push_back(S.substr(0,j+1));
        S[j] = S[i];
        S[i] = tmpatcoder;
      }
    }
  }
  if(ans.size() == 0){
    cout << -1 << endl;
    return 0;
  }else{
    sort(all(ans));
    cout << ans[0] << endl;
  }
  return 0;
}


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

#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  char c[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}
  if(s.size()<26){
    for(int i=0;i<s.size();i++){
      for(int j=0;j<26;j++){
        if(s[i]==c[i]){
          c[i]=='0';
          break;
        }
      }
    }
    cout<<s;
    for(int i=0;i<26;i++){
      if(c[i]!='0'){
        cout<<c[i];
        break;
      }
    }
  }else{
    if(s=="abcdefghijklmnopqrstuvwxyz")
      cout<<-1;
    else{
      for(int i=24;i>=0;i++){
        if(s[i]<s[i+1]){
          cout<<s.substr(0,i)<<(char)(s[i]+1);
          return 0;
        }
      }
    }
  }
}
          

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: expected ',' or ';' before 'if'
    7 |   if(s.size()<26){
      |   ^~
a.cc:23:4: error: 'else' without a previous 'if'
   23 |   }else{
      |    ^~~~
Language: C++

#include <iostream>
#include <stdio.h>
#include <algorithm>
//#include <string>
#include <string.h>
#include <math.h>
//#include <vector>

using namespace std;


int main() {
  char S[26];
  int Used[26];
  int n=0,i;
  char s; 
  char SL[]="zyxwvutsrqponmlkjihgfedcba";
  
  gets(S);
  
  while(S[n] != '\0')
    n++;
  // printf("%d\n",n);

  if(n<26){
    for(i=0;i<26;i++){
      Used[i]=0;
    }
    for(i=0;i<n;i++){
      Used[(int)(S[i]-97)]=1;
    }
    for(i=0;i<n;i++){
      if(Used[i]==0) break;
    }
    S[n]=(char)(i+97);
    S[n+1]='\0';
    puts(S);
  }else if(n==26){
    if(strcmp(SL,S)==0)
      cout << -1; 
    else{
      i=25;
      while(S[i-1]>S[i])
	i--;
      S[i-1]=S[25];
      S[i]='\0';
      puts(S);
    }
  }

  
  return 0;
}


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

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

bool next_perm(string& a) {
    int itr = a.size() - 1;
    bool judge = false;
    while (itr > 0) {
        --itr;
        if (a[itr] < a[itr + 1]) {
            judge = true;
            break;
        }
    }

    if (!judge) {
        reverse(a.begin(), a.end());
    } else {
        swap(a[itr], a.back());
    }

    return judge;
}

int main() {
    string S;
    cin >> S;
    int cnt[26];
    fill(cnt, cnt + 26, 0);

    for (char c : S) {
        ++cnt[c - 'a'];
    }

    for (int i = 0; i < 26; ++i) {
        if (cnt[i] == 0) {
            S.push_back('a' + i);
            cout << S << endl;
            return 0;
        }
    }

    string T = S;
    if (next_perm(S)) {
        for (int i = 0; i < 26; ++i) {
            cout << S[i];
            if (S[i] != T[i]) break;
        }
    } else {
        cout << -1;
    }
    cout << endl;
    return 0;
}


Compiler output:
a.cc: In function 'bool next_perm(std::string&)':
a.cc:17:9: error: 'reverse' was not declared in this scope
   17 |         reverse(a.begin(), a.end());
      |         ^~~~~~~
Language: C++

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

int main() {
    string S;
    cin >> S;
    int cnt[26];
    fill(cnt, cnt + 26, 0);

    for (char c : S) {
        ++cnt[c - 'a'];
    }

    for (int i = 0; i < 26; ++i) {
        if (cnt[i] == 0) {
            S.push_back('a' + i);
            cout << S << endl;
            return 0;
        }
    }

    string T = S;
    if (next_permutation(S.begin(), S.end())) {
        for (int i = 0; i < 26; ++i) {
            cout << S[i];
            if (S[i] != T[i]) break;
        }
    } else {
        cout << -1;
    }
    cout << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:25:9: error: 'next_permutation' was not declared in this scope
   25 |     if (next_permutation(S.begin(), S.end())) {
      |         ^~~~~~~~~~~~~~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
using ll = long long;

int main() {
	string s;
	cin >> s;
	int num[30] = {};
	int n = s.size();
	if (n < 26) {//使ってない文字を数える
		for (int i = 0;i < s.size();++i)num[s[i] - 'a']++;
		cout << s;
		for (int i = 0;i < 26;++i) {//使ってなかったらsの後ろに付ける
			if (num[i] == 0) {
				cout << al[i] << endl;
				return 0;
			}
		}
	}
	else {
		for (int i = 24; i >= 0; --i) {
			num[s[i + 1] - 'a'] = 0;//s[i+1]を使えるようにした
			for (int j = 0; j < 26; ++j) {
				if ('a' + j > s[i] && num[j] == 0) {
					cout << s.substr(0, i) << (char)('a' + j) << endl;
					return 0;
				}
			}
		}
		cout << -1 << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:41: error: 'al' was not declared in this scope; did you mean 'll'?
   17 |                                 cout << al[i] << endl;
      |                                         ^~
      |                                         ll