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

#include <cstdio>
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>

#ifdef _DEBUG
#define DMP(x) cerr << #x << ": " << x << "\n"
#else
#define DMP(x) ((void)0)
#endif

#define int lint

const int MOD = 1000000007, INF = 1111111111;
using namespace std;
typedef long long lint;

int tran(vector<pair<int, int>> &vec, int n) {

	int res, tmp;
	if (vec.size() == 3) {
		for (int i = 0; i * vec[0].first <= n; i++) {
			for (int j = 0; i * vec[0].first + j * vec[1].first <= n; j++) {
				tmp = n - i * vec[0].first - j * vec[1].first;
				res = max(res, i * vec[0].second + j * vec[1].second +
					tmp / vec[2].first * vec[2].second +
					tmp % vec[2].first);
			}
		}
	}	

	if (vec.size() == 2) {
		for (int i = 0; i * vec[0].first <= n; i++) {
			tmp = n - i * vec[0].first;
			res = max(res, i * vec[0].second +
				tmp / vec[1].first * vec[1].second +
				tmp % vec[1].first);
		}
	}

	if (vec.size() == 1) { res = n / vec[0].first * vec[0].second; }
	if (vec.size() == 0) { res = n; }
	return res;
}

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	vector<int> a(3), b(3);
	for (int i = 0; i < 3; i++) cin >> a[i];
	for (int i = 0; i < 3; i++) cin >> b[i];

	vector<pair<int, int>> ab, ba;
	for (int i = 0; i < 3; i++) {
		if (a[i] < b[i]) ab.emplace_back(make_pair(a[i], b[i]));
		if (a[i] > b[i]) ba.emplace_back(make_pair(b[i], a[i]));
	}

	cout << tran(ba, tran(ab, N)) << "\n";

	return 0;
}


Compiler output:
a.cc:17:13: error: 'lint' does not name a type; did you mean 'uint'?
   17 | #define int lint
      |             ^~~~
a.cc:19:7: note: in expansion of macro 'int'
   19 | const int MOD = 1000000007, INF = 1111111111;
      |       ^~~
a.cc:17:13: error: '::main' must return 'int'
   17 | #define int lint
      |             ^~~~
a.cc:51:1: note: in expansion of macro 'int'
   51 | int main() {
      | ^~~
Language: C++

//by xxj
#include<bits/stdc++.h>
using namespace std;
#define fst first
#define snd second
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define lowbit(x) x&-x
const int inf=1e9+7;
const double eps=1e-10;
const ll linf=1e18+7;
const ll hh=523;
//const int mod=;
ll dp[5007];
int a[3],b[3];
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	scanf("%d",&n);
	for (int i=0;i<3;i++){
		scanf("%d",a+i);
	}
	for (int i=0;i<3;i++){
		scanf("%d",b+i);
	}
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	int mx=n;
	for (int i=0;i<3;i++){
		for (int j=a[i];j<=n;j++){
			if (dp[j-a[i]]!=-1){
				dp[j]=max(dp[j],dp[j-a[i]]+b[i]);
				mx=max(mx,n-j+dp[j]);
			}
		}
	}
	memset(dp,-1,sizeof(dp));
	dp[0]=0;
	ll ans=mx;
	for (int i=0;i<3;i++){
		for (int j=b[i];j<=mx;j++){
			if (dp[j-b[i]]!=-1){
				dp[j]=max(dp[j],dp[j-b[i]]+a[i]);
				ans=max(ans,dp[j]+mx-j);
			}
		}
	}
	printf("%lld\n",ans);
	return 0;
}
/*
input:
*/


Compiler output:
a.cc: In function 'int main()':
a.cc:35:39: error: no matching function for call to 'max(int&, long long int)'
   35 |                                 mx=max(mx,n-j+dp[j]);
      |                                    ~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:35:39: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   35 |                                 mx=max(mx,n-j+dp[j]);
      |                                    ~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:35:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |                                 mx=max(mx,n-j+dp[j]);
      |                                    ~~~^~~~~~~~~~~~~~
Language: C++

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

	vector<vector<int>>rate(2,vector<int>(3,0));

	int solve(int n,int pre,int post){
		vector<int>dp(n+1,0);
		rep(i,n)dp[i]=i;
		rep(i,n+1)rep(j,m)if(i>=rate[pre][j]&&rate[pre][j]<rate[post][j])dp[i]=max(dp[i],dp[i-rate[pre][j]]+rate[post][j]);
		return dp[n];
	}

signed main(){
	int n;cin>>n;
	rep(i,2)rep(j,3)cin>>rate[i][j];
	cout<<solve(solve(n,0,1),1,0)<<endl;

	
}

Compiler output:
a.cc: In function 'long long int solve(long long int, long long int, long long int)':
a.cc:11:33: error: 'm' was not declared in this scope
   11 |                 rep(i,n+1)rep(j,m)if(i>=rate[pre][j]&&rate[pre][j]<rate[post][j])dp[i]=max(dp[i],dp[i-rate[pre][j]]+rate[post][j]);
      |                                 ^
a.cc:4:33: note: in definition of macro 'rep'
    4 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                                 ^
Language: C++

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

	vector<vector<int>>rate(2,vector<int>(3,0));

	int solve(int n,int pre,int post){
		vector<int>dp(n+1,0);
		rep(i,n)dp[i]=i;
		rep(i,n+1)rep(j,m)if(i>=rete[pre][j]&&rate[pre][j]<rete[post][j])dp[i]=max(dp[i],dp[i-rate[pre][j]]+rate[post][j]);
		return dp[n];
	}

signed main(){
	int n;cin>>n;
	rep(i,2)rep(j,3)cin>>rate[i][j];
	cout<<solve(solve(n,0,1),1,0)<<endl;

	
}

Compiler output:
a.cc: In function 'long long int solve(long long int, long long int, long long int)':
a.cc:11:33: error: 'm' was not declared in this scope
   11 |                 rep(i,n+1)rep(j,m)if(i>=rete[pre][j]&&rate[pre][j]<rete[post][j])dp[i]=max(dp[i],dp[i-rate[pre][j]]+rate[post][j]);
      |                                 ^
a.cc:4:33: note: in definition of macro 'rep'
    4 | #define rep(i,n) for(int i=0;i<(n);i++)
      |                                 ^
a.cc:11:41: error: 'rete' was not declared in this scope; did you mean 'rate'?
   11 |                 rep(i,n+1)rep(j,m)if(i>=rete[pre][j]&&rate[pre][j]<rete[post][j])dp[i]=max(dp[i],dp[i-rate[pre][j]]+rate[post][j]);
      |                                         ^~~~
      |                                         rate
Language: C++

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cstring> 
#include<cassert>
#include<cmath>
#include<sstream>
#include<fstream>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<bitset>
using namespace std;
int n;
void solve(long long ga,long long sa,long long ba,long long gb,long long sb,long long bb,long long &ma){
	if(sa<ba){
		swap(sa,ba);
		swap(sb,bb);
	}
	if(ga<sa){
		swap(ga,sa);
		swap(gb,sb);
	}
	for(long long g=0;g<=((ga>=gb)?0:n);g++){
		if(n-g*ga<0) break;
		for(long long s=0;s<=((sa>=sb)?0:n);s++){
			if(n-g*ga-s*sa>=0){
				long long re=n-g*ga-s*sa,b=0;
				if(ba<bb){
					b=re/ba;
					re-=b*ba;
				}
				long long now=re+g*gb+s*sb+b*bb;
				ma=max(now,ma);
			}
			else{
				break;
			}
		}
	}
}
long long main(){
	long long ga,sa,ba,gb,sb,bb;
	cin>>n>>ga>>sa>>ba>>gb>>sb>>bb;
	long long ma=n;
	solve(ga,sa,ba,gb,sb,bb,ma);
	n=ma;
	solve(gb,sb,bb,ga,sa,ba,ma);
	cout<<ma;
}

Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C

#include <stdio.h>
#include <stdlib.h>//random,NULL
#include <string.h>
#include <time.h>
#include <unistd.h>//sleep()
#include <math.h>
#include <stdbool.h>

#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000
const int mod = INF+7;

//確かにこれ、ナップザック問題か

int max(int a, int b){
  if(a>=b){
    return a;
  }
  else{
    return b;
  }
}

int main(){
  char buf[1024];
  int N;
  int a[3], b[3];

  fgets(buf,sizeof(buf),stdin);
  sscanf(buf, "%d", &N);

  fgets(buf,sizeof(buf),stdin);
  sscanf(buf, "%d %d %d", &a[0], &a[1], &a[2]);

  fgets(buf,sizeof(buf),stdin);
  sscanf(buf, "%d %d %d", &b[0], &b[1], &b[2]);

  int **dp=(int **)malloc(sizeof(int *)*4);
  rep(i,4){
    dp[i]=(int *)malloc(sizeof(int)*N);
  }
  rep(j,N){
    dp[0][j]=0;
  }

  srep(i, 1, 4){
    rep(j,N){
      if(j>=a[i-1]){
        dp[i][j]=max(dp[i-1][j-a[i-1]]+b[i]-a[i], dp[i-1][j]);
      }
      else{
        dp[i][j]=dp[i-1][j];
      }
    }
  }

  N=dp[3][N-1];
  rep(i,4){
    free(dp[i]);
  }
  free(dp);

  int **dp=(int **)malloc(sizeof(int *)*4);
  rep(i,4){
    dp[i]=(int *)malloc(sizeof(int)*N);
  }
  rep(j,N){
    dp[0][j]=0;
  }

  srep(i, 1, 4){
    rep(j,N){
      if(j>=b[i-1]){
        dp[i][j]=max(dp[i-1][j-b[i-1]]+a[i]-b[i], dp[i-1][j]);
      }
      else{
        dp[i][j]=dp[i-1][j];
      }
    }
  }

  printf("%d\n", dp[3][N-1]);

  return 0;

}


Compiler output:
main.c: In function 'main':
main.c:68:9: error: redefinition of 'dp'
   68 |   int **dp=(int **)malloc(sizeof(int *)*4);
      |         ^~
main.c:43:9: note: previous definition of 'dp' with type 'int **'
   43 |   int **dp=(int **)malloc(sizeof(int *)*4);
      |         ^~
Language: C++

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

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

long long N;
vector<long long> a(3), b(3);

const int MAX = 30000000;
long long dp[MAX];

long long calc(vector<long long> sei, vector<long long> obj, long long M) {
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < sei.size(); ++i) {
        for (int v = 0; v + sei[i] < MAX; ++v) {
            chmax(dp[v+sei[i]], dp[v] + obj[i]);
        }
    }
    long long res = M;
    for (int v = 0; v <= M; ++v) chmax(res, dp[v] + M-v);
    return res;
}

long long solve() {
    N = calc(a, b, N);
    N = calc(b, a, N);
    return N;
}

int main() {
    while (cin >> N) {
        for (int i = 0; i < 3; ++i) cin >> a[i];
        for (int i = 0; i < 3; ++i) cin >> b[i];
        cout << solve() << endl;
    }
}

Compiler output:
a.cc: In function 'long long int calc(std::vector<long long int>, std::vector<long long int>, long long int)':
a.cc:15:5: error: 'memset' was not declared in this scope
   15 |     memset(dp, 0, sizeof(dp));
      |     ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <vector>
  +++ |+#include <cstring>
    3 | using namespace std;
Language: Java

import java.util.*;

public class Main {

  static  class Pair{
        int x;
        int y;
        Pair(int x, int y){
            this.x =x;
            this.y =y;
        }
    }


    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int ga = sc.nextInt();
        int sa = sc.nextInt();
        int ba = sc.nextInt();
        int gb = sc.nextInt();
        int sb = sc.nextInt();
        int bb = sc.nextInt();


        int maxMult =0;
        TreeMap<Double,Pair> m = new TreeMap<Double, Pair>( Collections.reverseOrder() );
        m.put((double)ga/gb, new Pair(ga,gb));
        m.put((double)gb/ga, new Pair(gb,ga));
        m.put((double)sa/sb, new Pair(sa,sb));
        m.put((double)sb/sa, new Pair(sb,sa));
        m.put((double)ba/bb, new Pair(ba,bb));
        m.put((double)bb/ba, new Pair(bb,ba));

        int ans = 0;
        while(N>0){23
            1 1 1
            2 1 1
            Map.Entry<Double,Pair> e = m.firstEntry();
            if(e.getKey()<=1) break;
            Pair  p = e.getValue();
            ans  += N/p.y * p.x ;
            N = N% p.y;
        }


        System.out.println(ans+N);

    }

}


Compiler output:
Main.java:36: error: not a statement
        while(N>0){23
                   ^
Main.java:36: error: ';' expected
        while(N>0){23
                     ^
2 errors
Language: C++

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static void Main()
	{
		long N = GetLong();
		long[,] gsb = new long[2, 3];
		for(int i = 0; i < 2; i++)
			for(int j = 0; j < 3; j++)
				gsb[i, j] = GetLong();

		long[] dpAB = new long[N + 1];
		long maxAB = long.MinValue;
		for(long i = 1; i <= N; i++)
		{			
			dpAB[i] = i;
			for(int j = 0; j < 3; j++)
			{
				if(i < gsb[0, j])
					continue;

				dpAB[i] = Math.Max(dpAB[i], dpAB[i - gsb[0, j]] + gsb[1, j]);
			}			
			maxAB = Math.Max(maxAB, dpAB[i]);
		}

		long[] dpBA = new long[maxAB + 1];
		long maxBA = long.MinValue;
		for(long i = 1; i <= maxAB; i++)
		{
			dpBA[i] = i;
			for(int j = 0; j < 3; j++)
			{
				if(i < gsb[1, j])
					continue;

				dpBA[i] = Math.Max(dpBA[i], dpBA[i - gsb[1, j]] + gsb[0, j]);
			}
			maxBA = Math.Max(maxBA, dpBA[i]);
		}

		Console.WriteLine(maxBA);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}





Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:5:7: error: expected nested-name-specifier before 'System'
    5 | using System.Linq;
      |       ^~~~~~
a.cc:6:7: error: expected nested-name-specifier before 'static'
    6 | using static MyIO;
      |       ^~~~~~
a.cc:9:1: error: expected unqualified-id before 'public'
    9 | public class D
      | ^~~~~~
a.cc:54:1: error: expected unqualified-id before 'public'
   54 | public static class MyIO
      | ^~~~~~
Language: Java

import java.util.*;

class Main{
    static long mod = 1000000007;
    public static void main(String argv[]) {
        Scanner sc = new Scanner(System.in);
        int[] ris = {sc.nextInt(), 0,0,0};
        int[] a_trans = new int[3];
        int[] b_trans = new int[3];
        double[] rate = new double[3];
        for(int i=0;i<3;i++){
            a_trans[i] = sc.nextInt();
        }
        for(int i=0;i<3;i++){
            b_trans[i] = sc.nextInt();
            rate[i] = (double)a_trans[i]/b_trans[i];
        }
        if(rate[0]<1 || rate[1]<1 || rate[2]<1){
            String str = "g";
            if(rate[1]<rate[0])str = "s";
            if(rate[2]<Math.min(rate[0], rate[1]))str = "b";
            ris = exchange(ris, a_trans, b_trans, str);
        }
        if(rate[0]>1 || rate[1]>1 || rate[2]>1){
            String str = "g";
            if(rate[1]>rate[0])str = "s";
            if(rate[2]>Math.max(rate[0], rate[1]))str = "b";
            ris = exchange(ris, b_trans, a_trans, str);
        }
        System.out.println(ris[0]);
    }

    public static int[] exchange(int[] R, int[] a, int[] b, String str) {
        int p = 0;
        if(str.equals("g"))p=0;
        if(str.equals("s"))p=1;
        if(str.equals("b"))p=2;
        int[] result = R;
        if(R[0] > a[p]){
            int tmp = R[0]/a[p];
            result[0] -= a[p]*tmp;
            result[0] += b[p]*tmp;
        }
        return result;
    }
}




Compiler output:
Main.java:1: error: illegal character: '\u0008'
import java.util.*;
^
Main.java:1: error: class, interface, enum, or record expected
import java.util.*;
        ^
2 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;++i)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

bool comp(const PII& l, const PII& r){
  return (double)l.second/l.first > (double)r.second/r.first;
}

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(15);

  ll N;cin >> N;
  int N_MAX = 2.5e7;
  vector<PLL> x(3);
  cin >> x[0].first >> x[1].first >> x[2].first;
  cin >> x[0].second >> x[1].second >> x[2].second;
  int M = x.size();
  //dp[i+1][j]:i番目まで見て,j個ある時の変換後の最大数
  ll dp[N_MAX+1];
  REP(j,N+1) dp[0][j] = N;
  REP(j,N+1){
    dp[j] = j;
    REP(i,M){
      if(j < x[i].first)continue;
      dp[j] = max(dp[j], dp[j-x[i].first] + x[i].second);
    }
  }
  N = dp[M][N];

  REP(j,N+1){
    dp[j] = j;
    REP(i,M){
      if(j < x[i].second)continue;
      dp[j] = max(dp[j], dp[j-x[i].second] + x[i].first);
    }
  }
  N = dp[M][N];

  cout << N << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:19: error: invalid types 'll {aka long long int}[int]' for array subscript
   38 |   REP(j,N+1) dp[0][j] = N;
      |                   ^
a.cc:46:12: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   46 |   N = dp[M][N];
      |            ^
a.cc:55:12: error: invalid types 'll {aka long long int}[ll {aka long long int}]' for array subscript
   55 |   N = dp[M][N];
      |            ^
Language: C++

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

int n;
int ga, sa, ba;
int gb, sb, bb;

int gg(int n, vector<pair<int, int> > v)
{
    int maxu = 0;
    if (v.size() == 0)
        maxu = n;
    else if (v.size() == 1)
    {
        int nn = 0;
        int b = (n - nn) / v[0].first;
        nn = n - b * v[0].first;
        nn = nn + b * v[0].second;
        maxu = max(maxu, nn);
    }
    else if (v.size() == 2)
    {
        for (int s = 0; s <= n; ++s)
        {
            int nn = s * v[0].first;
            if (nn > n)
                break;
            int b = (n - nn) / v[1].first;
            nn = n - s * v[0].first - b * v[1].first;
            nn = nn + s * v[0].second + b * v[1].second;
            maxu = max(maxu, nn);
        }
    }
    else
    {
        for (int g = 0; g <= n; ++g)
        {
            if (g * ga > n)
                break;
            for (int s = 0; s <= n; ++s)
            {
                int nn = g * v[0].first + s * v[1].first;
                if (nn > n)
                    break;
                int b = (n - nn) / v[2].first;
                nn = n - g * v[0].first - s * v[1].first - b * v[2].first;
                nn = nn + g * v[0].second + s * v[1].second + b * v[2].second;
                maxu = max(maxu, nn);
            }
        }
    }
    return maxu;
}

int main()
{
    cin >> n;
    cin >> ga >> sa >> ba;
    cin >> gb >> sb >> bb;
    vector<pair<int, int> > va, vb;
    if (ga < gb)
        va.push_back(m_p(ga, gb));
    if (sa < sb)
        va.push_back(m_p(sa, sb));
    if (ba < bb)
        va.push_back(m_p(ba, bb));
    if (ga > gb)
        vb.push_back(m_p(gb, ga));
    if (sa > sb)
        vb.push_back(m_p(sb, sa));
    if (ba > bb)
        vb.push_back(m_p(bb, ba));
    n = gg(n, va);
    n = gg(n, vb);
    cout << n << endl;
    return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(int i=0;i<N;++i)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

bool comp(const PII& l, const PII& r){
  return (double)l.second/l.first > (double)r.second/r.first;
}

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(15);

  ll N;cin >> N;
  int N_MAX = 5e7;
  vector<PLL> x(3);
  cin >> x[0].first >> x[1].first >> x[2].first;
  cin >> x[0].second >> x[1].second >> x[2].second;
  int M = x.size();
  //dp[i+1][j]:i番目まで見て,j個ある時の変換後の最大数
  vector<vector<ll> dp(M+1,vector<ll>(N_MAX+1));
  REP(j,N+1) dp[0][j] = N;
  REP(i,M){
    REP(j,N+1){
      if(j < x[i].first){
        dp[i+1][j] = dp[i][j];
      }else{
        dp[i+1][j] = max(dp[i][j], dp[i+1][j-x[i].first] + x[i].second - x[i].first);
      }
    }
  }
  N = dp[M][N];

  REP(j,N+1) dp[0][j] = N;
  REP(i,M){
    REP(j,N+1){
      if(j < x[i].second){
        dp[i+1][j] = dp[i][j];
      }else{
        dp[i+1][j] = max(dp[i][j], dp[i+1][j-x[i].second] + x[i].first - x[i].second);
      }
    }
  }
  N = dp[M][N];

  cout << N << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:47: error: template argument 1 is invalid
   37 |   vector<vector<ll> dp(M+1,vector<ll>(N_MAX+1));
      |                                               ^
a.cc:37:47: error: template argument 2 is invalid
a.cc:38:14: error: 'dp' was not declared in this scope; did you mean 'dup'?
   38 |   REP(j,N+1) dp[0][j] = N;
      |              ^~
      |              dup
a.cc:42:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   42 |         dp[i+1][j] = dp[i][j];
      |         ^~
      |         dup
a.cc:44:9: error: 'dp' was not declared in this scope; did you mean 'dup'?
   44 |         dp[i+1][j] = max(dp[i][j], dp[i+1][j-x[i].first] + x[i].second - x[i].first);
      |         ^~
      |         dup
a.cc:48:7: error: 'dp' was not declared in this scope; did you mean 'dup'?
   48 |   N = dp[M][N];
      |       ^~
      |       dup
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
 
 
 
int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
 
    ll n;
    cin>>n;
    ll a[3],b[3];
    for(int i=0;i<3;i++){
        cin>>a[i];
    }
    for(int i=0;i<3;i++){
        cin>>b[i];
    }
    ll ans = n;
    
    
    for (long long bit = 0; bit < (1LL<<3); ++bit){
        int cnt = 0;
        for(int i=0;i<3;i++){
            if((bit>>i&1LL)){
                cnt++;
            }
        }
        if(cnt==3){
            for(int i=0;i*a[0]<=n;i++){
                for(int j=0;i*a[0]+j*a[1]<=n;j++){
                    ll ret = 0;
                    int k = (n-i*a[0]-j*a[1])/a[2];
                    ret += i*b[0] + j*b[1] + k*b[2] + n - (k*a[2]+i*a[0]+j*a[1]);
                    ans = max(ret,ans);
                }
            }
        }
        else if(cnt==2){
            int k=0,l=0,s;
            for(int i=0;i<3;i++){
                if((bit>>i&1LL)){
                    l=k,k=i;
                }
                else s=i;
            }
            for(int i=0;i*a[k]<=n;i++){
                ll ret = i*b[k] + (n-i*a[k])/a[l]*b[l] + n-(i*a[k] + (n-i*a[k])/a[l]*a[l]);
                ll t=ret/b[s];
                ret = t*a[s] + (ret - t*b[s]);
                ans = max(ret,ans);
            }
        }
        else if(cnt==1){
            int k,l,s;
            for(int i=0;i<3;i++){
                if((bit>>i&１LL)){
                    s=i;
                }
                else l=k,k=i;
            }
            ll ret = n-n/a[s]*a[s] + n/a[s]*b[s];
            for(int i=0;i*b[k]<=ret;i++){
                ll res = i*a[k] + (ret-i*b[k])/b[l]*a[l] + ret - (i*b[k] + (ret-i*b[k])/b[l]*b[l]);
                ans = max(res,ans);
            }
            
        }
        else {
            for(int i=0;i*b[0]<=n;i++){
                for(int j=0;i*b[0]+j*b[1]<=n;j++){
                    ll ret = 0;
                    int k = (n-i*b[0]-j*b[1])/b[2];
                    ret += i*a[0] + j*a[1] + k*a[2] + n - (k*b[2]+i*b[0]+j*b[1]);
                    ans = max(ret,ans);
                }
            }
        }
    }
 
    cout << ans << endl;
 
 
 
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:28: error: '\U0000ff11LL' was not declared in this scope
   58 |                 if((bit>>i&１LL)){
      |                            ^~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
    int N;
    cin >> N;
    int gsb[3][2];
    for(int i = 0; i < N; i++){
        cin >>gsb[0][i] >> gsb[1][i] >> gsb[2][i];
    }
    double funcAB[3];
    double funcBA[3];
    for(int i = 0; i < 3; i++){
        funcAB[i] = (double)gsb[i][1] / gsb[i][0];
        funcBA[i] = (double)gsb[i][0] / gsb[i][1];
    }
    

    dp[0] = 0;
    int max1 = 0;
    for(int i = 0; i <= N; i++){
        for(int j = 0; k < N - i; j++){
            int k = N - i - j;
            int gold = (int)max(funcAB[0] * i, funcBA[0] * i);
            int silv = (int)max(funcAB[1] * j, funcBA[1] * j);
            int cup = (int)max(funcAB[2] * k, funcBA[2] * k);
            int sum = gold + silv + cup;
            if(sum > max1){
                max1 = sum;
            }
        }
    }
    cout << max1 << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   21 |     dp[0] = 0;
      |     ^~
      |     dup
a.cc:24:24: error: 'k' was not declared in this scope
   24 |         for(int j = 0; k < N - i; j++){
      |                        ^
Language: C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100005
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int cmp(const void* a,const void* b){return *(int*)a-*(int*)b;}

typedef struct{double s;int r,num;}P;

int cmpd(const void* a,const void* b){
	if(((P*)a)->s>((P*)b)->s)return -1;
  if(((P*)a)->s<((P*)b)->s)return 1;
  return 0;
}

int main() {
  int i,N,A[3],B[3],a,ans=0;
  scanf("%d%d%d%d%d%d%d",&N,&A[0],&A[1],&A[2],&B[0],&B[1],&B[2]);
  P p[6];
  FOR(i,0,3){
    p[i].s=(double)A[i]/(double)B[i];
    p[i].num=i;
    p[i+3].s=(double)B[i]/(double)A[i];
    p[i+3].num=i+3;
  }
  qsort(p,6,sizeof(P),cmpd);
  FOR(i,0,6){
    if(p[i].s>1)p[i].r=2;
    else if(p[i].s<1)p[i].r=0;
    else p[i].r=1;
  }
  //FOR(i,0,6)printf("%lf %d\n",p[i].s,p[i].num);
  //if(p[0].num>=3)ans+=(N*B[p[0].num-3])/A[p[0].num-3];
  //else ans+=(N*A[p[0].num])/B[p[0].num];
  FOR(i,0,3){
    //if(p[i].r<=1)break;
    else{
      if(p[i].num>=3){
        ans+=(N/A[p[i].num-3])*B[p[i].num-3];
        N%=A[p[i].num-3];
      }
      else{
        ans+=(N/B[p[i].num])*A[p[i].num];
        N%=B[p[i].num];
      }
    //}
  }
  ans+=N;

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


Compiler output:
main.c: In function 'main':
main.c:45:5: error: 'else' without a previous 'if'
   45 |     else{
      |     ^~~~
main.c:60:1: error: expected declaration or statement at end of input
   60 | }
      | ^
Language: C++

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <climits>
#include <string>
#include <vector>

using namespace std;

int main () {
    int n, g_a, s_a, b_a, g_b, s_b, b_b;
    cin >> n >> g_a >> s_a >> b_a >> g_b >> s_b >> b_b;
    vector<vector<int>> dif_hav = {{g_b / g_a, g_b - g_a, g_a, g_b}, {s_b / s_a, s_b - s_a, s_a, s_b}, {b_b / b_a, b_b - b_a, b_a, b_b}};
    long long don = n;
    long long don_buf = n;
    sort(dif_hav.begin(), dif_hav.end());
    reverse(dif_hav.begin(), dif_hav.end());
    if (dif_hav.at(0).at(0) > 0) {
        don += don_buf / dif_hav.at(0).at(2) * dif_hav.at(0).at(1);
        don_buf -= don_buf / dif_hav.at(0).at(2) * dif_hav.at(0).at(2);
    }
    if (dif_hav.at(1).at(0) > 0) {
        don += don_buf / dif_hav.at(1).at(2) * dif_hav.at(1).at(1);
        don_buf -= don_buf / dif_hav.at(1).at(2) * dif_hav.at(1).at(2);
    }
    if (dif_hav.at(2).at(0) > 0) {
        don += don_buf / dif_hav.at(2).at(2) * dif_hav.at(2).at(1);
        don_buf -= don_buf / dif_hav.at(2).at(2) * dif_hav.at(2).at(2);
    }
    don_buf = don;
    dif_hav = {{g_a / g_b, g_b - g_a, g_a, g_b}, {s_a / s_b, s_b - s_a, s_a, s_b}, {b_a / b_b, b_b - b_a, b_a, b_b}};
    sort(dif_hav.begin(), dif_hav.end());
    reverse(dif_hav.begin(), dif_hav.end());
    if (dif_hav.at(0).at(0) > 0) {
        don += don_buf / dif_hav.at(0).at(3) * dif_hav.at(0).at(1);
        don_buf -= don_buf / dif_hav.at(0).at(3) * dif_hav.at(0).at(3);
    }
    if (dif_hav.at(1).at(0) > 0) {
        don += don_buf / dif_hav.at(1).at(3) * dif_hav.at(1).at(1);
        don_buf -= don_buf / dif_hav.at(1).at(3) * dif_hav.at(1).at(3));
    }
    if (dif_hav.at(2).at(0) > 0) {
        don += don_buf / dif_hav.at(2).at(3) * dif_hav.at(2).at(1);
        don_buf -= don_buf / dif_hav.at(2).at(3) * dif_hav.at(2).at(3);
    }
    cout << don << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:71: error: expected ';' before ')' token
   43 |         don_buf -= don_buf / dif_hav.at(1).at(3) * dif_hav.at(1).at(3));
      |                                                                       ^
      |                                                                       ;
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
long long int dp[25000000];
int main(){
	long long int ans,a[3],b[3];
	cin>>ans;
	cin>>a[0]>>a[1]>>a[2];
	cin>>b[0]>>b[1]>>b[2];
/*	for(long long int i=0;i<=5000;i++){dp[i]=i;}
	for(long long int i=0;i<=5000;i++){
		for(long long int j=0;j<3;j++){
			if(i>=a[j]){
				dp[i]=max(dp[i],dp[i-a[j]]+b[j]);
			}
		}
	}
	ans=dp[ans];
	for(long long int i=0;i<=4999;i++){
		for(long long int k=0;k<=5000;k++){
			dp[i*5000+k]=i*5000+k;
		for(long long int j=0;j<3;j++){
			if(i*5000+k>=a[j]){
				dp[i*5000+k]=max(dp[i*5000+k],dp[i*5000+k-b[j]]+a[j]);
			}
		}
		}
	}
	cout<<dp[ans]<<endl;*/
	int g[3];
	for(int i=0;i<3;i++){
		if(a[i]>b[i]){g[i]=1;}
		else{g[i]=0;}
	}
	if(g[0]+g[1]+g[2]==0 or g[0]+g[1]+g[2]==3){
		for(long long int i=0;i<=5000;i++){dp[i]=i;}
	for(long long int i=0;i<=5000;i++){
		for(long long int j=0;j<3;j++){
			if(i>=a[j]){
				dp[i]=max(dp[i],dp[i-a[j]]+b[j]);
			}
		}
	}
	ans=dp[ans];
			for(long long int i=0;i<=5000;i++){dp[i]=i;}
	for(long long int i=0;i<=5000;i++){
		for(long long int j=0;j<3;j++){
			if(i>=a[j]){
				dp[i]=max(dp[i],dp[i-b[j]]+a[j]);
			}
		}
	}
	ans=dp[ans];
		cout<<ans<<endl;
	}
	else if (g[0]+g[1]+g[2]==1){
		for(long long int i=0;i<=5000;i++){dp[i]=i;}
	for(long long int i=0;i<=5000;i++){
		for(long long int j=0;j<3;j++){
			if(i>=a[j]){
				dp[i]=max(dp[i],dp[i-a[j]]+b[j]);
			}
		}
	}
	ans=max(ans+(ans/b[1])*(a[1]-b[1]),ans+(ans/b[2])*(a[2]-b[2]),ans+(ans/b[0])*(a[0]-b[0]));
	cout<<ans<<endl;
	}
	else{
			for(long long int i=0;i<=5000;i++){dp[i]=i;}
	for(long long int i=0;i<=5000;i++){
		for(long long int j=0;j<3;j++){
			if(i>=a[j]){
				dp[i]=max(dp[i],dp[i-a[j]]+b[j]);
			}
		}
	}
	int y[2],z[2];
	int c=0;
	for(int i=0;i<3;i++){
		if(a[i]>b[i]){y[c]=a[i];z[c]=b[i];}
		c++;
	}
	for(int i=0;i<ans/z[0];i++){
		ans=max(ans,ans+i*(y[0]-z[0])+((ans-i*z[0])/z[1])*(y[1]-z[1]));
	}
	cout<<ans<<endl;
	}
	return 0;
}

Compiler output:
In file included 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_algobase.h: In instantiation of 'constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare) [with _Tp = long long int; _Compare = long long int]':
a.cc:65:9:   required from here
   65 |         ans=max(ans+(ans/b[1])*(a[1]-b[1]),ans+(ans/b[2])*(a[2]-b[2]),ans+(ans/b[0])*(a[0]-b[0]));
      |             ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:306:17: error: '__comp' cannot be used as a function
  306 |       if (__comp(__a, __b))
      |           ~~~~~~^~~~~~~~~~
Language: C++

//encoding:utf-8
//#include <iostream> //c++
//#include<stack> //スタックに関して　最新のデータから捨てる
//#include<queue> //キューに関して　最古のデータから捨てる
//#include<math.h>
//#include<vector>
//#include<algorithm> //sort とかにいる
#include<bits/stdc++.h>//vector,algorithm,que
#include<time.h> //時間にかんして

#define ll long long
#define MOD 1000000007
#define INF (1<<29)
using namespace std;
int main(){
  ll N;
  ll ag,as,ab;
  ll bg,bs,bb;
  cin >> N;
  cin>>ag>>as>>ab;
  cin>>bg>>bs>>bb;
  vector<ll> dp(N+1);
  ll g_v = bg-ag;
  ll s_v = bs - as;
  ll b_v = bb - ab;
  if(g_v>0){
    for(int i=ag;i<N+1;i++){
      dp[i] = max(dp[i],dp[i-ag]+g_v);
    }
  }
  if(s_v>0){
    for(int i=as;i<N+1;i++){
      dp[i] = max(dp[i],dp[i-as]+s_v);
    }
  }
  if(b_v>0){
    for(int i=ab;i<N+1;i++){
      dp[i] = max(dp[i],dp[i-ab]+b_v);
    }
  }
  ll tmp = 0;
  for(int i=0;i<N+1;i++){
    tmp = max(tmp,dp[i]);
  }
  N += tmp
  vector<ll> dp2(N+1);
  g_v = -bg + ag;
  s_v = -bs + as;
  b_v = -bb + ab;

  if(g_v>0){
    for(int i=ag;i<N+1;i++){
      dp[i] = max(dp2[i],dp2[i-ag]+g_v);
    }
  }
  if(s_v>0){
    for(int i=as;i<N+1;i++){
      dp[i] = max(dp2[i],dp2[i-as]+s_v);
    }
  }
  if(b_v>0){
    for(int i=ab;i<N+1;i++){
      dp[i] = max(dp2[i],dp2[i-ab]+b_v);
    }
  }
  ll tmp = 0;
  for(int i=0;i<N+1;i++){
    tmp = max(tmp,dp2[i]);
  }
  N += tmp;
  cout<<N<<endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:45:11: error: expected ';' before 'vector'
   45 |   N += tmp
      |           ^
      |           ;
   46 |   vector<ll> dp2(N+1);
      |   ~~~~~~   
a.cc:53:19: error: 'dp2' was not declared in this scope; did you mean 'dp'?
   53 |       dp[i] = max(dp2[i],dp2[i-ag]+g_v);
      |                   ^~~
      |                   dp
a.cc:58:19: error: 'dp2' was not declared in this scope; did you mean 'dp'?
   58 |       dp[i] = max(dp2[i],dp2[i-as]+s_v);
      |                   ^~~
      |                   dp
a.cc:63:19: error: 'dp2' was not declared in this scope; did you mean 'dp'?
   63 |       dp[i] = max(dp2[i],dp2[i-ab]+b_v);
      |                   ^~~
      |                   dp
a.cc:66:6: error: redeclaration of 'long long int tmp'
   66 |   ll tmp = 0;
      |      ^~~
a.cc:41:6: note: 'long long int tmp' previously declared here
   41 |   ll tmp = 0;
      |      ^~~
a.cc:68:19: error: 'dp2' was not declared in this scope; did you mean 'dp'?
   68 |     tmp = max(tmp,dp2[i]);
      |                   ^~~
      |                   dp
Language: C++

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

int n;
int ga, sa, ba;
int gb, sb, bb;

int main()
{
    cin >> n;
    cin >> ga >> sa >> ba;
    cin >> gb >> sb >> bb;
    int maxu = 0;
    if (ga < gb)
    {
        for (int g = 0; g <= n; ++g)
        {
            if (sa < sb)
            {
                for (int s = 0; s <= n; ++s)
                {
                    int nn = g * ga + s * sa;
                    if (nn > n)
                        break;
                    int b = 0;
                    if (ba < bb)
                        b = (n - nn) / ba;
                    nn = n - g * ga - s * sa - b * ba;
                    nn = nn + g * gb + s * sb + b * bb;
                    maxu = max(maxu, nn);
                }
            }
            else
            {
                int s = 0;
            int nn = g * ga + s * sa;
            if (nn > n)
                break;
            int b = 0;
            if (ba < bb)
                b = (n - nn) / ba;
            nn = n - g * ga - s * sa - b * ba;
            nn = nn + g * gb + s * sb + b * bb;
            maxu = max(maxu, nn);
        }
    }
    }
    else
    {
        int g = 0;
        if (sa < sb)
            {
                for (int s = 0; s <= n; ++s)
                {
                    int nn = g * ga + s * sa;
                    if (nn > n)
                        break;
                    int b = 0;
                    if (ba < bb)
                        b = (n - nn) / ba;
                    nn = n - g * ga - s * sa - b * ba;
                    nn = nn + g * gb + s * sb + b * bb;
                    maxu = max(maxu, nn);
                }
            }
            else
            {
                int s = 0;
            int nn = g * ga + s * sa;
            if (nn > n)
                break;
            int b = 0;
            if (ba < bb)
                b = (n - nn) / ba;
            nn = n - g * ga - s * sa - b * ba;
            nn = nn + g * gb + s * sb + b * bb;
            maxu = max(maxu, nn);
    }
    n = maxu;
    maxu = 0;
    for (int g = 0; g <= n; ++g)
    {
        for (int s = 0; s <= n; ++s)
        {
            int nn = g * gb + s * sb;
            if (nn > n)
                break;
            int b = 0;
            if (bb < ba)
                b = (n - nn) / bb;
            nn = n - g * gb - s * sb - b * bb;
            nn = nn + g * ga + s * sa + b * ba;
            maxu = max(maxu, nn);
        }
    }
    cout << maxu << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:71:17: error: break statement not within loop or switch
   71 |                 break;
      |                 ^~~~~
a.cc:98:2: error: expected '}' at end of input
   98 | }
      |  ^
a.cc:9:1: note: to match this '{'
    9 | {
      | ^
Language: C++

#include<bits/stdc++.h>
#define int long long

using namespace std;

int price[2][3];

int getAns(vector<int> st, int depth, const int const * l)
{
	int ab = depth % 2;
	if (depth == 3)
	{
		for (int i = 0; i < 3; i++)
			st[3] += st[i] * price[ab^1][i];
		return st[3];
	}
	for (int i = 0; i < 3; i++)
		st[3] += st[i] * price[ab][i];
	int permu[] = { 0,1,2 };
	int ans = st[3];
	for (int i = 0; i < 3; i++)
	{
		st[l[i]] = st[3] / price[ab][l[i]];
		st[3] = st[3] % price[ab][l[i]];
	}
	do
	{
		ans = max(getAns(st, depth+1, permu), ans);
	} while (next_permutation(permu, permu + 3));
	return ans;
}

signed main()
{
	int n;
	cin >> n;
	for (int i = 0; i < 2; i++)
		for (int j = 0; j < 3; j++)
			cin >> price[i][j];
	vector<int> status = { 0,0,0,n };
	int permu[] = { 0,1,2 };
	int ans = n;
	do 
	{
		ans = max(getAns(status,0, permu),ans);
	} while (next_permutation(permu, permu + 3));
	cout << ans;
}

Compiler output:
a.cc:8:49: error: duplicate 'const'
    8 | int getAns(vector<int> st, int depth, const int const * l)
      |                                                 ^~~~~
      |                                                 -----
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,tmp;
	cin>>n;
	ll ans1=n,ans2=n;
	vl a(3),b(3)c(3),d(3);
	rep(i,3)cin>>a[i];
	rep(i,3)cin>>b[i];
	rep(i,n+1){
		rep(j,n-i+1){
			tmp=n;
			int k=n-i-j;
			c[0]=i,c[1]=j,c[2]=k;
			rep(l,3){
				if(a[l]<b[l]){
					tmp-=c[l]/a[l];
					tmp+=(c[l]/a[l])*b[l];
				}
			}
			chmax(ans1,tmp);
		}
	}
	rep(i,3){
		rep(j,3){
			rep(k,ans1+1){
				rep(l,3)d[l]=0;
				d[i]=k;
				tmp=ans1;
				if(a[i]>b[i]){
					tmp-=d[i]/b[i];
					tmp+=(d[i]/b[i])*a[i];
				}
				if(i!=j&&a[j]>b[j]){
					d[j]=ans1-k;
					tmp-=d[j]/b[j];
					tmp+=(d[j]/b[j])*a[j];
				}
				chmax(ans2,tmp);
			}
		}
	}
	puta(ans2);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:56:21: error: expected ',' or ';' before 'c'
   56 |         vl a(3),b(3)c(3),d(3);
      |                     ^
a.cc:63:25: error: 'c' was not declared in this scope
   63 |                         c[0]=i,c[1]=j,c[2]=k;
      |                         ^
a.cc:76:41: error: 'd' was not declared in this scope
   76 |                                 rep(l,3)d[l]=0;
      |                                         ^
a.cc:77:33: error: 'd' was not declared in this scope
   77 |                                 d[i]=k;
      |                                 ^
Language: C++

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

int main()
{
  long n, ga, sa, ba, gb, sb, bb, amax = 0;
  cin >> n >> ga >> sa >> ba >> gb >> sb >> bb;
  for (long i = 0; i <= n / ga * (ga < gb); i++) {
    for (long j = 0; j <= (n - i * ga) / sa * (sa < sb); j++) {
      long a = n - i * ga - j * sa;
      long k = ba < bb ? a / ba : 0;
      a -= k * ba;
      a += i * gb + j * sb + k * bb;
      if (a > amax) amax = a;
    }
  }
  n = amax;
  for (long i = ga > gb ? (n - sb * bb) / gb : 0; i <= n / gb * (ga > gb); i++) {
    for (long j = sa > sb ? (n - i * gb - bb) / sb; j <= (n - i * gb) / sb * (sa > sb); j++) {
      long a = n - i * gb - j * sb;
      long k = ba > bb ? a / bb : 0;
      a -= k * bb;
      a += i * ga + j * sa + k * ba;
      if (a > amax) amax = a;
    }
  }
  cout << amax << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:19:51: error: expected ':' before ';' token
   19 |     for (long j = sa > sb ? (n - i * gb - bb) / sb; j <= (n - i * gb) / sb * (sa > sb); j++) {
      |                                                   ^
      |                                                   :
a.cc:19:51: error: expected primary-expression before ';' token
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int i,j,k;
    long long n;
    int ga,gb,sa,sb,ba,bb;
    std::cin >> n;
    std::cin >> ga>>sa>>ba;
    std::cin >> gb>>sb>>bb;
    long long ans=0;
    if(ga<=gb&&sa<=sb&&ba<=bb){
        for (i=0;i<=n/ga;i++){
            for (j=0;j<=(n-i*ga)/sa;j++){
                    int m=i*(gb-ga)+j*(sb-sa)+(n-i*ga-j*sa)/ba*(bb-ba);
                    if (m>ans) ans=m;
            }
        }
        ans+=n;
        int z=1;
        while(z=1)i++
    }
    else if(ga>=gb&&sa>=sb&&ba>=bb){
        int g=ga,s=sa,b=ba;
        ga=gb;sa=sb;ba=bb;gb=g;sb=s;bb=b;
        for (i=0;i<=n/ga;i++){
            for (j=0;j<=(n-i*ga)/sa;j++){
                    int m=i*(gb-ga)+j*(sb-sa)+(n-i*ga-j*sa)/ba*(bb-ba);
                    if (m>ans) ans=m;
            }
        }
        ans+=n;
    }
    else if(ga>=gb&&sa>=sb&&ba<=bb){
        n+=(bb-ba)*(n/ba);
        for (i=0;i<=n/gb;i++){
                int m=i*(ga-gb)+(n-i*gb)/sb*(sa-sb);
                if (m>ans) ans=m;
         }
        ans+=n;
    }
    else if(ga>=gb&&sa<=sb&&ba>=bb){
        n+=(sb-ba)*(n/sa);
        for (i=0;i<=n/gb;i++){
                int m=i*(ga-gb)+(n-i*gb)/bb*(ba-bb);
                if (m>ans) ans=m;
         }
        ans+=n;
    }
    else if(ga<=gb&&sa>=sb&&ba>=bb){
        n+=(gb-ga)*(n/ga);
        for (i=0;i<=n/bb;i++){
                int m=i*(ba-bb)+(n-i*bb)/sb*(sa-sb);
                if (m>ans) ans=m;
         }
        ans+=n;
    }
    else if(ga>=gb&&sa<=sb&&ba<=bb){
        for (i=0;i<=n/sa;i++){
                int m=i*(sb-sa)+(n-i*sa)/ba*(bb-ba);
                if (m>ans) ans=m;
         }
        n+=ans;
        n+=(ga-gb)*(n/gb);
        ans=n;
    }
    else if(ga<=gb&&sa>=sb&&ba<=bb){
        for (i=0;i<=n/ga;i++){
                int m=i*(gb-ga)+(n-i*ga)/ba*(bb-ba);
                if (m>ans) ans=m;
         }
        n+=ans;
        n+=(sa-sb)*(n/sb);
        ans=n;
    }
    else if(ga<=gb&&sa<=sb&&ba>=bb){
        for (i=0;i<=n/ga;i++){
                int m=i*(gb-ga)+(sb-sa)*(n-i*ga)/sa;
                if (m>ans) ans=m;
         }
        n+=ans;
        n+=(ba-bb)*(n/bb);
        ans=n;
    }
    std::cout << ans << std::endl;
   
}


Compiler output:
a.cc: In function 'int main()':
a.cc:21:22: error: expected ';' before '}' token
   21 |         while(z=1)i++
      |                      ^
      |                      ;
   22 |     }
      |     ~
Language: C++

int N, G[2], S[2], B[2];
int dp[5001];

ll solve(ll N, int A[]){
  return N + (N / A[0]) * (A[1] - A[0]);
}

ll solve(ll N, int A[], int B[]){
  ll i, j, k, res = 0;

  for(i=0;;i++){
    k = N - A[0] * i;
    if(k < 0) break;
    j = k / B[0];
    res >?= N + i * (A[1]-A[0]) + j * (B[1]-B[0]);
  }

  return res;
}

{
  int i, j, k;
  ll res;
  int a[2][2], sz;
  rd(N,(G,S,B)(2));

  if(G[0] >= G[1] && S[0] >= S[1] && B[0] >= B[1]){
    swap(G[0], G[1]);
    swap(S[0], S[1]);
    swap(B[0], B[1]);
  }
  if(G[0] <= G[1] && S[0] <= S[1] && B[0] <= B[1]){
    rep(i,N+1) dp[i] = i;
    rep(i,G[0],N+1) dp[i] >?= dp[i-G[0]] + G[1];
    rep(i,S[0],N+1) dp[i] >?= dp[i-S[0]] + S[1];
    rep(i,B[0],N+1) dp[i] >?= dp[i-B[0]] + B[1];
    res = dp[N];
  } else {
    res = N;
    rep(2){
      sz = 0;
      if(G[0] < G[1]) a[sz][0] = G[0], a[sz][1] = G[1], sz++;
      if(S[0] < S[1]) a[sz][0] = S[0], a[sz][1] = S[1], sz++;
      if(B[0] < B[1]) a[sz][0] = B[0], a[sz][1] = B[1], sz++;
      if(sz==1) res = solve(res, a[0]);
      if(sz==2) res = solve(res, a[0], a[1]);
      swap(G[0], G[1]);
      swap(S[0], S[1]);
      swap(B[0], B[1]);
    }
  }
  wt(res);
}


Compiler output:
a.cc:4:1: error: 'll' does not name a type
    4 | ll solve(ll N, int A[]){
      | ^~
a.cc:8:1: error: 'll' does not name a type
    8 | ll solve(ll N, int A[], int B[]){
      | ^~
a.cc:21:1: error: expected unqualified-id before '{' token
   21 | {
      | ^