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

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

typedef long long ll;
#define repi(i, a, b) for(int i = int(a); i < int(b); ++i)
#define rep(i, n) repi(i, 0, n)
#define rerepi(i, a, b) for(int i = int(a)-1; i >= b; --i)
#define rerep(i, n) rerepi(i, n, 0)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template <class T>ostream &operator<<(ostream &o,const vector<T>&v) {o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

const long long INF = 1LL << 60;

// ここから開始だよ！
ll N, M;
vector<ll> v;
ll dict[] = {2, 5, 5, 4, 5, 6, 3, 7, 6};

int main() {
	// 呪文エリア
	cin.tie(0);
	ios::sync_with_stdio(false);
	// 詠唱完了
  
  cin >> N >> M;
  rep(i, M) {
    ll a;
    cin >> a;
    v.push_back(a);
  }
  std::sort(v.begin(),v.end(),std::greater<ll>());
  
  std::vector<ll> DP(N+10, 0);
  repi(n, 1, N+1) {
    rep(i, M) {
      ll tmp = dict[v[i]-1];
      //cout << v[i] << "  " << dict[v[i]-1] << endl;
      if(n-tmp >= 0) {
        chmax(DP[n], DP[n-tmp] + 1);
      }
    }
  }
  
  vector<ll> DP2;
  rerepi(i, DP[N]+1, 1) {
    //cout << i << endl;
    rep(j, M) {
      ll tmp = dict[v[j]-1];
      if (DP[i - tmp] == DP[i] - 1) {
        DP2.push_back(v[j]);
        break;
      }
    }
  }
  
  rep(i, DP2.size()) {
    cout << DP2[i];
  }
  cout << endl;
  
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:8: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   35 |   std::sort(v.begin(),v.end(),std::greater<ll>());
      |        ^~~~
      |        qsort
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); }

vi mts {0,2,5,5,4,5,6,3,7,6};

void solve(int N, int M, vi& A){
  vi u(8,-1);
  for (int i=0;i<M;++i){
    int m=mts[A[i]];
    u[m]=amax(u[m],A[i]);
  }

  vvi dp(N+10, vi(10,-1));
  dp[0]=vi(10,0);
  for (int i=0;i<N;++i){
    for (int m=2;m<=7;++m){
      int p=10-u[m];
      if(p==-1){continue;}
      dp[i][p]++;
      dp[i][0]++;
      dp[i+m]=max(dp[i+m], dp[i]);
      dp[i][p]--;
      dp[i][0]--;
    }
  }

  for (int n=9;n>=1;--n){
    for (int j=0;j<dp[N][10-n];++j){
      putchar('0'+n);
    }
  }
  putchar('\n');
}

int main(){
  int N,M;cin>>N>>M;
  vi A;
  for (int i=0;i<M;++i){
    cin>> A[i];
  }
  solve(N, M, A);
  return 0;
}

Compiler output:
a.cc: In function 'void solve(int, int, vi&)':
a.cc:13:14: error: void value not ignored as it ought to be
   13 |     u[m]=amax(u[m],A[i]);
      |          ~~~~^~~~~~~~~~~
Language: C++

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

typedef vector<int> vi;
typedef vector<vi> vvi;

vi mts {0,2,5,5,4,5,6,3,7,6};

void solve(int N, int M, vi& A){
  //まず、本数mが提示された時に、どれを使うか？
  vi use_list(8, -1);
  for (int m=2;m<7;++m){
    for (int i=0;i<10;i++){
      if (mts[i]==m){
        use_list[m]=max(use_list[m], i);
      }
    }
  }

  //次に、実際に使うものをカウントする。
  //d[i][p]は、p=0は桁数を表し、それ以外の時は、10-pが何個使われているかを表す。
  vvi dp(N+10, vi(10, -1));

  dp[0][0]=0;
  for (int i=0;i<N+1;++i){
    for (int m=2;m<=7;++n){
      if (use_list[m]==-1){continue;}
      int p=10-use_list[m];
      dp[i][p]++;
      dp[i][0]++;
      dp[i+m]=max(dp[i+m], dp[i]);
      dp[i][p]--;
      dp[i][0]--;
    }
  }

  for (int p=1;p<=9;++p){
    for (int j=0;j<dp[N][j];++j){
      int n=10-p;
      putchar('0'+n);
    } 
    putchar('¥n');
  }
}

int main(){
  int N, M;cin>>N>>M;
  vi A(M);
  for (int i=0;i<M;++i){
    cin>>A[i];
  }
  solve(N, M, A);
  return 0;
}

Compiler output:
a.cc:42:13: warning: multi-character character constant [-Wmultichar]
   42 |     putchar('¥n');
      |             ^~~~
a.cc: In function 'void solve(int, int, vi&)':
a.cc:26:25: error: 'n' was not declared in this scope
   26 |     for (int m=2;m<=7;++n){
      |                         ^
Language: C++

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

typedef vector<int> vi;
typedef vector<vi> vvi;

vi mts {0,2,5,5,4,5,6,3,7,6};

void solve(int N, int M, vi& A){
  //まず、本数mが提示された時に、どれを使うか？
  vi use_list(8, -1);
  for (int m=2;m<7;++m){
    for (int i=0;i<10;i++){
      if (mts[i]==m){
        use_list[m]=max(use_list[m], i);
      }
    }
  }

  //次に、実際に使うものをカウントする。
  //d[i][p]は、p=0は桁数を表し、それ以外の時は、10-pが何個使われているかを表す。
  vvi dp(N+10, vi(10, -1));

  dp[0][0]=0;
  for (int i=0;i<N+1;++i){
    for (int m=2;m<=7;++n){
      if (use_list[m]==-1){continue;}
      int p=10-use_list[m];
      dp[i][p]++;
      dp[i][0]++;
      dp[i+m]=max(dp[i+m], dp[i]);
      dp[i][p]--;
      dp[i][0]--;
    }
  }

  for (int p=1;p<=9;++p){
    for (int j=0;j<dp[N][j];++j){
      int n=10-p;
      putchar('0'+n);
    } 
    purchar('¥n');
  }
}

int main(){
  int N, M;cin>>N>>M;
  vi A(M);
  for (int i=0;i<M;++i){
    cin>>A[i];
  }
  solve(N, M, A);
  return 0;
}

Compiler output:
a.cc:42:13: warning: multi-character character constant [-Wmultichar]
   42 |     purchar('¥n');
      |             ^~~~
a.cc: In function 'void solve(int, int, vi&)':
a.cc:26:25: error: 'n' was not declared in this scope
   26 |     for (int m=2;m<=7;++n){
      |                         ^
a.cc:42:5: error: 'purchar' was not declared in this scope; did you mean 'putchar'?
   42 |     purchar('¥n');
      |     ^~~~~~~
      |     putchar
Language: C++

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

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;

#define rep(var,n)  for(int var=0;var<(n);++var)

template<class T> inline void amin(T & a, T const & b) { a = min(a, b); }
template<class T> inline void amax(T & a, T const & b) { a = max(a, b); } 
 
vi mts { 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
 
 
void solve(int N, int M, vi& a) {
    vi u(8, -1);
    rep(i,M){
        int m = mts[ a[i] ];
        amax(u[m], a[i]);
    }
 
    vvi dp(N+10, vi(10, -1));
    dp[0] = vi(10, 0);
 
    rep(i,N){
        if (dp[i][0] == -1) continue;
        for (int m=2; m<=7; ++m) {
            if (u[m] == -1) continue;
            int p = 1 + (9 - u[m]);
            dp[i][0]++;
            dp[i][p]++;
            dp[i+m] = max(dp[i+m], dp[i]);
            dp[i][0]--;
            dp[i][p]--;
        }
    }
    for (int n=9; n>=1; --n) {
        rep(j, dp[N][1+9-n]) putchar('0'+n);
    }
    putchar('\n');
}
 
int main() {
    int N, M; cin >> N >> M;
    vi a(M);
    rep(i,M) cin >> a[i];
    solve(N,M,a);
    return 0;
}

Compiler output:
a.cc:7:16: error: 'ii' was not declared in this scope; did you mean 'vi'?
    7 | typedef vector<ii> vii;
      |                ^~
      |                vi
a.cc:7:18: error: template argument 1 is invalid
    7 | typedef vector<ii> vii;
      |                  ^
a.cc:7:18: error: template argument 2 is invalid
a.cc:8:23: error: 'ii' was not declared in this scope; did you mean 'vii'?
    8 | typedef vector<vector<ii>> vvii;
      |                       ^~
      |                       vii
a.cc:8:23: error: template argument 1 is invalid
a.cc:8:23: error: template argument 2 is invalid
a.cc:8:25: error: template argument 1 is invalid
    8 | typedef vector<vector<ii>> vvii;
      |                         ^~
a.cc:8:25: error: template argument 2 is invalid
Language: C++

#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#include "functional"
#include "cmath"
#include "set"

#define NDEF -200
#define NA -100
#define N_MAX 10000

std::vector<unsigned int> required_match{2, 5, 5, 4, 5, 6, 3, 7, 6};

std::vector<int> max_digit(N_MAX + 1, NDEF);


// setting max_digit[0]
void init_max_digit() {
    max_digit[0] = 0L;
    return;
}

// get max_digit by DP
int get_max_digit(int num_match, std::set<unsigned int> required_match_part) {
    if(max_digit[num_match] != NDEF) {
        return max_digit[num_match];
    } else {
        int maybe_max = NA;
        for (unsigned int required_num:required_match_part) {
            int remain_match = num_match - required_num;
            int remain_digit = (remain_match >= 0) ?
                    get_max_digit(remain_match, required_match_part) : NA;
            if (remain_digit >= 0) {
                maybe_max = std::max(maybe_max, remain_digit + 1);
            }
        }
        max_digit[num_match] = maybe_max;
        return maybe_max;
    }
}

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

    // get values from input
    int n, m;
    std::vector<int> a;

    std::cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int a_i;
        std::cin >> a_i;
        a.push_back(a_i);
    }

    // main procedure
    std::vector<int> digits_allowed = a; // sorted as desc
    std::sort(digits_allowed.begin(), digits_allowed.end(), std::greater<int>());

    std::set<unsigned int> required_match_part;
    for (int digit:digits_allowed) {
        required_match_part.insert(required_match[digit - 1]);
    }

    std::string ans;
    int remain_digit_num = get_max_digit(n, required_match_part);
    int remain_match_num = n;

    while (remain_match_num > 0) {
        int is_find = false;
        for (int digit:digits_allowed) {
            int match_num_tmp = remain_match_num - required_match[digit - 1];
            if (match_num_tmp < 0) {
                continue;
            }

            int digit_num_tmp = get_max_digit(match_num_tmp,
                    required_match_part);
            if (digit_num_tmp == remain_digit_num - 1){
                ans += std::to_string(digit);
                remain_match_num = match_num_tmp;
                remain_digit_num--;
                is_find = true;
                break;
            }
        }
        if (!is_find) {
            break;
        }
    }

    // output
    std::cout << ans << std::endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   46 |     cin.tie(0);
      |     ^~~
      |     std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:47:5: error: 'sync_with_stdio' was not declared in this scope
   47 |     sync_with_stdio(false);
      |     ^~~~~~~~~~~~~~~
Language: C++

#include <iostream>
#include <vector>

using namespace std;

const int num[10] = {10001, 2, 5, 5, 4, 5, 6, 3, 7, 6};

int dp_rec(vector<int>& dp, bool* a, int n) {
    if (n<0) return -1000000000;
    if(dp[n]>=0) return dp[n];
    int ans = 0;
    for(int i=1;i<10;++i) {
        if (!a[i]) continue;
        ans = max(ans, dp_rec(dp, a, n-num[i])+1);
    }
    return ans;
}

void dp_fill(vector<int>& dp, bool* a, int n) {
    dp[0] = 0;
    for(int i=1;i<=n;++i) {
        dp[i] = dp_rec(dp, a, i);
    }
}

int main(int argc, char const *argv[])
{
    int n, m; cin >> n >> m;

    bool a[10] = {0};
    for(int i=0,_;i<m;++i) {
        cin >> _;
        a[_] = true;
    }

    vector<int> dp(n+1,-1);
    dp_fill(dp, a, n);

    int d = dp[n];

    //for(int i=0;i<d;++i) {
    while(n>0) {
        for(int j=9;j>0;--j) {
            if(!a[j]) continue;
            if(i==d-1 && n-num[j] != 0) continue;
            if(i<d-1 && dp[n-num[j]] != dp[n]-1) continue;
            //if(n-num[j] < 0 || dp[n-num[j]] != dp[n] -1) continue;
            cout << j;
            n-=num[j];
            break;
        }
    }
    cout << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:45:16: error: 'i' was not declared in this scope
   45 |             if(i==d-1 && n-num[j] != 0) continue;
      |                ^
a.cc:46:16: error: 'i' was not declared in this scope
   46 |             if(i<d-1 && dp[n-num[j]] != dp[n]-1) continue;
      |                ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using std::vector;

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

int nums(int n, const vector<int>& ms) {
  vector<int> nn(n + 1, -1);

  for (const int m : ms) {
    nn[m] = 1;
  }
  
  for (int i = 1; i <= n; ++i) {
    int max = nn[i];
    for (const int m : ms) {
      if (i - m > 0 && nn[i - m] != -1 && max < nn[i - m] + 1) {
	max = nn[i - m] + 1;
      }
    }
    nn[i] = max;
  }
  
  return nn[n];
}

vector<int> decls;

int decl(const vector<int>& as, vector<int>* mm) {
  int match_diff = 0;
  auto i = mm->begin();
  while (*i == as[0]) {
    ++i;
  }
  match_diff += match[decls[*i]] - match[*i];
  *i = decls[*i];
  auto j = mm->begin();
  while (j != i) {
    match_diff += match[*i] - match[*j];
    *j = *i;
    ++j;
  }
  return md;
}

int main(int argc, char* argv[]) {
  using std::cin;
  using std::cout;
  using std::endl;
  using std::find_if;
  
  int n, m;
  cin >> n >> m;
  vector<int> tmp(m);
  for (int i = 0; i < m; ++i) {
    cin >> tmp[i];
  }
  sort(tmp.begin(), tmp.end());

  vector<int> as;
  for (auto i = tmp.begin(); i < tmp.end(); ++i) {
    if (find_if(i + 1, tmp.end(),
		[i](int j){ return match[*i] == match[j]; }) == tmp.end()) {
      as.push_back(*i);
    }
  }
  
  decls = vector<int>(10, -1);
  for (auto i = as.begin() + 1; i < as.end(); ++i) {
    decls[*i] = *(i - 1);
  }

  vector<int> ms;
  for (auto a : as) {
    ms.push_back(match[a]);
  }
  const int nn = nums(n, ms);
  
  vector<int> mm(nn, as.back());

  int match_count = nn * match[as.back()];
  while (match_count != n) {
    match_count += decl(as, &mm);
  }
  for (auto i = mm.end(); i > mm.begin(); --i) {
    cout << *(i - 1);
  }

  return 0;
}


Compiler output:
a.cc: In function 'int decl(const std::vector<int>&, std::vector<int>*)':
a.cc:45:10: error: 'md' was not declared in this scope; did you mean 'mm'?
   45 |   return md;
      |          ^~
      |          mm
Language: C++

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

int match[10] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
int N, M;
string dp[10100], INF = "-";

string max_str(string s, string t) {
    if (s == INF) return t;
    if (s.size() == t.size()) return (s > t ? s : t);
    else return (s.size#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int match[10] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
int N, M;
string dp[10100], INF = "-";

string max_str(string s, string t) {
    if (s == INF) return t;
    if (s.size() == t.size()) return (s > t ? s : t);
    else return (s.size() > t.size() ? s : t);
}

int main() {
    cin >> N >> M;
    vector<int> A(M);
    for (int i = 0; i < M; i++) cin >> A[i];
    for (int i = 0; i < 10100; i++) dp[i] = INF;
    dp[0] = "";
    for (int i = 0; i <= N; i++) {
        if (dp[i] == "-") continue;
        for (int j = 0; j < M; j++) {
            dp[i + match[A[j] - 1]] = max_str(dp[i + match[A[j] - 1]], dp[i] + to_string(A[j]));
        }
    }
    cout << dp[N] << endl;
}() > t.size() ? s : t);
}

int main() {
    cin >> N >> M;
    vector<int> A(M);
    for (int i = 0; i < M; i++) cin >> A[i];
    for (int i = 0; i < 10100; i++) dp[i] = INF;
  	dp[0] = "";
    for (int i = 0; i <= N; i++) {
        if (dp[i] == "-") continue;
        for (int j = 0; j < M; j++) {
            dp[i + match[A[j] - 1]] = max_str(dp[i + match[A[j] - 1]], dp[i] + to_string(A[j]));
        }
    }
    cout << dp[N] << endl;
}

Compiler output:
a.cc:13:24: error: stray '#' in program
   13 |     else return (s.size#include <iostream>
      |                        ^
a.cc: In function 'std::string max_str(std::string, std::string)':
a.cc:13:24: error: expected ')' before 'include'
   13 |     else return (s.size#include <iostream>
      |                 ~      ^~~~~~~~
      |                        )
a.cc:15:17: error: cannot convert 'std::__cxx11::basic_string<char>::size' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
   15 | using namespace std;
      |                 ^~~
a.cc:22:36: error: a function-definition is not allowed here before '{' token
   22 | string max_str(string s, string t) {
      |                                    ^
a.cc:28:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   28 | int main() {
      |         ^~
a.cc:28:9: note: remove parentheses to default-initialize a variable
   28 | int main() {
      |         ^~
      |         --
a.cc:28:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:28:12: error: a function-definition is not allowed here before '{' token
   28 | int main() {
      |            ^
a.cc:41:3: error: expected primary-expression before ')' token
   41 | }() > t.size() ? s : t);
      |   ^
Language: C++

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

int match[10] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
int N, M;
string dp[10100], INF = "-";
dp[0] = "";

string max_str(string s, string t) {
    if (s == INF) return t;
    if (s.size() == t.size()) return (s > t ? s : t);
    else return (s.size() > t.size() ? s : t);
}

int main() {
    cin >> N >> M;
    vector<int> A(M);
    for (int i = 0; i < M; i++) cin >> A[i];
    for (int i = 0; i < 10100; i++) dp[i] = INF;
    for (int i = 0; i <= N; i++) {
        if (dp[i] == "-") continue;
        for (int j = 0; j < M; j++) {
            dp[i + match[A[j] - 1]] = max_str(dp[i + match[A[j] - 1]], dp[i] + to_string(A[j]));
        }
    }
    cout << dp[N] << endl;
}

Compiler output:
a.cc:9:1: error: 'dp' does not name a type
    9 | dp[0] = "";
      | ^~
Language: C++

#include<iostream>
#include<algorithm>
#include<sstream>
using namespace std;
int main() {
  int m[] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  int N, M, A[9];
  cin >> N >> M;
  for (int i = 0;i < M;++ i) cin >> A[i];
  pair<int, int> d[9], d2[9];
  for (int i = 0;i < M;++ i) {
    d[i] = make_pair(m[A[i]], -A[i]);
    d2[i] = make_pair(A[i], m[A[i]]);
  }
  sort(d, d+M);
  sort(d2, d2+M);
  int i = N[0] / d[0].first, r = N % d[0].first;
  for (int j = M - 1;d2[j].first > -d[0].second;-- j) {
    if (d2[j].second > d[0].first) {
      for(int k;r >= (k = d2[j].second - d[0].first);-- i, r -= k)cout << d2[j].first;
    }
  }
  stringstream s;
  for (int j = M - 1, k;k = d[j].first - d[0].first; -- j) {
    if(d[j].first == d[j-1].first) continue;
    for (;r >= (k = d[j].first - d[0].first);-- i, r -= k) s << -d[j].second;
  }
  while(i--) cout << -d[0].second;
  string t = s.str();
  reverse(t.begin(), t.end());
  cout << t;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:12: error: invalid types 'int[int]' for array subscript
   17 |   int i = N[0] / d[0].first, r = N % d[0].first;
      |            ^
a.cc:20:17: error: 'r' was not declared in this scope
   20 |       for(int k;r >= (k = d2[j].second - d[0].first);-- i, r -= k)cout << d2[j].first;
      |                 ^
a.cc:26:11: error: 'r' was not declared in this scope
   26 |     for (;r >= (k = d[j].first - d[0].first);-- i, r -= k) s << -d[j].second;
      |           ^
Language: C++

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
const int INF = INT_MAX / 2;

int f(string a){
    vector<string> strA={"1","2","3","4","5","6","7","8","9"};
    vector<int> numA={2,5,5,4,5,6,3,7,6};
    for(int i=0;i<9;i++){
        if( a==strA[i]) return numA[i];
    }
    return 0;
}

int main(){
    // dp[i] max num from i matches, loger is bigger, chk as a string
    int n,m;
    cin >> n >> m;
    vector<int> inA(m);
    for(int i=0;i<m;i++){
        int k;
        cin >>k;
        inA[i] = k;
    }
    vector<string> A(m);
    sort(inA.begin(), inA.end());
    for(int i=0;i<m;i++){
        string s;
        s = to_string(inA[i]);
        A[i] = s;
    }
    // 状態n 遷移d(m,n) 10^9 ぎりぎりOK 
    //f(x) xを作るために使うマッチの数
    // vector<string> dp(n);
    // for (int i=0;i<n;i++){
    //     dp[i] = max_str(dp[i-fabs(Aj)]+Aj | j=1~M)
    // }
    vector<int> dp(n+1,-INF);
    dp[0] = 0;
    for(int i=0;i<n+1;i++){
        for(int j=0;j<m;j++){
        if (i - f(A[j])<0) continue;
        int ne = dp[i - f(A[j])] + 1;
        dp[i] = max(dp[i],ne);
        }
        // if(i<10){
        //     cout << "dp["<<i<<"]:" << dp[i] << endl;
        // }
            
    }
    string ans= "";
    int remain = dp[n];
    int match = n;
    // for(int i=9;i>=0;i--){
    //     cout << "i:"<<i<<",f(i):"<<f(to_string(i))<<endl;
    // }
    // cout << "remain:" << remain << "match:" << match << endl;
    while(match > 0){
        for(int i=m-1;i>=0;i--){
            // cout << "i:"<<i<<",";
            if(dp[match-f(A[i])] == remain-1 & match-f(A[i])>=0){
                ans += A[i];
                match -= f(A[i]);
                remain--;
                // cout <<"i=" << i << ",remain="<<remain<< ",match="<<match<<",";
                // cout <<"ans:" << ans << endl;
                i = m;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Compiler output:
a.cc:6:17: error: 'INT_MAX' was not declared in this scope
    6 | const int INF = INT_MAX / 2;
      |                 ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <vector>
  +++ |+#include <climits>
    4 | #include <string>
Language: C++

#include<bits/stdc++.h>
using namespace std;
int N,M,i,A[9],num[0]={2,5,5,4,5,6,3,7,6};
string dp[10101];
void chmax(string &s,string t){
  if(s=="_"||s.size()<t.size()||(s.size()==t.size()&&s<t))s=t;
}
int main(void){
  cin>>N>>M;
  for(i=0;i<M;i++)cin>>A[i];
  fill(dp,dp+10101,"_");
  dp[0]="";
  for(i=0;i<=N;i++){
    if(dp[i]=="_")continue;
    for(auto a:A){
      chmax(dp[i+num[a-1]],dp[i]+to_string(a));
    }
  }
  cout<<dp[N]<<endl;
  return EXIT_SUCCESS;
}


Compiler output:
a.cc:3:41: error: too many initializers for 'int [0]'
    3 | int N,M,i,A[9],num[0]={2,5,5,4,5,6,3,7,6};
      |                                         ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
const int INF = 1000000;
void swap(int& a, int& b) {
  int t = a;
  a = b;
  b = t;
}
int main () {
  int N, M;
  int use[10];
  for (int i = 0; i < M; i ++) cin >> use[i];
  for (int i = 0; i < M; i ++) {
    for (int i = 1; i < M; i ++) {
      if (use[i] < use[i - 1]) swap(use[i], use[i - 1]);
    }
  }
  int num[] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
  int dp[100000];
  for (int i = 0; i < 7; i ++) dp[i] = -INF;
  dp[7] = 0;
  for (int i = 8; i < N + 8; i ++) {
    dp[i] = dp[i - num[use[0]]];
    for (int j = 1; j < M; j ++) {
      if (dp[i] > dp[i - num[use[j]]] + 1)dp[i] = dp[i - num[use[j]]] + 1;
    }
  }
  int k = N + 7
  int a = dp[k];
  vector<int>ans(a);
  for (int i = 0; i < a; i ++) {
    for (int j = M - 1; j >= 0; j --) {
      if (dp[k] = dp[k - num[use[j]]] + 1) {
        ans[i] = use[j];
        k -= num[use[j]];
        break;
      }
    }
  }
  for (int i = 0; i < a; i ++) cout << ans[i];
  cout << endl;
}
    
  

Compiler output:
a.cc: In function 'int main()':
a.cc:30:3: error: expected ',' or ';' before 'int'
   30 |   int a = dp[k];
      |   ^~~
a.cc:31:18: error: 'a' was not declared in this scope
   31 |   vector<int>ans(a);
      |                  ^
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

//            0  1  2  3  4  5  6  7  8  9
ll match[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
ll dp[11000];
ll N , M ;
vector<ll> matchNum;
map<ll,ll> A;

bool func1(ll a, ll b){
    return A[a] > A[b];
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    rep(i, 11000) dp[i] = -100;
    rep(i, 10) A[i] = 0;

    cin >> N >> M ;

    rep(i, M){
        ll inp; cin >> inp;
        matchNum.pb(match[inp]);
        A[match[inp]] = max(A[match[inp]], inp);
    }

    rmsame(matchNum);
    dp[0] = 0;
    rep(i, N + 1){
        if(dp[i] == -100) continue;
        rep(j, matchNum.size()){
            ll num = matchNum[j];
            if ((i + num) <= N)dp[i + num] = max(dp[i] + 1, dp[i + num]);
        }
    }

    sort(all(match), func1);

    vector<ll> ans;
    while(N != 0){
        rep(i, matchNum.size()){
            ll num = matchNum[i];
            if(N-num < 0) continue;
            if(dp[N - num] == dp[N]-1){
                ans.pb(A[num]);
                N -= num;
                break;
            }
        }
    }

    sort(rall(ans));
    rep(i, ans.size()) cout << ans[i];
    cout << endl;

    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:18: error: request for member 'begin' in 'match', which is of non-class type 'long long int [10]'
   19 | #define all(a) a.begin(),a.end()
      |                  ^~~~~
a.cc:64:10: note: in expansion of macro 'all'
   64 |     sort(all(match), func1);
      |          ^~~
a.cc:19:28: error: request for member 'end' in 'match', which is of non-class type 'long long int [10]'
   19 | #define all(a) a.begin(),a.end()
      |                            ^~~
a.cc:64:10: note: in expansion of macro 'all'
   64 |     sort(all(match), func1);
      |          ^~~
Language: C++

#include <iostream>
#include <vector>
#include <tuple>
#include <map>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>

namespace mp = boost::multiprecision;
using namespace std;
// 使えるマッチ棒の数字 -> 作るのに必要な本数
map<int, int> costs;

// n: 残り本数 -> ret: (最大の本数, 使った数字履歴)
map<int, int> calc_order_memo{ {0, 1} }; // n->桁数: 0本で使い切ったときは終了条件なので1本としておく
map<int, mp::cpp_int> calc_num_memo{ {0, 0} }; // n->使った数字をメモしておきたい

tuple<int, mp::cpp_int> calc_order(int n) {
    if(calc_order_memo.count(n)) {
        return { calc_order_memo[n], calc_num_memo[n] };
    } else {
        // 本数を使い切らずに一番コストの低い数字を選択する
        int max_result = -1; // 帰ってきた桁数で最大の藻を
        int select_n = -1; // max_result時にこのCall上で選んだ数字
        mp::cpp_int max_num = -1; // 帰ってきた関数の具体的な数値

        for(const auto& c: costs) {
            // cout << "[DEBUG] n=" << n << ", c=(" << c.first << ", " << c.second << ")" << endl;
            // つくれないので失敗
            if (c.second > n) {
                continue; 
            }
            // 作れるので再帰する
            auto [result, num] = calc_order(dst_n);

            if(result > max_result) {
                max_result = result;
                select_n = c.first;
                max_num = num;
            }
        }
        if (max_result == -1) {
            return { -1, 0 }; // つくれない
        } else {
            calc_order_memo[n] = max_result + 1; // 桁数
            calc_num_memo[n] = (max_num * 10) + selecT_n; // 使った数字+これまでの桁を足しておく
            cout << "[DEBUG] ret {" << calc_order_memo[n] << ", " << calc_num_memo[n] << "}" << endl;

            return { calc_order_memo[n], calc_num_memo[n] }; // 桁数を一個足して返す
        }
    }
}

int main(void) {
    map<int, int> costs_src;
    costs_src[1] = 2;
    costs_src[2] = 5;
    costs_src[3] = 5;
    costs_src[4] = 4;
    costs_src[5] = 5;
    costs_src[6] = 6;
    costs_src[7] = 3;
    costs_src[8] = 7;
    costs_src[9] = 6;

    int n, m;
    cin >> n; // マッチ本数
    cin >> m; // 使える数字の種類
    for (int i = 0; i < m; ++i) {
        int an;
        cin >> an;
        costs[an] = costs_src[an];
    }
    for (const auto &c : costs) {
        cout << c.first << ", " << c.second << endl;
    }
    // 作れる最大の桁数を求める
    auto [order, num] = calc_order(n);
    cout << "order: " << order << ", num:" << num << endl;

    return 0;
}

Compiler output:
a.cc:6:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    6 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
using namespace std;
struct Node
{
    int num[10]= {0};
    Node& operator=(Node& t)
    {
        for(int i=0; i<9; i++)
            num[i]=t.num[i];
        return *this;
    }
};
bool operator <(const Node &a,const Node &b)//true
{
    if(a.num[0]!=b.num[0])
        return a.num[0]<b.num[0];
    else
        for(int i=9; i>0; i--)
            if(a.num[i]!=b.num[i])
                return a.num[i]<b.num[i];
    return 0;
}
bool operator ==(const Node &a,const Node &b)
{
    for(int i=0; i<9; i++)
        if(a.num[i]!=b.num[i])
            return 0;
    return 1;
}
bool operator !=(const Node &a,const Node &b)
{
    for(int i=0; i<9; i++)
        if(a.num[i]!=b.num[i])
            return 1;
    return 0;
}
bool cmp(char a,char b)
{
    return a>b;
}
int cmp2(string a,string b)
{
    if(a.size()==b.size())
        return a>b;
    else
        return a.size()>b.size();

}
string max1(string s1,string s2)
{
    if(cmp2(s1,s2)>0)
        return s1;
    else
        return s2;
}
void prf(Node a)
{
    for(int i=9; i>0; i--)
    {
        while(a.num[i]>0)
        {
            a.num[i]--;
            printf("%d",i);
        }
    }
    printf("\n");
}
Node dp[10011];
int main()
{
    int n,m;
    int a2[]= {0,2,5,5,4,5,6,3,7,6};
    int ai[10]= {0};
    cin >> n >> m;
    for(int i=0; i<m; i++)
        cin >> ai[i];
    sort(ai,ai+m);
    for(int i=0; i<m; i++)
    {
        dp[a2[ai[i]]]=dp[0];
        dp[a2[ai[i]]].num[0]++;
        dp[a2[ai[i]]].num[ai[i]]++;
        //prf(dp[a2[ai[i]]]);
    }
    for(int i=1; i<=n; i++)
    {
        if(a[i]!=a[0])
            continue;
        else
        for(int j=0; j<m; j++)
        {
            Node s;
            s=dp[i];
            s.num[0]++;
            s.num[ai[j]]++;
            if(dp[i+a2[ai[j]]]<s)
                dp[i+a2[ai[j]]]=s;
        }
        //prf(dp[i]);
    }
    for(int i=9; i>0; i--)
    {
        while(dp[n].num[i]>0)
        {
            dp[n].num[i]--;
            printf("%d",i);
        }
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:90:12: error: 'a' was not declared in this scope
   90 |         if(a[i]!=a[0])
      |            ^
Language: C

#include <stdio.h>
#include <stdlib.h>
int max(int a, int b) {
  return a > b ? a : b;
}
typedef struct {
  int key;
  int value;
}match_t;
int cmp(const void*a, const void *b) {
  return ((match_t*)(a)) -> value - ((match_t*)(b)) -> value;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int *ans = (int*)malloc(((n>>1) + 1)*sizeof(int));
  int *dp = (int*)calloc((n+1)*sizeof(int));
  int *form = (int*)malloc((n+1)*sizeof(int));
  match_t match[10];
  match[0].value = -1;
  int match_stick[10] = {0,2,5,5,4,5,6,3,7,6};
  int reverse[10] = {0,0,1,7,4,2,6,8,0,0};
  int i;
  for (i = 1; i <= m; i++) {
    scanf("%d", &match[i].key);
    match[i].value = match_stick[match[i].key];
  }
  qsort(&match[1], m, sizeof(match_t), cmp);
  for (i = 1; i <=m ;i++) {
    if (match[i].key == 3 && reverse[5] < 5) {
      reverse[5] = 3;
    }
    if (match[i].key == 5) {
      reverse[5] = 5;
    }
    if (match[i].key == 9) {
      reverse[6] = 9;
    }
  }
  for (i = 1; i <= m; i++) {
    int value = match[i].value;
    if (value == match[i - 1].value) {
      continue;
    }
    int j;
    for (j = value; j <= n; j++) {
      int t = dp[j-value] + 1;
      if (dp[j] < t) {
        form[j] = value;
        dp[j] = t;
      }
    }
  }
  int x = n;
  int size = 0;
  while (x) {
    ans[size++] = reverse[form[x]];
    x -= form[x];
  }
  for (i = size-1; i >=0; i--) {
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:17:19: error: too few arguments to function 'calloc'
   17 |   int *dp = (int*)calloc((n+1)*sizeof(int));
      |                   ^~~~~~
In file included from main.c:2:
/usr/include/stdlib.h:675:14: note: declared here
  675 | extern void *calloc (size_t __nmemb, size_t __size)
      |              ^~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
int max(int a, int b) {
  return a > b ? a : b;
}
typedef struct {
  int key;
  int value;
}match_t;
int cmp(const void*a, const void *b) {
  return ((match_t*)(a)) -> value - ((match_t*)(b)) -> value;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int *ans = (char*)malloc(((n>>1) + 1)*sizeof(int));
  int *dp = (int*)calloc((n+1)*sizeof(int));
  int *form = (int*)malloc((n+1)*sizeof(int));
  match_t match[10];
  match[0].value = -1;
  int match_stick[10] = {0,2,5,5,4,5,6,3,7,6};
  int reverse[10] = {0,0,1,7,4,2,6,8,0,0};
  int i;
  for (i = 1; i <= m; i++) {
    scanf("%d", &match[i].key);
    match[i].value = match_stick[match[i].key];
  }
  qsort(&match[1], m, sizeof(match_t), cmp);
  for (i = 1; i <=m ;i++) {
    if (match[i].key == 3 && reverse[5] < 5) {
      reverse[5] = 3;
    }
    if (match[i].key == 5) {
      reverse[5] = 5;
    }
    if (match[i].key == 9) {
      reverse[6] = 9;
    }
  }
  for (i = 1; i <= m; i++) {
    int value = match[i].value;
    if (value == match[i - 1].value) {
      continue;
    }
    int j;
    for (j = value; j <= n; j++) {
      int t = dp[j-value] + 1;
      if (dp[j] < t) {
        form[j] = value;
        dp[j] = t;
      }
    }
  }
  int x = n;
  int size = 0;
  while (x) {
    ans[size++] = reverse[form[x]];
    x -= form[x];
  }
  for (i = size-1; i >=0; i--) {
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:16:14: error: initialization of 'int *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
   16 |   int *ans = (char*)malloc(((n>>1) + 1)*sizeof(int));
      |              ^
main.c:17:19: error: too few arguments to function 'calloc'
   17 |   int *dp = (int*)calloc((n+1)*sizeof(int));
      |                   ^~~~~~
In file included from main.c:2:
/usr/include/stdlib.h:675:14: note: declared here
  675 | extern void *calloc (size_t __nmemb, size_t __size)
      |              ^~~~~~
Language: C

#include <stdio.h>
#include <stdlib.h>
int max(int a, int b) {
  return a > b ? a : b;
}
typedef struct {
  int key;
  int value;
}match_t;
int cmp(const void*a, const void *b) {
  return (match_t*)(a) -> value - (match_t*)(b) -> value;
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int *ans = (char*)malloc(((n>>1) + 1)*sizeof(int));
  int *dp = (int*)calloc((n+1)*sizeof(int));
  int *form = (int*)malloc((n+1)*sizeof(int));
  match_t match[10];
  match[0].value = -1;
  int match_stick[10] = {0,2,5,5,4,5,6,3,7,6};
  int reverse[10] = {0,0,1,7,4,2,6,8,0,0};
  int i;
  for (i = 1; i <= m; i++) {
    scanf("%d", &match[i].key);
    match[i].value = match_stick[match[i].key];
  }
  qsort(&match[1], m, sizeof(match_t), cmp);
  for (i = 1; i <=m ;i++) {
    if (match[i].key == 3 && reverse[5] < 5) {
      reverse[5] = 3;
    }
    if (match[i].key == 5) {
      reverse[5] = 5;
    }
    if (match[i].key == 9) {
      reverse[6] = 9;
    }
  }
  for (i = 1; i <= m; i++) {
    int value = match[i].value;
    if (value == match[i - 1].value) {
      continue;
    }
    int j;
    for (j = value; j <= n; j++) {
      int t = dp[j-value] + 1;
      if (dp[j] < t) {
        form[j] = value;
        dp[j] = t;
      }
    }
  }
  int x = n;
  int size = 0;
  while (x) {
    ans[size++] = reverse[form[x]];
    x -= form[x];
  }
  for (i = size-1; i >=0; i--) {
    printf("%d", ans[i]);
  }
  printf("\n");
  return 0;
}

Compiler output:
main.c: In function 'cmp':
main.c:11:24: warning: dereferencing 'void *' pointer
   11 |   return (match_t*)(a) -> value - (match_t*)(b) -> value;
      |                        ^~
main.c:11:24: error: request for member 'value' in something not a structure or union
main.c:11:49: warning: dereferencing 'void *' pointer
   11 |   return (match_t*)(a) -> value - (match_t*)(b) -> value;
      |                                                 ^~
main.c:11:49: error: request for member 'value' in something not a structure or union
main.c: In function 'main':
main.c:16:14: error: initialization of 'int *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
   16 |   int *ans = (char*)malloc(((n>>1) + 1)*sizeof(int));
      |              ^
main.c:17:19: error: too few arguments to function 'calloc'
   17 |   int *dp = (int*)calloc((n+1)*sizeof(int));
      |                   ^~~~~~
In file included from main.c:2:
/usr/include/stdlib.h:675:14: note: declared here
  675 | extern void *calloc (size_t __nmemb, size_t __size)
      |              ^~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  long n; cin >>n;
  int m; cin >>m;
  vector<int> num(m);
  vector<int> match(m);
  vector<int> matches = {2,5,5,4,5,6,3,7,6};
  for( int i = 0; i < m; i++ ){
    cin >> num[i];
  }
  sort(num.begin(),num.end());
  reverse(num.begin(),num.end());
  for(int i=0;i<m;i++){
    match[i] = matches[num[i]-1];
  }
  
  
  vector<int> dp(n+1);
  dp[0] = 0; dp[1] = -100;
  
  for(int i = 2; i <= n; i++){
    int dp1=-100,dp2=-100,dp3=-100,dp4=-100,dp5=-100;
    for(int j=0; j<m; j++){
      if(i<match[j]){dp1=-100;}
      else if(i>match[j]){
        if(dp[i-match[j]] == dp[i-1]){dp5=dp[i-1]+1;break;}
        else{dp2=dp[i-1];}}
      else if(i==match[j]){dp3=1;}
    }
      dp[i] = max({dp1,dp2,dp3,dp4,dp5});
  }
  

  
  
  int a,b=0;
  string ans="";
  for(int i=0;i<dp[n];i++){
    a=0;
    for(int j = 0 ; j < m ; j++){
      if( dp[ n - match[j] - b ] == dp[n]-i-1 &&n-match[j]-b>=0&&dp[n-match[j]-b>=0){
        a = j;
        break;
      }
    }
    ans += to_string(num[a]);
    b += match[a]; 
  }
  cout << ans << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:84: error: expected ']' before ')' token
   42 |       if( dp[ n - match[j] - b ] == dp[n]-i-1 &&n-match[j]-b>=0&&dp[n-match[j]-b>=0){
      |                                                                                    ^
      |                                                                                    ]
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e4+7;
int dp[maxn] = {1};
int Wight[10] = {0,2,5,5,4,5,6,3,7,6},A[10];
int n,m;
signed main(){
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)scanf("%d",&A[i]);
    for(int i=1;i<=m;i++)
        for(int j=Wight[A[i]];j<=n;j++)
            dp[j] = max(dp[j],dp[j-Wight[A[i]]]+1);
    sort(A+1,A+1+m);
    while(n){
        if(dp[n] == dp[n-Wight[A[m]]]+1)
            printf("%d",A[m]),n -= Wight[A[m]];
        else m--;
    }
    return 0;



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

#include <iostream>
#include <vector>
#include <functional>

#define INF 100000000

using namespace std;

int match[] = {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];
    }
    std::sort(A.begin(), A.end());

    vector<int> dp(N+1, -INF);
    dp[0] = 0;
    for(int i=2; i<=N; ++i){
        for(int j=0; j<M; ++j){
            if(i - match[A[j]-1] >= 0){
                dp[i] = max(dp[i], dp[i - match[A[j]-1]] + 1);
            }
        }
    }
    
    for(int j=M-1; j>=0; --j){
        while(N - match[A[j]-1] >= 0 && dp[N - match[A[j]-1]] == dp[N] - 1){
            cout<<A[j];
            N -= match[A[j]-1];
        }
    }
    cout<<endl;
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   19 |     std::sort(A.begin(), A.end());
      |          ^~~~
      |          qsort
Language: C++

#include <iostream>
#include <vector>
#include <functional>

#define INF 100000000

using namespace std;

int match[] = {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];
    }
    sort(A.begin(), A.end());

    vector<int> dp(N+1, -INF);
    dp[0] = 0;
    for(int i=2; i<=N; ++i){
        for(int j=0; j<M; ++j){
            if(i - match[A[j]-1] >= 0){
                dp[i] = max(dp[i], dp[i - match[A[j]-1]] + 1);
            }
        }
    }
    
    for(int j=M-1; j>=0; --j){
        while(N - match[A[j]-1] >= 0 && dp[N - match[A[j]-1]] == dp[N] - 1){
            cout<<A[j];
            N -= match[A[j]-1];
        }
    }
    cout<<endl;
    
    return 0;
}

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

#include <bits/stdc++.h>
using namespace std;
 
int N,M;
bool number[10];
string ans;
vector<int> A(10),B(10);
int rec[10050][5050];

int dp(int n,int k){
  if(n>N){return 0;}
  if(n==N){return k;}
  int M=0;
  for(int i=0;i<M;i++){
    if(rec[n+B[i]][k+1]==-1){rec[n+B[i]][k+1]=dp(n+B[i],k+1);}
    M=max(M,rec[n+B[i]][k+1]);
  }
  return M;
}

int main(){
  cin >> N >> M;
  ans="";
  for(int i=0;i<M;i++)cin >> A[i];
  for(int i=0;i<10020;i++){
    for(int j=0;j<5020;j++){rec[i][j]=-1;}
  }
  for(int i=0;i<M;i++){
    if(A[i]==1){B[i]=2;}
    else if(A[i]==7){B[i]=3;}
    else if(A[i]==4){B[i]=4;}
    else if(A[i]==8){B[i]=7;}
    else if(A[i]==6 || A[i]==9){B[i]=6;}
    else{B[i]=5;}
  }
  cout << dp(0,0) << endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:36:27: error: expected '}' at end of input
   36 |   cout << dp(0,0) << endl;
      |                           ^
a.cc:21:11: note: to match this '{'
   21 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int c[]={0,2,5,5,4,5,6,3,7,6};
string stmax(string a, string b)
{
  if(a.size() > b.size())
  {
    return a;
  }
  else if(a.size() < b.size())
  {
      return b;
  }
  else{
  	if(a>=b)return a;
    else return b;
  }
}
    
int main(){
  int n,m;
  cin>>n>>m;
  int a[m];
  for(int i=0; i<m; i++){
    cin>>a[i];
  }
  vector<string>dp(10101,"");
  for(int i=0; i<=n; i++){
    for(int j=0; j<a.size(); j++){
      if(i==0||dp[i]!=""){			//
        dp[i+c[a[j]]]=stmax(dp[i]+to_string(a[j]),dp[i+c[a[j]]]);
      }
    }
  }
  cout<<dp[n]<<endl;
}
    
  
   


Compiler output:
a.cc: In function 'int main()':
a.cc:29:22: error: request for member 'size' in 'a', which is of non-class type 'int [m]'
   29 |     for(int j=0; j<a.size(); j++){
      |                      ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const int c[]={0,2,5,5,4,5,6,3,7,6};
string stmax(string a, string b)
{
  if(a.size() > b.size())
  {
    return a;
  }
  else if(a.size() < b.size())
  {
      return b;
  }
  else{
  	if(a>=b)return a;
    else return b;
  }
}
    
int main(){
  int n,m;
  cin>>n>>m;
  vector<int>a(m);
  for(int i=0; i<m; i++){
    cin>>a[i];
  }
  vector<string>dp(10101,"");
  for(int i=0; i<=n; i++){
    for(int j=0; j<a.size(); j++){
      if(i==0||dp[i]!=""){ 　//重要
      	if(i+c[a[j]]>n)continue;
        dp[i+c[a[j]]]=stmax(dp[i]+to_string(a[j]),dp[i+c[a[j]]]);
      }
    }
  }
  cout<<dp[n]<<endl;
}
    
  
   


Compiler output:
a.cc:30:28: error: extended character 　 is not valid in an identifier
   30 |       if(i==0||dp[i]!=""){ 　//重要
      |                            ^
a.cc: In function 'int main()':
a.cc:30:28: error: '\U00003000' was not declared in this scope
   30 |       if(i==0||dp[i]!=""){ 　//重要
      |                            ^~
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int n=scan.nextInt();
    int m=scan.nextInt();
    int p[]=new int[8];
    for(int i=2;i<8;i++){
      p[i]=0;
    }
    int hoge;
    for(int i=0;i<m;i++){
      hoge=scan.nextInt();
      switch(hoge){
        case 1:
          p[2]=1;
          break;
        case 7:
          p[3]=7;
          break;
        case 4:
          p[4]=4;
          break;
        case 2:
        case 3:
        case 5:
          p[5]=max(p[5],hoge);
          break;
        case 6:
        case 9:
          p[6]=max(p[6],hoge);
          break;
        case 8:
          p[7]=8;
          break;
      }
      int mi=10;
      int a[]=new int[8];
      for(int i=2;i<8;i++){
        a[i]=0;
        if(p[i]!=0){
          a[i]=i;
          mi=min(mi,i);
        }
      }
      a[mi]=0;
      m=n%mi;
      int k;
      for(int i=0;i<10;i++){
      for(int p=0;p<mi;p++){
      for(int q=0;q<mi;q++){
      for(int r=0;r<mi;r++){
      for(int s=0;s<mi;s++){
      for(int t=0;t<mi;t++){
        k=p*a[3]+q*a[4]+r*a[5]+s*a[6]+t*a[7];
        if(k==m+(i*mi)) i=114514;
      }
      }
      }
      }
      }
      }
      
    }
  }
}


Compiler output:
Main.java:27: error: cannot find symbol
          p[5]=max(p[5],hoge);
               ^
  symbol:   method max(int,int)
  location: class Main
Main.java:31: error: cannot find symbol
          p[6]=max(p[6],hoge);
               ^
  symbol:   method max(int,int)
  location: class Main
Main.java:39: error: variable i is already defined in method main(String[])
      for(int i=2;i<8;i++){
              ^
Main.java:43: error: cannot find symbol
          mi=min(mi,i);
             ^
  symbol:   method min(int,int)
  location: class Main
Main.java:49: error: variable i is already defined in method main(String[])
      for(int i=0;i<10;i++){
              ^
Main.java:50: error: variable p is already defined in method main(String[])
      for(int p=0;p<mi;p++){
              ^
6 errors
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int n=scan.nextInt();
    int m=scan.nextInt();
    int p[]=new int[8];
    for(int i=2;i<8;i++){
      p[i]=0;
    }
    int hoge;
    for(int i=0;i<m;i++){
      hoge=scan.nextInt();
      switch(hoge){
        case 1:
          p[2]=1;
          break;
        case 7:
          p[3]=7;
          break;
        case 4:
          p[4]=4;
          break;
        case 2:
        case 3:
        case 5:
          p[5]=max(p[5],hoge);
          break;
        case 6:
        case 9:
          p[6]=max(p[6],hoge);
          break;
        case 8:
          p[7]=8;
          break;
      }
    }
  }
}

Compiler output:
Main.java:27: error: cannot find symbol
          p[5]=max(p[5],hoge);
               ^
  symbol:   method max(int,int)
  location: class Main
Main.java:31: error: cannot find symbol
          p[6]=max(p[6],hoge);
               ^
  symbol:   method max(int,int)
  location: class Main
2 errors