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

import Control.Applicative
import qualified Data.Vector as V
import Data.Monoid
import Data.List

data Subsequence = Subsequence
    { str :: String
    , indicies :: [Int] } deriving Show

emptySubseq :: Subsequence
emptySubseq = Subsequence "" []

allStrings :: [String] -> [String]
allStrings alphabet =  alphabet <> ((++) <$> allStrings alphabet <*> alphabet)

dict = allStrings $ map (: []) ['a'..'z']

{-
insertAndReturnSeqIdx :: Int -> [Int] -> Int -> ([Int], Int)
insertAndReturnSeqIdx i [] a = ([i], a)
insertAndReturnSeqIdx i ix a
    | i < head ix = (i : ix, a)
    | not $ null ix = let
        (res, newA) = insertAndReturnSeqIdx i (tail ix) (a + 1) in
        (head ix : res, newA)
    | null ix = ([i], a)

-- recurrence relation between subsequences
-- TODO: Tabulation
reccur :: V.Vector Char -> Subsequence -> Int -> Subsequence
reccur input prevSeq idx = Subsequence newStr newIndicies
      where (newIndicies, seqIdx) =
                insertAndReturnSeqIdx idx (indicies prevSeq) 0
            (front, end) = splitAt seqIdx $ str prevSeq
            newStr = front ++ ((input V.! idx) : end)

isSubseq Subsequence sx = 
-}

{-
search :: V.Vector Char -> String -> Either String Int
search input target = do
    let limit = length target
    let inputLen = V.length input
    map 
-}

search :: String -> [String] -> String
search input dict
    | isSubsequenceOf (head dict) input = search input (tail dict)
    | otherwise = head dict


{-
solve :: V.Vector Char -> Int
solve input = 
-}
    

main = do
    --input <- V.fromList <$> getLine
    input <- getLine
    let res = search input dict
    print res


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import Control.Applicative
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:27: error: 'deriving' does not name a type
    8 |     , indicies :: [Int] } deriving Show
      |                           ^~~~~~~~
a.cc:40:1: error: expected unqualified-id before '{' token
   40 | {-
      | ^
a.cc:48:1: error: 'search' does not name a type
   48 | search :: String -> [String] -> String
      | ^~~~~~
a.cc:60:1: error: 'main' does not name a type
   60 | main = do
      | ^~~~
Language: C++

#include<iostream>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
vector<int>::iterator it;
vector<int> v[26];
string s;
int surf[200010];
int main(){
  cin>>s;
  lol(i,26)v[i].push_back(-1);
  lol(i,s.size()){
    v[s[i]-'a'].push_back(i);
  }
  lol(i,26)v[i].push_back(mod);
  int now=-1,len=0;
  while(true){
    int maxi=0,pnt;
    lol(i,26){
      it=upper_bound(v[i].begin(),v[i].end(),now);
      if(maxi<*it){
	maxi=*it;
	pnt=i;
      }
    }
    it=upper_bound(v[pnt].begin(),v[pnt].end(),now);
    it--;
    surf[len]=*it;
    len++;
    if(maxi==mod)break;
    now=maxi;
  }

  now=-1;
  for(int i=0;i<len;i++){
    int pnt=0;
    while(true){
      it=upper_bound(v[pnt].begin(),v[pnt].end(),now);
      if(surf[i]<*it)break;
      pnt++;
    }
    char z=pnt+'a';cout<<z;
    now=*it;
  }
  cout<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:10: error: 'upper_bound' was not declared in this scope
   23 |       it=upper_bound(v[i].begin(),v[i].end(),now);
      |          ^~~~~~~~~~~
a.cc:29:8: error: 'upper_bound' was not declared in this scope
   29 |     it=upper_bound(v[pnt].begin(),v[pnt].end(),now);
      |        ^~~~~~~~~~~
a.cc:41:10: error: 'upper_bound' was not declared in this scope
   41 |       it=upper_bound(v[pnt].begin(),v[pnt].end(),now);
      |          ^~~~~~~~~~~
Language: C++

#include<iostream>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
vector<int>::iterator it;
vector<int> v[26];
string s;
int surf[200010];
int main(){
  cin>>s;
  lol(i,26)v[i].push_back(-1);
  lol(i,s.size()){
    v[s[i]-'a'].push_back(i);
  }
  lol(i,26)v[i].push_back(mod);
  int at=-1,len=0;
  while(true){
    int maxi=0,pnt;
    lol(i,26){
      it=upper_bound(v[i].begin(),v[i].end(),at);
      if(maxi<*it){
	maxi=*it;
	pnt=i;
      }
    }
    it=upper_bound(v[pnt].begin(),v[pnt].end(),at);
    it--;
    surf[len]=*it;
    len++;
    if(maxi==mod)break;
    at=maxi;
  }

  at=-1;
  for(int i=0;i<len;i++){
    int pnt=0;
    while(true){
      it=upper_bound(v[pnt].begin(),v[pnt].end(),at);
      if(surf[i]<*it)break;
      pnt++;
    }
    char z=pnt+'a';cout<<z;
    at=*it;
  }
  cout<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:10: error: 'upper_bound' was not declared in this scope
   23 |       it=upper_bound(v[i].begin(),v[i].end(),at);
      |          ^~~~~~~~~~~
a.cc:29:8: error: 'upper_bound' was not declared in this scope
   29 |     it=upper_bound(v[pnt].begin(),v[pnt].end(),at);
      |        ^~~~~~~~~~~
a.cc:41:10: error: 'upper_bound' was not declared in this scope
   41 |       it=upper_bound(v[pnt].begin(),v[pnt].end(),at);
      |          ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define red(i, r, l) for (int i = r; i >= l; --i)
#define re(i, n) for(int i = 0; i < n; ++i)
#define db(x) cout << #x << "=" << (x) << " "
#define el cout << endl
using namespace std;
const int MXN = 100010;

int n;

char str[MXN];
int nxt[MXN][26], far[MXN], l[MXN];
void calc(int i, int len)
{
    if (len == 0)
        return;
    re(k, 26)
        if (l[nxt[i][k] + 1] + 1 == len)
        {
            putchar('a' + k);
            calc(nxt[i][k] + 1, len - 1);
            break;
        }
}
int main()
{
    gets(str + 1); n = strlen(str + 1);
    re(k, 26)
        nxt[n + 1][k] = n + 1, l[n + 1] = 1, l[n + 2] = 0;
    red(i, n, 1)
    {
        re(k, 26)
            nxt[i][k] = nxt[i + 1][k];
        nxt[i][str[i] - 'a'] = i;
        int j = str[i] - 'a';
        re(k, 26)
            if (nxt[i][j] < nxt[i][k])
                j = k;
        far[i] = j;
        l[i] = l[nxt[i][far[i]] + 1] + 1;
        //db(l[i]), db(far[i]), el;
    }
    calc(1, l[1]);
    putchar('\n');
    return 0;
}


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

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define N 200010
#define M 26
int n, dp[N][M];
char dp2[N][M];
string s;

int main(){
	cin>>s;
	n = s.size();
	reverse(all(s));
	cerr<<s<<endl;
	mset(dp, 0x9); mset(dp2, 0x9);
	rep(i, M){
		dp[0][i] = 1;
		dp2[0][i] = (char)(i);
	}
	rep(i, n){
		char c = s[i]-'a';
		rep(j, M){
			if(j!=c){
				dp[i+1][j] = dp[i][j];
				dp2[i+1][j] = dp2[i][j];
			}
		}
		rep(j, M){
			if(dp[i+1][c] >= dp[i][j]+1){
				if(dp[i+1][c]==dp[i][j]+1) chmin(dp2[i+1][c], j);
				else dp2[i+1][c] = j;
				dp[i+1][c] = dp[i][j]+1;
			}
		}
	}
	string res = "";
	char p = 0;
	rep(i, M) if(dp[n][i]<dp[n][p]) p = i;
	//for(int j = n; j >= 0; j--) {rep(i, M) cerr<<dp[j][i]<<" "; cerr<<endl;}
	//cerr<<dp[n][p]<<endl;
	res += 'a'+p;
	//char q = dp2[n][p], cnt = dp[n][p];
	for(int j = n; j >= 0; j--) {rep(i, M) cerr<<(char)('a'+dp2[j][i])<<" "; cerr<<endl;}
	for(int i = n-1; i >= 0; i--){
		if(dp[i][q]<cnt){
			cnt--;
			res += 'a'+q;
			q = dp2[i][q];
		}
	}
	cout<<res<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:82:26: error: 'q' was not declared in this scope
   82 |                 if(dp[i][q]<cnt){
      |                          ^
a.cc:82:29: error: 'cnt' was not declared in this scope; did you mean 'int'?
   82 |                 if(dp[i][q]<cnt){
      |                             ^~~
      |                             int
Language: C++

#include<iostream>
#include<cassert>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

string s;
int n, nex[200010][26], can[200010];
int dp[200010];

int main(){
	cin >> s;
	n = s.size();
	memset(nex, -1, sizeof(nex));
	for(int i = n - 1; i >= 0; i--){
			rep(j, 26) nex[i][j] = nex[i + 1][j];
			nex[i][s[i] - 'a'] = i;
	}
	rep(i, n + 10) dp[i] = 1e9;
	dp[0] = 0;
	rep(i, n + 1) rep(j, 26){
		int k = nex[i][j];
		if(k < 0) dp[n + 1] = min(dp[n + 1], dp[i] + 1);
		else dp[k + 1] = min(dp[k + 1], dp[i] + 1);
	}
	//cerr << dp[n + 1] << endl;
	
	can[n + 1] = 1;
	for(int i = n; i >= 0; i--) rep(j, 26){
		int k = nex[i][j];
		if(k < 0){
			if(dp[n + 1] == dp[i] + 1 && can[n + 1]) can[i] = 1;
		}
		else{
			if(dp[k + 1] == dp[i] + 1 && can[k + 1]) can[i] = 1;
		}
	}
	string ans;
	for(int i = 0; i <= n;){
		rep(j, 26){
			int k = nex[i][j];
			if(k < 0){
				if(can[n + 1] && dp[n + 1] == dp[i] + 1){
					//cerr<<dp[i]<<" to "<<dp[n+1]<<endl;
					ans += 'a' + j;
					i = n + 1; break;
				}
			}
			else{
				if(can[k + 1] && dp[k + 1] == dp[i] + 1){
					//cerr<<dp[i]<<" to "<<dp[k+1]<<endl;
					ans += 'a' + j;
					i = k + 1; break;
				}
			}
		}
		//cerr<<"i:"<<i<<" ans:"<<ans<<endl;
	}
	//cerr<<"n:"<<n<<endl;
	cout << ans << endl;


	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:9: error: 'memset' was not declared in this scope
   13 |         memset(nex, -1, sizeof(nex));
      |         ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include<cassert>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: C++

/*
 ***
 Question Name:
 ***
 Question Link:
 
 ***
 Idea:
 */

#include <memory.h>
#include <iomanip>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <cmath>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>

#define REP(i,s,n) for(int (i)=s; (i)<(int)(n);(i)++)
#define RIT(it,c) for(__typeof(c.begin()) it = c.begin();it!=c.end();it++)
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x).size()
#define MSET(m,v) memset(m,v,sizeof(m))

using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<LL> vL;
typedef vector<bool> vb;
typedef unordered_set<int> ui;
typedef pair<LL,LL> pLL;


class NotSubsequence{
    vi dp;
    vector<char> to;
    vector<vi> next;
    string S;
    int N;
    void init(string &s){
        S = s;
        N = (int)s.size();
        dp = vi(N+1,-1);
        dp[N] = 1;
        to.resize(N+1,'a');
        next = vector<vi>(26,vi(N,N));
        for(int i=N-1;i>=0;--i) for(int j=0;j<26;++j){
            if(S[i] == char((int)'a' + j)) next[j][i] = i;
            else next[j][i] = (i<N-1? next[j][i+1]:N);
        }
        return;
    }
    
    int minLength(int i){
        if(i>N) return 0;
        if(dp[i] >= 0) return dp[i];
        dp[i] = N+1;
        to[i] = 'z';
        for(int j=0;j<26;++j){
            int tmpl = 1 + minLength(next[j][i]+1);
            if(tmpl < dp[i]){
                dp[i] = tmpl;
                to[i] = (char)((int)'a' + j);
            }
        }
        return dp[i];
    }
public:
    string solution(string s){
        if(s.empty()) return "a";
        init(s);
        int L = minLength(0), j = 0;
        assert(L > 0);
        string ans;
        while(true){
            ans += to[j];
            j = next[(int)(to[j]-'a')][j]+1;
            if(j>=N) break;
        }
        return ans;
    }
};

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>

#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v,a) (reverse((v).begin(), (v).end()))
#define LOWER_BOUND(v,a) (lower_bound((v).begin(), (v).end(), (a)))
#define UPPER_BOUND(v,a) (upper_bound((v).begin(), (v).end(), (a)))
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
using namespace std;

char A[200000];
int group[200000];
vector<int> index_list[26];

signed main()
{
	cin >> A;
	int len = strlen(A);

	int cnt = 0;
	int g = 0;

	bool flg[26] = {};
	for (int i = len - 1; i >= 0; i--)
	{
		char n = A[i] - 'a';
		index_list[n].push_back(i);
		if (!flg[n])
		{
			cnt++;
		}
		flg[n] = true;
		group[i] = g;
		if (cnt == 26)
		{
			memset(flg, 0, sizeof(flg));
			cnt = 0;
			g++;
		}
	}

	for (int c = 0; c < 26; c++)
	{
		REVERSE(index_list[c]);
	}

	string ans = "";
	int index = -1;

	for (int i = g; i >= 0; i--)
	{
		for (int c = 0; c < 26; c++)
		{
			auto it = UPPER_BOUND(index_list[c], index);
			if (i > 0)
			{
				int n = *it;
				int gg = group[n];
				if (gg == i - 1)
				{
					ans += (char)(c + 'a');
					index = n;
					break;
				}
			}
			else
			{
				if (it == index_list[c].end())
				{
					ans += (char)(c + 'a');
					break;
				}
			}
		}
	}

	cout << ans << endl;
}

Compiler output:
a.cc:63:38: error: macro "REVERSE" requires 2 arguments, but only 1 given
   63 |                 REVERSE(index_list[c]);
      |                                      ^
a.cc:24:9: note: macro "REVERSE" defined here
   24 | #define REVERSE(v,a) (reverse((v).begin(), (v).end()))
      |         ^~~~~~~
a.cc: In function 'int main()':
a.cc:63:17: error: 'REVERSE' was not declared in this scope
   63 |                 REVERSE(index_list[c]);
      |                 ^~~~~~~
Language: C++

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


bool is_sub(string &s,string &sub)
{
	int i,isubLen = (int)sub.length(),iPos=0;
	char c;
	char *pos = (char*)s.c_str();
	for (i = 0; i < isubLen; i++) {
		c = sub[i];
		pos = (char*)strchr(pos, c);
		if (NULL == pos) { return false; }
		pos++;
	}

	return true;
}
string fNextString(const char *s)
{
	string sRet;
	int i, iCarry=1;
	char c;

	i = (int)strlen(s) - 1;
	for (; i >= 0;i--) {
		if (iCarry == 0) {
			sRet.insert(sRet.begin(), s,&s[i+1]);
			break;
		}
		c = s[i] + iCarry;		
		iCarry = (c > 'z')?1:0;
		c = (c > 'z')?'a': c;
		sRet.insert(sRet.begin(), c);
	};
	if (iCarry!=0) { sRet.insert(sRet.begin(), 'a'); }

	return sRet;
}


int main() {
	string sIn,sSub;
	bool bIsSub = true;

	cin >> sIn;

	do {
		sSub = fNextString(sSub.c_str());
		bIsSub = is_sub(sIn, sSub);
	} while (bIsSub);
	
	cout <<sSub<< endl;
	return 0;
}

Compiler output:
a.cc: In function 'bool is_sub(std::string&, std::string&)':
a.cc:16:30: error: 'strchr' was not declared in this scope
   16 |                 pos = (char*)strchr(pos, c);
      |                              ^~~~~~
a.cc:6:1: note: 'strchr' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <algorithm>
  +++ |+#include <cstring>
    6 | using namespace std;
a.cc: In function 'std::string fNextString(const char*)':
a.cc:29:18: error: 'strlen' was not declared in this scope
   29 |         i = (int)strlen(s) - 1;
      |                  ^~~~~~
a.cc:29:18: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

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


bool is_CharInS(string &s, int &iPos, char c)
{
	int iLen = (int)s.length(),i;
	iPos = min(iPos,iLen-1);
	iPos = max(iPos,0);

	for (i = iPos; i < iLen; i++) {
		if (c == s[i]) {
			iPos = i+1;
			return true;
		}
	}
	return false;
}


bool is_sub(string &s,string &sub)
{
	int i,isubLen = (int)sub.length(),iPos=0;
	char c;
	bool bIsSub = true;
	for (i = 0; i < isubLen; i++) {
		c = sub[i];
		bIsSub = is_CharInS(s, iPos, c);
		if (!bIsSub) { break; }
	}

	return bIsSub;
}
string fNextString(const char *s)
{
	string sRet;
	int i, iCarry=1;
	char c;

	i = (int)strlen(s) - 1;
	for (; i >= 0;i--) {
		if (iCarry == 0) {
			sRet.insert(sRet.begin(), s,&s[i+1]);
			break;
		}
		c = s[i] + iCarry;		
		iCarry = (c > 'z')?1:0;
		c = (c > 'z')?'a': c;
		sRet.insert(sRet.begin(), c);
	};
	if (iCarry!=0) { sRet.insert(sRet.begin(), 'a'); }

	return sRet;
}


int main() {
	string sIn,sSub;
	bool bIsSub = true;

	cin >> sIn;

	do {
		sSub = fNextString(sSub.c_str());
		bIsSub = is_sub(sIn, sSub);
	} while (bIsSub);
	
	cout <<sSub<< endl;
	return 0;
}

Compiler output:
a.cc: In function 'std::string fNextString(const char*)':
a.cc:44:18: error: 'strlen' was not declared in this scope
   44 |         i = (int)strlen(s) - 1;
      |                  ^~~~~~
a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include <algorithm>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
int n,m,i,j,dp[200005],last[30],pre[200005],mi;
char ans[200005];
string st;
void print(int x)
{
	cout<<ans[x];
	if (pre[x]<st.length()) print(pre[x]+1);
}
int main()
{
	cin>>st;
	for (i=1;i<=26;i++) last[i]=st.length();
	dp[st.length()]=1;a
	pre[st.length()]=st.length()+1;
	for (i=st.length();i>=0;i--)
	{
		last[st[i]-'a'+1]=i;
		mi=1;
		for (j=1;j<=26;j++) 
		{
			if (dp[last[j]+1]<dp[last[mi]+1])
			{
				mi=j;
			}
		}
		ans[i]=mi+'a'-1;
		dp[i]=dp[last[mi]+1]+1;
		pre[i]=last[mi];
	}
	print(0);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:27: error: 'a' was not declared in this scope
   23 |         dp[st.length()]=1;a
      |                           ^
Language: C++

#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
#define N 200005
using namespace std;
char str[N],mm[N];
int dp[N];
int next[N][30];
int route[N];
int a[30];
int main(void)
{
    scanf("%s",str + 1);
    int l = strlen(str+1);
    memset(next,-1,sizeof(next));
    memset(route,-1,sizeof(route));
    memset(dp,0x3f,sizeof(dp));
    memset(a,-1,sizeof(a));
    int id = 0;
    dp[l+1] = 1;
    route[l+1] = l + 1;
    mm[l+1] = 0;
    for(int i = l+2;i < N;i++)
        dp[i] = 0;
    for(int i = 0; i < 26; i++)
        a[i] = l+1;
    for(int i = l; i >= 1; i--)
    {
        a[str[i]-'a'] = i;
        for(int j = 0; j < 26; j++)
        {
            if(dp[i] > dp[a[j] + 1] + 1)
            {
                mm[i] = j;
                //printf("%d\n",j);
                dp[i] = dp[a[j] + 1]+1;
                route[i] = a[j] + 1;
            }
        }
    }
    //printf("%d\n",dp[1]);
    int f = 1;
    while(f<l+1)
    {
        printf("%c",mm[f] + 'a');
        f = route[f];
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:12: error: reference to 'next' is ambiguous
   16 |     memset(next,-1,sizeof(next));
      |            ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:9:5: note:                 'int next [200005][30]'
    9 | int next[N][30];
      |     ^~~~
a.cc:16:27: error: reference to 'next' is ambiguous
   16 |     memset(next,-1,sizeof(next));
      |                           ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:9:5: note:                 'int next [200005][30]'
    9 | int next[N][30];
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
#define N 200005
using namespace std;
char str[N],mm[N];
int dp[N];
int next[N][30];
int route[N];
int a[30];
int main(void)
{
    scanf("%s",str + 1);
    int l = strlen(str+1);
    memset(next,-1,sizeof(next));
    memset(route,-1,sizeof(route));
    memset(dp,0x3f,sizeof(dp));
    memset(a,-1,sizeof(a));
    int id = 0;
    dp[l+1] = 1;
    route[l+1] = l + 1;
    mm[l+1] = 0;
    for(int i = l+2;i < N;i++)
        dp[i] = 0;
    for(int i = 0; i < 26; i++)
        a[i] = l+1;
    for(int i = l; i >= 1; i--)
    {
        a[str[i]-'a'] = i;
        for(int j = 0; j < 26; j++)
        {
            if(dp[i] > dp[a[j] + 1] + 1)
            {
                mm[i] = j;
                //printf("%d\n",j);
                dp[i] = dp[a[j] + 1]+1;
                route[i] = a[j] + 1;
            }
        }
    }
    //printf("%d\n",dp[1]);
    int f = 1;
    while(f<l+1)
    {
        printf("%c",mm[f] + 'a');
        f = route[f];
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:12: error: reference to 'next' is ambiguous
   13 |     memset(next,-1,sizeof(next));
      |            ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:6:5: note:                 'int next [200005][30]'
    6 | int next[N][30];
      |     ^~~~
a.cc:13:27: error: reference to 'next' is ambiguous
   13 |     memset(next,-1,sizeof(next));
      |                           ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:6:5: note:                 'int next [200005][30]'
    6 | int next[N][30];
      |     ^~~~
Language: C++

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
string str;
vector<int> xid[27];
int dp[200001];
int type[200001],next[200001];

int solve(int v){
	if(dp[v]!=-1)return dp[v];
	int res=n+2,nex=n+2;
	for(int i=0;i<26;i++){
		int nv=lower_bound(xid[i].begin(),xid[i].end(),v)-xid[i].begin();
		if(xid[i][nv]==n){
			if(res>1){
				res=1;
				type[v]=i;
				next[v]=n;
			}
		}else{
			int vv=solve(xid[i][nv]+1);
			if(res>vv+1){
				res=vv+1;
				type[v]=i;
				next[v]=xid[i][nv]+1;
			}
		}
	}
	dp[v]=res;
	return dp[v];
}

int main(void){
	memset(dp,-1,sizeof(dp));
	cin >> str;
	n=str.size();
	dp[n]=1;
	for(int i=0;i<n;i++){
		xid[str[i]-'a'].push_back(i);
	}
	for(int i=0;i<26;i++){
		xid[i].push_back(n);
	}
	solve(0);
	int now=0;
	string res="";
	while(now<n){
		res+=('a'+type[now]);
		now=next[now];
	}
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int solve(int)':
a.cc:22:33: error: reference to 'next' is ambiguous
   22 |                                 next[v]=n;
      |                                 ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:11:18: note:                 'int next [200001]'
   11 | int type[200001],next[200001];
      |                  ^~~~
a.cc:29:33: error: reference to 'next' is ambiguous
   29 |                                 next[v]=xid[i][nv]+1;
      |                                 ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:11:18: note:                 'int next [200001]'
   11 | int type[200001],next[200001];
      |                  ^~~~
a.cc: In function 'int main()':
a.cc:53:21: error: reference to 'next' is ambiguous
   53 |                 now=next[now];
      |                     ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:11:18: note:                 'int next [200001]'
   11 | int type[200001],next[200001];
      |                  ^~~~
Language: C++

#include <bits/stdc++.h>

#define PB          push_back
#define PF          push_front
#define MP          make_pair
#define FI          first
#define SE          second
#define SIZE( A )   int( ( A ).size( ) )
#define ALL( A )    ( A ).begin( ), ( A ).end( )
#define ALLR( A )   ( A ).rbegin( ), ( A ).rend( )

using namespace std;

typedef long long           ll;
typedef unsigned long long  ull;
typedef long double         lf;
typedef pair< int, int >    pii;
typedef pair< ll, ll >      pll;
typedef vector< bool >      vb;
typedef vector< lf >        vd;
typedef vector< ll >        vll;
typedef vector< int >       vi;
typedef vector< pii >       vpii;

const int MAXN = int( 2e5 )+10;
const int MOD  = int( 360 );
const int oo   = INT_MAX;	
const int A    = 26;

string s;
int nxt[ A ][ MAXN ];
int dp[ MAXN ];
string ans;

void precalc() {
  int sz = SIZE(s);
  for( int i = 0; i < A; ++i ) {
    nxt[ i ][ sz ] = -1;
  }
  for( int i = sz-1; i >= 0; --i ) {
    for( int j = 0; j < A; ++j ) {
      nxt[ j ][ i ] = nxt[ j ][ i+1 ];
    }
    nxt[ s[i]-'a' ][ i ] = i+1;
  }
}

void solve() {
  int sz = SIZE(s);
  for( int i = sz-1; i >= 0; --i ) {
    dp[ i ] = oo;
    for( int j = 0; j < A; ++j ) {
      if( nxt[ j ][ i ] == -1 ) dp[ i ] = 1;
      else dp[ i ] = min( dp[i], dp[ nxt[ j ][ i ] ]+1 );
    }
  }
}

void get_ans( int cur ) {
  for( int i = 0; i < A; ++i ) {
    if( nxt[ i ][ cur ] == -1 ) {
      ans.PB( 'a'+i );
      return;
    }
    else if( dp[ cur ] == dp[ nxt[ i ][ cur ] ]+1 ) {
      ans.PB( 'a'+i );
      get_ans( nxt[ i ][ cur ]+1 )
      return ;
    }
  }
}

int main( ) {

  #ifdef LOCAL
    freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
  #else
    //freopen( "input", "r", stdin );
    //freopen( "output", "w", stdout );
    ios_base::sync_with_stdio( 0 );
    cin.tie( 0 );
  #endif

  while( cin >> s ) {
    precalc();
    solve();
    ans = "";
    get_ans( 0 );
    cout << ans << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'void get_ans(int)':
a.cc:67:35: error: expected ';' before 'return'
   67 |       get_ans( nxt[ i ][ cur ]+1 )
      |                                   ^
      |                                   ;
   68 |       return ;
      |       ~~~~~~
Language: C++

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

const int N = 2e5+5;

char s[N];
int dp[N], nxt[N], f[30], p[30];

int main() {
    CLR(dp, INF);
    scanf("%s", s);
    int l = strlen(s);
    for(int i = 0; i < 26; i++) {
        dp[l+i] = f[i] = 0;
        p[i] = l+i;
        nxt[l+i] = -1;
        s[l+i] = i+'a';
    }
    for(int i = l-1; i >= 0; i--) {
        int c = s[i]-'a';
        for(int j = 0; j < 26; j++) {
            if(dp[p[j]]+1 < dp[i]) {
                dp[i] = dp[p[j]]+1;
                nxt[i] = p[j];
                f[c] = dp[i];
            }
        }
        p[c] = i;
    }
    int j = 0;
    for(int i = 0; i < 26; i++)
        if(f[i] < f[j]) j = i;
    int x = p[j];
    while(x != -1) {
        printf("%c", s[x]);
        x = nxt[x];
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:13: error: 'INF' was not declared in this scope
   10 |     CLR(dp, INF);
      |             ^~~
a.cc:10:5: error: 'CLR' was not declared in this scope
   10 |     CLR(dp, INF);
      |     ^~~
Language: C++

#include <cstdio>
#include <algorithm>
#include <cstring>
#define maxn 200010
#define INF 9999999
using namespace std;
int n,pos[233],next[maxn][27],dp[maxn],now;
char s[maxn];
int main()
{
	scanf("%s",s+1);
	n=strlen(s+1);
	dp[n+1]=1;
	for (int i=0;i<26;++i) pos[i]=-1;
	for (int i=n;i>=1;--i)
	  {
	  	pos[s[i]-'a']=i;
	  	for (int j=0;j<26;++j)
	  	  next[i][j]=pos[j];
	  }
	for (int i=n;i>=1;--i)
	{
		int tmp=INF;
		for (int j=0;j<26;++j) 
		tmp=min(tmp,dp[next[i][j]+1]);
	    dp[i]=tmp+1;
	}
	now=1;
	while (now>0)
	{
		for (int j=0;j<26;++j)
		  if (dp[now]==dp[next[now][j]+1]+1)
		  {
		  	  now=next[now][j]+1;
		  	  printf("%c",'a'+j);
			  break;
		  }
	}
	printf("\n");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:19: error: reference to 'next' is ambiguous
   19 |                   next[i][j]=pos[j];
      |                   ^~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:66,
                 from /usr/include/c++/14/algorithm:60,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:7:16: note:                 'int next [200010][27]'
    7 | int n,pos[233],next[maxn][27],dp[maxn],now;
      |                ^~~~
a.cc:25:32: error: reference to 'next' is ambiguous
   25 |                 tmp=min(tmp,dp[next[i][j]+1]);
      |                                ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:7:16: note:                 'int next [200010][27]'
    7 | int n,pos[233],next[maxn][27],dp[maxn],now;
      |                ^~~~
a.cc:32:35: error: reference to 'next' is ambiguous
   32 |                   if (dp[now]==dp[next[now][j]+1]+1)
      |                                   ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:7:16: note:                 'int next [200010][27]'
    7 | int n,pos[233],next[maxn][27],dp[maxn],now;
      |                ^~~~
a.cc:34:31: error: reference to 'next' is ambiguous
   34 |                           now=next[now][j]+1;
      |                               ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:232:5: note: candidates are: 'template<class _InputIterator> constexpr _InputIterator std::next(_InputIterator, typename iterator_traits<_Iter>::difference_type)'
  232 |     next(_InputIterator __x, typename
      |     ^~~~
a.cc:7:16: note:                 'int next [200010][27]'
    7 | int n,pos[233],next[maxn][27],dp[maxn],now;
      |                ^~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>

#define MOD 1000000007
#define ll long long
#define ld long double

using namespace std;

//多くても4文字が答え
int main(){
  string A;
  int a[26] ={0};
  int b[676]={0};
  int c[17576] ={0};
  int d[456976] ={0};
  
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> A;

  for(ll i =0;i<A.size();i++){
    a[A[i]-'a']=1;//0~25
  }
  for(ll i =0;i<26;i++){
    if(a[i]==0) {
      cout << (char)('a'+i) << endl;
      return 0;
    }
  }

  for(ll i =1;i<A.size();i++){
    int s1=A[i-1]-'a';
    int s2=A[i]-'a';
    b[s1*26+s2]=1;
  }
  for(ll i =0;i<26*26;i++){
    if(b[i]==0){
      int s1 = i/26;
      int s2 = i%26;
      cout << (char)('a'+s1) << (char)('a'+s2) << endl;
      return 0;
    }
  }

  for(ll i =2;i<A.size();i++){
    int s1=A[i-2]-'a';
    int s2=A[i-1]-'a';
    int s3=A[i]-'a';
    b[s1*26*26+s2*26+s1]=1;
  }
  for(ll i =0;i<26*26*26;i++){
    if(b[i]==0){
      ll l = i;
      int s3 = l%26;
      
      int s3 = 
      cout << (char)('a'+s1) << (char)('a'+s2) << endl;
      return 0;
    }
  }

  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:11: error: redeclaration of 'int s3'
   64 |       int s3 =
      |           ^~
a.cc:62:11: note: 'int s3' previously declared here
   62 |       int s3 = l%26;
      |           ^~
a.cc:65:26: error: 's1' was not declared in this scope; did you mean 's3'?
   65 |       cout << (char)('a'+s1) << (char)('a'+s2) << endl;
      |                          ^~
      |                          s3
a.cc:65:44: error: 's2' was not declared in this scope; did you mean 's3'?
   65 |       cout << (char)('a'+s1) << (char)('a'+s2) << endl;
      |                                            ^~
      |                                            s3
Language: C++

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

int r[100010][26],pos[100010][26],pre[100010];
char s[200022];
stack<char> ans;

int main(){
    scanf("%s",s+1);
    int n = strlen(s+1);
    for(int i = 1;i <= 100000;++i){
        for(int j1 = 'a';j1 <= 'z';++j1){
            for(int j2 = 'a';j2 <= 'z';++j2){
                for(int k = pos[i-1][j1-'a']+1;k <= n;++k){
                    if(s[j] == j2){
                        pos[i][j2-'a'] = k;
                        pre[i+1] = j2;
                        break;
                    }
                    if(k == n){
                        int q = i-1;
                        int t = pos[q][j1-'a'];
                        ans.push(s[t]);
                        q--;
                        while(q){
                            t = pos[q][s[t]];
                            ans.push(s[t]);
                            q--;
                        }
                        while(!ans.empty()){
                            putchar(ans.top());
                            ans.pop();
                        }
                        return 0;
                    }
                }
            }
        }

    }

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:26: error: 'j' was not declared in this scope
   15 |                     if(s[j] == j2){
      |                          ^
Language: C++

#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include"time.h"
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x)  cerr << #x << " = " << (x) << endl

//毎回変える場所
#define N_MAX 200


//問題文のとおり
string A;
int i=0,roop=1,sizeA=0;
int round1[26];
vector<int> slush;//各セットの最終番号

//round1が全部存在したらfalseを返す
bool checkNO(){
	REP(i, 26) {
		if(round1[i]==0)return true;
	}
	return false;
}

int main() {
	cin>>A;
	sizeA=A.size();
	while(true){
		memset(round1, false, sizeof(round1));
		while (checkNO()) {
			if (sizeA <= i)goto end;
			round1[A[i] - 'a'] = true;
			i++;
		}
		roop++;
		slush.push_back(i-1);
	}
end:

	//着目するindex
	int index=0;
	while(A[index]!='a')index++;
	index++;

	//slushで次に超えるべきところ
	int num = 0;
	//最後まで進める
	while (index < sizeA) {
		if(slush.size()<=num)break;

		//slush超える
		memset(round1,false,sizeof(round1));
		while (index <= slush[num]) {
			round1[A[index]-'a']=true;
			index++;
		}
		REP(i, 26) {
			if (round1[i] == false) {
				printf("%c",i+'a');
				while(A[index]!=i+'a')index++;
				index++;
				num++;
				break;
			}
		}
	}
	memset(round1,false,sizeof(round1));
	while (index < sizeA) {
		round1[A[index]-'a']=true;
		index++;
	}
	REP(i,26){
		if (round1[i]==false){
			printf("%c\n", i + 'a');
			break;
		}
	}
	cin>>A;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:17: error: 'memset' was not declared in this scope
   44 |                 memset(round1, false, sizeof(round1));
      |                 ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include<stdlib.h>
  +++ |+#include <cstring>
   11 | #include<string>
a.cc:67:17: error: 'memset' was not declared in this scope
   67 |                 memset(round1,false,sizeof(round1));
      |                 ^~~~~~
a.cc:67:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:82:9: error: 'memset' was not declared in this scope
   82 |         memset(round1,false,sizeof(round1));
      |         ^~~~~~
a.cc:82:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include"time.h"
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x)  cerr << #x << " = " << (x) << endl

//毎回変える場所
#define N_MAX 200


//問題文のとおり
string A;
int i=0,roop=1,sizeA=0;
int round1[26];
vector<int> slush;//各セットの最終番号

//round1が全部存在したらfalseを返す
bool checkNO(){
	REP(i, 26) {
		if(round1[i]==0)return true;
	}
	return false;
}

int main() {
	cin>>A;
	sizeA=A.size();
	while(true){
		memset(round1, false, sizeof(round1));
		while (checkNO()) {
			if (sizeA <= i)goto end;
			round1[A[i] - 'a'] = true;
			i++;
		}
		roop++;
		slush.push_back(i-1);
	}
end:

	//着目するindex
	int index=0;
	while(A[index]!='a')index++;
	index++;

	//slushで次に超えるべきところ
	int num = 0;
	//最後まで進める
	while (index < sizeA) {
		if(slush.size()<=num)break;

		//slush超える
		memset(round1,false,sizeof(round1));
		while (index <= slush[num]) {
			round1[A[index]-'a']=true;
			index++;
		}
		REP(i, 26) {
			if (round1[i] == false) {
				printf("%c",i+'a');
				while(A[index]!=i+'a')index++;
				index++;
				num++;
				break;
			}
		}
	}
	memset(round1,false,sizeof(round1));
	while (index < sizeA) {
		round1[A[index]-'a']=true;
		index++;
	}
	REP(i,26){
		if (round1[i]==false)printf("%c\n",i+'a');
	}

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:17: error: 'memset' was not declared in this scope
   44 |                 memset(round1, false, sizeof(round1));
      |                 ^~~~~~
a.cc:11:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include<stdlib.h>
  +++ |+#include <cstring>
   11 | #include<string>
a.cc:67:17: error: 'memset' was not declared in this scope
   67 |                 memset(round1,false,sizeof(round1));
      |                 ^~~~~~
a.cc:67:17: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
a.cc:82:9: error: 'memset' was not declared in this scope
   82 |         memset(round1,false,sizeof(round1));
      |         ^~~~~~
a.cc:82:9: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++

#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int, int>P;

string dp[300000];
int p[300000][26];

string Min(string&a, string&b) {
	if (a == "")return b;
	if (a.size() != b.size())return a.size() < b.size() ? a : b;
	return a < b ? a : b;
}
signed main() {
	string s; cin >> s;
	rep(i, 26)p[s.size()][i] = s.size();
	for (int i = s.size() - 1; i >= 0; i--) {
		rep(j, 26) {
			if (s[i] == 'a' + j)p[i][j] = i;
			else p[i][j] = p[i + 1][j];
		}
	}
	rep(i, 26) {
		string S = ""; S += 'a' + i;
		dp[p[0][i]] = Min(dp[p[0][i]], S);
	}
	rep(i, s.size()) {
		if (dp[i] == "")continue;
		rep(j, 26) {
			dp[p[i + 1][j]] = Min(dp[p[i + 1][j]], dp[i] + (char)('a' + j));
		}
	}
	cout << dp[s.size()] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:70: error: cannot bind non-const lvalue reference of type 'std::string&' {aka 'std::__cxx11::basic_string<char>&'} to an rvalue of type 'std::__cxx11::basic_string<char>'
   35 |                         dp[p[i + 1][j]] = Min(dp[p[i + 1][j]], dp[i] + (char)('a' + j));
      |                                                                ~~~~~~^~~~~~~~~~~~~~~~~
a.cc:14:29: note:   initializing argument 2 of 'std::string Min(std::string&, std::string&)'
   14 | string Min(string&a, string&b) {
      |                      ~~~~~~~^
Language: C++

#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;
vector <int> v[30];
int n,Min,Min1,i,j,nr,nr1,r,y,c[30][100004],u[30][100004];
char x,a[100004],s[100004];
bool ok;
int main()
{
    gets(s);
    n=strlen(s);
    for (i=0;i<=(n-1);i++)
        v[s[i]-'a'].push_back(i);
    ok=true;
    Min=2000000000;
    for (i=0;i<=25;i++)
    {
        if (v[i].size()==0)
        {
            ok=false;
            x='a'+i;
            break;
        }
        c[i][1]=v[i].size()-2;
        u[i][1]=v[i][c[i][1]+1];
        if (u[i][1]<Min)
            Min=u[i][1];
    }
    if (ok==false)
        printf ("%c\n", x);
    else
    {
        nr=0;
        nr1=1;
        while (ok==true)
        {
            nr1++;
            Min1=Min;
            for (i=0;i<=25;i++)
            {
                for (j=c[i][nr1-1];j>=0;j--)
                {
                    if (v[i][j]<Min1)
                        break;
                }
                if (j<0)
                {
                    a[++nr]='a'+i;
                    ok=false;
                    r=i;
                    c[i][nr1]=-1;
                    break;
                }
                else
                {
                    c[i][nr1]=j-1;
                    u[i][nr1]=v[i][c[i][nr1]+1];
                    if (u[i][nr1]<Min)
                        Min=u[i][nr1];
                }
            }
        }
        y=v[r][0];
        for (j=(nr1-1);j>=1;j--)
        {
            for (i=0;i<=25;i++)
            {
                if (u[i][j]<=y)
                    break;
            }
            r=i;
            a[++nr]='a'+i;
            if ((c[r][j]+2)<=(v[r].size()-1))
                y=v[r][c[r][j]+2];
            else
                y=n;
        }
    }
    for (i=1;i<=nr;i++)
        printf ("%c", a[i]);
    printf ("\n");
    return 0;
}


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

//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
using namespace std;
int m[400];vector<int> ep;string s;
int y[200005][30];
string ans;int d[400],dd[400];
void fun(int x)
{
	if(x==ep.size()-2)
	{
		cout<<ans;
		for(int i='a';i<='z';i++)
		{
			if(m[i]==0) 
			{
				cout<<char(i);exit(0);
			}
		}
	}
	for(int j='a';j<='z';j++) dd[j]=d[j];
	for(int i='a';i<='z';i++)
	{
		if(dd[i]!=0) continue;
		for(int j='a';j<='z';j++) d[j]=0;
		int j=y[x][i-'a'];
			if(s[j]==char(i)) 
			{
				for(int k=j+1;k<=ep[x+1];k++)
				{
					d[s[k]]++;
				}
				for(int k='a';k<='z';k++)
				{
					if(d[k]==0)
					{
						ans+=char(i);fun(x+1);
					}
				}
			}
	}
}char ccc[200008];
int main()
{
 	//freopen("","r",stdin);
	//freopen("","w",stdout);
	scanf("%s",&ccc);s=c;ep.push_back(-1);
	memset(y,-1,sizeof(y));
	for(int i=0;i<s.size();i++)
	{
		m[s[i]]++;int flag=1;
		for(int ii='a';ii<='z';ii++)
		{
			if(m[ii]<=0) flag=0;
		}
		if(flag)
		{
			for(int ii='a';ii<='z';ii++)
			{
				m[ii]=0;
			}
			for(int j=ep[ep.size()-1]+1;j<=i;j++)
			{
				if(y[ep.size()-1][s[j]-'a']==-1) y[ep.size()-1][s[j]-'a']=j;
			}
			ep.push_back(i);
		}
	}
	ep.push_back(s.size()-1);
	fun(0); 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:28: error: 'c' was not declared in this scope
   57 |         scanf("%s",&ccc);s=c;ep.push_back(-1);
      |                            ^
Language: C++

//A,Elebereth Gilthoniel mantae!
//For Temeria!
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<cstdio>
#include<map>
#include<stack>
#include<queue>
#include<cstring> 
using namespace std;
int m[400];vector<int> ep;string s;
int y[200005][30];
string ans;int d[400],dd[400];
void fun(int x)
{
	if(x==ep.size()-2)
	{
		cout<<ans;
		for(int i='a';i<='z';i++)
		{
			if(m[i]==0) 
			{
				cout<<char(i);exit(0);
			}
		}
	}
	for(int j='a';j<='z';j++) dd[j]=d[j];
	for(int i='a';i<='z';i++)
	{
		if(dd[i]!=0) continue;
		for(int j='a';j<='z';j++) d[j]=0;
		int j=y[x][i-'a'];
			if(s[j]==char(i)) 
			{
				for(int k=j+1;k<=ep[x+1];k++)
				{
					d[s[k]]++;
				}
				for(int k='a';k<='z';k++)
				{
					if(d[k]==0)
					{
						ans+=char(i);fun(x+1);
					}
				}
			}
	}
}char ccc[200008];
int main()
{
 	//freopen("","r",stdin);
	//freopen("","w",stdout);
	scanf("%s",&c);s=c;ep.push_back(-1);
	memset(y,-1,sizeof(y));
	for(int i=0;i<s.size();i++)
	{
		m[s[i]]++;int flag=1;
		for(int ii='a';ii<='z';ii++)
		{
			if(m[ii]<=0) flag=0;
		}
		if(flag)
		{
			for(int ii='a';ii<='z';ii++)
			{
				m[ii]=0;
			}
			for(int j=ep[ep.size()-1]+1;j<=i;j++)
			{
				if(y[ep.size()-1][s[j]-'a']==-1) y[ep.size()-1][s[j]-'a']=j;
			}
			ep.push_back(i);
		}
	}
	ep.push_back(s.size()-1);
	fun(0); 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:21: error: 'c' was not declared in this scope
   57 |         scanf("%s",&c);s=c;ep.push_back(-1);
      |                     ^