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

#include<bits/stdc++.h>
/*
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<numeric>
#include<iomanip>
#include<utility>
#include<cstdlib>
#include<typeinfo>
#include<stack>
#include<cassert>
#include<functional>
*/
#define int long long int
#define double long double
using namespace std;
#define INT_DMAX 1000000007
#define INF 1000000000000000007
const int MAX_N = 1 << 17;
#define rep(i,n) for(int (i)=0, i##_len = (n);(i)<i##_len;(i)++)
#define reps(i,x) for(int (i)=1;(i)<=(int)(x);(i)++)
#define rrep(i,x) for(int (i)=((int)(x)-1);(i)>=0;(i)--)
#define rreps(i,x) for(int (i)=((int)(x));(i)>0;(i)--)
#define FOR(i,a,b) for (int (i) = (a); (i) < (b); (i)++)
#define pb push_back
#define mp make_pair
#define bit(n) ((int)(1)<<(n))
#define all(x) (x).begin(),(x).end()
#define debug(x) std::cout << #x << ": " << (x) << std::endl 
#define nint int
using namespace std;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
typedef pair<int,int> pii;
typedef pair<double,double> dop;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
}aaaaaaa;



signed main()
{
int n,m;
std::cin >> n >> m;
//1 -> 2,3->7
std::vector<int> check(10,0);
int cost[10] = {INF,2,5,5,4,5,6,3,7,6};
rep(i,m){
    int temp;
    std::cin >> temp;
    check[temp]++;
}
std::vector<std::vector<int>> dp(n + 1,std::vector<int>(9,-1));
dp[0][0] = 0;
for(int i = 0; i <= n; i++){
    if(cost[1] + i <= n){
        if(check[1] == 1 && dp[i][0] >= 0 && dp[i + cost[1]][0] < dp[i][0] + 1){
            dp[i + cost[1]][0] = dp[i][0] + 1;
        }
    
}
for(int j = 1; j < 9; j++){
    for(int i = 0; i <= n; i++){
        if(dp[i][j] < dp[i][j - 1]){
            dp[i][j] = dp[i][j - 1];
        }
        if(check[j] == 1 && cost[j] + i <= n){
           if(dp[i][j] >= 0 && dp[i + cost[j] ][j] < dp[i][j] + 1){
            dp[i + cost[j]][j] = dp[i][j] + 1;
           } 
        }
    }
}
std::vector<int> count(8,0);
std::string out;
int index = n;
int num = 8;
while(index > 0 && num >= 0){
    if(index - cost[num] >= 0){        
        if((check[num] == 1) && (dp[index][num] - 1 == dp[index - cost[num]][num])){
            count[cost[num]]++;
            index -= cost[num];
        } else {
            num--;
        }
    } else {
        num--;
    }
}
for(int i = 9; i > 0; i--){
    if(check[i] != 1){
        continue;
    }
    for(int j = 0; j < count[cost[i]]; j++){
        out += (char)('0' + i);
    }
    count[cost[i]] = 0;
}
std::cout << out << std::endl;
return 0;
}

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

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

const int number[] = { 0,2,5,5,4,5,6,3,7,6 };

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> A(m);

	for (int i = 0; i < m; i++) {
		cin >> A[i];
	}

	vector<int> DP(n);
	int max;
	for (int i = 0; i < n; i++) {
		max = 0;
		for (int j = 0; j < m; j++) {
			if (i - number[A[j]] >= 0 && max < DP[i - number[A[j]] + 1) {
				max = DP[i - number[A[j]] + 1;
			}
		}
		DP[i] = max;
	}
	sort(A.begin(), A.end(), greater<int>());

	int remain = DP[n],match = n;
	while (remain > 0) {
		for (int i = 0; i < m; i++) {
			if (match - number[A[i]] >= 0 && DP[match - number[A[i]]] == remain - 1) {
				cout << A[i];
				match -= number[A[i]];
				remain--;
				break;
			}
		}
	}
	cout << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:83: error: expected ']' before ')' token
   23 |                         if (i - number[A[j]] >= 0 && max < DP[i - number[A[j]] + 1) {
      |                                                                                   ^
      |                                                                                   ]
a.cc:24:62: error: expected ']' before ';' token
   24 |                                 max = DP[i - number[A[j]] + 1;
      |                                                              ^
      |                                                              ]
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)

ll mod = 1e9 + 7;
using pii = pair<int, int>;

ll dp[10001];

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

  ll n, m;
  cin >> n >> m;

  ll ms[9] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
  ll abailable[8] = {}, usednum[10] = {};

  ll a[m];
  REP(i, m){
    cin >> a[i];
    available[ms[a[i] - 1]]++;
    used[a[i]]++;
  }

  vector<int> numst;
  REP(i, 8){
    if(available[i]) numst.pb(i);
  }
  
  REP(i, n + 1) dp[i] = -10000;
  dp[0] = 0;
  REP(i, numst.size()) dp[numst[i]] = 1;

  for(int i = 2; i <= n; i++){
    REP(j, numst.size()){
      if(i - numst[j] >= 0){
        if(dp[i - numst[j]] + 1 > dp[i]){
          dp[i] = dp[i - numst[j]] + 1;
        }
      }
    }
  }
  ll tmp = n;
  vector<int> anss;
  REP(i, dp[n]){
    REP(j, numst.size()){
      if(dp[tmp - numst[j]] == dp[tmp] - 1){
        anss.pb(numst[j]);
        tmp -= numst[j];
        break;
      }
    }
  }

  int num[8] = {0, 0, 1, 7, 4, 2, 6, 8};
  if(used[3]) num[5] = 3;
  if(used[5]) num[5] = 5;
  if(used[9]) num[6] = 9;

  ll lan = anss.size();
  int ansset[10] = {};
  REP(i, lan){
    ansset[num[anss[i]]]++;
  }

  vector<char> ccc;

  REP(i, 10){
    REP(j, ansset[i]){
      ccc.pb(i + '0');
    }
  }

  ll cll = ccc.size();
  REP(i, cll){
    cout << ccc[cll - 1 - i];
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:30:5: error: 'available' was not declared in this scope; did you mean 'abailable'?
   30 |     available[ms[a[i] - 1]]++;
      |     ^~~~~~~~~
      |     abailable
a.cc:31:5: error: 'used' was not declared in this scope
   31 |     used[a[i]]++;
      |     ^~~~
a.cc:36:8: error: 'available' was not declared in this scope; did you mean 'abailable'?
   36 |     if(available[i]) numst.pb(i);
      |        ^~~~~~~~~
      |        abailable
a.cc:65:6: error: 'used' was not declared in this scope
   65 |   if(used[3]) num[5] = 3;
      |      ^~~~
a.cc:66:6: error: 'used' was not declared in this scope
   66 |   if(used[5]) num[5] = 5;
      |      ^~~~
a.cc:67:6: error: 'used' was not declared in this scope
   67 |   if(used[9]) num[6] = 9;
      |      ^~~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int MAX_N = 1e4 + 10;
int number[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int A[MAX_N];
int n, m;
string dp[MAX_N];
void dfs(int sum, int pos, string s)
{
    if(pos >= m) return;
    if(dp[sum].size() > s.size()) return;
    if(dp[sum].size() < s.size()) dp[sum] = s;
    else if(dp[sum] < s) dp[sum] = s;
    dfs(sum, pos + 1, s);
    if(sum + number[A[pos]] <= n)
    {
        s += A[pos] + '0';
        dfs(sum + number[A[pos]], pos, s);
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    for(int i = 0; i < MAX_N; i++) dp[i] = "";
    cin >> n >> m;
    for(int i = 0; i < m; i++) cin >> A[i];
    sort(A.begin(), A.end(), greater<int>());
    dfs(0, 0, "");
    cout << dp[n] << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:12: error: request for member 'begin' in 'A', which is of non-class type 'int [10010]'
   34 |     sort(A.begin(), A.end(), greater<int>());
      |            ^~~~~
a.cc:34:23: error: request for member 'end' in 'A', which is of non-class type 'int [10010]'
   34 |     sort(A.begin(), A.end(), greater<int>());
      |                       ^~~
Language: C++

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

int N;
int M, A[10];

int m[10];

vector< pair<int, int> > V, W;

int check[10];

int KETA(int K, int y) {
	while (y > 0) { K /= 7; y--; }
	return K % 7;
}

int COUNT(int INIT, int max_sum) {

	int H = W.size();
	int X[10];

	int ret = 0;

	for (int i = INIT; i < pow(7,7); i++) {
		int sum = 0;
		int n = 0;
		int sign= 0;
		for (int m = 1; m < (int)H; m++) { X[m] = KETA(i, m);  sum += X[m]; }
		if (sign == 1) {
			continue;
		}
		for (int j = 1; j < (int)H; j++) {
			n += W[j].first * X[j];
		}
		if (n > N) { continue; }
		if (((N - n) % W[0].first) == 0) {
			
			sum += (N - n) / W[0].first;
			if (sum >= max_sum) {
				max_sum = sum;  return i; 
			                    }
		}
	}
	return 10000000;
}

int main(void) {

	cin >> N >> M;

	for (int i = 1; i <= M; i++) {
		cin >> A[i];
	}

	m[1] = 2;
	m[2] = 5;
	m[3] = 5;
	m[4] = 4;
	m[5] = 5;
	m[6] = 6;
	m[7] = 3;
	m[8] = 7;
	m[9] = 6;

	for (int i = 1; i <= M; i++) {
		pair<int, int> P;
		P.first = m[A[i]];
		P.second = A[i];
		V.push_back(P);
	}

	sort(V.rbegin(), V.rend());

	for (int i = 0; i < (int)V.size(); i++) {
		if (check[V[i].first] == 0) { W.push_back(V[i]); check[V[i].first] = 1; }
	}

	sort(W.begin(), W.end());

	/*for (int i = 0; i < (int)W.size(); i++){
		cout << W[i].first << " " << W[i].second << endl;
}*/

	

	

	vector<int> U;
	U.resize(10);
	int tmp = 0;
	vector<int> ANS, TMP_ANS;
	string ans="11", tmp_ans;

	int R = 0; int max_sum = 1;
	while (R < pow(7,7)) {
		//cout << "R= " << R << endl;
		R = COUNT(R+1, max_sum);
		if (R >= pow(7,7)) { break; }
		tmp = 0; max_sum = 0;
		for (int i = 1; i < (int)W.size(); i++) {
			U[i] = KETA(R, i); tmp += KETA(R, i)*W[i].first; max_sum += KETA(R, i);
		}
		U[0] = (N - tmp) / W[0].first;
		max_sum += U[0];

		TMP_ANS.clear();

		for (int i = 0; i < (int)W.size(); i++) {
			for (int j = 0; j < (int)U[i]; j++) {
				TMP_ANS.push_back(W[i].second);
			}
		}

		sort(TMP_ANS.rbegin(), TMP_ANS.rend());

		/*for (int i = 0; i < (int)TMP_ANS.size(); i++) {
			cout << TMP_ANS[i];
		}cout << endl;
		*/
		/*tmp_ans = "";
		for (int i = 0; i < (int)ANS.size(); i++) {
			tmp_ans += (char) ANS[i];
		}*/
		//cout << "tmp_ans= " << tmp_ans << endl;
		if (TMP_ANS >ANS) { ANS = TMP_ANS; }
	}
	
	for (int i = 0; i < (int)ANS.size(); i++) {
		cout << ANS[i];
	}cout << endl;
	
	//system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int COUNT(int, int)':
a.cc:28:32: error: 'pow' was not declared in this scope
   28 |         for (int i = INIT; i < pow(7,7); i++) {
      |                                ^~~
a.cc: In function 'int main()':
a.cc:99:20: error: 'pow' was not declared in this scope
   99 |         while (R < pow(7,7)) {
      |                    ^~~
Language: C++

#include <cstdio>
#include <algorithm>

int n;
int m;
int a[10];
int b[10];
int c[10];
int d;
int bb;
int min;
int minj = 0;
int max;
int maxj = 0;
int temp1, temp2, temp3;
int r;
int count = 0;
int value;

bool bEnd = false;

void bubbleSort(int M[], int N[], int len){
  for(int i=0; i<len; i++){
    for(int j=len-1; j>i; j--){
      if((N[j] < N[j-1]) || (N[j] == N[j-1] && M[j] > M[j-1])){
        temp1 = M[j];
        temp2 = N[j];
        M[j] = M[j-1];
        N[j] = N[j-1];
        M[j-1] = temp1;
        N[j-1] = temp2;
      }
    }
  }
}

void rbubbleSort(int L[], int M[], int N[], int len){
  for(int i=0; i<len; i++){
    for(int j=len-1; j>i; j--){
      if(L[j] > L[j-1]){
        temp1 = L[j];
        temp2 = M[j];
        temp3 = N[j];
        L[j] = L[j-1];
        M[j] = M[j-1];
        N[j] = N[j-1];
        L[j-1] = temp1;
        M[j-1] = temp2;
        N[j-1] = temp3;
      }
    }
  }
}

void solve() {
  for (int i = 0; i < m; i++) {
    if (a[i] == 1) {
      b[i] = 2;
    } else if (a[i] == 2 || a[i] == 3 || a[i] == 5) {
      b[i] = 5;
    } else if (a[i] == 4) {
      b[i] = 4;
    } else if (a[i] == 6 || a[i] == 9) {
      b[i] = 6;
    } else if (a[i] == 7) {
      b[i] = 3;
    } else {
      b[i] = 7;
    }
  }
  bubbleSort(a, b, m);

  for (int i = 1; i < m; i++) {
    if (b[i] == b[i-1]) {
      for (int j = i; j < m-1; j++) {
        b[j] = b[j+1];
        a[j] = a[j+1];
      }
      m -= 1;
    }
  }

  for (int i = 1; i < m; i++) {
    if (b[i] == b[i-1]) {
      for (int j = i; j < m-1; j++) {
        b[j] = b[j+1];
        a[j] = a[j+1];
      }
      m -= 1;
    }
  }
  for (int i = m; i < 9; i++) {
    b[i] = 0;
  }
  bb = b[0];
  r = n % b[0];

  for (int i = 0; i < 10; i++) {
    d = i * b[0] + r;
    for (int q = 0; q < 10; q++) {
      for (int j = 0; j < 10; j++) {
        for (int k = 0; k < 10; k++) {
          for (int l = 0; l < 10; l++) {
            for (int p = 0; p < 10; p++) {
              value = b[1]*p+b[2]*l+b[3]*k+b[4]*j+b[5]*q;
                if (value == d) {
                  c[1] = p;
                  c[2] = l;
                  c[3] = k;
                  c[4] = j;
                  c[5] = q;
                  c[0] = (n - d) / b[0];
                  bEnd = true;
                }
                if( bEnd ){break;}
              }
              if( bEnd ){break;}
            }
            if( bEnd ){break;}
          }
          if( bEnd ){break;}
        } 
        if( bEnd ){break;}
      }
      if( bEnd ){break;}
    }
    rbubbleSort(a, b, c, m);
    for (int i = 0; i < m; i++) {
      for (int j = 0; j < c[i]; j++) {
        printf("%d", a[i]);
      }
    }
  }

}
 
int main() {
  scanf("%d", &n);
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &a[i]);
  }
  solve();
 
  return 0;
}


Compiler output:
a.cc:135:1: error: expected declaration before '}' token
  135 | }
      | ^
Language: C++

#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

const string MINUSINF = "-";

void chmax(string &a, string &b) {
	if (a == MINUSINF
		|| a.size() < b.size()
		|| (a.size() == b.size() && a < b)
	) {
		a = b;
	}
}

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

	int n, m;
	cin >> n >> m;

	vector<int> a(m);
	for (auto &v : a) {
		cin >> v;
	}

	vector<ll> match = { 2,5,5,4,5,6,3,7,6 };
	vector<string> dp(11000, MINUSINF);
	dp[0] = "";
	for (int i = 0; i <= n; i++) {
		if (dp[i] == MINUSINF) {
			continue;
		}
		for (auto v : a) {
			chmax(dp[i + match[v - 1]], dp[i] + (char)('0' + v));
		}
	}

	cout << dp[n] << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:59: 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>'
   49 |                         chmax(dp[i + match[v - 1]], dp[i] + (char)('0' + v));
a.cc:20:31: note:   initializing argument 2 of 'void chmax(std::string&, std::string&)'
   20 | void chmax(string &a, string &b) {
      |                       ~~~~~~~~^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 30;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};

ll sowa(int v[]) {
  ll res = 0;
  for (int i = 0; i < 9; i++) {
    res += (i + 1) * v[i];
  }
  return res;
}

int main() {
  int n, m;
  cin >> n >> m;
  int dp[n + 1][9] = {};  // dp[n本で作れる][数字どれだけ使うか]
  int cost[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  int suji[m] = {};
  for (int i = 0; i < m; i++)
    cin >> suji[i];

  for (int i = 0; i <= n; i++) {
    for (int j = 0; j < m; j++) {
      if (i + cost[suji[j]] > n)
        continue;

      // cout << i << " " << j << " " << cost[suji[j]] << " " << suji[j] <<
      // endl;

      if (accumulate(dp[i], dp[i] + 9, 0) + 1
              > accumulate(dp[i + cost[suji[j]]], dp[i + cost[suji[j]]] + 9, 0)
          || (accumulate(dp[i], dp[i] + 9, 0) + 1
                  == accumulate(dp[i + cost[suji[j]]],
                                dp[i + cost[suji[j]]] + 9, 0)
              && sowa(dp[i]) + j
                     > sowa(dp[i + cost[suji[j]]]))) {  /Mint/スコアを更新

        for (int k = 0; k < 9; k++)
          dp[i + cost[suji[j]]][k] = dp[i][k];

        dp[i + cost[suji[j]]][suji[j] - 1]++;  // 使う数字の回数を+1しておく
      }
    }
  }

  for (auto x : dp[n]) {
    cout << x << " ";
  }
  cout << endl;

  for (int i = 8; 0 <= i; i--) {  // 9からおろしていく
    for (int j = 0; j < dp[n - 1][i]; j++) {
      cout << i + 1;
    }
  }
  cout << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:57: error: expected primary-expression before '/' token
   41 |                      > sowa(dp[i + cost[suji[j]]]))) {  /Mint/スコアを更新
      |                                                         ^
a.cc:41:58: error: 'Mint' was not declared in this scope; did you mean 'uint'?
   41 |                      > sowa(dp[i + cost[suji[j]]]))) {  /Mint/スコアを更新
      |                                                          ^~~~
      |                                                          uint
a.cc:41:63: error: '\U000030b9\U000030b3\U000030a2\U00003092\U000066f4\U000065b0' was not declared in this scope
   41 |                      > sowa(dp[i + cost[suji[j]]]))) {  /Mint/スコアを更新
      |                                                               ^~~~~~~~~~~~
a.cc:43:25: error: 'k' was not declared in this scope
   43 |         for (int k = 0; k < 9; k++)
      |                         ^
Language: Java

import java.util.*;

public class D {
    private static int[] costs = new int[]{-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};

    private static class RunLenNum implements Comparable<RunLenNum> {
        private int totLen;
        private int[] numCounts;

        public RunLenNum() {
            this.totLen = 0;
            this.numCounts = new int[10];
        }

        public RunLenNum addNum(int num) {
            RunLenNum res = new RunLenNum();
            res.totLen = totLen + 1;
            res.numCounts = Arrays.copyOf(numCounts, numCounts.length);
            res.numCounts[num]++;

            return res;
        }

        @Override
        public int compareTo(RunLenNum o) {
            if (o == null)
                return 1;

            if (totLen != o.totLen)
                return Integer.compare(totLen, o.totLen);

            for (int i = 9; i > 0; i--) {
                if (numCounts[i] != o.numCounts[i])
                    return Integer.compare(numCounts[i], o.numCounts[i]);
            }

            return 0;
        }

        @Override
        public String toString() {
            StringBuilder sb = new StringBuilder();

            for (int i = 9; i > 0; i--) {
                if (numCounts[i] == 0)
                    continue;

                for (int j = 0; j < numCounts[i]; j++) {
                    sb.append(i);
                }
            }

            return sb.toString();
        }
    }

    private static RunLenNum findBest(RunLenNum[] memo, int minDigits, int n, List<Integer> digits) {
        if (n < minDigits)
            return null;

        if (memo[n] != null)
            return memo[n];

        ArrayList<RunLenNum> choices = new ArrayList<>();

        for (int d : digits) {
            if (costs[d] == n)
                choices.add(new RunLenNum().addNum(d));
        }

        for (int d : digits) {
            RunLenNum bestWithoutThis = findBest(memo, minDigits, n - costs[d], digits);

            if (bestWithoutThis != null)
                choices.add(bestWithoutThis.addNum(d));
        }

        if (choices.size() == 0)
            memo[n] = null;
        else
            memo[n] = Collections.max(choices);

        return memo[n];
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt(), m = sc.nextInt();

        ArrayList<Integer> ds = new ArrayList<>(m);

        for (int i = 0; i < m; i++) {
            ds.add(sc.nextInt());
        }

        int minDigits = 10;

        for (int d : ds) {
            minDigits = Math.min(minDigits, costs[d]);
        }

        RunLenNum[] memo = new RunLenNum[Math.max(10, n + 1)];

        System.out.println(findBest(memo, minDigits, n, ds));
    }
}

Compiler output:
Main.java:3: error: class D is public, should be declared in a file named D.java
public class D {
       ^
1 error
Language: C++

c=[0,2,5,5,4,5,6,3,7,6];N,M=gets.split.map &:to_i;A=gets.split.map &:to_i;d=[0]+Array.new(N);0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]

Compiler output:
a.cc:1:1: error: 'c' does not name a type
    1 | c=[0,2,5,5,4,5,6,3,7,6];N,M=gets.split.map &:to_i;A=gets.split.map &:to_i;d=[0]+Array.new(N);0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]
      | ^
a.cc:1:25: error: 'N' does not name a type
    1 | c=[0,2,5,5,4,5,6,3,7,6];N,M=gets.split.map &:to_i;A=gets.split.map &:to_i;d=[0]+Array.new(N);0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]
      |                         ^
a.cc:1:51: error: 'A' does not name a type
    1 | c=[0,2,5,5,4,5,6,3,7,6];N,M=gets.split.map &:to_i;A=gets.split.map &:to_i;d=[0]+Array.new(N);0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]
      |                                                   ^
a.cc:1:75: error: 'd' does not name a type
    1 | c=[0,2,5,5,4,5,6,3,7,6];N,M=gets.split.map &:to_i;A=gets.split.map &:to_i;d=[0]+Array.new(N);0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]
      |                                                                           ^
a.cc:1:94: error: expected unqualified-id before numeric constant
    1 | c=[0,2,5,5,4,5,6,3,7,6];N,M=gets.split.map &:to_i;A=gets.split.map &:to_i;d=[0]+Array.new(N);0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]
      |                                                                                              ^~~~~~
a.cc:1:180: error: 'p' does not name a type
    1 | c=[0,2,5,5,4,5,6,3,7,6];N,M=gets.split.map &:to_i;A=gets.split.map &:to_i;d=[0]+Array.new(N);0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]
      |                                                                                                                                                                                    ^
Language: C++

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

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vll;
const int INF = 0x3f3f3f3f;
struct match {
    int number;
    int cnt;
};

bool cmpS(const string &x, const string &y) {
    if (x.length() != y.length()) {
        return x.length() < y.length();
    }
    for (int i = 0; i < x.length(); ++i) {
        if (x[i] != y[i]) {
            return x[i] < y[i];
        }
    }
    return false;
}

bool cmp(const match& x, const match& y) {
    if (x.cnt == y.cnt) {
        return x.number > y.number;
    }
    return x.cnt < y.cnt;
}

int main() {
    const vector<int> matches = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    ll n, m;
    cin >> n >> m;
    vector<match> nums(m);
    for (int i = 0; i < m; ++i) {
        cin >> nums[i].number;
        nums[i].cnt = matches[nums[i].number];
    }
    sort(nums.begin(), nums.end(), cmp);
    vector<int> w;
    vector<int> v;
    w.push_back(nums[0].cnt);
    v.push_back(nums[0].number);
    for (int i = 1; i < m; ++i) {
        if (nums[i].cnt == nums[i - 1].cnt) continue;
        w.push_back(nums[i].cnt);
        v.push_back(nums[i].number);
    }
    vector<string> dp(100000);
    // vll record(100000, -1);
    // dp[0] = 0;
    for (int i = 0; i < w.size(); ++i) {
        for (int j = w[i]; j <= n; ++j) {
            if (cmpS(dp[j], dp[j - w[i]] + char(v[i] + '0'))) {
                dp[j] = dp[j - w[i]] + char(v[i] + '0');
            }
        }
    }
    ll ans = dp[n];
    sort(ans.begin(), ans.end(), greater<char>());
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:18: error: cannot convert '__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> >, std::__cxx11::basic_string<char> >::value_type' {aka 'std::__cxx11::basic_string<char>'} to 'll' {aka 'long long int'} in initialization
   61 |     ll ans = dp[n];
      |                  ^
a.cc:62:14: error: request for member 'begin' in 'ans', which is of non-class type 'll' {aka 'long long int'}
   62 |     sort(ans.begin(), ans.end(), greater<char>());
      |              ^~~~~
a.cc:62:27: error: request for member 'end' in 'ans', which is of non-class type 'll' {aka 'long long int'}
   62 |     sort(ans.begin(), ans.end(), greater<char>());
      |                           ^~~
Language: C++

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

int main()
{
	int n, m;
	int count[9] = { 2,5,5,4,5,6,3,7,6 };
	cin >> n >> m;
	vector<int> arr(m, 0);
	for (int i = 0; i < m; i++) {
		cin >> arr[i];
	}

	vector<int> wei(n + 1, 0);
	vector<long long> dp(n + 1, 0);
	for (int i = 2; i <= n; i++) {
		for (int j = 0; j < m; j++) {
			int first = arr[j];
			int sticks = count[first - 1];
			if (i >= sticks) {
				int cur = 0;
				if (dp[i-sticks] > 0 || dp[i-sticks]==0 && i==sticks) cur = first * pow(10, wei[i - sticks]) + dp[i - sticks];
				if (dp[i] < cur) {
					dp[i] = cur;
					wei[i] = wei[i - sticks] + 1;
				}
			}
		}
	}
	cout << dp[n] << endl;
	//for (int i = 0; i <= n; i++) cout << i << ": " << dp[i] << " ";
	//cout << endl;
	// dp[i] = max{num[j]*10^wei[j] + dp[i-count[j]]} | j=arr_0->arr_m ;
	// wei[i] = wei[j] + 1;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:101: error: 'pow' was not declared in this scope
   24 |                                 if (dp[i-sticks] > 0 || dp[i-sticks]==0 && i==sticks) cur = first * pow(10, wei[i - sticks]) + dp[i - sticks];
      |                                                                                                     ^~~
Language: C++

#include<iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include <stdlib.h>
#include<string>
#include<queue>
#include<algorithm>
#include<math.h>
using namespace std;

int main(){
	int N,M,A[10]={};//つかえるかずりすと
	int dp[10000]={};//N本でできる最大の桁数
	int match[10]={0,2,5,5,4,5,6,3,7,6};
	string dps[10000];
	priority_queue<int> q;
	cin>>N>>M;

	for(int i=0;i<M;i++){
		cin>>A[i];
	}
	for(int i=0;i<M;i++){
		for(int j=i+1;j<M;j++){
			if(A[i]>A[j]){
				int tmp=A[i];
				A[i]=A[j];
				A[j]=tmp;A
			}
		}
	}
	cout<<A[0]<<endl;
	cout<<"miria";
	for(int i=0;i<M;i++){
		dp[match[A[i]]]=1;
		dps[match[A[i]]]=to_string(A[i]);
	}
	cout<<"miria";
	for(int i=0;i<=N;i++){
		if(dp[i]==0){
			continue;
		}else{
			for(int j=0;j<M;j++){
				if(dp[i+match[A[j]]]<=dp[i]+1){
				dp[i+match[A[j]]]=dp[i]+1;
				dps[i+match[A[j]]]=dps[i]+to_string(A[j]);
				}
			}
		}
	}
	cout<<"miria";
	cout<<dps[N]<<endl;
	for(int i=0;i<dps[N].size();i++){
		q.push(dps[N][i]);
	}
	while(!q.empty()){
		cout<<q.top()-48;
		q.pop();
	}
	cout<<endl;
}


	

Compiler output:
a.cc: In function 'int main()':
a.cc:27:43: error: expected ';' before '}' token
   27 |                                 A[j]=tmp;A
      |                                           ^
      |                                           ;
   28 |                         }
      |                         ~
Language: C++

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

typedef long long ll;

int degit[] = {0,2,5,5,4,5,6,3,7,6};

int n, m;
int a[10];
vector<pair<int, int>> v;

string dp[100010];

bool s_compare(string p, string q){
    if (p.size() != q.size()){
        return p.size() < q.size();
    } else {
        for (int i = 0; i < p.size(); i++){
            if (p[i] != q[i]){
                return p[i] < q[i];
            }
        }
    }
    cout << "!!" << endl;
    return true;
}

int main(){
    cin >> n >> m;
    for (int i = 0; i < m; i++){
        cin >> a[i];
        v.push_back(make_pair(a[i],degit[a[i]]));
    }

    sort(v.begin(), v.end(), [](pair<int, int> a, pair<int, int> b){
        {if (a.second != b.second){
            return a.second < b.second;
        } else {
            a.first > b.first;
        }}
    });
/*
    for (int i = 0; i < m; i++){
        cout << v[i].first << "," << v[i].second << endl;
    }
*/
    for (int i = 0; i <= n; i++){
        dp[i] = "hoge";
    }
    dp[0] = '';

    for (int i = 0; i < m; ++i){
        for (int w = v[i].second; w <= n; w++)
        {
            if (dp[w] == "hoge") continue;
            if(s_compare(dp[w], to_string(v[i].first) + dp[w - v[i].second])){
                dp[w] = to_string(v[i].first) + dp[w - v[i].second];
            }
        }
    }
    cout << dp[n] << endl;
}





Compiler output:
a.cc:50:13: error: empty character constant
   50 |     dp[0] = '';
      |             ^~
a.cc: In lambda function:
a.cc:41:5: warning: control reaches end of non-void function [-Wreturn-type]
   41 |     });
      |     ^
Language: C++

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

int N,M;
bool number[10];
string ans;

int main(){
  cin >> N >> M;
  ans="";
  vector<int> A(M);
  for(int i=0;i<M;i++)cin >> A[i];
  for(int i=1;i<=9;i++){number[i]=false;}
  for(int i=0;i<M;i++){number[A[i]]=true;}
  if(number[1]){
    if(N%2==0){
      for(int i=0;i<N/2;i++){ans+='1';}
    }
    else if(number[7]){
      ans+='7';
      for(int i=0;i<(N-3)/2;i++){ans+='1';}
    }
    else if(number[5]){
      ans+='5';
      for(int i=0;i<(N-5)/2;i++){ans+='1';}
    }
    else if(number[3]){
      ans+='3';
      for(int i=0;i<(N-5)/2;i++){ans+='1';}
    }
    else if(number[2]){
      ans+='2';
      for(int i=0;i<(N-5)/2;i++){ans+='1';}
    }
    else if(number[8]){
      ans+='8';
      for(int i=0;i<(N-7)/2;i++){ans+='1';}
    }
  }
  else if(number[7]){
    if(N%3==0){
      for(int i=0;i<N/3;i++){ans+='7';}
    }
    else if(

Compiler output:
a.cc: In function 'int main()':
a.cc:44:13: error: expected primary-expression at end of input
   44 |     else if(
      |             ^
a.cc:44:13: error: expected ')' at end of input
   44 |     else if(
      |            ~^
      |             )
a.cc:44:13: error: expected statement at end of input
a.cc:44:13: error: expected '}' at end of input
a.cc:40:21: note: to match this '{'
   40 |   else if(number[7]){
      |                     ^
a.cc:44:13: error: expected '}' at end of input
   44 |     else if(
      |             ^
a.cc:8:11: note: to match this '{'
    8 | int main(){
      |           ^
Language: Java

import java.util.*;
public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		int[] e = new int[b];
		int[] f = new int[b];
		int[] ans = new int[b];
		int[] n = {2,5,5,4,5,6,3,7,6};
		for(int i=0;i<b;i++){
			int c =scan.nextInt();
			e[i] =c;
			f[i] =n[c-1];
		}
		Arrays.sort(f);
		Arrays.sort(e);
		int p=0;
		int u = a/f[0];
		ans[0]=u;
		int k = a%f[0];
		boolean flg=true;
		while(flg){
			if(k==0){break;}
			a=k+f[0];
			ans[0]--;
			for(int i=p;i<b;i++){
				if(a%f[i]==0){
					ans[i]++;
					flg=false;
					break;
				}
			}
			if(flg){
				while(true){
					if(a-f[p]>0){
						a-=f[p];
						ans[p]++;
					}else{
						break;
					}
				}
			}
			k=a;
			p++;
		}

		for(int i=b;i>0;i--){
			for(int l=8;l>=0;l--){
				if(n[l]==f[i-1]){
					for(int u=0;u<b;u++){
						if(l+1==e[u]){
							for(int y=0;y<ans[i-1];y++){
						System.out.print(f[l]);
					}
						}
					}
				}
			}
		}

	}
}

Compiler output:
Main.java:51: error: variable u is already defined in method main(String[])
					for(int u=0;u<b;u++){
					        ^
1 error
Language: C++

#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<numeric>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
int main(){
    int n,m,A[200000],dp[100000][11]={0};
    cin>>n>>m;
    rep(i,m) cin>>A[i];
    int B[10]={0,2,5,5,4,5,6,3,7,6},C[10];
    rep(i,m) C[i]=B[A[i]];
    int D[10],b=0;
    rep(i,m-1) if(C[i]!=C[i+1]) D[b]=C[i],b++;
    D[b]=C[m-1],b++;
    int c,E[10],d;
    rep(i,n+1) dp[i][0]=-1;
    dp[0][0]=0;
    for(int i=1;i<=n;i++){
        c=-1,d=-1;
        rep(j,b) if(i>=D[j]) if(dp[i-D[j]][0]>c) c=dp[i-D[j]][0]+1,d=D[j];
        dp[i][0]=c;
        if(d>=0) {rep(j,b) dp[i][j]=dp[i-d][j];dp[i-d][d]++;
    }
    sort(A,A+m,greater<int>());
    rep(i,m){
        rep(j,dp[n][B[A[i]]]) cout<<A[i];
        dp[n][B[A[i]]]=0;
    }
}

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

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

int N,M;
bool number[10];
string ans;

void dp(int N){
  if(number[1]){
    for(int i=0;i<N/2;i++){ans+='1';}  N=N%2;
  }
  else if(number[7]){
    for(int i=0;i<N/3;i++){ans+='7';}  N=N%3;
  }
  else if(number[4]){
    for(int i=0;i<N/4;i++){ans+='4';}  N=N%4;
  }
  else if(number[5]){
    for(int i=0;i<N/5;i++){ans+='5';}  N=N%5;
  }
  else if(number[3]){
    for(int i=0;i<N/5;i++){ans+='3';}  N=N%5;
  }
  else if(number[2]){
    for(int i=0;i<N/5;i++){ans+='2';}  N=N%5;
  }
  else if(number[9]){
    for(int i=0;i<N/6;i++){ans+='9';}  N=N%6;
  }
  else if(number[6]){
    for(int i=0;i<N/6;i++){ans+='6';}  N=N%6;
  }
  else if(number[8]){
    for(int i=0;i<N/7;i++){ans+='8';}  N=N%7;
  }
  if(N==0){cout << ans << endl; return 0;}
  else{
    

int main(){
  cin >> N >> M;
  ans="";
  vector<int> A(M);
  for(int i=0;i<M;i++)cin >> A[i];
  for(int i=1;i<=9;i++){number[i]=false;}
  for(int i=0;i<M;i++){number[A[i]]=true;}

Compiler output:
a.cc: In function 'void dp(int)':
a.cc:36:40: error: return-statement with a value, in function returning 'void' [-fpermissive]
   36 |   if(N==0){cout << ans << endl; return 0;}
      |                                        ^
a.cc:40:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   40 | int main(){
      |         ^~
a.cc:40:9: note: remove parentheses to default-initialize a variable
   40 | int main(){
      |         ^~
      |         --
a.cc:40:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:40:11: error: a function-definition is not allowed here before '{' token
   40 | int main(){
      |           ^
a.cc:46:43: error: expected '}' at end of input
   46 |   for(int i=0;i<M;i++){number[A[i]]=true;}
      |                                           ^
a.cc:37:7: note: to match this '{'
   37 |   else{
      |       ^
a.cc:46:43: error: expected '}' at end of input
   46 |   for(int i=0;i<M;i++){number[A[i]]=true;}
      |                                           ^
a.cc:8:15: note: to match this '{'
    8 | void dp(int N){
      |               ^
Language: C++

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

constexpr char match[] = {'-', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
constexpr int match_n[] = {-1, 2, 5, 5, 4, 5, 6, 3, 7, 6};

bool is_subset_sum(const vector<int>& a, const int k){
    auto n {a.size()};
    bool dp[n+1][k+1];
    memset(dp, false, sizeof(dp));
    dp[0][0] = true;
    for(int i = 0; i < n; ++i){
        for(int j = 0; j <= k; ++j){
            dp[i+1][j] |= dp[i][j];
            if(j >= a[i]) dp[i+1][j] |= dp[i][j-a[i]];
        }
    }
    return dp[n][k];
}

int main(){
    int N, M;
    cin >> N >> M;

    vector<int> A(M), B(M);
    for(int i = 0; i < M; ++i){
        cin >> A[i];
        B[i] = A[i];
    }
    
    sort(begin(B), end(B), greater<int>());
    sort(begin(A), end(A), [](const auto& a, const auto& b){return match_n[a] < match_n[b];});

    int x = A[0];
    string ans(N/match_n[x], match[x]);
    N %= match_n[x];

    while(1){
        cout << ans << endl;
        if(is_subset_sum(A, N)){
            vector<string> ans_tmp;
            for(int b = 0; b < 1<<M; ++b){
                string s = "";
                int sum = 0;
                for(int i = 0; i < M; ++i){
                    if(b & (1<<i)){
                        s += match[B[i]];
                        sum += match_n[B[i]];
                    }
                }
                if(sum == N){
                    ans_tmp.emplace_back(s);
                }
            }
            ans += *max_element(begin(ans_tmp), end(ans_tmp));
            break;
        }else{
            ans.erase(end(ans)-1);
            N += match_n[x];
        }
    }

    sort(begin(ans), end(ans), greater<char>());
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'bool is_subset_sum(const std::vector<int>&, int)':
a.cc:13:5: error: 'memset' was not declared in this scope
   13 |     memset(dp, false, sizeof(dp));
      |     ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    3 | #include <vector>
  +++ |+#include <cstring>
    4 | #include <string>
Language: C++

#include<iostream>
#include<string>
#include<utility>
#include<map>
using namespace std;
typedef pair<int, int> P;

const int MAX_M = 11;
const int MAX_N = 1e4 + 4;

char A[MAX_M];
P dp[MAX_N][MAX_M];

int main() {
    int N, M;
    cin >> N >> M;
    map<char, int> MP;
    for (int i = 1; i <= M; i++) {
        cin >> A[i];
        if (A[i] == '1') MP[A[i]] = 2;
        else if (A[i] == '4') MP[A[i]] = 4;
        else if (A[i] == '7') MP[A[i]] = 3;
        else if (A[i] == '8') MP[A[i]] = 7;
        else if (A[i] == '6' || A[i] == '9') MP[A[i]] = 6;
        else MP[A[i]] = 5;
    }
    for (int i = 0; i <= N; i++) {
        for (int j = 0; j <= M; j++) dp[i][j] = P(-1, 0);
    }
    dp[0][0] = P(0, 0);
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= M; j++) {
            if (i - MP[A[j]] >= 0) {
                for (int k = 0; k <= M; k++) {
                    if (dp[i][j].first <= dp[i - MP[A[j]]][k].first + 1) {
                        dp[i][j].first = dp[i - MP[A[j]]][k].first + 1;
                        dp[i][j].second = k;
                    }
                }
            }
        }
    }
    string max_ans = "";
    for (int i = 1; i <= M; i++) {
        if (dp[N][i].first > 0) {
            string now_ans = "";
            int prev = i, rest = N;
            while (prev > 0) {
                now_ans.push_back(A[prev]);
                int tmp = prev;
                prev = dp[rest][prev].second;
                rest -= MP[A[tmp]];
            }
            reverse(now_ans.begin(), now_ans.end());
            if (max_ans.length() < now_ans.length()) max_ans = now_ans;
            else if (max_ans.length() == now_ans.length()) max_ans = max(max_ans, now_ans);
        }
    }
    cout << max_ans << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:13: error: 'reverse' was not declared in this scope
   54 |             reverse(now_ans.begin(), now_ans.end());
      |             ^~~~~~~
Language: C++

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

int N,M;
int M[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
int A[10];


int main() {
	cin >> N >> M;

	for (int i = 0; i < M; i++) {
    	cin >> A[i];
	}

	int ans;
	
	cout << ans << endl;
	return 0;
}

Compiler output:
a.cc:6:5: error: conflicting declaration 'int M [10]'
    6 | int M[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
      |     ^
a.cc:5:7: note: previous declaration as 'int M'
    5 | int N,M;
      |       ^
Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <utility>

using namespace std;

vector<int> dx = {0, 1, 0, -1};
vector<int> dy = {1, 0, -1, 0};

template<typename T> 
void show(T a){
  for(auto i : a){ cout << i << " "; }
  cout << endl;
}
template<typename T> 
void showmatrix(T a){
  for(auto j: a){for(auto i : j){ cout << i; }cout << endl;}
  cout << endl;
}

vector<int> stick = {0, 2,5,5,4,5,6,3,7,6};
vector<int> v;
string resnum;

bool small(string& a, string& b){
  if(a.size() == b.size()) {
    int i = 0;
    while(a[i] == b[i] && i <a.size()){i++;}
    return a[i] < b[i];
  }
  else return a.size() < b.size();
}

void dfs(string res, int num){
  if(num < 0) return;
  if(num == 0){
    //cout << "res:" << res << endl;
    if(small(resnum , res)) resnum = res;
    return ;
  }
  for(int i = 0; i < v.size(); i++){
    res.push_back(v[i]+'0');
    dfs(res, num-stick[v[i]]);
    res.pop_back();
  }
}

int main(int argc, char *argv[]){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n, m;
  cin >> n >> m;
  v = vector<int>(m, 0);
  for(auto& i : v){
    cin >> i;
  }
  sort(v.begin(), v.end());
  dfs("", n);
  cout << resnum << endl;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:60:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   60 |   sort(v.begin(), v.end());
      |   ^~~~
      |   short
Language: C++

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

int N,M;

char A[9];

map<int,int> mp;

mp[1]=2;
mp[2]=5;
mp[3]=5;
mp[4]=4;
mp[5]=5;
mp[6]=6;
mp[7]=3;
mp[8]=7;
mp[9]=6;

int main(){
	cin >> N >>M;
	for(int i=0;i<M;i++) cin >> A[i];
	string dp[10005*7];//dp[i] i個のマッチをを使ってできる最大の数
	for(int i=0;i<=N;i++){
		for(int j=0;j<M;j++){
			int a = sizeof(dp[i+mp[j]]);
			if(a<sizeof(dp[i])+1||(a==sizeof(dp[i])+1&&(dp[i+mp[j]][0]-'0'<j)) dp[i+j] = dp[i]+j;
		}
	}
	cout << dp[N];
	return 0;
}

Compiler output:
a.cc:10:1: error: 'mp' does not name a type
   10 | mp[1]=2;
      | ^~
a.cc:11:1: error: 'mp' does not name a type
   11 | mp[2]=5;
      | ^~
a.cc:12:1: error: 'mp' does not name a type
   12 | mp[3]=5;
      | ^~
a.cc:13:1: error: 'mp' does not name a type
   13 | mp[4]=4;
      | ^~
a.cc:14:1: error: 'mp' does not name a type
   14 | mp[5]=5;
      | ^~
a.cc:15:1: error: 'mp' does not name a type
   15 | mp[6]=6;
      | ^~
a.cc:16:1: error: 'mp' does not name a type
   16 | mp[7]=3;
      | ^~
a.cc:17:1: error: 'mp' does not name a type
   17 | mp[8]=7;
      | ^~
a.cc:18:1: error: 'mp' does not name a type
   18 | mp[9]=6;
      | ^~
a.cc: In function 'int main()':
a.cc:27:91: error: expected ';' before 'dp'
   27 |                         if(a<sizeof(dp[i])+1||(a==sizeof(dp[i])+1&&(dp[i+mp[j]][0]-'0'<j)) dp[i+j] = dp[i]+j;
      |                                                                                           ^~~
      |                                                                                           ;
a.cc:28:17: error: expected primary-expression before '}' token
   28 |                 }
      |                 ^
a.cc:27:110: error: expected ')' before '}' token
   27 |                         if(a<sizeof(dp[i])+1||(a==sizeof(dp[i])+1&&(dp[i+mp[j]][0]-'0'<j)) dp[i+j] = dp[i]+j;
      |                           ~                                                                                  ^
      |                                                                                                              )
   28 |                 }
      |                 ~                                                                                             
a.cc:28:17: error: expected primary-expression before '}' token
   28 |                 }
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  int a[m];
  int b[4];
  int co[10]={0,2,5,5,4,5,6,3,7,6};
  int num,mi=10;
  bool son[10];fill(son,son+10,false);
  for(int i=0;i<m;i++){
    cin>>a[i];
    son[a[i]]=true;
  }
  int k[4];
  k[0]=1;k[1]=5;k[2]=7;k[3]=8;
  if(son[1]==false){
    if(son[4]==false)k[0]=0;
    else k[0]=4;
  }
  if(son[5]==false){
    if(son[3]==false){
      if(son[2]==false)k[1]=0;
      else k[1]=2;
    }
    else k[1]=3;
  }
  if(son[7]==false){
    if(son[9]==false){
      if(son[6]==false)k[2]=0;
      else k[2]=6;
    }
    else k[2]=9;
  }
  if(son[8]==false)k[3]=0;
  int num;
  int mi=10;
  for(int i=0;i<4;i++){
    if(k[i]==0)continue;
    if(co[k[i]]<mi){
      num=i;
      mi=co[k[i]];
    }
  }
  for(int i=0;i<4;i++){
    if(i==num){
      b[i]=n/co[k[i]];
    }
    else{
      int u=co[k[num]];
      for(int j=1;;j++){
        if((co[k[i]]*j)%u==0){
          b[i]=j-1;
          break;
        }
      }
    }
  }
  swap(b[0],b[num]);
  swap(k[0],k[num]);
  int ans[4];
  for(int i=b[0];i>=0;i--){
    int now=co[k[0]]*i;
    int r=0;
    for(int j=0;j<=b[1];j++){
      for(int kk=0;kk<=b[2];kk++){
        for(int l=0;l<=b[3];l++){
          int sum=co[k[1]]*j+co[k[2]]*kk+co[k[3]]*l;
          if(now+sum==n){
            ans[0]=i;
            ans[1]=j;
            ans[2]=kk;
            ans[3]=l;
            r=1;
            break;
          }
        }
        if(r)break;
      }
      if(r)break;
    }
    if(r)break;
  }
  vector<int> v;
  for(int i=0;i<4;i++){
    for(int j=0;j<ans[i];j++)v.push_back(k[i]);
  }
  sort(v.begin(),v.end(),greater<int>());
  for(int i=0;i<v.size();i++){
    cout<<v[i];
  }
  cout<<endl;
}
      

Compiler output:
a.cc: In function 'int main()':
a.cc:35:7: error: redeclaration of 'int num'
   35 |   int num;
      |       ^~~
a.cc:8:7: note: 'int num' previously declared here
    8 |   int num,mi=10;
      |       ^~~
a.cc:36:7: error: redeclaration of 'int mi'
   36 |   int mi=10;
      |       ^~
a.cc:8:11: note: 'int mi' previously declared here
    8 |   int num,mi=10;
      |           ^~
Language: C

#include <iostream>
#include <map>
#include <string>
using namespace std;
typedef long long ll;
ll n, m, a[10];
string str[1010], test[10];
map<ll, ll> mp;
map<ll, string> np;
bool jud[1010], h[10];
int main(void)
{
	mp[1] = 2, mp[2] = 5, mp[3] = 5, mp[4] = 4;
	mp[5] = 5, mp[6] = 6, mp[7] = 3, mp[8] = 7;
	mp[9] = 6;
	np[1] = "1", np[2] = "2", np[3] = "3", np[4] = "4", np[5] = "5";
	np[6] = "6", np[7] = "7", np[8] = "8", np[9] = "9";
	jud[0] = true;
	cin >> n >> m;
	for (ll i = 0; i < m; i++) cin >> a[i];
	for (ll i = 2; i <= n; i++)
	{
		for (int j = 0; j < m; j++) h[j] = false;
		for (ll j = 0; j < m; j++)
		{
			if (i < mp[a[j]]) continue;
			if (!jud[i - mp[a[j]]]) continue;
			h[j] = true;
			test[j] = str[i - mp[a[j]]] + np[a[j]];
		}
		ll len = 0, num = -1;
		for (ll j = 0; j < m; j++)
		{
			if (!h[j]) continue;
			if (test[j].length() > len)
			{
				len = test[j].length();
				num = j;
			}
			else if (test[j].length() == len)
			{
				if (test[j] > test[num])
				{
					num = j;
				}
			}
		}
		if (num == -1) continue;
		str[i] = test[num];
		jud[i] = true;
	}
	for (ll i = 0; i < str[n].length(); i++) cout << str[n][i];
	cout << endl;
}

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