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

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  int consume[]={-1,2,5,5,4,5,6,3,7,6};
  int n,m;
  cin>>n>>m;
  vector<int> a(m);
  REP(i,m){
    cin>>a[i];
  }
  sort(a.begin(),a.end(),greater<int>());
  
  vector<int> dp(n+1,-1);//マッチをi本使って作れる最大の桁数を格納する。
  vector<int> to(n+1,-1);
  REP(i,m){
    if(dp[consume[a[i]]]>0)continue;
    dp[consume[a[i]]] = 1;
    to[consume[a[i]]] = i;
  }
  REP(i,n){
    REP(j,m){
      if(i+1-consume[a[j]]<0)continue;
      if(dp[i+1-consume[a[j]]]<0)continue;
      if(dp[i+1]<dp[i+1-consume[a[j]]]+1){
        dp[i+1] = dp[i+1-consume[a[j]]]+1;
        to[i+1] = j;
      }
    }
  }
  
  int matches = n;//残りのマッチの数
  int digits = dp[n];//未決定の桁数
  
  string ans="";
  int index;
  char next_
  REP(i,digits){
    index = to[matches];
    next_ = '0' + a[index];
    ans += next_;
    matches -= consume[a[index]];
  }
    
  
  cout<<ans<<endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:18: error: expected initializer before 'for'
    2 | #define REP(i,n) for(int i=0;i<n;i++)
      |                  ^~~
a.cc:124:3: note: in expansion of macro 'REP'
  124 |   REP(i,digits){
      |   ^~~
a.cc:124:7: error: 'i' was not declared in this scope
  124 |   REP(i,digits){
      |       ^
a.cc:2:30: note: in definition of macro 'REP'
    2 | #define REP(i,n) for(int i=0;i<n;i++)
      |                              ^
Language: C++

#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  int consume[]={-1,2,5,5,4,5,6,3,7,6};
  int n,m;
  cin>>n>>m;
  vector<int> a(m);
  REP(i,m){
    cin>>a[i];
  }
  
  int dp[n+1]={};//マッチをi本使って作れる最大の桁数を格納する。
  REP(i,n){
    REP(j,m){
      if(i+1-consume[a[j]]<0)continue;
      dp[i+1] = max(dp[i+1],dp[i+1-consume[a[j]]]+1);
    }
  }
  
  sort(a.begin(),a.end(),greater<int>());
  int matches = n;//残りのマッチの数
  int digits = dp[n];//未決定の桁数
  
  string ans="";
  char next_;
  while(matches>0 digits>0){
    REP(i,m){
      if(matches-consume[a[i]]<0)continue;
      if(dp[matches-consume[a[i]]]==(digits-1)){
        matches -= consume[a[i]];
        digits--;
        next_ = '0' + a[i];
        break;
      }else{
        continue;
      }
    }
    ans += next_;
  }
  
  cout<<ans<<endl;
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:113:18: error: expected ')' before 'digits'
  113 |   while(matches>0 digits>0){
      |        ~         ^~~~~~~
      |                  )
a.cc:113:27: error: expected ';' before ')' token
  113 |   while(matches>0 digits>0){
      |                           ^
      |                           ;
Language: C++

#include<bits/stdc++.h>

using namespace std;

void chmax( string &a, string b){
 if( a == "-"){ a = b;}// aが未更新だった場合
  //それ以外の場合はaとbの大小比較
  if( b.size() > a.size()){ a = b;}

  else{
    //aとbの桁数が一致した時、最高位から順に調べていく
   a = max( a, b); }
     }
}
 
 
  
int match[] = {0,2,5,5,4,5,6,3,7,6};


string dp[10100];
//dpは入力が整数で出力がstring

int main(){
int N,M; cin >> N >> M;
  vector<char> A(M);
  for(int i = 0; i < M; i++){ cin >> A[i];}
  for(int i = 0; i < 10100; i++){ dp[i] = "-";}
  //-は未記入 テーブルを記入していく
  dp[0] = ""; 
  for(int i = 0; i < 10010; i++){
    for(int j = 0; j < M; j++){
      //配るDP
   if( dp[i] != "-"){
   chmax( dp[i + match[A[j] - '0']], dp[i] + A[j]); }}}
  
  cout << dp[N] << endl; return 0;}


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

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


int main(){
  int n, m;
  cin >> n >> m;
  int c[10]={0, 2, 5, 5, 4, 5, 6, 3, 7, 6}
  vector<int>a(m);
  for(int i = 0; i < m; i++) cin >> a[i];
  int dp[10005];
  
  for(int i = 0; i < m; i++){
		for(int j = c[a[i]]; j <= n;j++)
			dp[j] = max(dp[j],dp[j-c[a[i]]]+1);
	}
  
  sort(a,a+m);
	m--;
	while(n>0){
		if(n-c[a[m]] >= 0 && dp[n]==dp[n-c[a[m]]]+1){
			n -= c[a[m]];
			cout<<a[m];
		}else m--;
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:3: error: expected ',' or ';' before 'vector'
    9 |   vector<int>a(m);
      |   ^~~~~~
a.cc:10:37: error: 'a' was not declared in this scope
   10 |   for(int i = 0; i < m; i++) cin >> a[i];
      |                                     ^
a.cc:14:31: error: 'a' was not declared in this scope
   14 |                 for(int j = c[a[i]]; j <= n;j++)
      |                               ^
a.cc:18:8: error: 'a' was not declared in this scope
   18 |   sort(a,a+m);
      |        ^
Language: C++

#include <iostream>
using namespace std;
const string MIN = "(^ ω ^)";

int N, M;
int A[10];
int B[10] = {0,2,5,5,4,5,6,3,7,6};
string dp[10101]; // dp[i] := maximum num of using i matches

void chmax(string &a, string b) {
    if(a == MIN) a = b;

    if(a.size() < b.size()) a = b;
    else if(a.size() == b.size()) {
        if(a < b) a = b;
    }
}

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> N >> M;
    for(int i=0,i < M; ++i) cin >> A[i];

    for(int i=0,i < 10101; ++i) dp[i] = MIN;
    dp[0] = "";

    for(int i = 0;i < N;i++){
        if(dp[i] == MIN) continue;
        for(int a : A) chmax( dp[i + B[a]], dp[i] + (char)(a + '0') );
    }
    cout << dp[N] << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:18: error: expected ';' before '<' token
   22 |     for(int i=0,i < M; ++i) cin >> A[i];
      |                  ^~
      |                  ;
a.cc:22:19: error: expected primary-expression before '<' token
   22 |     for(int i=0,i < M; ++i) cin >> A[i];
      |                   ^
a.cc:24:18: error: expected ';' before '<' token
   24 |     for(int i=0,i < 10101; ++i) dp[i] = MIN;
      |                  ^~
      |                  ;
a.cc:24:19: error: expected primary-expression before '<' token
   24 |     for(int i=0,i < 10101; ++i) dp[i] = MIN;
      |                   ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
int len[10010];
int res[10010];
int dp[10010];
int n,m;
int x;
bool yes[10010];
int cost[10]={1e9,2,5,5,4,5,6,3,7,6};
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>x;
		yes[x]=true;
	}
	memset(res,-1,sizeof(res));
	res[0]=0;
	for(int i=1;i<=n;i++){
		for(int j=9;j>=1;j--){
			if(cost[j]<=i&&yes[j]&&res[i-cost[j]]!=-1){
				if(len[i]<len[i-cost[j]]+1){
					len[i]=len[i-cost[j]]+1;
					res[i]=j;
					dp[i]=i-cost[j];
				}
			}
		}
	}
	for(int i=n;i;i=dp[i])
		cout<<res[i]; 
	return 0;
}


Compiler output:
a.cc:9:15: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
    9 | int cost[10]={1e9,2,5,5,4,5,6,3,7,6};
      |               ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define bint vector<int>
#define minus qwertyuiopasdfghjklzxcvbnm
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
struct hugenum{
	int digits;
	int cnt[10];
	hugenum(){
		digits=0;
		memset(cnt,0,sizeof(cnt)); 
	}
}dp[10010];
int cost[10]={1e9,2,5,5,4,5,6,3,7,6};
bool vis[10010];
bool big(hugenum a,hugenum b){
	if(a.digits!=b.digits)
		return a.digits>b.digits;
	for(int i=9;i>=1;i--)
		if(a.cnt[i]!=b.cnt[i])
			return a.cnt[i]>b.cnt[i];
	return 0;
}
int n,m;
bool yes[10];
int x;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>x;
		yes[x]=true;
	}
	vis[0]=true;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=9;j++)if(yes[j]&&cost[j]<=i&&vis[i-cost[j]]){
			hugenum x=dp[i-cost[j]];
			x.cnt[j]++;
			x.digits++;
			if(big(x,dp[i])){
				dp[i]=x;
			}
			vis[i]=true;
		}
	}
	for(int i=9;i>=1;i--){
		for(int j=1;j<=dp[n].cnt[i];j++)
			cout<<i;
	}
	return 0;
}


Compiler output:
a.cc:20:15: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
   20 | int cost[10]={1e9,2,5,5,4,5,6,3,7,6};
      |               ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
int len[10010];
int res[10010];
int dp[10010];
int n,m;
int x;
bool yes[10010];
int cost[10]={1e9,2,5,5,4,5,6,3,7,6};
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>x;
		yes[x]=true;
	}
	memset(res,-1,sizeof(res));
	res[0]=0;
	for(int i=1;i<=n;i++){
		for(int j=9;j>=1;j--){
			if(cost[j]<=i&&yes[j]&&res[i-cost[j]]!=-1){
				if(len[i]<len[i-cost[j]]+1){
					len[i]=len[i-cost[j]]+1;
					res[i]=j;
					dp[i]=i-cost[j];
				}
			}
		}
	}
	for(int i=n;i;i=dp[i])
		cout<<res[i]; 
	return 0;
}


Compiler output:
a.cc:16:15: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
   16 | int cost[10]={1e9,2,5,5,4,5,6,3,7,6};
      |               ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define uniq(x) (x).erase(unique(ALL(x)),(x).end())
#define SORT(x) sort(ALL(x))
#define REV(x) reverse(ALL(x))
#define foreach(it,x) for(__typeof((x).begin()) it=(x).begin();it!=(x).end();it++)
#define debug(x) cerr<<#x<<"="<<(x)<<endl
#define gett() cerr<<"Time:"<<clock()<<"ms."<<endl
bool bigger(string a,string b){
	if(a.size()!=b.size())
		return a.size()>b.size();
	for(int i=0;i<a.size();i++)
		if(a[i]!=b[i])
			return a[i]>b[i];
	return false;
}
int n,m,x;
string dp[10010];
bool yes[10];
int cnt[10]={1e9,2,5,5,4,5,6,3,7,6};
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>x;
		yes[x]=1;
	}
	for(int i=0;i<=n;i++)
		dp[i]=" ";
	dp[0]="";
	for(int i=1;i<=n;i++){
		for(int j=9;j>=1;j--){
			if(yes[j]&&cnt[j]<=i&&dp[i-cnt[j]]!=" "){
				string mm=dp[i-cnt[j]]+(char)(j+'0');
				sort(mm.begin(),mm.end());
				reverse(mm.begin(),mm.end());
				if(bigger(mm,dp[i])){
					dp[i]=mm;
				}
			}
		}
	}
	cout<<dp[n]<<endl;
	return 0;
}


Compiler output:
a.cc:21:14: error: narrowing conversion of '1.0e+9' from 'double' to 'int' [-Wnarrowing]
   21 | int cnt[10]={1e9,2,5,5,4,5,6,3,7,6};
      |              ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const __int64 INF=2147483647;
const int mtc[]={0,2,5,5,4,5,6,3,7,6};
vector<int> num;
string ans,now;
int Left;
string max(string a,string b)
{
	if(a.length()!=b.length())
		return a.length()>b.length()?a:b;
	return a>b?a:b;
}
void dfs(int x)
{
	if(x==num.size))
	{
		if(Left==0)
			ans=max(ans,now);
		return ;
	}
	int L=Left;
	string A=now;
	for(int i=0;i<=L/(mtc[num[x]]);i++)
	{
		dfs(x+1);
		Left-=mtc[num[x]];
		now+=(char)('0'+num[x]);
	}
	now=A;
	Left=L;
	return ;
}
int main()
{
	cin>>Left;
	int M;
	cin>>M;
	while(M--)
	{
		int x;
		cin>>x;
		num.push_back(x);
	}
	sort(num.begin(),num.end(),greater<int>());
	dfs(0);
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc:3:7: error: '__int64' does not name a type; did you mean '__int64_t'?
    3 | const __int64 INF=2147483647;
      |       ^~~~~~~
      |       __int64_t
a.cc: In function 'void dfs(int)':
a.cc:16:19: error: invalid use of member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::size() const [with _Tp = int; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   16 |         if(x==num.size))
      |               ~~~~^~~~
      |                       ()
a.cc:16:24: error: expected primary-expression before ')' token
   16 |         if(x==num.size))
      |                        ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, m;
vector<int> a;
int change[9];
string dp[11000];
const string MINUSINF = "-";
void chmax(string &a, string b) //参照を渡して書き換える
{
    if (a == MINUSINF)
        a = b;
    else if (a.size() < b.size()) //sizeが大きいなら桁数が大きい
        a = b;
    else if (a.size() == b.size()) //辞書順が大きい
    {
        if (a < b)
            a = b;
    }
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int temp;
        cin >> temp;
        a.push_back(temp)
    }
    int match[9] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
    for (int i = 0; i < 11000; ++i)
        dp[i] = MINUSINF;
    dp[0] = "";
    for (int i = 0; i <= n; ++i)
    {
        if (dp[i] == MINUSINF)
            continue;
        for (int j = 0; j < a.size(); j++)
            chmax(dp[i + match[a[j] - 1]], dp[i] + (char)('0' + a[j]));
    }
    cout << dp[n] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:26: error: expected ';' before '}' token
   60 |         a.push_back(temp)
      |                          ^
      |                          ;
   61 |     }
      |     ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n)-1;i>=0;i--)
#define repf(i,j,n) for(int i=(j);i<(n);i++)

const int maxn=10020;
int dp[maxn];

void amax(int& x,int y){if(x<y)x=y;}

signed main(){
int n,m;cin>>n>>m;
vector<int>a(m);
for(auto&& u:a)cin>>u;
vector<int>dp(n+15,-1);
dp[0]=0;

vector<int> digit={0,2,5,5,4,5,6,3,7,6};
rep(i,n){
if(dp[i]<0)continue;
repf(j,m){
amax(dp[i+digit[a[j]]],dp[i]+1);
}
}
rep(i,30)cerr<<dp[i]<<" ";
cerr<<endl;
int num=dp[n];
int cnt=n;
cerr<<num;
rep(i,num){
repr(j,m){
if(cnt-digit[a[j]]>=0&&dp[cnt]==dp[cnt-digit[a[j]]+1){
	cout<<j;cnt-=digit[a[j]];break;
}
}
}
cout<<endl;	
}



Compiler output:
a.cc:23:9: error: macro "repf" requires 3 arguments, but only 2 given
   23 | repf(j,m){
      |         ^
a.cc:6:9: note: macro "repf" defined here
    6 | #define repf(i,j,n) for(int i=(j);i<(n);i++)
      |         ^~~~
a.cc: In function 'int main()':
a.cc:23:1: error: 'repf' was not declared in this scope
   23 | repf(j,m){
      | ^~~~
a.cc:34:53: error: expected ']' before ')' token
   34 | if(cnt-digit[a[j]]>=0&&dp[cnt]==dp[cnt-digit[a[j]]+1){
      |                                                     ^
      |                                                     ]
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n)-1;i>=0;i--)
#define repf(i,j,n) for(int i=(j);i<(n);i++)

void amax(int a,int b){if(a<b)a=b;}

signed main(){
int n,m;cin>>n>>m;
vector<int> dp(n+10,-1);dp[0]=0;
vector<int> digit={0,2,5,5,4,5,6,3,7,6};
rep(i,n){
rep(j,1,10){
if(dp[i]!=-1)amax(dp[i+digit[j]],dp[i]+1);
}
}
int num=dp[n];
int cnt=n;
while(cnt>0){
repr(j,10){
if(cnt-digit[j]>=0&&dp[cnt]==dp[cnt-digit[j]]+1){
	cout<<j;cnt-=digit[j];break;
}
}
}
	
}



Compiler output:
a.cc:15:11: error: macro "rep" passed 3 arguments, but takes just 2
   15 | rep(j,1,10){
      |           ^
a.cc:4:9: note: macro "rep" defined here
    4 | #define rep(i,n) for(int i=0;i<(n);i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:15:1: error: 'rep' was not declared in this scope
   15 | rep(j,1,10){
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repr(i,n) for(int i=(n)-1;i>=0;i--)
#define repf(i,j,n) for(int i=(j);i<(n);i++)

void amax(a,b){if(a<b)a=b;}

signed main(){
int n,m;cin>>n>>m;
vector<int> dp(n+10,-1);dp[0]=0;
vector<int> digit={0,2,5,5,4,5,6,3,7,6};
rep(i,n){
rep(j,1,10){
if(dp[i]!=-1)amax(dp[i+digit[j]],dp[i]+1);
}
}
int num=dp[n];
int cnt=n;
while(cnt>0){
repr(j,10){
if(cnt-digit[j]>=0&&dp[cnt]==dp[cnt-digit[j]]+1){
	cout<<j;cnt-=digit[j];break;
}
}
}
	
}



Compiler output:
a.cc:15:11: error: macro "rep" passed 3 arguments, but takes just 2
   15 | rep(j,1,10){
      |           ^
a.cc:4:9: note: macro "rep" defined here
    4 | #define rep(i,n) for(int i=0;i<(n);i++)
      |         ^~~
a.cc:8:6: error: variable or field 'amax' declared void
    8 | void amax(a,b){if(a<b)a=b;}
      |      ^~~~
a.cc:8:11: error: 'a' was not declared in this scope
    8 | void amax(a,b){if(a<b)a=b;}
      |           ^
a.cc:8:13: error: 'b' was not declared in this scope
    8 | void amax(a,b){if(a<b)a=b;}
      |             ^
a.cc: In function 'int main()':
a.cc:15:1: error: 'rep' was not declared in this scope
   15 | rep(j,1,10){
      | ^~~
Language: C++

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

int main() {
  int n = 0;
  int m = 0;
  int a[9], am[9];
  fill_n(a, 9, 0);
  fill_n(am, 9, 0);
  int amap[9];
  amap[0] = 2;
  amap[1] = 5;
  amap[2] = 5;
  amap[3] = 4;
  amap[4] = 5;
  amap[5] = 6;
  amap[6] = 3;
  amap[7] = 7;
  amap[8] = 6;

  cin >> n;
  cin >> m;
  for(int i=0; i<m; ++i){
    cin >> a[i];
  }
  sort(a, a+m, greater<int>());
  for(int i=0; i<m; ++i) {
    am[i] = amap[a[i]-1];
//    cout << a[i] << ":" <<am[i] << ", ";
  }
//  cout << endl;

  int dp[10010][3];
  fill_n(dp[0], 10010*2, 0);
  
  vector<vector<int>> vv = vector<vector<int>>(10010);
  for(int i=0; i<=n; ++i){
    for(int j=0; j<m; ++j){
      if (i - am[j] >= 0) {
        if (dp[i-am[j]][2] + am[j] <= n) {
          if (dp[i][0] == 0 ||
              dp[i-am[j]][0] + 1 > dp[i][0] ||
              (dp[i-am[j]][0] + 1 == dp[i][0] && dp[i-am[j]][2] + am[j] > dp[i][2]) || 
              (dp[i-am[j]][0] + 1 == dp[i][0] && dp[i-am[j]][2] + am[j] == dp[i][2] && dp[i-am[j]][1] + a[j] > dp[i][1])
              ){
            dp[i][0] = dp[i-am[j]][0] + 1;
            dp[i][1] = dp[i-am[j]][1] + a[j];
            dp[i][2] = dp[i-am[j]][2] + am[j];
            vv[i] = vv[i-am[j]];
            vv[i].push_back(a[j]);
          }
        }
      }
    }
  }

//  for(int i=0; i <= n; ++i) {
//    cout << i << ": " << dp[i][0] << ", " << dp[i][1] << ", " << dp[i][2] << " : ";
//    for(auto itr = vv[i].begin(); itr != vv[i].end(); ++itr){
//      cout << *itr;
//    }
//    cout << endl;
//  }
  
  vector<int> v;
  for(int i=n; i>=0; --i){
    if (!vv[n].empty()) {
      v = vv[n];
      break;
    }
  }
  
  sort(v.begin(), v.end(), greater<int>());
  for (auto itr = v.begin(); itr != v.end(); ++itr) {
    cout << *itr;
  }
  cout << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   27 |   sort(a, a+m, greater<int>());
      |   ^~~~
      |   short
Language: C++

#include <iostream>
#include <vector>

using namespace std;

int digit_count[10];

bool dfs(vector<pair<int, int>> p, int n)
{
  if (n == 0) return true;

  for (auto&& e : p) {
    if (n >= e.first) {
      n -= e.first;
      digit_count[e.second]++;
      if (dfs(p, n)) return true;
      n += e.first;
      digit_count[e.second]--;
    }
  }

  return false;
}

int main()
{
  static const int num[] {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
  int n, m;
  cin >> n >> m;
  vector<bool> f(10, false);

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

  vector<pair<int, int>> p;

  for (int i = 9; i > 0; i--) {
    if (f[i]) {
      p.push_back({num[i], i});
    }
  }

  stable_sort(begin(p), end(p), [](auto a, auto b){return a.first < b.first;});

  dfs(p, n);

  string ans;
  for (int i = 9; i > 0; i--) {
    for (int j = 0; j < digit_count[i]; j++) {
      ans += to_string(i);
    }
  }
  cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:46:3: error: 'stable_sort' was not declared in this scope
   46 |   stable_sort(begin(p), end(p), [](auto a, auto b){return a.first < b.first;});
      |   ^~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int dp[10005][10];
int t[10];
int main(){
  for(int i=0;i<10005;i++) for(int j=0;j<10;j++) dp[i][j]=0;
  t[1]=2;t[2]=5;t[3]=5; t[4]=4;t[5]=5;t[6]=6;t[7]=3;t[8]=7;t[9]=6;
  t[0] = 100000000;
  vector<bool> v(10);
  int n,m; cin >> n >> m;
  for(int i=0;i<10;i++) v[i] = false;
  for(int i=0;i<m;i++){ 
    int temp; 
    cin >> temp;
    v[temp] = true;
  }
  for(int i=n;i>1;i--){
    int psum = 0;
    for(int k=1;k<=9;k++){psum += dp[i][k]; pnsum += dp[i][k]*k;}
    if(i!=n && psum==0) continue;
    psum++;
  	for(int j=1;j<=9;j++) if(v[j] && i-t[j] >= 0){
      int p = i-t[j], isum=0;
      for(int k=1;k<=9;k++){ isum += dp[p][k];}
      if(isum < psum){
      	for(int k=1;k<=9;k++) dp[p][k] = dp[i][k];
        dp[p][j]++;
      }
      else if(isum==psum){
      	bool flag = true;
        for(int k=9;k>=1;k--){
          if(dp[p][k] < dp[i][k] + (j==k ? 1 : 0)) break;
          else if(dp[p][k] == dp[i][k]) continue;
          else{flag = false; break;}
        }
        if(flag){
        	for(int k=1;k<=9;k++) dp[p][k] = dp[i][k];
        	dp[p][j]++;
        }
      }
    }
  }
  for(int i=9;i>=1;i--) for(int j=0;j<dp[0][i];j++) putchar('0'+i);
  cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:45: error: 'pnsum' was not declared in this scope; did you mean 'psum'?
   21 |     for(int k=1;k<=9;k++){psum += dp[i][k]; pnsum += dp[i][k]*k;}
      |                                             ^~~~~
      |                                             psum
Language: C++

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

typedef vector<int> vi;

int main(){
  int N, M;cin>>N>>M;
  vi A;
  for (int i=0;i<M;++i){int a;cin>>a;A.push_back(a);}

  map<int,int> n_match={{1,2}, {2,5}, {3,5}, {4,4}, {5,5}, {6,6}, {7,3}, {8,7}, {9,6}};

  vi use_list(9, -1);

  for (int i=2;i<=7;++i){
    for (int m=0;m<M;++m){
      if(n_match[A[m]]==i) use_list[i]=max(A[m], use_list[i]);
    }
  }

  //dp[N][0]に、桁数を格納.dp[i][j]には、　10-jの使用個数を格納
  int dp[N+10][10];
  memset(dp, 0, sizeof(dp));

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

  for (int i=0;i<9;++i){
    for (int j=0;j<dp[N][i];++j){cout << 10-j;}
  }

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:24: error: invalid array assignment
   30 |       dp[i+use_list[m]]=max(dp[i], dp[i+use_list[m]]);
      |       ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int n;
int m;
vector<int> num(m);
int match(int t){
  if(t==1){return 2;}
  else if(t==2){return 5;}
  else if(t==3){return 5;}
  else if(t==4){return 4;}
  else if(t==5){return 5;}
  else if(t==6){return 6;}
  else if(t==7){return 3;}
  else if(t==8){return 7;}
  else if(t==9){return 6;}
  else{return 0;}
}
  for(int l=0;l<m;l++){num[l]=match(num[l];)}
int dfs(n,num[m]){

  
  
int main()

Compiler output:
a.cc:18:3: error: expected unqualified-id before 'for'
   18 |   for(int l=0;l<m;l++){num[l]=match(num[l];)}
      |   ^~~
a.cc:18:15: error: 'l' does not name a type
   18 |   for(int l=0;l<m;l++){num[l]=match(num[l];)}
      |               ^
a.cc:18:19: error: 'l' does not name a type
   18 |   for(int l=0;l<m;l++){num[l]=match(num[l];)}
      |                   ^
a.cc:19:17: error: expression list treated as compound expression in initializer [-fpermissive]
   19 | int dfs(n,num[m]){
      |                 ^
a.cc:19:18: error: expected ',' or ';' before '{' token
   19 | int dfs(n,num[m]){
      |                  ^
Language: C++

#include <iostream>
#include <cstdlib>
void f(int n, int k, int i, int d[10], int u[10]) {
    if (i == 0) {
        if (n == 0) {
            for (int j = 9; j >= 0; j--) {
                int dj = d[j];
                for (int x = 0; x < dj; x++) {
                    std::cout << j;
                }
            }
            std::exit(0);
        }
    } else if (u[i]) {
        int u_min = INT_MAX, u_max = 0;
        for (int j = 0; j < i; j++) if (u[j] && u_min > u[j]) u_min = u[j];
        for (int j = 0; j < i; j++) if (u[j] && u_max < u[j]) u_max = u[j];
        int lo = 0;
        int hi = n / u[i];
        if (u_max) {
            if (u[i] > u_max) lo = std::max(lo, (n - k * u_max) / (u[i] - u_max));
            if (u[i] > u_min) hi = std::min(hi, (n - k * u_min) / (u[i] - u_min));
            if (u[i] < u_max) hi = std::min(hi, (n - k * u_max) / (u[i] - u_max));
            if (u[i] < u_min) lo = std::max(lo, (n - k * u_min) / (u[i] - u_min));
        } else {
            lo = hi = n / u[i];
        }
        for (int j = hi; j >= lo; j--) {
            d[i] = j;
            f(n - u[i] * j, k - j, i - 1, d, u);
        }
    } else {
        d[i] = 0;
        f(n, k, i - 1, d, u);
    }
}
int main() {
    int u[10] = { 0, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
    int n, m;
    std::cin >> n >> m;
    int w[10] = {};
    for (int i = 0; i < m; i++) {
        int a;
        std::cin >> a;
        w[u[a]] = a;
    }
    bool b[10] = {};
    for (int i = 0; i < 10; i++) {
        if (w[i]) b[w[i]] = true;
    }
    for (int i = 0; i < 10; i++) {
        if (!b[i]) u[i] = 0;
    }
    int u_min = INT_MAX;
    for (int i = 0; i < 10; i++) if (u[i] && u_min > u[i]) u_min = u[i];
    int k = n / u_min;
    int d[10] = {};
    for (;;) {
        f(n, k, 9, d, u);
        k--;
    }
}

Compiler output:
a.cc: In function 'void f(int, int, int, int*, int*)':
a.cc:15:21: error: 'INT_MAX' was not declared in this scope
   15 |         int u_min = INT_MAX, u_max = 0;
      |                     ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <cstdlib>
  +++ |+#include <climits>
    3 | void f(int n, int k, int i, int d[10], int u[10]) {
a.cc:17:49: error: 'u_max' was not declared in this scope
   17 |         for (int j = 0; j < i; j++) if (u[j] && u_max < u[j]) u_max = u[j];
      |                                                 ^~~~~
a.cc:20:13: error: 'u_max' was not declared in this scope
   20 |         if (u_max) {
      |             ^~~~~
a.cc: In function 'int main()':
a.cc:54:17: error: 'INT_MAX' was not declared in this scope
   54 |     int u_min = INT_MAX;
      |                 ^~~~~~~
a.cc:54:17: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

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

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


int main() {

    int N, M;
    int A[9];

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

    vector<int> dp(10001);
    dp[0] = 0;
    for (int i = 1; i <= N; i++) {
        dp[i] = INT_MIN;
        for (int j = 0; j < M; j++) {
            if ( i >= cost[A[j]]){
                dp[i] = max(dp[i - cost[A[j]]] + 1, dp[i]);
            }
        }
    }
    sort(A, A + M, greater<int>());
    int index = N;
    string str;
    for (int i = 0; i < dp[N]; i++) {

        for (int j = 0; j < M; j++) {

            int n = cost[A[j]];
            if (index >= n and dp[index - n] == dp[index] - 1) {

                index -= n;
                str += A[j] + '0';
                break;
            }
        }
    }
    cout << str << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:24:17: error: 'INT_MIN' was not declared in this scope
   24 |         dp[i] = INT_MIN;
      |                 ^~~~~~~
a.cc:5:1: note: 'INT_MIN' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <algorithm>
  +++ |+#include <climits>
    5 | using namespace std;
Language: C++

#include <iostream>
#include <cstring>
#include <string>
#include <vector>
using namespace std;
typedef unsigned long long ll;

int N, M;
int A[11];
int cost[11] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
ll Num[10010];

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

    Num[0] = 0;
    for (int i = 0; i < N+1; i++) {
        vector<ll> v;
        v.push_back(0);
        for (int idx = 0; idx < M; idx++) {
            if (i - cost[A[idx]] < 0)
                continue;
            else if (i == cost[A[idx]])
                v.push_back(A[idx]);
            else if (Num[i - cost[A[idx]]] != 0) {
            string numStr = to_string(Num[i - cost[A[idx]]]);
            int j = 0;
            char cur = (char)A[idx];
            for (;j < numStr.size(); j++) {
                if ( cur >= numStr[j])
                    break;
            }
            numStr.insert(j, to_string(A[idx]));
            v.push_back(atoi(numStr.c_str()));
            }
            else
                continue;
            Num[i] = *max_element(v.begin(), v.end());
        }
    }
    cout << Num[N] << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:23: error: 'max_element' was not declared in this scope
   39 |             Num[i] = *max_element(v.begin(), v.end());
      |                       ^~~~~~~~~~~
Language: C++

#include <iostream>
#include <cstring>
#include <string>
#include <vector>
using namespace std;
typedef unsigned long long ll;

int N, M;
int A[11];
int cost[11] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
ll Num[10010];

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

    Num[0] = 0;
    for (int i = 0; i < N+1; i++) {
        vector<ll> v;
        v.push_back(0);
        for (int idx = 0; idx < M; idx++) {
            if (i - cost[A[idx]] < 0)
                continue;
            else if (i == cost[A[idx]])
                v.push_back(A[idx]);
            else if (Num[i - cost[A[idx]]] != 0) {
            string numStr = to_string(Num[i - cost[A[idx]]]);
            int j = 0;
            char cur = (char)A[idx];
            for (;j < numStr.size(); j++) {
                if ( cur >= numStr[j])
                    break;
            }
            numStr.insert(j, to_string(A[idx]));
            v.push_back(atoi(numStr.c_str()));
            }
            else
                continue;
/*            for (int i = 0; i < v.size(); i++) {
                cout << v[i] << ' ';
            }
            cout << '\n';
            */
            Num[i] = *max_element(v.begin(), v.end());
        }
    }
    cout << Num[N] << '\n';
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:23: error: 'max_element' was not declared in this scope
   44 |             Num[i] = *max_element(v.begin(), v.end());
      |                       ^~~~~~~~~~~
Language: C++

if __name__ == "__main__":
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    cost = [0, 2, 5, 5, 4, 5, 6, 3, 7, 6]
    Num = [0] * (N+10)

    Num[0] = 0
    for i in range(1, N+1):
        L = [0]
        for idx in A:
            if i - cost[idx] < 0:
                continue
            elif i == cost[idx]:
                L.append(idx)
            elif Num[i - cost[idx]] != 0:
                l = list(str(Num[i - cost[idx]])) + [str(idx)]
                l.sort(reverse = 1)
                L.append(int("".join(l)))
            else:
                continue
            Num[i] = max(L)

    print(Num[N])

Compiler output:
a.cc:1:1: error: expected unqualified-id before 'if'
    1 | if __name__ == "__main__":
      | ^~
Language: Java



		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int m = scanner.nextInt();
			int[] aA = IntStream.range(0, m).map(i -> scanner.nextInt()).toArray();
			final Map<Integer, Integer> CONST_NUM = new HashMap<Integer, Integer>() {
				{
					put(1, 2);
					put(2, 5);
					put(3, 5);
					put(4, 4);
					put(5, 5);
					put(6, 6);
					put(7, 3);
					put(8, 7);
					put(9, 6);
				}
			};
			String[] dp = new String[10009];
			/*
			 * dp[i]の時に、作られている最大の数値
			 * 配るDPで実装
			 */
			//dp[0]の時は、空
			dp[0] = "";
			for (int i = 0; i < 10000; i++) {
				/*
				 * dp[0]のみ初期化しておいて、その後、aA[]に値がないやつは飛ばす
				 * nullという文字列が入ると文字列の最大値判定上困る
				 * null値だったらいいんだけどね。
				 */
				if (dp[i] == null) {
					continue;
				}
				for (int j = 0; j < aA.length; j++) {
					/*
					 * dp[aA[j]の桁を選択した場合のマッチ消費数]
					 * = max(既に格納されている数値 , dp[現在のマッチ消費数]+aA[j]を選択した場合の数値)
					 */
					dp[i + CONST_NUM.get(aA[j])] = max(dp[i + CONST_NUM.get(aA[j])], dp[i] + aA[j]);
				}
			}
			System.out.println(dp[n]);
		}
	

Compiler output:
Main.java:3: error: class, interface, enum, or record expected
		try (Scanner scanner = new Scanner(System.in)) {
		^
Main.java:5: error: unnamed classes are a preview feature and are disabled by default.
			int m = scanner.nextInt();
			^
  (use --enable-preview to enable unnamed classes)
Main.java:26: error: class, interface, enum, or record expected
			dp[0] = "";
			^
Main.java:27: error: class, interface, enum, or record expected
			for (int i = 0; i < 10000; i++) {
			^
Main.java:27: error: class, interface, enum, or record expected
			for (int i = 0; i < 10000; i++) {
			                ^
Main.java:27: error: class, interface, enum, or record expected
			for (int i = 0; i < 10000; i++) {
			                           ^
Main.java:35: error: class, interface, enum, or record expected
				}
				^
Main.java:36: error: class, interface, enum, or record expected
				for (int j = 0; j < aA.length; j++) {
				                ^
Main.java:36: error: class, interface, enum, or record expected
				for (int j = 0; j < aA.length; j++) {
				                               ^
Main.java:42: error: class, interface, enum, or record expected
				}
				^
Main.java:45: error: class, interface, enum, or record expected
		}
		^
11 errors
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <deque>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M, temp;
  std::cin >> N >> M;
  vvi dp = vv(N+1, M + 1, 0, int);
  vvi usable = vv(M, 2, 0, int);
  int mach[9] = {2, 5, 5, 4, 5, 6, 3, 7, 6};
  range(i, M){
    std::cin >> temp;
    usable[i][0] = temp;
    usable[i][1] = mach[temp-1];
    //1: number 2: the number of match
  }
  sort(usable.begin(), usable.end());
  reverse(usable.begin(), usable.end());
  ranges(i, 1, N+1){
    dp[i][M+1] = -1;
  }
  ranges(i, 1, N+1){
    range(j, M){
      if(usable[j][1] > i) {
        continue;
      }else if(dp[i - usable[j][1]][M+1]== -1){
        continue;
      }else{
        if(dp[i-usable[j][1]][M+1] > dp[i][M+1]){
          range(k, M){
            dp[i][k] = dp[i - usable[j][1]][k];
          }
          dp[i][j]++;
          dp[i][M+1] = dp[i-usable[j][1]][M+1]+1;
        }
      }
    }
  }
  range(i, M){
    range(j, dp[N][i]){
      std::cout << usable[i][0];
    }
  }
  return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main(){
  int N, M;cin>>N>>M;
  vi num_match={0,2,5,5,4,5,6,3,7,6};
  vi A;
  for (int i=0;i<M;++i){
    int a;cin>>a;A.push_back(a);
  }

  vi uselist(8,-1);

  for (int m=2;m<=7;++m){
    for (int i=0;i<M;++i){
      if(num_match[A[i]]==m){uselist[m]=max(uselist[m], A[i]);}
    }
  }


  //n本のマッチ棒を使って最大数を作った時の桁数をdp[n][0]に格納し、
  //pが使われる個数をdp[n][p]に格納する。
  vvi dp(N+10, vi(10, 0));
  //initialization
  dp[0]=vi(10,0);

  for (int i=0;i<N;++i){
    for (int m=2;m<=7;++m){
      if (uselist[m]==-1){continue;}
      //uselist[m]=1の時は、pとして9thに格納したい
      int p=10-uselist[m];
      dp[n][0]++;
      dp[n][p]++;
      dp[n+m]=max(dp[n], dp[n+m]);
      dp[n][0]--;
      dp[n][p]--;
    }
  }

  for (int i=9;i>=1;++i){
    //数字として大きい方から出力したい。それは、番号が若い方。
    int T=dp[N][10-i];
    for (int j=0;j<T;++j){
      cout << i;
    }
  }
  cout << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:10: error: 'n' was not declared in this scope
   34 |       dp[n][0]++;
      |          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int m[10] = {0,2,5,5,4,5,6,3,7,6};
int main(){
  int n, m;
  cin >> n >> m;
  vector<int> dp(n + 1, 0);
  vector<int> p(m);
  for(int & i : p) cin >> i;
  sort(p.begin(), p.end());
  for(int i = 1; i <= n; i++){
  	for(int j : p){
    	if(i - m[j] >= 0) dp[i] = max(dp[i], dp[i - m[j]] + 1);
    }
  }
  string s;
  while(n){
    for(int j : p){
      if(n - m[j] >= 0 && dp[n] == dp[n - m[j]] + 1){
        cout << j;
        n -= m[j];
        break;
      }
    }
  }
  cout << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: invalid types 'int[int]' for array subscript
   13 |         if(i - m[j] >= 0) dp[i] = max(dp[i], dp[i - m[j]] + 1);
      |                 ^
a.cc:13:54: error: invalid types 'int[int]' for array subscript
   13 |         if(i - m[j] >= 0) dp[i] = max(dp[i], dp[i - m[j]] + 1);
      |                                                      ^
a.cc:19:15: error: invalid types 'int[int]' for array subscript
   19 |       if(n - m[j] >= 0 && dp[n] == dp[n - m[j]] + 1){
      |               ^
a.cc:19:44: error: invalid types 'int[int]' for array subscript
   19 |       if(n - m[j] >= 0 && dp[n] == dp[n - m[j]] + 1){
      |                                            ^
a.cc:21:15: error: invalid types 'int[int]' for array subscript
   21 |         n -= m[j];
      |               ^
Language: C++


#include "pch.h"
#include <iostream>
#include<queue>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>

using namespace std;
#define lint long long
#define MAX_N 10010
#define INF 1000000000000000
int main() {

	lint N, M; cin >> N >> M;
	vector<pair<lint, lint>> A(9);
	vector<int> An(9);
	for (lint i = 0; i < M; i++)
	{
		lint a; cin >> a;
		switch (a) {
		case 1: A[i] = make_pair(a,2); break;
		case 2: A[i] = make_pair(a,5); break;
		case 3: A[i] = make_pair(a,5); break;
		case 4: A[i] = make_pair(a,4); break;
		case 5: A[i] = make_pair(a,5); break;
		case 6: A[i] = make_pair(a,6); break;
		case 7: A[i] = make_pair(a,3); break;
		case 8: A[i] = make_pair(a,7); break;
		case 9: A[i] = make_pair(a,6); break;
		}

	}
	
	sort(A.begin(), A.end());
	reverse(A.begin(), A.end());
	lint dp[MAX_N];
	dp[0] = 0;
	for (lint i = 1; i <= N; i++)
	{
		lint maxo = -1*INF;
		for (lint j = 0; j < M; j++)
		{
			if (i - A[j].second < 0) continue;
			else{
				maxo = max(maxo, dp[i - A[j].second] + 1);
			}

		}
		dp[i] = maxo;

	}
	//cout << dp[N] << endl;
	
	int k = N;
	for(lint j = dp[N];j > 0;j--) {
		lint i;
		for (i = 0; i < M; i++)
		{
			if (dp[k - A[i].second] == dp[k] - 1) {
				cout << A[i].first;
				break;
			}

		}
		k -= A[i].second;
	}
	cout << endl;
	return 0;
	

}

Compiler output:
a.cc:2:10: fatal error: pch.h: No such file or directory
    2 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++


#include <climits>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;


int num[10] = { 0,2,5,5,4,5,6,3,7,6 };// 添え字に数字を入れると、そのマッチ数が出る

char str[128] = "";

bool try_fill(int match, map<int, int>& digit, char* ptr = str)
{
	if (ptr - str < 0)
		return false;

	for (auto d_ptr = next(digit.begin()); d_ptr != digit.end(); d_ptr++)
	{
		if (match < (*d_ptr).first)
			return false;
		else if (match == (*d_ptr).first)
		{
			*ptr = '0' + (*d_ptr).second;
			return true;
		}
		else
		{
			if (try_fill(match - (*d_ptr).first, digit, ptr + 1))
			{
				*ptr = '0' + (*d_ptr).second;
				return true;
			}
		}
	}
	int tmp = *ptr - '0';
	*ptr = '\0';
	return try_fill(match + num[tmp], digit, ptr - 1);
}

int main()
{
	int n;
	scanf("%d", &n);
	int m;
	scanf("%d", &m);
	map<int, int> digit;

	for (int i = 0; i < m; i++)
	{
		int tmp;
		scanf("%d", &tmp);
		if (digit.find(num[tmp]) != digit.end())
		{
			if (digit[num[tmp]] < tmp)
				digit[num[tmp]] = tmp;
		}
		else
		{
			digit.emplace(num[tmp], tmp);
		}
	}
	//連想配列digitは、マッチの本数をキーとする。値は、そのマッチの本数で書ける最大の数字
	int top = (*digit.begin()).first;
	int match = n % top;
	memset(str, digit[top] + '0', n / top);

	bool x = try_fill(match + top, digit, &str[n / top - 1]);

	for (int i = strlen(str) - 1; i > 0; i--)
	{
		printf("%c", str[i]);
	}
	printf("\n");
}


Compiler output:
a.cc: In function 'int main()':
a.cc:68:9: error: 'memset' was not declared in this scope
   68 |         memset(str, digit[top] + '0', n / top);
      |         ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <map>
  +++ |+#include <cstring>
    7 | 
a.cc:72:22: error: 'strlen' was not declared in this scope
   72 |         for (int i = strlen(str) - 1; i > 0; i--)
      |                      ^~~~~~
a.cc:72:22: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
Language: C++


#include "pch.h"
#include <climits>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <map>

using namespace std;


int num[10] = { 0,2,5,5,4,5,6,3,7,6 };// 添え字に数字を入れると、そのマッチ数が出る

char str[128] = "";

bool try_fill(int match, map<int, int>& digit, char* ptr = str)
{
	if (ptr - str < 0)
		return false;

	for (auto d_ptr = next(digit.begin()); d_ptr != digit.end(); d_ptr++)
	{
		if (match < (*d_ptr).first)
			return false;
		else if (match == (*d_ptr).first)
		{
			*ptr = '0' + (*d_ptr).second;
			return true;
		}
		else
		{
			if (try_fill(match - (*d_ptr).first, digit, ptr + 1))
			{
				*ptr = '0' + (*d_ptr).second;
				return true;
			}
		}
	}
	int tmp = *ptr - '0';
	*ptr = '\0';
	return try_fill(match + num[tmp], digit, ptr - 1);
}

int main()
{
	int n;
	scanf("%d", &n);
	int m;
	scanf("%d", &m);
	map<int, int> digit;

	for (int i = 0; i < m; i++)
	{
		int tmp;
		scanf("%d", &tmp);
		if (digit.find(num[tmp]) != digit.end())
		{
			if (digit[num[tmp]] < tmp)
				digit[num[tmp]] = tmp;
		}
		else
		{
			digit.emplace(num[tmp], tmp);
		}
	}
	//連想配列digitは、マッチの本数をキーとする。値は、そのマッチの本数で書ける最大の数字
	int top = (*digit.begin()).first;
	int match = n % top;
	memset(str, digit[top] + '0', n / top);

	bool x = try_fill(match + top, digit, &str[n / top - 1]);

	for (int i = strlen(str) - 1; i > 0; i--)
	{
		printf("%c", str[i]);
	}
	printf("\n");
}


Compiler output:
a.cc:2:10: fatal error: pch.h: No such file or directory
    2 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.