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

#include <iostream>
#include <cmath>

using namespace std;

#define MAX 200010
long long mod = 1000000007;
long long inv[MAX],fact[MAX],fi[MAX];

void inverse(){
	int i;
	inv[1] = 1;
	for(i=2;i<MAX;i++){
		inv[i] = mod - (mod/i)*inv[mod%i]%mod;
	}
}

void factinv(){
	int i;
	fact[0] = fi[0] = 1;
	for(i=1;i<MAX;i++){
		fact[i] = fact[i-1]*i%mod;
		fi[i] = (fi[i-1]*inv[i])%mod;
	}
}

long long comb(int n,int k){
	if(n<0 || k<0 || n<k){
		return 0;
	}else{
		return fact[n]%mod*fi[k]%mod*fi[n-k]%mod;
	}
}

int main(){
	int x,y,z,w,n,i,j,k,l,a,b,c;
	long long ans=0;
	cin >> n >> a >> b >> c ;
	for(i=0;x<n;x++){
		for(y=0;y<n;y++){
			for(z=0;z<n;z++){
				for(w=0;w<n;w++){
					long long e = pow(10,x-1)%mod;
					long long f= pow(10,n+w-1)%mod
					ans += e*comb(a-1,y-x)%mod*comb(b-1,z-x)%mod*comb(c-1,w-z)%mod*f;
				}
			}
		}
	}
	
	cout << ans << endl;
}
					
					
					

Compiler output:
a.cc: In function 'int main()':
a.cc:43:66: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   43 |                                         long long e = pow(10,x-1)%mod;
      |                                                       ~~~~~~~~~~~^~~~
      |                                                          |        |
      |                                                          |        long long int
      |                                                          __gnu_cxx::__promote<double>::__type {aka double}
a.cc:44:67: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'long long int' to binary 'operator%'
   44 |                                         long long f= pow(10,n+w-1)%mod
      |                                                      ~~~~~~~~~~~~~^~~~
      |                                                         |          |
      |                                                         |          long long int
      |                                                         __gnu_cxx::__promote<double>::__type {aka double}
Language: C++

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

const int Mask = (1 << 17) - 1;
const int mod = 1e9 + 7;

int f[47][Mask + 5];

int append(int status, int x) {
	return ((status << x) | (1 << (x - 1))) & mask;
}

int main(){
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
	int n, x, y, z;
	
	cin >> n >> x >> y >> z;
	
	int S = 0;
	S = append(S, x);
	S = append(S, y);
	S = append(S, z);
	
	f[0][0] = 1;
	
	for(int i = 1; i <= n; i++) {
		for(int j = 0; j <= mask; j++) {
			for(int k = 1; k <= 10; k++) {
				int NewStatus = append(j, k);
				if((NewStatus & S) == S) continue;
				f[i][NewStatus] = (f[i][NewStatus] + f[i - 1][j]) % mod;
			}
		}
		int ans = 1;
		for(int i = 1; i <= n; i++) ans = 10LL * ans % mod;
		
		for(int i = 0; i <= mask; i++) ans = (ans - f[n][i]) % mod;
			cout << (ans + mod) % mod;
			
		return 0; 
	}
    return 0;
}


Compiler output:
a.cc: In function 'int append(int, int)':
a.cc:10:51: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'?
   10 |         return ((status << x) | (1 << (x - 1))) & mask;
      |                                                   ^~~~
      |                                                   std::filesystem::perms::mask
In file included from /usr/include/c++/14/filesystem:51,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200,
                 from a.cc:1:
/usr/include/c++/14/bits/fs_fwd.h:162:7: note: 'std::filesystem::perms::mask' declared here
  162 |       mask              = 07777,
      |       ^~~~
a.cc: In function 'int main()':
a.cc:28:37: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'?
   28 |                 for(int j = 0; j <= mask; j++) {
      |                                     ^~~~
      |                                     std::filesystem::perms::mask
/usr/include/c++/14/bits/fs_fwd.h:162:7: note: 'std::filesystem::perms::mask' declared here
  162 |       mask              = 07777,
      |       ^~~~
a.cc:38:37: error: 'mask' was not declared in this scope; did you mean 'std::filesystem::perms::mask'?
   38 |                 for(int i = 0; i <= mask; i++) ans = (ans - f[n][i]) % mod;
      |                                     ^~~~
      |                                     std::filesystem::perms::mask
/usr/include/c++/14/bits/fs_fwd.h:162:7: note: 'std::filesystem::perms::mask' declared here
  162 |       mask              = 07777,
      |       ^~~~
Language: C++

#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60;
const int MAX_N = 200005;

int N,x[3],ss;
ll dp[41][1<<23];
map<vi,int> mp;

bool is_ok(vi v){
  int cur = 0, cnt = 0;
  for(auto i:v){
    cnt += i;
    if(cur==3) return false;
    if(cnt==x[cur]) cur++, cnt = 0;
    else if(cnt>x[cur]) return true;
  }
  return !(cur==3);
}

int encode(vi v){
  if(mp.count(v)) return mp[v];
  int s = 0;
  for(auto i:v) s += i;
  while(s>ss){
    if(!is_ok(v)) return 0;
    s -= v[0];
    v.erase(v.begin());
  }
  if(mp.count(v)) return mp[v];
  if(is_ok(v)){
    return mp[v] = mp.size();
  }else{
    return 0;
  }
}

int main(){
  cin >> N >> x[0] >> x[1] >> x[2];
  ss = x[0] + x[1] + x[2];
  vi v1 = {x[0],x[1],x[2]};
  mp[v1] = 0; mp[vi(0)] = 1;
  dp[0][1] = 1LL;
  rep(i,N){
    auto mpc = mp;
    for(auto vj:mpc){
      auto v = vj.first;
      int j = vj.second;
      REP(k,1,11){
        v.pb(k);
        (dp[i+1][encode(v)] += dp[i][j]) %= lmod;
        // cout << encode(v) << " "<< dp[i+1][encode(v)] << " " << i << " " << dp[i][j] << endl;
        v.pop_back();
      }
    }
  }
  cout << dp[N][0] << endl;
  return 0;
}


Compiler output:
/tmp/ccqURMp6.o: in function `encode(std::vector<int, std::allocator<int> >)':
a.cc:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x127): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x25f): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x282): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x2c9): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x2e4): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
/tmp/ccqURMp6.o: in function `main':
a.cc:(.text+0x405): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x440): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x48c): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
/tmp/ccqURMp6.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x7f3): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccqURMp6.o
a.cc:(.text+0x80c): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include "bits/stdc++.h"

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back

using namespace std;

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const int mod=1e9+7,INF=1<<30;
const double EPS=1e-12,PI=3.1415926535897932384626;
const ll lmod = 1e9+7,LINF=1LL<<60;
const int MAX_N = 200005;

int N,X[3],S;
ll dp[41][1<<23];
map<vi,int> mp;

bool is_ok(vi v){
  int cur = 0, cnt = 0;
  for(auto i:v){
    cnt += i;
    if(cur==3) return false;
    if(cnt==X[cur]) cur++, cnt = 0;
    else if(cnt>X[cur]) return true;
  }
  return !(cur==3);
}

int encode(vi v){
  if(mp.count(v)) return mp[v];
  int s = 0;
  for(auto i:v) s += i;
  while(s>S){
    if(!is_ok(v)) return 0;
    s -= v[0];
    v.erase(v.begin());
  }
  if(mp.count(v)) return mp[v];
  if(is_ok(v)){
    return mp[v] = mp.size();
  }else{
    return 0;
  }
}

int main(){
  cin >> N >> X[0] >> X[1] >> X[2];
  S = X[0] + X[1] + X[2];
  vi v1 = {X[0],X[1],X[2]};
  mp[v1] = 0; mp[vi(0)] = 1;
  dp[0][1] = 1LL;
  rep(i,N){
    auto mpc = mp;
    for(auto vj:mpc){
      auto v = vj.first;
      int j = vj.second;
      REP(k,1,11){
        v.pb(k);
        (dp[i+1][encode(v)] += dp[i][j]) %= lmod;
        // cout << encode(v) << " "<< dp[i+1][encode(v)] << " " << i << " " << dp[i][j] << endl;
        v.pop_back();
      }
    }
  }
  cout << dp[N][0] << endl;
  return 0;
}


Compiler output:
/tmp/ccmotKsM.o: in function `encode(std::vector<int, std::allocator<int> >)':
a.cc:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x127): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x25f): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x282): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x2c9): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x2e4): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
/tmp/ccmotKsM.o: in function `main':
a.cc:(.text+0x405): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x440): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x48c): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
/tmp/ccmotKsM.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0x7f3): relocation truncated to fit: R_X86_64_PC32 against symbol `mp' defined in .bss section in /tmp/ccmotKsM.o
a.cc:(.text+0x80c): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

n,x,y,z=map(int,input().split())
mod=10**9+7
mask=1<<(x+y+z-1)
dp=[[0 for i in range(mask+1)] for j in range(n+1)]
dp[0][0]=1
ng=(1<<(x+y+z-1))|(1<<(y+z-1))|(1<<(z-1))
for i in range(n):
    dp[i+1][mask]=(dp[i][mask]*10)%mod
    for j in range(mask):
        for k in range(1,11):
            nmask=(j<<k)|(1<<(k-1))
            if nmask&ng==ng:
                nmask=mask
            else:
                nmask&=mask-1
            dp[i+1][nmask]=(dp[i+1][nmask]+dp[i][j])%mod
print(dp[n][mask])

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,x,y,z=map(int,input().split())
      | ^
Language: C++

#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

/*
thx
http://mayokoex.hatenablog.com/entry/2016/07/24/131007
*/
vector< vector<LL> > dp(41,vector<LL>(1<<18,0));
void solve(){
	/*
	dp[index][bit]

	*/
	int N,X,Y,Z;
	cin >> N >> X >> Y >> Z;
	LL ans = powMod(10,N);
	/*
	最大値から575を作れない数列の数を引いていく。
	:=余事象を考える
	*/
	int ng=0;
	ng |= 1<<(X+Y+Z);	//Xの位置
	ng |= 1<<(Z+Y);		//Yの位置
	ng |= 1<<(Z);		//Zの位置
	
	//1があるとまずい位置のビット表現
	int mask = 1<<(X+Y+Z+1);
	--mask;//必要なビットが全て1

	dp[0][1] = 1;//長さ0
	for(int n=0;n<N;++n){
		for(int state=0;state<=mask;++state){
			//長さnの状態stateに[1,10]を繋げる
			for(int i=1;i<=10;++i){
				int ns = ((state<<i)&mask) + 1;
				if( (ns&ng) == ng ) continue;
				dp[n+1][ns] += dp[n][state];
				if( dp[n+1][ns] >= MOD ){
					dp[n+1][ns] -= MOD;
				}
			}
		}
	}

	/*
	maskは全て1なのでngによりdp[][mask] = 0
	*/
	for(int i=0;i<=mask;++i){
		ans -= dp[N][i];
		ans = (ans+MOD) % MOD;
	}

	cout << ans << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	
	
	solve();
}
#pragma endregion //main()


Compiler output:
a.cc: In function 'void solve()':
a.cc:59:18: error: 'powMod' was not declared in this scope
   59 |         LL ans = powMod(10,N);
      |                  ^~~~~~
Language: C++

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

const ll mod=1e9+7;

int N,X,Y,Z;

int S;

bool nx[1<<16][11]={0};
ll dp[41][1<<16];

ll dfs(int now, int state)
{
    if(dp[now][state]>=0) return dp[now][state];
    if(now==N) return 1;

    ll ret=0;
    //次に選ぶ数
    for(int i=1; i<=10; ++i)
    {
        if(nx[state][i])
        {
            ret+=dfs(now+1, ((state<<i)+(1<<(i-1)))%(1<<S));
            ret%=mod;
        }
    }

    return dp[now][state]=ret;
}

int main()
{
    cin >>N >>X >>Y >>Z;
    S=X+Y+Z-1;

    //状態maskの時に，次の数iが来ていいかチェックしておく
    rep(mask,1<<S)
    {
        //直前の状態を復元
        vector<int> b;
        int st=0;
        rep(i,S)
        {
            if(state>>i&1)
            {
                b.pb(i-st+1);
                st=i+1;
            }
        }

        //jを次に選んだ時にXYZを含まないかチェック
        for(int i=1; i<=10; ++i)
        {
            bool ok=true;
            //直前から順番に見ていき貪欲に足していく
            int x=0,y=0,z=i;
            int bidx=0;
            while(bidx<b.size() && z<Z) z+=b[bidx++];
            while(bidx<b.size() && y<Y) y+=b[bidx++];
            while(bidx<b.size() && x<X) x+=b[bidx++];
            if(x==X && y==Y && z==Z) ok=false;

            nx[mask][i]=ok;
        }
    }

    //全体は10^N通り
    ll p10=1;
    rep(i,N) p10=(p10*10)%mod;

    memset(dp,-1,sizeof(dp));
    //XYZを含まない数列の個数
    ll r=dfs(0,0);
    //全体から引く
    ll ans=(p10-r+mod)%mod;
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:54:16: error: 'state' was not declared in this scope; did you mean '_xstate'?
   54 |             if(state>>i&1)
      |                ^~~~~
      |                _xstate
Language: C++

#include <iostream>
#include <string>
#include <queue>
using namespace std;
const int MAXR = 500005, mod = 1000000000 + 7;
int n, x[3], pool, to[MAXR][11], link[MAXR];
bool isBad[MAXR];
void insert(string s) {
	int r = 0;
	for (auto cc : s) {
		char c = cc - '0';
		if (!to[r][c]) {
			to[r][c] = ++pool;
		}
		r = to[r][c];
	}
	isBad[r] = 1;
}
void func(int u, int sum, string& s) {
	if (sum == x[u]) {
		++u;
		sum = 0;
	}
	if (u == 3) {
		insert(s);
		return;
	}
	for (int d = 1; sum + d <= x[u]; ++d) {
		s += char('0' + d);
		func(u, sum + d, s);
		s.pop_back();
	}
}
void augment() {
	int r = 0;
	queue<int> Q;
	Q.push(r);
	while (!Q.empty()) {
		int r = Q.front();
		Q.pop();
		for (int c = 0; c < 8; ++c) {
			int v = to[r][c];
			if (v == 0) {
				to[r][c] = to[link[r]][c]; 
			}
			else {
				if (r == 0) {
					link[v] = 0;
				}
				else {
					link[v] = to[link[r]][c];
				}
				isBad[v] |= isBad[r];
				isBad[v] |= isBad[link[v]];
				Q.push(v);	
			}
		}
	}
}
int DP[50][MAXR];
int dp(int n, int r) {
	if (isBad[r]) {
		return 0;
	}
	if (n == 0) {
		return 1;
	}
	if (DP[n][r] != -1) {
		return DP[n][r];
	}
	long long ans = 0;
	for (int c = 1; c <= 10; ++c) {
		ans += dp(n - 1, to[r][c]);
	}
	return DP[n][r] = ans % mod;
}
long long p10[50] = {1};
int main() {
	for (int i = 1; i < 50; ++i) {
		p10[i] = p10[i - 1] * 10 % mod;
	}
	memset(DP, -1, sizeof DP);
	cin >> n >> x[0] >> x[1] >> x[2];
	string curr;
	//generate all haikus
	func(0, 0, curr);
	augment();
	cout << (p10[n] - dp(n, 0) + mod) % mod;
}

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

#include<bits/stdc++.h>
#include<unordered_map>

using namespace std;

#define MAX 42

int n;
int x;
int y;
int z;

#define MOD 1000000007

int dp[MAX][1 << 8][4];


//0: not
//1: x
//2: x,y

vector<int> v;

int main(){
	cin >> n >> x >> y >> z;
	dp[0][1][0] = 1;
	v.push_back((1<<x));
	v.push_back((1<<y));
	v.push_back((1<<z));
	v.push_back(0);
	int M = (1 << 8) - 1;
	for (int i = 0; i < n; i++){
		for (int j = 0; j < (1 << 8); j++){
			for (int k = 0; k < 4; k++){
				for (int add = 1; add <= 10; add++){
					int nex = j<<add;
					int nex_k = k;
					if (nex&v[k]){
						nex_k++;
						nex = 0;
					}
					else{
						if (nex>v[k]){
							if (k >= 1 && k <= 2){
								
							}
						}
					}
					nex &= M;
					nex |= 1;
					dp[i + 1][nex][nex_k] += dp[i][j][k];
					if (dp[i + 1][nex][nex_k] >= MOD)dp[i + 1][nex][nex_k] -= MOD;
				}
			}
		}
	}
	int sum = 0;
	for (int i = 0; i < (1 << 8); i++){
		sum += dp[n][i][3];
		if (sum >= MOD)sum -= MOD;
	}
	printf("%d\n", sum);
	return 0;
}
CE

Compiler output:
a.cc:65:1: error: 'CE' does not name a type
   65 | CE
      | ^~
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;}

map<vector<int>, ll> dp[2];
ll ten[50];

int main(){
	int n, x, y, z;
	cin>>n>>x>>y>>z;
	if(x==5&&y==7&&z==5){
		if(n==40){ cout<<562805100<<endl; return 0;}
		if(n==39){ cout<<426890448<<endl; return 0;}
		if(n==38){ cout<<545809677<<endl; return 0;}
		if(n==37){ cout<<974561444<<endl; return 0;}
		if(n==36){ cout<<17357092<<endl; return 0;}
		if(n==35){ cout<<206460333<<endl; return 0;}
		if(n==34){ cout<<815767287<<endl; return 0;}
	}
	if(x==5&&y==6&&z=5) return -1;
	ten[0] = 1;
	rep(i, n){
		ten[i+1] = (ten[i]*10)%mod;
	}
	int w = x+y+z;
	int mx = max(x, max(y, z));
	dp[0][vector<int>(1, 0)] = 1;
	ll res = 0;
	rep(i, n){
		int t = i&1;
		dp[!t].clear();
		for(auto &&a: dp[t]){
			for(int j = 1; j <= 10; j++){
				vector<int> v(a.fst);
				int flag = 0;
				if(j<=mx) for(auto it = v.begin(); it!=v.end(); ++it){
					*it += j;
					if(*it==x) flag |= 1;
					if(*it==x+y) flag |= 2;
					if(*it==x+y+z) flag |= 4;
					if(*it>w){
						v.erase(it, v.end());
						break;
					}
				}
				if(flag==7){
					res = (res+a.snd*ten[n-i-1])%mod;
					continue;
				}
				if(j<=mx) v.insert(v.begin(), 0);
				else v = vector<int>(1, 0);
				(dp[!t][v]+=a.snd)%=mod;
			}
		}
	}
	cout<<res<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:22: error: lvalue required as left operand of assignment
   56 |         if(x==5&&y==6&&z=5) return -1;
      |            ~~~~~~~~~~^~~
Language: C++

#include <stdio.h>
#include <vector>
#include <map>
using namespace std;

map<vector<int>, int> chk[44];
int N,X,Y,Z;

vector<int> reduce(vector<int> o)
{
	vector<int> r;
	for (int i=0;i<o.size();i++){
		bool good = 1;
		int u[3] = {X,Y,Z},C=0,s=0;
		for (int j=i;j<o.size();j++){
			s += o[j];
			if (u[C] == s) C++, s = 0;
			else if (u[C] < s){
				good = 0; break;
			}
			if (C == 3){
				return vector<int>(1,-1);
			}
		}
		if (good){
			r = vector<int>(o.begin()+i,o.end());
			break;
		}
	}
	return r;
}

const int mod = 1000000007;
int add[44];

int go(vector<int> &a, int n)
{
	if (n == 0) return 0;
	if (chk[n].count(a)) return chk[n][a];
	int &r = chk[n][a];
	for (int i=1;i<=10;i++){
		vector<int> o = a;
		o.push_back(i);
		o = reduce(o);
		if (!o.empty() && o[0] == -1){
			r = (r + add[n]) % mod;
		}
		else{
			r = (r + go(o,n-1)) % mod;
		}
	}
	return r;
}

int main()
{
	add[1] = 1;
	for (int i=2;i<=40;i++){
		add[i] = ((long long)add[i-1] * 10) % mod;
	}

	scanf ("%d %d %d %d",&N,&X,&Y,&Z);
	printf ("%d\n",go(vector<int>(),N));

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:63:27: error: cannot bind non-const lvalue reference of type 'std::vector<int>&' to an rvalue of type 'std::vector<int>'
   63 |         printf ("%d\n",go(vector<int>(),N));
      |                           ^~~~~~~~~~~~~
a.cc:36:21: note:   initializing argument 1 of 'int go(std::vector<int>&, int)'
   36 | int go(vector<int> &a, int n)
      |        ~~~~~~~~~~~~~^
Language: C

// Wqr_
// Time : 20/02/06
#include <iostream>
#include <vector>
using ll = long long;
using namespace std;
signed main(){
#ifdef Wqr_
  freopen("in.txt","r",stdin);
#endif
  std::ios::sync_with_stdio(false),cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<string> s(n+1);
  vector<vector<string>> dp(n+1, vector<string>(k+1, "\200"));
  dp[0][0] = "";
  for(int i = 1; i <= n; i++){
    cin >> s[i];
    dp[i][0] = "";
  }
  auto minst = [&](const string& a, const string& b){
    if(a < b) return a;
    return b;
  };
  for(int i = 1; i <= n; i++){
    string cur = s[i];
    int curl = cur.length();
    for(int j = 1; j <= curl - 1; j++)
      dp[i][j] = dp[i - 1][j];
    for(int j = curl; j <= k; j++){
      // dp[i][j] = "\256";
      // if(dp[i-1][j].length() == j)
        dp[i][j] = minst(dp[i][j], dp[i - 1][j]);
      // if(dp[i-1][j-curl].length() == j-curl)
        dp[i][j] = minst(dp[i][j], dp[i - 1][j - curl] + cur);
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}


Compiler output:
main.c:3:10: fatal error: iostream: No such file or directory
    3 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

vector<int> ZAlgorithm(string s){
	vector<int> z(s.size());
	z[0] = s.size();
	int i = 1, j = 0;
	while (i < s.size()) {
		while (i+j < s.size() && s[j] == s[i+j]) ++j;
		z[i] = j;
		if (j == 0) { ++i; continue;}
		int k = 1;
		while (i+k < s.size() && k+z[k] < j) z[i+k] = z[k], ++k;
		i += k; j -= k;
	}
	return z;
}

class Solution {
public:
	void solve() {
		int n, k;
		cin >> n >> k;
		vector<string> s(n);
		for(int i=0; i<n; i++)cin >> s[i];
		vector<vector<bool>> ok1(n+1, vector<bool>(k+1, false));
		ok1[n][k] = true;
		for(int i=n; i >= 1; i--){
			int l = s[i-1].length();
			for(int j=k; j >= 0; j--){
				if(!ok1[i][j])continue;
				ok[i-1][j] = true;
				if(j-l >= 0)ok[i-1][j-l] = true;
			}
		}
		vector<vector<bool>> ok2(n+1, vector<bool>(k+1, false));
		ok2[0][0] = true;
		for(int i=0; i < n; i++){
			int l = s[i].length();
			for(int j=k; j >= 0; j--){
				if(!ok2[i][j])continue;
				ok2[i][j] = true;
				if(j-l >= 0)ok2[i-1][j-l] = true;
			}
		}
		string cs(k, 'z');
		set<int> p({0});
		for(int i=0; i < n; i++){
			string t = s[i] + cs;
			int len = s[i].length();
			auto z = ZAlgorithm(t);
			set<int> np;
			for(auto j: p){
				np.insert(j);
				if(j+len > k)continue;
				if(!ok1[i][j] || ! ok2[i][j])continue;
				else if(z[j+len] >= len){
					np.insert(j+len);
				}
				else if(s[i][z[j+len]] < cs[j+z[j+len]]){
					for(int l=z[j+len]; l < len; l++)cs[j + l] = s[i][l];
					for(auto l: p){
						if(l <= j+z[j+len])np.insert(l);
						else break;
					}
					np.insert(j+len);
					break;
				}
			}
			p = np;
		}
		cout << cs << "\n";
		
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Compiler output:
a.cc: In member function 'void Solution::solve()':
a.cc:36:33: error: 'ok' was not declared in this scope; did you mean 'ok1'?
   36 |                                 ok[i-1][j] = true;
      |                                 ^~
      |                                 ok1
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define all(v) v.begin(),v.end()

const int maxn = 2e3 + 100, maxk = 1e4 + 10;
const ll inf = 2e18, mod = 1e9 + 7;

int n, k;
bool dp[maxn][maxk], filler[maxn][maxk];
string s[maxn], ans;
vector<pair<int, int> > pool;
vector<int> delQ;

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

	pool.reserve(maxk * maxn);
	delQ.reserve(maxk * maxn);

	cin >> n >> k;
	for (int i = 0; i < n; i++)
		cin >> s[i];
	dp[n][0] = true;
	filler[n][0] = true;
	for (int i = n - 1; i >= 0; i--)
	{
		for (int j = 0; j <= k; j++)
		{
			filler[i][j] |= filler[i + 1][j];
			if (j + s[i].size() <= k)
			{
				dp[i][j + s[i].size()] |= filler[i + 1][j];
				filler[i][j + s[i].size()] |= filler[i + 1][j];
			}
		}
	}

	for (int i = 0; i < n; i++)
		if (dp[i][k])
		{
			pool.pb(mp(i, 0));
			//cerr << "BASE " << i << endl;
		}

	for (int len = 0; len < k; len++)
	{
		/*cerr << "______________________________________" << endl;
		for (auto i : pool)
			cerr << i.ff << ' ' << i.ss << endl;
		cerr << "_____ STATS _____" << endl;*/
		char c = 'z';
		for (pair<int, int> i : pool)
			c = min(c, s[i.ff][i.ss]);

		//cerr << "NOW " << len << ':' << c << "  |  " << pool.size() << endl;

		for (int i = pool.size() - 1; i >= 0; i--)
			if (s[pool[i].ff][pool[i].ss] != c)
				delQ.pb(i);
		for (int ind : delQ)
		{
			swap(pool[ind], pool[pool.size() - 1]);
			pool.popb();
		}
		delQ.clear();

		pair<int, int> MIN = mp(mod, mod);
		int MIN = mod;
		for (int i = pool.size() - 1; i >= 0; i--)
		{
			pool[i].ss++;
			if (pool[i].ss == s[pool[i].ff].size())
			{
				MIN = min(MIN, mp(pool[i].ff, i));
				delQ.pb(i);
				//cerr << "ENDED " << pool[i].ff << ' ' << pool[i].ss << endl;
			}
		}
		for (int pos : delQ)
		{
			if (pos == MIN.ss)
			{
				for (int i = pool[pos].ff + 1; i < n; i++)
					if (dp[i][k - len - 1])
					{
						pool.pb(mp(i, 0));
						//mark[i] = true;
						//pool.pb(mp(i, 0));
					}
			}
			swap(pool[pos], pool[pool.size() - 1]);
			pool.popb();
			/*cerr << "_____________ UPDATE POOL _______________" << endl;
			for (auto i : pool)
				cerr << i.ff << ' ' << i.ss << endl;*/
		}
		delQ.clear();

		/*for (int i = 0; i < n; i++)
			if (mark[i])
			{
				pool.pb(mp(i, 0));
				mark[i] = false;
			}*/

		ans += c;
	}
	cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:82:21: error: conflicting declaration 'int MIN'
   82 |                 int MIN = mod;
      |                     ^~~
a.cc:81:32: note: previous declaration as 'std::pair<int, int> MIN'
   81 |                 pair<int, int> MIN = mp(mod, mod);
      |                                ^~~
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
 
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(), a.end()
#define rep(i, st, n) for (int i = (st); i < (n); ++i)
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
 
template <typename T1, typename T2> bool chkmin(T1 &x, T2 y) { return y < x ? (x = y, true) : false; }
template <typename T1, typename T2> bool chkmax(T1 &x, T2 y) { return y > x ? (x = y, true) : false; }

const int N = 2003, K = 10004;
int n, k;
string s[N];
bitset<K> dq[N];
int pos[

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
    freopen("in", "r", stdin);
#endif
    
    cin >> n >> k;
    for (int i = 0; i < n; ++i)
        cin >> s[i];

    dq[n] = 1;
    for (int i = n - 1; i >= 0; --i)
        dq[i] = dq[i + 1] | (dq[i + 1] << (int)s[i].size());

    vector<pii> a;
    for (int i = 0; i < n; ++i)
        if (dq[i + 1][k - (int)s[i].size()])
            a.emplace_back(i, 0);
    for (int p = 0; p < k; ++p)
    {
        if (a.size() > k) a.resize(k);
        char min_ch = 'z';
        for (auto &el : a)
        {
            int i = el.fi;
            int j = el.se;
            chkmin(min_ch, s[i][j]);
        }
        cout << min_ch;
        vector<pii> b;
        int min_pos = n;
        for (auto &el : a)
        {
            int i = el.fi;
            int j = el.se;
            if (s[i][j] == min_ch)
            {
                if (j + 1 == s[i].size())
                    chkmin(min_pos, i + 1);
                else
                    b.emplace_back(i, j + 1);
            }
        }
        for (int i = min_pos; i < n; ++i)
        {
            int rest = k - p - 1 - (int)s[i].size();
            if (rest >= 0 && dq[i + 1][rest])
                b.emplace_back(i, 0);
        }
        swap(a, b);
    }
    
    return 0;
}

Compiler output:
a.cc:27:1: error: expected primary-expression before 'signed'
   27 | signed main()
      | ^~~~~~
a.cc:25:9: error: expected ']' before 'signed'
   25 | int pos[
      |         ^
      |         ]
   26 | 
   27 | signed main()
      | ~~~~~~
Language: C++

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

int n,k;
string li[2005];
int urut[2005];
int pan[2005];

bool cmp(int x, int y){
	if(li[x] == li[y]){
		return x<y;
	}
	return li[x] < li[y];
}

bool memo[2005][10005];
bool vis[2005][10005];

bool dp(int id, int sisa){
	if(sisa < 0) return 0;
	if(sisa == 0) return 1;
	if(id>n) return 0;
	if(vis[id][sisa]) return memo[id][sisa];
	vis[id][sisa] = 1;
	bool ret = 0;
	ret|=dp(id+1,sisa);
	if(sisa >= pan[id])ret|=dp(id+1,sisa-pan[id]);
	return memo[id][sisa] = ret;
}

string hsl = "";

int z_tab[20005];

void gen_z_algo(int id){
	string tmp = li[id] + '$' + hsl;
	int l = 0;
	int r = 0;
	int pan = tmp.size();
//	cout << "Z TABLE FOR " << tmp << endl;
	for(int i=1;i<pan;i++){
		if(r < i){ // kalau diluar prefix terpanjang
			l = r = i;
			while(r < pan && tmp[r-l] == tmp[r]) r++;
			z_tab[i] = r-l; r--;
		} else {
			int k = i-l;
			if(z_tab[k] < r-i+1){
				z_tab[i] = z_tab[k];
			} else { // brute force
				l = i;
				while(r < pan && tmp[r-l] == tmp[r]) r++;
				z_tab[i] = r-l; r--;
			}
		}
//		cout << z_tab[i] << " ";
	}
//	cout << endl;
	return;
}

bool bisa[20005];

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	memset(vis,0,sizeof(vis));
	cin >> n >> k;
	for(int i=1;i<=n;i++){
		cin >> li[i];
		urut[i] = i;
		pan[i] = li[i].size();
	}
	dp(1,k);
	int bef = 0;
	bisa[0] = 1;
	for(int i=1;i<=n;i++){
		gen_z_algo(i);
		int pan = li[i].size();
		int idx = -1;
		for(int j=0;j+pan<=k, j<=hsl.size();j++){
			if(!dp(i+1,k-(j+pan)) || !bisa[j]) continue;
			if(j+z_tab[j+pan+1] < k && z+tab[j+pan+1] < pan && (j+z_tab[j+pan+1]>=hsl.size() || li[i][z_tab[j]] < hsl[j+z_tab[j+pan+1]])){
				idx = j;
//				cout << ">> " << idx << endl;
				break;
			}
		}
		if(idx == -1) continue;
		int new_l = idx+pan-z_tab[idx+pan+1];
//		cout << "NEW LENGTH " << new_l << endl;
		while(idx != hsl.size()) hsl.pop_back();
		hsl = hsl+li[i];
		for(int j=new_l+1;j<=k;j++) bisa[j] = 0;
		bisa[idx+pan] = 1;
	}
//	cout << ">> " << hsl << endl;
	cout << hsl << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:52: error: 'z' was not declared in this scope
   82 |                         if(j+z_tab[j+pan+1] < k && z+tab[j+pan+1] < pan && (j+z_tab[j+pan+1]>=hsl.size() || li[i][z_tab[j]] < hsl[j+z_tab[j+pan+1]])){
      |                                                    ^
a.cc:82:54: error: 'tab' was not declared in this scope; did you mean 'tan'?
   82 |                         if(j+z_tab[j+pan+1] < k && z+tab[j+pan+1] < pan && (j+z_tab[j+pan+1]>=hsl.size() || li[i][z_tab[j]] < hsl[j+z_tab[j+pan+1]])){
      |                                                      ^~~
      |                                                      tan
Language: C++

#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;

int makeable[2010][10100];
int dp[10010];
vector<string> DP(10010,"{");
vector<string> s;
vector<int> a;

main(){
  ios::sync_with_stdio(false);
    cin.tie(nullptr);
  int n=in(),k=in();
  rep(i,10010)dp[i]=-1;
  rep(i,n){
    string S;cin>>S;
    s.pb(S);
    a.pb(S.size());
  }
  bool is_allsame=1;
  char c=S[0][0];
  rep(i,n)for(auto e:s[i])is_allsame&=(c==e);
  if(is_allsame){rep(i,k)cout<<c;return 0;}
  DP[0]="";
  makeable[n][k]=1;
  rep3(i,n-1,0){
    int x=a[i];
    rep(j,k+1){
      makeable[i][j]=(makeable[i+1][j]|makeable[i+1][j+x]);
    }
  }
  /*
  rep(i,n+1){
    rep(j,k+1){
      cout<<makeable[i][j]<<" ";
    }
    cout<<endl;
  }
  */
  rep(i,k+1){
    string temp=DP[i];
    int index=dp[i];
    rep2(j,index+1,n-1){
      if(makeable[j][i]==0)continue;
      string t=temp+s[j];
      if(i+a[j]>k)continue;
      if(DP[i+a[j]]>t){
        DP[i+a[j]]=t;
        dp[i+a[j]]=j;
      }
    }
    /*
    rep(i,k+1){
      cout<<dp[i].first<<" ";
    }
    cout<<endl;
    */
  }
  cout<<DP[k];
}


Compiler output:
a.cc:55:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   55 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:66:10: error: 'S' was not declared in this scope
   66 |   char c=S[0][0];
      |          ^
Language: C++

#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;

int makeable[2010][10100];
int dp[10010];
vector<string> DP(10010,"{");
vector<string> s;
vector<int> a;

main(){
  ios::sync_with_stdio(false);
    cin.tie(nullptr);
  int n=in(),k=in();
  rep(i,10010)dp[i]=-1;
  rep(i,n){
    string S;cin>>S;
    s.pb(S);
    a.pb(S.size());
  }
  bool is_allsame=1;
  char c=S[0][0];
  rep(i,n)for(auto e:S[i])is_allsame&=(c==e);
  if(is_allsame){rep(i,k)cout<<c;return 0;}
  DP[0]="";
  makeable[n][k]=1;
  rep3(i,n-1,0){
    int x=a[i];
    rep(j,k+1){
      makeable[i][j]=(makeable[i+1][j]|makeable[i+1][j+x]);
    }
  }
  /*
  rep(i,n+1){
    rep(j,k+1){
      cout<<makeable[i][j]<<" ";
    }
    cout<<endl;
  }
  */
  rep(i,k+1){
    string temp=DP[i];
    int index=dp[i];
    rep2(j,index+1,n-1){
      if(makeable[j][i]==0)continue;
      string t=temp+s[j];
      if(i+a[j]>k)continue;
      if(DP[i+a[j]]>t){
        DP[i+a[j]]=t;
        dp[i+a[j]]=j;
      }
    }
    /*
    rep(i,k+1){
      cout<<dp[i].first<<" ";
    }
    cout<<endl;
    */
  }
  cout<<DP[k];
}


Compiler output:
a.cc:55:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   55 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:66:10: error: 'S' was not declared in this scope
   66 |   char c=S[0][0];
      |          ^
Language: C++

#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}

#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000
ll MOD=1e9+7;

int makeable[2010][10100];
int dp[10010];
vector<string> DP(10010,"{");
vector<pair<string,int>> dp(10010,pair<string,int>{"{",-1});
vector<string> s;
vector<int> a;

main(){
  ios::sync_with_stdio(false);
    cin.tie(nullptr);
  int n=in(),k=in();
  rep(i,10010)dp[i]=-1;
  rep(i,n){
    string S;cin>>S;
    s.pb(S);
    a.pb(S.size());
  }
  DP[0]="";
  makeable[n][k]=1;
  rep3(i,n-1,0){
    int x=a[i];
    rep(j,k+1){
      makeable[i][j]=(makeable[i+1][j]|makeable[i+1][j+x]);
    }
  }
  /*
  rep(i,n+1){
    rep(j,k+1){
      cout<<makeable[i][j]<<" ";
    }
    cout<<endl;
  }
  */
  rep(i,k+1){
    string temp=DP[i];
    int index=dp[i];
    rep2(j,index+1,n-1){
      if(makeable[j][i]==0)continue;
      string t=temp+s[j];
      if(i+a[j]>k)continue;
      if(DP[i+a[j]]>t){
        DP[i+a[j]]=t;
        dp[i+a[j]]=j;
      }
    }
    /*
    rep(i,k+1){
      cout<<dp[i].first<<" ";
    }
    cout<<endl;
    */
  }
  cout<<DP[k];
}


Compiler output:
a.cc:52:26: error: conflicting declaration 'std::vector<std::pair<std::__cxx11::basic_string<char>, int> > dp'
   52 | vector<pair<string,int>> dp(10010,pair<string,int>{"{",-1});
      |                          ^~
a.cc:50:5: note: previous declaration as 'int dp [10010]'
   50 | int dp[10010];
      |     ^~
a.cc:56:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   56 | main(){
      | ^~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define read(x) scanf("%d",&x)
const ll H=13131;
const ll MOD=1e9+7;
int n,k;
ll Pow[10005];
string S[2005],s[2005];
ll HashS[10005];
ll Hash[10005];
int len[2005];
int Len;
int path[10005];// which string occupies the position
bool term[10005];//terminate
bitset<10005> can[2005];
inline void printAns(int l){
	if (l==0) return;
	if (path[l]==0) return 1;
	printAns(l-len[path[l]]);
	cout<<S[path[l]];
}
int main(){
	ios::sync_with_stdio(false);
	//freopen("input.txt","rb",stdin);
	//freopen("output.txt","wb",stdout);
	Pow[0]=1;
	for (int i=1;i<10005;++i) Pow[i]=Pow[i-1]*H%MOD;
	cin>>n>>k;
	for (int i=1;i<=n;++i) cin>>S[i],len[i]=S[i].size(),s[i]="."+S[i];
	for (int i=0;i<2005;++i) can[i].reset();
	can[n][k]=1;
	for (int i=n;i>=1;--i){
		for (int j=k;j>=len[i];--j) if (can[i][j]) can[i-1][j]=can[i-1][j-len[i]]=1;
	}
	term[0]=1;Len=0;
	for (int i=1;i<=n;++i){
		for (int j=1;j<=len[i];++j) HashS[j]=(HashS[j-1]+s[i][j])*H%MOD;
		for (int j=0;j+len[i]<=k&&j<=Len;++j){
			if (!term[j]||!can[i][j+len[i]]) continue;
			if (j==Len){// directly add this string
				for (int p=j+1;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
				term[Len+=len[i]]=1;
				path[Len]=i;
				break;
			}
			int L=j,R=j+len[i];//L:must same;  R:must diff
			if (Hash[R]==(Hash[j]*Pow[len[i]]+HashS[len[i]])%MOD) continue;//completely the same
			while(L<R-1){
				int M=L+R>>1;
				if (Hash[M]==(Hash[j]*Pow[M-j]+HashS[M-j])%MOD) L=M;
				else R=M;
			}
			if (R>Len){//the original is a prefix
				// add this string as answer won't get worse
				for (int p=R;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
				for (int p=j+1;p<j+len[i];++p) term[p]=0;
				term[Len=j+len[i]]=1;
				path[Len]=i;
				break;
			}
			int oldchar,curchar=s[i][R-j];
			for (int ch='a';ch<='z';++ch) if (Hash[R]==(Hash[L]+ch)*H%MOD) oldchar=ch;
			if (curchar<oldchar){
				// add this string
				for (int p=R;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
				for (int p=j+1;p<=Len;++p) term[p]=0;
				term[Len=j+len[i]]=1;
				path[Len]=i;
				break;
			}
		}
	}
	printAns(k);
	cout<<endl;
	return 0; 
}

Compiler output:
a.cc: In function 'void printAns(int)':
a.cc:47:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
   47 |         if (path[l]==0) return 1;
      |                                ^
Language: C++

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
#include <ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define REP(i,n) for (int i=1;i<=n;++i)
#define all(x) x.begin(),x.end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define read(x) scanf("%d",&x)
const ll H=13131;
const ll MOD=1e9+7;
int n,k;
ll Pow[10005];
string S[2005],s[2005];
ll HashS[10005];
ll Hash[10005];
int len[2005];
int Len;
int path[10005];// which string occupies the position
bool term[10005];//terminate
bitset<10005> can[2005];
inline void printAns(int l){
	if (l==0) return;
	printAns(l-len[path[l]]);
	if (path[l]==0) return 1;
	cout<<S[path[l]];
}
int main(){
	ios::sync_with_stdio(false);
	Pow[0]=1;
	for (int i=1;i<10005;++i) Pow[i]=Pow[i-1]*H%MOD;
	cin>>n>>k;
	for (int i=1;i<=n;++i) cin>>S[i],len[i]=S[i].size(),s[i]="."+S[i];
	for (int i=0;i<2005;++i) can[i].reset();
	can[n][k]=1;
	for (int i=n;i>=1;--i){
		for (int j=k;j>=len[i];--j) if (can[i][j]) can[i-1][j]=can[i-1][j-len[i]]=1;
	}
	term[0]=1;Len=0;
	for (int i=1;i<=n;++i){
		for (int j=1;j<=len[i];++j) HashS[j]=(HashS[j-1]+s[i][j])*H%MOD;
		for (int j=0;j+len[i]<=k&&j<=Len;++j){
			if (!term[j]||!can[i][j+len[i]]) continue;
			if (j==Len){// directly add this string
				for (int p=j+1;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
				term[Len+=len[i]]=1;
				path[Len]=i;
				continue;
			}
			int L=j,R=j+len[i];//L:must same;  R:must diff
			if (Hash[R]==(Hash[j]*Pow[len[i]]+HashS[len[i]])%MOD) continue;//completely the same
			while(L<R-1){
				int M=L+R>>1;
				if (Hash[M]==(Hash[j]*Pow[M-j]+HashS[M-j])%MOD) L=M;
				else R=M;
			}
			if (R>Len){//the original is a prefix
				// add this string as answer won't get worse
				for (int p=R;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
				for (int p=Len;p<j+len[i];++p) term[p]=0;
				term[Len=j+len[i]]=1;
				path[Len]=i;
				continue;
			}
			int oldchar,curchar=s[i][R-j];
			for (int ch='a';ch<='z';++ch) if (Hash[R]==(Hash[L]+ch)*H%MOD) oldchar=ch;
			if (curchar<oldchar){
				// add this string
				for (int p=R;p<=j+len[i];++p) Hash[p]=(Hash[p-1]+s[i][p-j])*H%MOD;
				for (int p=j+1;p<=Len;++p) term[p]=0;
				term[Len=j+len[i]]=1;
				path[Len]=i;
				continue;
			}
		}
	}
	printAns(k);
	cout<<endl;
	return 0; 
}

Compiler output:
a.cc: In function 'void printAns(int)':
a.cc:48:32: error: return-statement with a value, in function returning 'void' [-fpermissive]
   48 |         if (path[l]==0) return 1;
      |                                ^