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

#include <cstdio>
#include <iostream>
#include <vector>

using namespace std;


int gcd(int a,int b)
{
    if (a%b==0)
    {
        return(b);
    }
    else
    {
        return(gcd(b,a%b));
    }
}


int main(void)
{
    int n;
    cin >>n;
    vector<int> a;

    for(int i = 0; i < n; i++){
        int tmp;
        cin >>tmp;
        a.push_back(tmp);
    }

    int gcdans = gcd(a[0], a[1]);
    for(int i = 2; i < n; i++){
        gcdans = gcd(a[i], gcdans);
    }

    printf("%d\n", gcdans);
    return 0;
}
[

Compiler output:
a.cc:41:1: error: expected unqualified-id before '[' token
   41 | [
      | ^
Language: C++

#include<iostream>

using namespace std;

int minimum(int n,int a[]){
  int min;
  for(int i=0;i<n;i++){
    if(a[i]>0){
      min=i;
      break;
    }
  }
  for(int i=0;i<n;i++){
    if(a[i]>0&&a[min]>a[i]) min=i;
  }
  return min;
}

int main(){

  int n;
  cin >> n;
  int tmp=n;

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

  int alive;

  while(tmp!=1){
    alive=minimum(n,a);
    for(int i=0;i<n;i++){
      if(a[i]>0&&i!=min){
	a[i]-=a[min];
	if(a[i]<=0) tmp--;
      }
    }
  }

  cout << a[alive] << endl;

  return 0;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:19: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator!='
   35 |       if(a[i]>0&&i!=min){
      |                  ~^~~~~
a.cc:36:16: error: invalid types 'int [n][<unresolved overloaded function type>]' for array subscript
   36 |         a[i]-=a[min];
      |                ^
Language: C++

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

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

int main(){
	int N;
	cin >> N;
	int A[N];
	for(int i=0; i<N; i++){
		cin >> A[i];
	}
	int t = A[i];
	for(int i=1; i<N; i++){
		t = gcd(t, A[i]);
	}
	cout << t << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int gcd(int, int)':
a.cc:9:21: error: expected ')' before '!' token
    9 |                 if(b!){
      |                   ~ ^
      |                     )
a.cc: In function 'int main()':
a.cc:24:19: error: 'i' was not declared in this scope
   24 |         int t = A[i];
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int N;

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

	cin >> N;

	vector<int> A(M);


	for(auto &x: A){
		cin >> x;
	}

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

	while(1){
		REP(i,N - 1){
			if(A[i] == 0 || A[i + 1] == 0) continue;
			int tb = A[i + 1];
			A[i + 1] = A[i + 1] % A[i];
			if(tb == A[i + 1]){
				if(A[i] > A[i + 1]){
					A[i + 1] = 0;
				}else{
					A[i] = 0;
				}
			}


		}

		sort(A.begin(),A.end());
		if(A[N - 2] == 0) break;
	}
	cout << A[N - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: 'M' was not declared in this scope
   14 |         vector<int> A(M);
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int N;

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

	cin >> N;

	vector<int> A(M);


	for(auto &x: A){
		cin >> x;
	}

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

	while(1)
		REP(i,N - 1){
			if(A[i] == 0 || A[i + 1] == 0) continue;
			int tb = A[i + 1];
			A[i + 1] = A[i + 1] % A[i];
			if(tb == A[i + 1]){
				if(A[i] > A[i + 1]){
					A[i + 1] = 0;
				}else{
					A[i] = 0;
				}
			}


		}

		sort(A.begin(),A.end());
		if(A[N - 2] == 0) break;
	}
	cout << A[N - 1] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:23: error: 'M' was not declared in this scope
   14 |         vector<int> A(M);
      |                       ^
a.cc:40:35: error: break statement not within loop or switch
   40 |                 if(A[N - 2] == 0) break;
      |                                   ^~~~~
a.cc: At global scope:
a.cc:42:9: error: 'cout' does not name a type
   42 |         cout << A[N - 1] << endl;
      |         ^~~~
a.cc:43:1: error: expected declaration before '}' token
   43 | }
      | ^
Language: C++

#include<iostream>
#include<math.h>
#include<algorithm>
#include<numeric>
#include <type_traits>
#define ll long long int
#define FOR(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n)

using namespace std;

int main(){
	int n;
    cin >> n;
    int a[n];
    REP(i,n) cin >> a[i];
    int ans = 1000000001;
    REP(i,n-1){
        int temp = __algo_gcd(a[i], a[i+1]);
        ans = min(ans,temp);
    }
    cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:20: error: '__algo_gcd' was not declared in this scope
   20 |         int temp = __algo_gcd(a[i], a[i+1]);
      |                    ^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))

#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repis(x, y, z, s) for ((x) = (z); (x) < (y); (x) += (s))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define nepit(x) for (__typeof((x).rbegin()) it = (x).rbegin(); it != (x).rend(); it++)

#define All(x) (x).begin(),(x).end()

#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))

#define Unique(v) v.resize(unique(All(v)) - v.begin())

#define peq(p0, p1)(p0.first == p1.first && p0.second == p1.second)

#define End '\n'
#define Out(x) cout<<(x)<<End
#define OutP(p, sep, end) cout<<p.first<<sep<<p.second<<end

template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb std::lower_bound
#define ub std::upper_bound

#define lbi(v, x) lb(All(v), (x))-v.begin()
#define ubi(v, x) ub(All(v), (x))-v.begin()

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);
	//std::cout.precision(18);

    int n;

	cin >> n;

	ll a[n];
	ll gap[n - 1];
	int x = 0;
	int y = 1;
	ll m = LLONG_MAX;

	int i, len = n - 1;

	rep(i, n) cin >> a[i];

	sort(a, a + n);

	if (a[0] == 1) {
		Out(1);

		return 0;
	}

	repi(i, len) gap[i] = a[i + 1] - a[i];

    rep(i, len) {
		if (0 < gap[i] && gap[i] < m) {
			m = gap[i];
			x = i;
			y = i + 1;
		}
	}

	while (0 < a[x] && 0 < a[y]) {
		if (a[x] <= a[y]) a[y] -= a[x];
		else a[x] -= a[y];
	}

	if (a[x] < 1) a[x] += a[y];
	else if (a[y] < 1) a[y] += a[x];

	m = min(a[x], a[y]);

	rep(i, n) {
		if (a[i] % m == 0) a[i] = m;
		else a[i] %= m;
	}

	sort(a, a + n);

	Out(a[0]);
	
	return 0;
}


Compiler output:
a.cc:88:20: error: macro "repi" requires 3 arguments, but only 2 given
   88 |         repi(i, len) gap[i] = a[i + 1] - a[i];
      |                    ^
a.cc:14:9: note: macro "repi" defined here
   14 | #define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
      |         ^~~~
a.cc: In function 'int main()':
a.cc:88:9: error: 'repi' was not declared in this scope
   88 |         repi(i, len) gap[i] = a[i + 1] - a[i];
      |         ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int gcd(int a,int b){
  if(a<b) swap(a,b);
  if(a%b==0) return b;
  else return gcd(b,a%b);
}
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  bool f=true,e=false,o=false,ff=true;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  int d=M;
  for(int i=1;i<n;i++){
    if(a[i]!=a[0]) ff=false;
    if(a[i]%a[0]!=0) f=false;
    d=min(d,gcd(a[0],a[i]);
   }
 cout<<d;
}
    

Compiler output:
a.cc: In function 'int main()':
a.cc:24:27: error: expected ')' before ';' token
   24 |     d=min(d,gcd(a[0],a[i]);
      |          ~                ^
      |                           )
Language: Java

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

import jdk.nashorn.api.tree.ForInLoopTree;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            new Main().solve(sc);
        }
    }

    void solve(Scanner sc) {
        int n = sc.nextInt();
        Set<Integer> aSet = new HashSet<>(n);
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            min = Math.min(min, a);
            aSet.add(a);
        }

        while (aSet.size() > 1) {
            Set<Integer> nextSet = new HashSet<>(n);
            nextSet.add(min);
            int nextMin = min;
            for (Integer a : aSet) {
                if (min != a) {
                    Integer tmp = a % min;
                    if (tmp != 0) {
                        nextSet.add(tmp);
                        nextMin = Math.min(nextMin, tmp);
                    }
                }
            }

            aSet = nextSet;
            min = nextMin;
        }
        System.out.println(min);
    }
}


Compiler output:
Main.java:5: error: package jdk.nashorn.api.tree does not exist
import jdk.nashorn.api.tree.ForInLoopTree;
                           ^
1 error
Language: Java

import java.util.PriorityQueue;
import java.util.Scanner;

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

        int n = sc.nextInt();

        PriorityQueue<Integer> q = new PriorityQueue<>(n);

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

        while (q.size() > 1) {
            int smallest = q.poll();
            int nextSmallest = q.poll();

            if (nextSmallest % smallest != 0)
                q.add(nextSmallest % smallest);

            q.add(smallest);
        }

        System.out.println(q.poll());
    }
}

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

#include<bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
	if(b%a==0)return a;
  return gcd(b%a,a);
}
int main()[
  int n,i;
  int a[111111];
  cin>>n;
  for(i=0;i<n;i++)cin>>a[i];
  for(i=1;i<n;i++)a[0]=gcd(a[0],a[i]);
  cout<<a[0];
  }

Compiler output:
a.cc:8:3: error: expected primary-expression before 'int'
    8 |   int n,i;
      |   ^~~
a.cc:7:12: error: expected ']' before 'int'
    7 | int main()[
      |            ^
      |            ]
    8 |   int n,i;
      |   ~~~       
a.cc:10:3: error: 'cin' does not name a type
   10 |   cin>>n;
      |   ^~~
a.cc:11:3: error: expected unqualified-id before 'for'
   11 |   for(i=0;i<n;i++)cin>>a[i];
      |   ^~~
a.cc:11:11: error: 'i' does not name a type
   11 |   for(i=0;i<n;i++)cin>>a[i];
      |           ^
a.cc:11:15: error: 'i' does not name a type
   11 |   for(i=0;i<n;i++)cin>>a[i];
      |               ^
a.cc:12:3: error: expected unqualified-id before 'for'
   12 |   for(i=1;i<n;i++)a[0]=gcd(a[0],a[i]);
      |   ^~~
a.cc:12:11: error: 'i' does not name a type
   12 |   for(i=1;i<n;i++)a[0]=gcd(a[0],a[i]);
      |           ^
a.cc:12:15: error: 'i' does not name a type
   12 |   for(i=1;i<n;i++)a[0]=gcd(a[0],a[i]);
      |               ^
a.cc:13:3: error: 'cout' does not name a type
   13 |   cout<<a[0];
      |   ^~~~
a.cc:14:3: error: expected declaration before '}' token
   14 |   }
      |   ^
Language: C++

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

int main(){
  int n;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }
  sort(a[1],a[n]);
  int ans=a[1]
  for(int i=2;i<=n;i++){
    if(a[i]%a[1]==0){}
    else if(a[i]%a[1]<=ans)ans=a[i]%a[1];
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'a' was not declared in this scope
    8 |     cin>>a[i];
      |          ^
a.cc:10:8: error: 'a' was not declared in this scope
   10 |   sort(a[1],a[n]);
      |        ^
a.cc:12:15: error: 'i' was not declared in this scope
   12 |   for(int i=2;i<=n;i++){
      |               ^
Language: C++

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

int gcd(int a, int b){
    if(b == 0)
        return a;
    return gcd(b, a%b);
}

void compute(){
    int n;
    cin>>n;
    vi v(n);
    int mn = INT_MAX;
    for(int i=0; i<n; i++){ cin>>v[i];
        mn = min(mn, v[i]);
    }
    int res = mn;
    for(int i=0; i<n; i++){
        res = gcd(res, v[i]);
    }
    cout<<res<<"\n";
}

int main(){
    compute();
    return 0;
}


Compiler output:
a.cc: In function 'void compute()':
a.cc:13:5: error: 'vi' was not declared in this scope
   13 |     vi v(n);
      |     ^~
a.cc:15:34: error: 'v' was not declared in this scope
   15 |     for(int i=0; i<n; i++){ cin>>v[i];
      |                                  ^
a.cc:20:24: error: 'v' was not declared in this scope
   20 |         res = gcd(res, v[i]);
      |                        ^
Language: C++

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

#define FasterIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int main(){
    FasterIO;

    int n;

    while(cin>>n){
        int data[n];
        int mn = INT_MAX;

        for(int i=0; i<n; i++){
            cin>>data[i];
            mn = min(mn, data[i]);
        }

        int gcd = data[0];

        for(int i=1; i<n; i++){
            gcd = __gcd(gcd, data[i])
            if(gcd==1)
                break;
        }

        cout<<gcd<<endl;
    }

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:38: error: expected ';' before 'if'
   23 |             gcd = __gcd(gcd, data[i])
      |                                      ^
      |                                      ;
   24 |             if(gcd==1)
      |             ~~
Language: C++

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

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

int maini(){
  int n; int a; cin >> n >> a;
  for(int i=0;i<n-1;i++){
  	int tem;
  	cin >> tem;
    a = gcd(a,tem);
  }
  cout << a << endl;
  return 0;
}

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

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

signed main(){
  int N;cin>>N;
  int a;cin>>a;
  for(int i=0;i<N-1;i++){
    int b;cin>>b;
    a=__gcc(a,b);
  }
  cout<<a<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:7: error: '__gcc' was not declared in this scope
   10 |     a=__gcc(a,b);
      |       ^~~~~
Language: C++

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

template <typename T>
bool chmax(T &a, const T &b) {
    if (a < b) {
      a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmin(T &a, const T &b) {
    if (a > b) {
      a = b;
      return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, M;
    cin >> N >> M;
    vP p(M);
    vl match={0,2,5,5,4,5,6,3,7,6};
    rep(i,M){
        cin >> p[i].first;
        p[i].second=match[p[i].first];
    }
    vl dp(N+1,-INF);
    dp[0]=0;
    FOR(i,1,N+1){
        rep(j,M){
            if(i>=p[j].second){
                chmax(dp[i],dp[i-p[j].second]+1);
            }
        }
    }
    string ans="";
    int res=N;
    while(res){
        rep(i,M){
            if(res>=p[i].second&&dp[res]==dp[res-p[i].second]+1){
                ans+=(p[i].first+'0');
                res-=p[i].second;
            }
        }
    }
    sort(ans.begin(),ans.end());reverse(ans.begin(),ans.end())
    cout << ans << '\n';
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

Compiler output:
a.cc: In function 'int main()':
a.cc:71:63: error: expected ';' before 'cout'
   71 |     sort(ans.begin(),ans.end());reverse(ans.begin(),ans.end())
      |                                                               ^
      |                                                               ;
   72 |     cout << ans << '\n';
      |     ~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int a[10]={0,2,5,5,4,5,6,3,7,6};
int b[10];
int dp[10005];
int main(){
    int n,m;
    cin >> n >> m;
    for(int i=0;i<m;i++)cin >> b[i];
    sort(b,b+m);
    dp[1]=-1e9;
    for(int i=2;i<n+1;i++){
        for(int j=0;j<m;j++){
            if(i-a[b[j]]>=0)dp[i]=max(dp[i],dp[i-a[b[j]]]+1);
        }
        if(dp[i]==0)dp[i]=-1e9;
    }
    int num=0;
    int ma=n;
    string S;
    while(num<dp[n]){
        for(int i=m-1;i>=0;i--){
            if(dp[ma-a[b[i]]]==dp[ma]-1 && ma-a[b[i]>=0){
                S[num]=('0'+b[i]);
                ma-=a[b[i]];
                break;
            }
        }
        num++;
    }
    for(int i=0;i<num;i++)cout << S[i];       
}


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

#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;                        // 任意長整数
using Real = mp::number<mp::cpp_dec_float<1024>>;// 仮数部が1024bitの浮動小数点数
using namespace std;
using ll = long long;
using P = pair<int,int>;
using PL = pair<ll,ll>;

vector<pair<Bint,int>> ma = {{1,2}, {2,5}, {3,5}, {4,4}, {5,5}, {6,6}, {7,3}, {8,7}, {9,6}};

int main() { 
    int n, m;
    cin >> n >> m;
    vector<pair<Bint,int>> in(m);
    for(int i = 0; i < m; i++) {
        int t; cin >> t;
        in[i] = ma[t - 1];
        cerr << in[i].first << " : " << in[i].second << endl;
    }

    vector<Bint> dp(n + 1, Bint("-1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")); //dp[i] := i個のマッチを使って作れる最大の整数
    dp[0] = 0;
    for(int i = 0; i < n; i++) {
        for(auto j : in) {
            if(i + j.second > n)continue;
            dp[i + j.second] = max(dp[i + j.second], dp[i] * 10 + j.first);

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

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

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define P pair<ll, ll>
#define PP pair<P,P>
using namespace std;
const int match[10]={0,2,5,5,4,5,6,3,7,6};

int main(){
    int n,m; cin >> n >> m;
    int mm=INF;
    int wmm=0;
    vector<int> a(m);
    rep(i,m){
        int aa; cin >> aa;
        a[i]=aa;
        if(mm>match[aa] || (mm==match[aa] && wmm<aa)){
            mm=match[aa];
            wmm=aa;
        }
    }

    int keta=n/mm;
    int sp=n-(keta*match[wmm]);
    //cout << keta << ' ' << wmm << ' ' << mm << ' ' << sp << endl;

    vector<int> ans;

    rep(i,keta){
        bool u=false;
        if(sp){
            for(int j=9; j>wmm; j--){
                bool can=false;
                rep(k,m){
                    if(a[k]==j){
                        can=true;
                        break;
                    }
                }
                if(!can) continue;
                if(match[j]-match[wmm]<=sp){
                    ans.push_back(j);
                    sp-=(match[j]-match[wmm]);
                    u=true;
                    break;
                }
            }
        }
        if(!u) ans.push_back(wmm);
    }
if(sp){
    int now=keta-1;
    int maxn=0;

        for(int i=wmm-1; i>0; i--){
            bool can=false;
            rep(k,m){
                if(a[k]==i){
                    can=true;
                    break;
                }
            }
            if(!can) continue;
            //cout << match[i]-match[wmm] << ' ' << i << endl;
            if(match[i]-match[wmm]<=sp) maxn=max(maxn,match[i]-match[wmm]);
        }
    if(maxn!=0) int keta2=sp/maxn;
    if(maxn==0) keta2=0;

    for(int i=keta2; i>0; i--){
        for(int j=wmm-1; j>0; j--){
            bool can=false;
            rep(k,m){
                if(a[k]==j){
                    can=true;
                    break;
                }
            }
            if(!can) continue;

            if(match[j]-match[wmm]<=sp && (sp-(match[j]-match[wmm]))<=maxn*(i-1)){
                ans[keta-i]=j;
                sp-=match[j]-match[wmm];
            }
        }
    }
}
    rep(i,keta) printf("%d",ans[i]);
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:17: error: 'keta2' was not declared in this scope; did you mean 'keta'?
   71 |     if(maxn==0) keta2=0;
      |                 ^~~~~
      |                 keta
a.cc:73:15: error: 'keta2' was not declared in this scope; did you mean 'keta'?
   73 |     for(int i=keta2; i>0; i--){
      |               ^~~~~
      |               keta
Language: C++

#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct Edge{ll from, to, cost;};
struct node{ll cost, to;
  bool friend operator>(node a, node b){
    return a.cost>b.cost;
  }
};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

string ssmax(string s, string t){
  ll ns = s.size();
  ll nt = t.size();
  if(ns==0)return t;
  if(nt==0)return s;
  if(s[ns-1]=='?')return t;
  else if(t[nt-1]=='?')return s;
  
  if(ns>nt){
    return s;
  }else if(ns<nt){
    return t;
  }else{
    rep(ii, ns){
      ll i = ii;
      if(s[i]>t[i]){
        return s;
      }else if(s[i]<t[i]){
        return t;
      }
    }
    return s;
  }
}
ll N, M;
string dp[10000];
ll v[10000];
set<ll> exist;
ll num[]={0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

string dpf(ll n){
  if(v[n]>0){
    return dp[n];
  }else{
    v[n]=1;
    dp[n]="";
    if(n==0){
      
    }else{
      for(auto i:exist){
        bool imp=true;
        if(n-num[i]>=0){
          dp[n] = ssmax(dp[n], to_string(i) + dpf(n-num[i]));
          imp=false;
        }
      }
    }
    if(n!=0 and imp){
      dp[n]="?";
    }
    return dp[n];
  }
}

/**************************************
** A main function starts from here  **
***************************************/
int main(){
  cin >> N >> M;
  rep(i, M){
    ll tmp; cin >> tmp;
    exist.insert(tmp);
  }
  cout << dpf(N);

  return 0;
}


Compiler output:
a.cc: In function 'std::string dpf(ll)':
a.cc:112:17: error: 'imp' was not declared in this scope
  112 |     if(n!=0 and imp){
      |                 ^~~
Language: C++

n,m=map(int,input().split())
A=reversed(sorted(map(int,input().split())))
M=[2,5,5,4,5,6,3,7,6]
D={}
for a in A:
    if M[a-1] in D:
        continue
    else:
        D[a]=M[a-1]
        
dp=[0]*(n+2)
for i in range(1,n+2):
    cnt=-1
    for d in D:
        x=D[d]
        if i-x>=0:
            if dp[i-x]!=-1:
                cnt=max(dp[i-x]+1,cnt)
    dp[i]=cnt    
k=dp[n]
ans=""
while k>0:
    for d in D:
        x=D[d]
        if dp[n-x]==k-1:
            ans+=str(d)
            k-=1
            n-=x
            break
print(ans)

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,m=map(int,input().split())
      | ^
a.cc:5:1: error: expected unqualified-id before 'for'
    5 | for a in A:
      | ^~~
Language: C++

#include <iostream>

using namespace std;

const int M = 1e6+7;

int s[] = {0,2,5,5,4,5,6,3,7,6};
int a[M],ans[M];
int n,m;
int dp[M];

int cmp(int a,int b){
    return a > b;
}
 
int main(){
    cin>>n;
	cin>>m;
    for(int i = 0;i < m;i++){
        cin>>a[i];
    }
    memset(dp,-1,sizeof(dp));
    dp[0] = 1;
 
    int vis[10] = {0};
    for(int i = 0;i < m;i++){
        for(int j = s[a[i]];j <= n;j++){
            dp[j] = max(dp[j],dp[j-s[a[i]]]+1);
        }
    }
 
    sort(a,a+m,cmp);
    while(n){
        for(int i = 0;i < m;i++){
            if(n >= s[a[i]] && dp[n-s[a[i]]]+1 == dp[n]){
                cout<<a[i]+'0';
                n = n-s[a[i]];
				break;
            }
        }
    }
 
    cout<<endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'memset' was not declared in this scope
   22 |     memset(dp,-1,sizeof(dp));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | 
a.cc:32:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   32 |     sort(a,a+m,cmp);
      |     ^~~~
      |     short
Language: C++

#include <iostream>

using namespace std;

const int M = 1e6+7;

int s[] = {0,2,5,5,4,5,6,3,7,6};
int a[M],ans[M];
int n,m;
int dp[M];

int cmp(int a,int b){
    return a > b;
}
 
int main(){
    cin>>n;
	cin>>m;
    for(int i = 0;i < m;i++){
        cin>>a[i];
    }
    memset(dp,-1,sizeof(dp));
    dp[0] = 1;
 
    int vis[10] = {0};
    for(int i = 0;i < m;i++){
        for(int j = s[a[i]];j <= n;j++){
            dp[j] = max(dp[j],dp[j-s[a[i]]]+1);
        }
    }
 
    sort(a,a+m,cmp);
    while(n){
        for(int i = 0;i < m;i++){
            if(n >= s[a[i]] && dp[n-s[a[i]]]+1 == dp[n]){
                cout<<a[i]+'0';
                n = n-s[a[i]];
				break;
            }
        }
    }
 
    cout<<endl;
    return 0； 
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:5: error: 'memset' was not declared in this scope
   22 |     memset(dp,-1,sizeof(dp));
      |     ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 | 
a.cc:32:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   32 |     sort(a,a+m,cmp);
      |     ^~~~
      |     short
a.cc:44:12: error: unable to find numeric literal operator 'operator""\U0000ff1b'
   44 |     return 0；
      |            ^~~
a.cc:44:15: error: expected ';' before '}' token
   44 |     return 0；
      |               ^
      |               ;
   45 | }
      | ~
Language: C++

package probb

val ms = intArrayOf(2, 3, 4, 5, 6, 7, 8)
val num = intArrayOf(0,2,5,5,4,5,6,3,7,6)
val max_num = intArrayOf(0,0,0,0,0,0,0,0,0,0)

fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map(String::toInt)
    val a = readLine()!!.split(" ").map(String::toInt)
    for(i in 0 until m){
        max_num[num[a[i]]] = Math.max(max_num[num[a[i]]], a[i])
    }
    val dp = Array<Int>(n+1, {-100000000})
    for(i in 0 until m){
        if(num[a[i]] > n) continue
        dp[num[a[i]]] = Math.max(dp[num[a[i]]], 1)
    }
    dp[0] = 0
    for(i in 2..n){
        for(j in 2..9){
            if(max_num[j] == 0) continue
            if(i-j >=0) dp[i] = Math.max(dp[i], dp[i-j]+1)
        }
    }
    var cur = n
    while(cur > 0){
        var mx = -1
        var mm = 0
        for(i in 2..9){
            if(max_num[i] == 0) continue
            if(cur-i >= 0){
                if(mx < max_num[i] && dp[cur]==dp[cur-i]+1){
                    mx = max_num[i]
                    mm = i
                }
            }
        }
        print(mx)
        cur -= mm
    }
    println()
}


Compiler output:
a.cc:19:14: error: too many decimal points in number
   19 |     for(i in 2..n){
      |              ^~~~
a.cc:20:18: error: too many decimal points in number
   20 |         for(j in 2..9){
      |                  ^~~~
a.cc:29:18: error: too many decimal points in number
   29 |         for(i in 2..9){
      |                  ^~~~
a.cc:1:1: error: 'package' does not name a type
    1 | package probb
      | ^~~~~~~
Language: Java

import java.util.*;

public class ABC118D_3 {
	static Scanner sc = new Scanner(System.in);
	static int dp[];
	static int N, M;
	static int[] matchsticks = {
		2,
		5,
		5,
		4,
		5,
		6,
		3,
		7,
		6
	};
	static ArrayList<String> possibleAns = new ArrayList<String>();
	static Digit[] digits;

	public static void main(String[] args) {
		N = sc.nextInt();
		M = sc.nextInt();
		digits  = new Digit[M];
		dp = new int[N+1];
		Arrays.fill(dp, -1);
		for(int i = 0; i < M; i++) {
			int curr = sc.nextInt();
			digits[i] = new Digit(curr, matchsticks[curr-1]);
		}

		Arrays.sort(digits);

		// for(Digit d : digits) {
		// 	System.out.println(d.digit + " " + d.matchsticks);
		// }

		int length = dp(N);
		String ans = formDigits(length);

		System.out.println(ans);
	}

	public static String formDigits(int length) {
		StringBuilder sb = new StringBuilder();
		int index = M-1;
		int copyN = N;
		while(length > 0 && index >= 0) {
			if(dp(copyN - digits[index].matchsticks) == dp(copyN)-1) {
				sb.append(digits[index].digit);
				length--;
				copyN -= digits[index].matchsticks;
			}
			else {
				index--;
			}
		}

		return sb.toString();
	}

	public static int dp(int i) {
		if(i == 0) return 0;

		if(i < 0) return Integer.MIN_VALUE;

		if(dp[i] == -1) {
			int ans = Integer.MIN_VALUE;
			for(int j = 0; j < M; j++) {
				ans = Math.max(ans, dp(i-digits[j].matchsticks) + 1);
			}

			dp[i] = ans;
		}

		return dp[i];
	}

	static class Digit implements Comparable<Digit> {
		public int digit, matchsticks;

		public Digit(int d, int m) {
			digit = d;
			matchsticks = m;
		}

		public int compareTo(Digit b) {
			return new Integer(this.digit).compareTo(b.digit);
		}
	}
}

Compiler output:
Main.java:3: error: class ABC118D_3 is public, should be declared in a file named ABC118D_3.java
public class ABC118D_3 {
       ^
Main.java:88: warning: [removal] Integer(int) in Integer has been deprecated and marked for removal
			return new Integer(this.digit).compareTo(b.digit);
			       ^
1 error
1 warning
Language: C++

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }


long long match[10] = {2,5,5,4,5,6,3,7,6};

string dp[11000];

int main() {
    int N, M; cin >> N >> M;
  
    int a[100010];
  
    for (int i = 0; i < M; ++i) cin >> A[i];    
    for (int i = 0; i < 11000; ++i) dp[i] = "-1e9";  
  
    dp[0] ="" ;
    for (int i = 0; i <= N; ++i) {
        if (dp[i] == "-1e9") continue;
      
        for (auto a : A)  chmax(dp[i+match[a-1]], dp[i] + (char)('0' + a));
    }
  
    cout << dp[N] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:40: error: 'A' was not declared in this scope
   18 |     for (int i = 0; i < M; ++i) cin >> A[i];
      |                                        ^
a.cc:25:23: error: 'A' was not declared in this scope
   25 |         for (auto a : A)  chmax(dp[i+match[a-1]], dp[i] + (char)('0' + a));
      |                       ^
Language: Java

import java.util.*;
public class Main{
  public static void main(String[] args){
    int INF = (int)Math.pow(10,9);
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] a = new int[m];
    for(int i=0;i<m;i++)a[i]=sc.nextInt();
    int[] dp = new int[n+1];
    int[] num = {0,2,5,5,4,5,6,3,7,6};
    
    for(int i=1;i<=n;i++){
      for(int j=0;j<m;j++){
        if(i>=num[a[j]])dp[i]=Math.max(dp[i],dp[i-num[a[j]]]+1);
        else dp[i]=(-1)*INF;
      }
    }
    Arrays.sort(a,Comparator.reverseOrder());
    int res = n;
    for(int i=0;i<dp[n];i++){
      for(int j=0;j<m;j++){
        if(dp[res-num[a[j]]]==dp[res]-1){
          System.out.print(a[j]);
          res-=num[a[j]];
          break;
        }
      }
    }
    System.out.println("");
  }
}

Compiler output:
Main.java:19: error: no suitable method found for sort(int[],Comparator<T#1>)
    Arrays.sort(a,Comparator.reverseOrder());
          ^
    method Arrays.<T#2>sort(T#2[],Comparator<? super T#2>) is not applicable
      (inference variable T#2 has incompatible bounds
        equality constraints: int
        upper bounds: Object)
    method Arrays.<T#3>sort(T#3[],int,int,Comparator<? super T#3>) is not applicable
      (cannot infer type-variable(s) T#3
        (actual and formal argument lists differ in length))
  where T#1,T#2,T#3 are type-variables:
    T#1 extends Comparable<? super T#1>
    T#2 extends Object declared in method <T#2>sort(T#2[],Comparator<? super T#2>)
    T#3 extends Object declared in method <T#3>sort(T#3[],int,int,Comparator<? super T#3>)
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

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

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    
    vector<int> a(m);
    
    for (int i = 0; i < m; i++) {
        cin >> a[i];
    }
    
    int p[10] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    
    struct R {
        R() : len(-1) {
            fill(c.begin(), c.end(), 0);
        }
        
        int len;
        std::array<int, 9> c;   
    
        bool operator<(const R& rhs) const {
            if (len == -1) {
                return true;
            } else if (rhs.len == -1) {
                return false;
            } else if (len == rhs.len) {
                return c < rhs.c;
            } else {
                return len < rhs.len;
            }
        }
    };
    
    vector<R> dp(n + 1);
    
    dp[0].len = 0;
    
    for (int i = 0; i < n; i++) {
        if (dp[i].len == -1) {
            continue;
        }
        
        for (int k : a) {
            int s = i + p[k];
            
            if (s <= n) {
                R st = dp[i];
                st.len++;
                
                st.c[9 - k]++;
                
                dp[s] = max(dp[s], st);
            }
        }
    }
    
    string ans;
    
    for (int i = 0; i < 9; i++) {
        ans += string(dp[n].c[i], '9' - i);
    }
    
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:28: error: field 'c' has incomplete type 'std::array<int, 9>'
   27 |         std::array<int, 9> c;
      |                            ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_pair.h:99:12: note: declaration of 'struct std::array<int, 9>'
   99 |     struct array;
      |            ^~~~~
Language: C

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

int main(void){
    
    int N,M;
    int match[10]={0,2,5,5,4,5,6,3,7,6};
    int num[10];
    int hon[10];
    int t;
    int minhon=10;
    int keta=0;
    scanf("%d%d",&N,&M);
    printf("%d %d\n",N,M);

    for(int i=0;i<M;i++)
    {
        scanf("%d",&num[i]);
        hon[i]=match[num[i]];
        printf("%d",hon[i]);
        
        if(minhon>hon[i])
        {
            minhon=hon[i];
        }
    }
    
    keta=N/minhon;
    
    for(int i=0;i<M;i++)
    {
        keta=N/minhon;
        if(minhon==N)
        {
            for(int i=0;i<N;i++)
            {
                printf("%d")
            }
        }
    }
    
    printf("%d",keta);
    
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:39:29: error: expected ';' before '}' token
   39 |                 printf("%d")
      |                             ^
      |                             ;
   40 |             }
      |             ~
Language: C++

#include <bits/stdc++.h>

#ifndef ONLINE_JUDGE
	#define W(x, y) cerr << "\033[31m" << #x << " = " << x << "\033[0m" << y;
#else
	#define W(x, y)
#endif


#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vii vector<pii>
#define vl vector<ll>
#define vll vector<pll>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pi acos(-1)
#define ld long double
#define prime (1000000000 + 7)

using namespace std;

#define INF 1000000000

vll h(string s){
	ll p1 = 1000000000 + 7, p2 = 1000000000 + 9, q = 31;

	ll n = s.size();
	vll res(n);

	res[0].ff = (s[0]-'a' + 1)%p1;
	res[0].ss = (s[0]-'a' + 1)%p1;
	for(int i = 1; i < n; ++i){
		res[i].ff = ((s[i]-'a' + 1)%p1 + (res[i-1].ff * q)%p1 )%p1;
		res[i].ss = ((s[i]-'a' + 1)%p2 + (res[i-1].ss * q)%p2 )%p2;
	}


	return res;
}

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

	
	ll n, m, l;
	cin >> n >> m >> l;
	vector<vector<pair<ll, pll>>> listAdj(n, vector<pair<ll, pll>>(n, {0x003f3f3f3f3f3f3fLL, {}}));
	for(int i = 0; i < m; ++i){
		ll a, b, c;
		cin >> a >> b >> c;
		if(c > l){
			a--;
			b--;
			listAdj[a][b] = listAdj[b][a] = {c, {l-c, 0}};
		}
	}
	for(int k = 0; k < n; ++k){
		for(int i = 0; i < n; ++i){
			for(int j = 0; j < n; ++j){
				if(listAdj[i][k].ss.ss + listAdj[k][j].ss.ss + 1 < listAdj[i][j].ss.ss){
					
				} else if(listAdj[i][k].ss.ss + listAdj[k][j].ss.ss > listAdj[i][j].ss.ss){

				} else{
					if(listAdj[i][k].ss.ff + listAdj[k][j].ss.ss)
				}
			}
		}
	}
	for(int i = 0; i < n; ++i){
		listAdj[i][i] = {0, {l, 0}};
	}
	for(int i = 0; i < l; ++i){
		ll s, t;
		cin >> s >> t;
	}

	
	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:33: error: expected primary-expression before '}' token
   72 |                                 }
      |                                 ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
const string MINUSINF = "-";

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

ll match[10] = { 2, 5, 5, 4, 5, 6, 3, 7, 6 };
string dp[12345];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int N, M;
    cin >> N >> M;
    vector<int> A(M);
    rep(i, M) { cin >> A[i]; }
    rep(i, 12345) { dp[i] = MINUSINF; }

    dp[0] = "";

    for (int i = 0; i <= N; i++) {
        if (dp[i] == MINUSINF) {
            continue;
        }
        for (auto& a : A) {
            chmax(dp[i + match[a - 1]], dp[i] + (char)('0' + a));
        }
    }
    cout << dp[N] << endl;

    return 0;
}

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

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

#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

int main() {
  int n, m; cin >> n >> m;
  vector<int> arr(m);
  for (int i = 0; i < m; ++i) {
    cin >> arr[i];
  }
  map<int, int> match;
  vector<int> match_nums = {2,5,5,4,5,6,3,7,6};
  for (int i = 1; i < 10; ++i) {
    match[i] = match_nums[i - 1];
  }
  vector<cpp_int> dp(n + 7, -1);
  dp[0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int a: arr) {
      if (dp[i] == -1) continue;
      dp[i + match[a]] = max(dp[i + match[a]], dp[i] * 10 + a);
    }
  }
  cout << dp[n] << endl;
}


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

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

#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

int order(cpp_int x) {
  int cnt = 0;
  while (x > 0) {
    ++cnt;
    x /= 10;
  }
  return cnt;
}

cpp_int Pow(cpp_int x, int n){
  cpp_int res = 1;
  while (n > 0) {
    if (n % 2 == 0) {
      x = x * x;
      n /= 2;
    } else {
      res = res * x;
      --n;
    }
  }
  return res;
}

int main() {
  int n, m; cin >> n >> m;
  vector<int> arr(m);
  for (int i = 0; i < m; ++i) {
    cin >> arr[i];
  }
  map<int, int> match;
  vector<int> match_nums = {2,5,5,4,5,6,3,7,6};
  for (int i = 1; i < 10; ++i) {
    match[i] = match_nums[i - 1];
  }
  vector<cpp_int> dp(n + 7, -1);
  dp[0] = 0;
  for (int i = 0; i < n; ++i) {
    for (int a: arr) {
      if (dp[i] == -1) {
        continue;
      } else if (dp[i] == 0) {
        dp[i + match[a]] = a;
      } else {
        dp[i + match[a]] = max(dp[i] * 10 + a, dp[i] + Pow(10, order(dp[i])) * a);
      }
    }
  }
  cout << dp[n] << endl;
}



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

#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<map>
using namespace std;
int num[] = { 0,2,5,5,4,5,6,3,7,6 };
int f[10005], tmp, a[10];
map<int, int>mp;
string ans[10005];
int main()
{
	int n, m; cin >> n >> m;
	for (int i = 0; i < m; i++)
	{
		cin >> tmp;
		mp[num[tmp]] = max(mp[num[tmp]], tmp);
	}
	m = mp.size(); tmp = 0;
	for (auto i : mp)a[tmp++] = i.second;
	memset(f, -1, sizeof(f)); f[0] = 0;
	for (int i = 0; i <= n; i++)ans[i] = "";
	for (int i = 0; i < m; i++)
	{
		for (int j = num[a[i]]; j <= n; j++)
			if (f[j - num[a[i]]] >= 0 && f[j] <= f[j - num[a[i]]] + 1)
			{
				f[j] = f[j - num[a[i]]] + 1;
				ans[j] = ans[j - num[a[i]]] + char('0' + a[i]);
			}
	}
	sort(ans[n].begin(), ans[n].end(), greater<int>());
	cout << ans[n] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:9: error: 'memset' was not declared in this scope
   21 |         memset(f, -1, sizeof(f)); f[0] = 0;
      |         ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    5 | #include<map>
  +++ |+#include <cstring>
    6 | using namespace std;
Language: C++

#include <iostream>
#include <vector>
#include <utility>
using namespace std;
#define pair pair<int,int>
#define ll long long int

int N,M;
vector<pair> A;

bool compare1(pair a, pair b){
	if(a.second == b.second){
		return a.first > b.first;
	}else{
		return a.second < b.second;
	}
}


bool compare2(pair a, pair b){
	return a.first > b.first;
}


bool compare3(pair a, pair b){
	return a.second > b.second;
}


void solve(){
	sort(A.begin(), A.end(), compare1);

	int len = N / A[0].second;
	vector<int> ans(len, A[0].first);
	pair tmp = A[0];
	N -= tmp.second*len;

	sort(A.begin(), A.end(), compare2);

	for(int i=0;i<len;i++){
		for(int j=0;j<M;j++){
			if(tmp.first<A[j].first && A[j].second - tmp.second <= N){
				ans[i] = A[j].first;
				N -= A[j].second - tmp.second;
				break;
			}
		}
	}

	sort(A.begin(), A.end(), compare3);

	for(int i=len-1;0<=i;i--){
		for(int j=0;j<M;j++){
			if(A[j] != tmp && A[j].second - tmp.second <= N){
				ans[i] = A[j].first;
				N -= A[j].second - tmp.second;
				break;
			}
		}
	}
	
	for(auto u:ans) cout << u;
	cout << endl;

}


int main(){
	int v[10];
	v[1]=2;v[2]=5;v[3]=5;v[4]=4;v[5]=5;v[6]=6;v[7]=3;v[8]=7;v[9]=6;

	cin >> N >> M;
	A.resize(M);

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

Compiler output:
a.cc: In function 'void solve()':
a.cc:31:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   31 |         sort(A.begin(), A.end(), compare1);
      |         ^~~~
      |         short
Language: C++

#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using  namespace std;
typedef long long ll;
#define Inf 100000

int main()
{
  int num[] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
  int dp[n+1] = {};

  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  rep(i, m) {
    cin >> a[i];
    --a[i];
  }
  sort(a.begin(), a.end(), greater<int>() );

  for (int i = 1; i <= n; ++i) {
    int max = -Inf;
    for (int j = 0; j < m; ++j) {
      if (i - num[a[j]] < 0) continue;
      int tmp = dp[i - num[a[j]] ] + 1;
      if (tmp > max) {
        max = tmp;
      }
    }
    dp[i] = max;
  }

  int res = n;
  for (int i = 0; i < dp[n]; ++i) {
    for (int j = 0; j < m; ++j) {
      if (res - num[a[j]] < 0) continue;
      if (dp[res - num[a[j] ] == dp[res] - 1) {
        res -= num[a[j]];
        printf("%d", a[j]);
        break;
      }
    }
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: 'n' was not declared in this scope; did you mean 'yn'?
   10 |   int dp[n+1] = {};
      |          ^
      |          yn
a.cc:25:17: error: 'dp' was not declared in this scope; did you mean 'dup'?
   25 |       int tmp = dp[i - num[a[j]] ] + 1;
      |                 ^~
      |                 dup
a.cc:30:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   30 |     dp[i] = max;
      |     ^~
      |     dup
a.cc:34:23: error: 'dp' was not declared in this scope; did you mean 'dup'?
   34 |   for (int i = 0; i < dp[n]; ++i) {
      |                       ^~
      |                       dup
a.cc:37:45: error: expected ']' before ')' token
   37 |       if (dp[res - num[a[j] ] == dp[res] - 1) {
      |                                             ^
      |                                             ]