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

#include<bits/stdc++.h>
#include<cstdio>

using namespace std;

typedef long long int ll;

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

typedef pair<int,int> pair;

int main(){
    int h,n; cin >> h >> n;
    vector<int> a(n);
    vector<int> b(n);

    for(int i=0;i<n;i++) cin >> a[i] >> b[i];
    //a:AT,b:MP

    int MP=0;
    for(auto v : b) MP+=v;

    int dp[n][n]; for(int i=0;i<n;i++) for(int j=0;j<n;j++)dp[i][j]=0; 
    for(int i=0;i<n;i++){
        for(int j=0;j<=h;j++){
            if(h>=a[i]){ 
                dp[i+1][j]=max(dp[i][j],dp[i]+b[i][j-a[i]]);
                printf("One-") ;
            }else {
                dp[i+1][j]=dp[i][j];
                printf("Zero-");
            }
            h-=dp[i][j];
            printf("dp[%d]=%d\n",i,dp[i+1]);
        }   
    }

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

Compiler output:
a.cc: In function 'int main()':
a.cc:28:51: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   28 |                 dp[i+1][j]=max(dp[i][j],dp[i]+b[i][j-a[i]]);
      |                                                   ^
Language: Java

import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int N = sc.nextInt();
        Map<Integer,Integer> AB = new HashMap<>();
        Map<Integer,Integer> BA = new HashMap<>();
        ArrayList<Integer> List = new ArrayList<>();
        for(int i=0;i<N;i++) {
            int A = sc.nextInt();
            int B = sc.nextInt();
            AB.put(A, B);
            List.add(A);
        }
        long min = List.get(0);
        for(int i= 1;i<List.size();i++){
            long r = GCD(Math.max(min,List.get(i)),Math.min(min,List.get(i)));
            if(r!=0)min = (min*List.get(i))/r;
        }
        long min_p=999999999,min_A=0;
        for(int i=0;i<N;i++){
            long num = min/ List.get(i);
            long p = num*AB.get(List.get(i));
            if(min_p>p){
                min_p=p;
                min_A=List.get(i);
            }
        }
        long num = H/min_A;
        long sum = num*AB.get((int)min_A);
        if(H%min_A==0) System.out.println(num*AB.get((int)min_A));
        else{
            H-= num*min_A;
            min_p = 999999999;
            min_A=0;
            for(int i=0;i<N;i++){
                if(H-List.get(i)<0) if(min_p<AB.get(List.get(i))) min_p=AB.get(List.get(i));
                else{
                    if(H%List.get(i)!=0)num = H/List.get(i)+1;
                    else num = H/List.get(i);
                    if(min_p<AB.get(List.get(i)*num)) min_p=AB.get(List.get(i)*num;
                }
            }
            sum+=min_p;
            System.out.println(sum);
        }
    }
    public static long GCD(long a,long b){
        long r=b;
        while (a % b != 0) {
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
}


Compiler output:
Main.java:42: error: ')' or ',' expected
                    if(min_p<AB.get(List.get(i)*num)) min_p=AB.get(List.get(i)*num;
                                                                                  ^
1 error
Language: C++

INF = 1000000007
h, n = gets.split.map(&:to_i)
a = []
b = []
n.times{
  ai, bi = gets.split.map(&:to_i)
  a << ai
  b << bi
}
dp = []
max = a.inject(:+)
(n+1).times{ dp << Array.new(a.inject(:+)+1, INF) }
costRange = 0
dp[0] << INF
n.times{|i|
  #costRange += b[i]
  #[*1..costRange-1].each{|j|
  [*1..max].each{|j|
    tmp = j-a[i]<1 ? b[i] : dp[i][j-a[i]]+b[i]
    dp[i+1][j] = [dp[i][j], tmp].min
  }
}
p dp[n][h]

Compiler output:
a.cc:16:4: error: invalid preprocessing directive #costRange
   16 |   #costRange += b[i]
      |    ^~~~~~~~~
a.cc:17:4: error: invalid preprocessing directive #[
   17 |   #[*1..costRange-1].each{|j|
      |    ^
a.cc:18:5: error: too many decimal points in number
   18 |   [*1..max].each{|j|
      |     ^~~~~~
a.cc:1:1: error: 'INF' does not name a type
    1 | INF = 1000000007
      | ^~~
a.cc:10:1: error: 'dp' does not name a type
   10 | dp = []
      | ^~
a.cc:13:1: error: 'costRange' does not name a type
   13 | costRange = 0
      | ^~~~~~~~~
a.cc:23:1: error: 'p' does not name a type
   23 | p dp[n][h]
      | ^
Language: C++

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    private static class R {
        public int a;
        public int b;
        public R(int a, int b) { this.a = a; this.b = b; }
    }

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        List<R> l = new ArrayList<>();
        int h = s.nextInt();
        int n = s.nextInt();
        int maxa = 0;
        for (int i = 0; i < n; ++i) {
            int ai = s.nextInt();
            int bi = s.nextInt();
            l.add(new R(ai, bi));
            maxa = Math.max(maxa, ai);
        }

        int maxh = h + maxa;
        long[][] f = new long[n][maxh];
        for (int j = 1; j < (int)Math.ceil(1.0 * h / l.get(0).a); ++j) {
            f[0][l.get(0).a * j] = l.get(0).b * j;
        }

        for (int i = 1; i < n; ++i) {
            for (int j = 0; j < maxh; ++j) {
                int maxk = (int)(j / l.get(i).a);
                for (int k = 0; k < maxk; ++k) {
                    if (j < k * l.get(i).a) continue;
                    if (f[i - 1][j - k * l.get(i).a] == 0) continue;

                    long f1 = f[i - 1][j - k * l.get(i).a] + k * l.get(i).b;
                    f[i][j] = f[i][j] == 0 ? f1 : Math.min(f[i][j], f1);
                }
            }
        }

//        for (int i = 0; i < n; ++i) {
//            for (int j = 0; j < maxh; ++j) {
//                System.out.print(f[i][j] + " ");
//            }
//            System.out.println();
//        }

        long minf = Long.MAX_VALUE;
        for (int i = h; i < maxh; ++i) {
            if (f[n - 1][i] > 0) minf = Math.min(minf, f[n - 1][i]);
        }

        System.out.println(minf);
    }
}


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import java.util.ArrayList;
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
    2 | import java.util.List;
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
    3 | import java.util.Scanner;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: expected unqualified-id before 'public'
    5 | public class Main {
      | ^~~~~~
Language: C

//#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
	ll h,n;
	cin>>h>> n;
	vector<pair<double,pair<ll,ll> > > a(n);
	for(ll i=0;i<n;i++){
		cin>> a[i].second.first>> a[i].second.second;
		a[i].first = (double)a[i].second.first/(double)a[i].second.second;
/*		if(max< c[i]){
			max = c[i]
			max_index = i;
		}*/
	}
	sort(a.begin(),a.end());
	ll ans =0;
	while(h > 0){
		if(h < a[a.size()-1].second.first && a.size() != 1){
			a.pop_back();
			continue;
		}
		ans += (h%a[a.size()-1].second.first)*a[a.size()-1].second.second;
		h /= a[a.size()-1].second.first;
		a.pop_back();
	}
	cout << ans << endl;
	return 0;

}

Compiler output:
main.c:2:9: fatal error: iostream: No such file or directory
    2 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

H, N = map(int, input().split())
A, B = [], []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

max_A = max(A)
dp = [[float('inf') for _ in range(H + max_A)] for _ in range(N+1)]
for i in range(N+1):
    dp[i][0] = 0

for i in range(N):
    for h in range(H + max_A):
        dp[i + 1][h] = min(dp[i + 1][h], dp[i][h])
        if h >= A[i]:
            dp[i + 1][h] = min(dp[i + 1][h], dp[i + 1][h - A[i]] + B[i])

# print(dp)
for h in range(H, H + max_A):
    if not (dp[N][h] == float('inf')):
        print(dp[N][h])
        exit()

Compiler output:
a.cc:9:14: warning: multi-character character constant [-Wmultichar]
    9 | dp = [[float('inf') for _ in range(H + max_A)] for _ in range(N+1)]
      |              ^~~~~
a.cc:19:3: error: invalid preprocessing directive #print
   19 | # print(dp)
      |   ^~~~~
a.cc:21:31: warning: multi-character character constant [-Wmultichar]
   21 |     if not (dp[N][h] == float('inf')):
      |                               ^~~~~
a.cc:1:1: error: 'H' does not name a type
    1 | H, N = map(int, input().split())
      | ^
Language: C

//#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
	ll h,n;
	cin>>h>> n;
	vector<pair<double,pair<ll,ll> > > a(n);
	for(ll i=0;i<n;i++){
		cin>> a[i].second.first>> a[i].second.second;
		a[i].first = (double)a[i].second.first/(double)a[i].second.second;
/*		if(max< c[i]){
			max = c[i]
			max_index = i;
		}*/
	}
	sort(a.begin(),a.end());
	ll ans =0;
	while(h > 0){
		if(h < a[a.size()-1].second.first && a.size() != 1){
			a.pop_back();
			continue;
		}
		ans += (h%a[a.size()-1].second.first)*a[a.size()-1].second.second;
		h /= a[a.size()-1].second.first;
		a.pop_back();
	}
	cout << ans << endl;

}

Compiler output:
main.c:2:9: fatal error: iostream: No such file or directory
    2 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
#define itn int
#define lli unsigned long long int
#define REP(a,n) for(int i=a;i < n;i++)
#define REP2(a,n) for(int j = a;j<n;j++)
#define Damage(a,h) a >= h ? h : a
#define scanf scanf_s
using namespace std;
int main(void) {
	lli h, n;
	lli a, b;
	cin >> h >> n;
	lli** table = new lli*[n];
	cin >> a >> b;
	table[0] = new lli[h+1];
	for (lli i = 0; i <= h; i++) {
		table[0][i] = -1;
	}
	for (lli i = 1; i <= h / a; i++) {
		table[0][i*a] = b*i;
	}
	for (lli i = 1; i < n; i++) {
		scanf("%d %d", &a, &b);
		table[i] = new lli[h + 1];
		for (lli k = 0; k <= h; k++) {
			table[i][k] = table[i - 1][k];
		}
		if (table[i - 1][Damage(a, h)] == -1) {
			table[i][Damage(a, h)] = b;
		}
		else {
			table[i][Damage(a, h)] = Damage(b, table[i - 1][Damage(a, h)]);
		}
		for (lli j = 1; j <= h / a; j++) {
			table[i][Damage(a, h)] = Damage(b, table[i - 1][Damage(a, h)]);
			for (lli k = 0; k <= h; k++) {
				if (table[i][k] == -1)continue;
				if (table[i][Damage((k + a), h)] == -1) {
					table[i][Damage((k + a), h)] = table[i][k] + b;
				}else if (table[i][Damage((k + a), h)] > table[i][k] + b) {
					table[i][Damage((k + a), h)] = table[i][k] + b;
				}
			}
		}
	}
	cout << table[n - 1][h] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
    7 | #define scanf scanf_s
      |               ^~~~~~~
a.cc:23:17: note: in expansion of macro 'scanf'
   23 |                 scanf("%d %d", &a, &b);
      |                 ^~~~~
Language: C

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll h,n;
	cin>>h>> n;
	vector<pair<double,pair<ll,ll> > > a(n);
	for(ll i=0;i<n;i++){
		cin>> a[i].second.first>> a[i].second.second;
		a[i].first = (double)a[i].second.first/(double)a[i].second.second;
/*		if(max< c[i]){
			max = c[i]
			max_index = i;
		}*/
	}
	sort(a.begin(),a.end());
	ll ans =0;
	while(h > 0){
		if(h < a[a.size()-1].second.first && a.size() != 1){
			a.pop_back();
			continue;
		}
		ans += (h%a[a.size()-1].second.first)*a[a.size()-1].second.second;
		h /= a[a.size()-1].second.first;
		a.pop_back();
	}
	cout << ans << endl;

}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>

using namespace std;


int main() {

	long long H, N, ans = 10000000000;
	cin >> H >> N;
	vector<long long>A(N), B(N), cost(30000, 10000000000);
	for (size_t i = 0; i < N; i++)
	{
		cin >> A.at(i) >> B.at(i);
	}
	cost.at(0)=0
	for (size_t i = 0; i < N; i++)
	{
		cost.at(A.at(i)) = B.at(i);
	}
	for (size_t i = 0; i < 30000; i++)
	{
		for (size_t j = 0; j < N; j++)
		{
			if (A.at(j) - i>=0)
			{
				cost.at(i) = min(cost.at(i - A.at(j)) + B.at(j), cost.at(i));
			}
		}
	}
	for (size_t i = H; i < 30000; i++)
	{
		ans = min(ans, cost.at(i));
	}
	cout << ans;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:15:21: error: expected ';' before 'for'
   15 |         cost.at(0)=0
      |                     ^
      |                     ;
   16 |         for (size_t i = 0; i < N; i++)
      |         ~~~          
a.cc:16:28: error: 'i' was not declared in this scope
   16 |         for (size_t i = 0; i < N; i++)
      |                            ^
Language: C++

#include<iostream>
#include<
using namespace std;
int main()
{
  int H, N;
  cin>>H>>N;
  int arra[N], arrb[N];
  int i,min,t;
  int minc = 0;
  for(i=0;i<N;i++)
  {
    cin>>arra[i];
    cin>>arrb[i];
  }
  while(H > 0)
  {
  min = ( H / arra[0] ) * arrb[0];
    t = H % arra[0];
    for(i=1; i < N ; i++)
    {
      if((( H / arra[i] ) * arrb[i] ) < min)
      {
        min = ( H / arra[i] ) * arrb[i];
        t = H % arra[i];
      }
      minc = min + minc;
      H = t;
    }
  }
  cout<<minc<<endl;
  return 0;
}

Compiler output:
a.cc:2:10: error: missing terminating > character
    2 | #include<
      |          ^
a.cc:2:9: error: empty filename in #include
    2 | #include<
      |         ^
Language: C++

#include<iostream>
using namespace std;
int main()
{
	int h,n,y=0;
	cin>>h>>n;
	
	int a[n],b[n];
	for(int i=0;i<n;i++)
	{cin>>a[i];
	}
		for(int i=0;i<n;i++)
	{cin>>b[i];
	}
		int i=0;
		for(int j=0;;j++)
	{i++
		if(i==n-1)i=0;
	h= h-a[i];
	y=y+b[i];
	if(h<=0)
	{break;
	}
	}
cout<<y;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:13: error: expected ';' before 'if'
   17 |         {i++
      |             ^
      |             ;
   18 |                 if(i==n-1)i=0;
      |                 ~~
Language: C++

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

int main(void){
    long long H,N;
    cin >> H >> N;
    vector<long long> ab(2*N);
    for (long long& v : ab)
	{
		cin >> v;
	}
  vector<long long> c(N);
  for (int i=0;i<N;i=i++){
    c[i] = (float)ab[2*i] / ab[2*i+1];
  }
  sort(c.begin(),c.end());
 　long long sab[N][2];
  for (int i=0;i<N;i=i+2){
    for(int j = 0;j<N;j++){
      if(c[j] == (float)ab[i] / ab[i+1]){
        sab[j][0] = ab[i];
        sab[j][1] = ab[i+1];
        break;
      }
    }
  }
  
  long long sum = 0;
  while(H>=0){
    for (int i= 0;i<N;i++){
      if(H>=sab[i][0]){
        H -= sab[i][0];
        sum += 1;
        break;}
   }
 }
 
cout << sum;
  
   
   return 0; 
}

Compiler output:
a.cc:18:2: error: extended character 　 is not valid in an identifier
   18 |  　long long sab[N][2];
      |  ^
a.cc: In function 'int main()':
a.cc:18:2: error: '\U00003000long' was not declared in this scope; did you mean 'ulong'?
   18 |  　long long sab[N][2];
      |  ^~~~~~
      |  ulong
a.cc:22:9: error: 'sab' was not declared in this scope; did you mean 'ab'?
   22 |         sab[j][0] = ab[i];
      |         ^~~
      |         ab
a.cc:32:13: error: 'sab' was not declared in this scope; did you mean 'ab'?
   32 |       if(H>=sab[i][0]){
      |             ^~~
      |             ab
Language: C++

#include <bits/stdc++.h>
 
using namespace std;
int main(void){
    long long H,N;
    cin >> N >> K;
    vector<long long> ab(2*N);
    for (long long& v : ab)
	{
		cin >> v;
	}
  vector<long long> c(N);
  for (int i=0;i<N;i=i+2){
    c[i] = (float)ab[i] / ab[i+1];
  }
  sort(c.begin(),c.end());
 　long long sab[N][2];
  for (int i=0;i<N;i=i+2){
    for(int j = 0;j<N;j++){
      if(c[j] == (float)ab[i] / ab[i+1]){
        sab[j][0] = ab[i];
        sab[j][1] = ab[i+1];
      }
    }
  }
  
  long long sum = 0;
  while(H>=0){
    for (int i= 0;i<N;i++){
      if(H>=sub[i][0]){
        H -= sub[i][0];
        sum += 1;
        break;}
    }
   }
 }

cout << sum;
  
   
   return 0; 
}

Compiler output:
a.cc:17:2: error: extended character 　 is not valid in an identifier
   17 |  　long long sab[N][2];
      |  ^
a.cc: In function 'int main()':
a.cc:6:17: error: 'K' was not declared in this scope
    6 |     cin >> N >> K;
      |                 ^
a.cc:17:2: error: '\U00003000long' was not declared in this scope; did you mean 'ulong'?
   17 |  　long long sab[N][2];
      |  ^~~~~~
      |  ulong
a.cc:21:9: error: 'sab' was not declared in this scope; did you mean 'ab'?
   21 |         sab[j][0] = ab[i];
      |         ^~~
      |         ab
a.cc:30:13: error: 'sub' was not declared in this scope; did you mean 'sum'?
   30 |       if(H>=sub[i][0]){
      |             ^~~
      |             sum
a.cc: At global scope:
a.cc:38:1: error: 'cout' does not name a type
   38 | cout << sum;
      | ^~~~
a.cc:41:4: error: expected unqualified-id before 'return'
   41 |    return 0;
      |    ^~~~~~
a.cc:42:1: error: expected declaration before '}' token
   42 | }
      | ^
Language: C++

include<iostream>
using namespace std;
int main()
{
	int h,n,y=0;
	cin>>h>>n;
	
	int a[n],b[n];
	for(int i=0;i<n;i++)
	{cin>>a[i]>>b[i];
	}
		/*for(int i=0;i<n;i++)
	{cin>>b[i];
	}*/
		for(int i=0;i<n;i++)
	{h= h-a[i];
	y=y+b[i];
	if(h<=0)
	{break;
	}
	}
cout<<y;
	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<iostream>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:6:9: error: 'cin' was not declared in this scope
    6 |         cin>>h>>n;
      |         ^~~
a.cc:22:1: error: 'cout' was not declared in this scope
   22 | cout<<y;
      | ^~~~
Language: C++

#include<stdio.h>
#include<algorithm>

using namespace std;

typedef pair<float,int> P;
typedef pair<int,int> PP:

P m[100 + 1];
int a[100 + 1];
int b[100 + 1];

int main(){
    
    int n,h,ans=0;
    
    scanf("%d%d",&h,&n);
    
    for(int i=0;i<n;i++){
        scanf("%d %d",&a[i],&b[i]);
        P x=make_pair(float(a[i]/b[i]),i);
        m[i]=x;
    }
    
    sort(m,m+1);
    
    ans=(h/a[m[n-1].second])*b[m[n-1].second];
    int r=h/a[m[n-1].second];
    
    int* l=lower_bound(m,m+n,make_pair(r,0))-m;
    ans+=b[l];
    
    printf("%d\n",ans);
    
    return 0;
}

Compiler output:
a.cc:7:25: error: found ':' in nested-name-specifier, expected '::'
    7 | typedef pair<int,int> PP:
      |                         ^
      |                         ::
a.cc:7:23: error: 'PP' has not been declared
    7 | typedef pair<int,int> PP:
      |                       ^~
a.cc:9:3: error: expected initializer before 'm'
    9 | P m[100 + 1];
      |   ^
a.cc: In function 'int main()':
a.cc:22:9: error: 'm' was not declared in this scope
   22 |         m[i]=x;
      |         ^
a.cc:25:10: error: 'm' was not declared in this scope
   25 |     sort(m,m+1);
      |          ^
a.cc:31:11: error: invalid types 'int [101][int*]' for array subscript
   31 |     ans+=b[l];
      |           ^
Language: C++

#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include <iomanip>
#include<cmath>
#include<stdio.h>
#include<map>
#define rep(i,n) for(int i=0;i<(n);i++)
#define ll long long
#define sort(s) sort(s.begin(),s.end())
#define r(s) reverse(s.begin(),s.end())
#define please return
constexpr auto AC = 0;
using namespace std;
int bbb(int a, int b) {
	for (int i = 1;; i++) {
		if (i * b >= a)return i;
	}
}
int main() {
	int a, b;
	double x = 0;
	cin >> a >> b;
	int y = b;
	vector<double> n(b+1), m(b+1);
	vector<double> s(b);
	rep(i, b) {
		cin >> n[i] >> m[i];
		if (x < n[i] / m[i])x = n[i] / m[i],y=i;
	}

	double ans = a / n[y];
	double aaa = a % n[y];
	
	for (int i = 0; i < b; i++) {
		m[i] *= bbb(aaa, n[i]);
	}
	sort(m);
	ans = ans * m[y] + m[0];
	cout << ans << endl;
	
	please AC;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:24: error: invalid operands of types 'int' and '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'} to binary 'operator%'
   34 |         double aaa = a % n[y];
Language: C++

#include <iostream>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;


struct Atk{
    ll A, B;
    double ratio;
};

bool cmp(Atk a, Atk b)
{
    if(a.ratio != b.ratio)
    {
        return a.ratio > b.ratio;
    }

    return a.B < b.B;
}



Atk arr[10005];

ll min_b = INT_MAX;

void find_ans(ll i, ll n, ll h, ll curSumA, ll curSumB)
{
    if(curSumB >= min_b)
    {
        return;
    }
    if(i == n)
    {
        if(curSumA >= h && min_b > curSumB)
        {
            min_b = curSumB;
        }
        return;
    }

    find_ans(i + 1, n, h, curSumA + arr[i].A, curSumB + arr[i].B);
    find_ans(i + 1, n, h, curSumA, curSumB);
}
ll c[10005];

void change(ll m, int n)
{
    memset(c, 0x7f, sizeof(c));
    c[0] = 0;

    for (int i = 0; i < n; ++i)
        for (ll j = arr[i].A; j <= m; ++j){
            cout << j << endl;
            cout << "c[j] = " << c[j] << endl;
            cout << "c[j-arr[i].A] = " << c[j-arr[i].A] << endl;
            cout << "arr[i].B = "  << arr[i].B << endl;
            c[j] = min(c[j], c[j-arr[i].A] + arr[i].B);
        }


    cout << "湊得價位" << m;
    cout << "最少需（只）要" << c[m] << "個錢幣";
}

ll find_ans2(int n,ll W){
    ll f[100005];
    f[0]=0;
    bool g[100005];
    g[0]=true;
    for (int i=0;i<n;i++)
        for (ll j=0;j<=W;j++)
            if (g[j]) {
                g[j+arr[i].A]=true;
                if (f[j+arr[i].A]==0||f[j+arr[i].A]>f[j]+arr[i].B)
                    f[j+arr[i].A]=f[j]+arr[i].B;
            }

    if (g[W]) return f[W];
    else return 0;
}
int main()
{
    ll h, n;
    while(cin >> h >> n)
    {
        for(ll i = 0 ; i < n ;++i)
        {
            cin >> arr[i].A >> arr[i].B;
            arr[i].ratio = (double)arr[i].A / (double)arr[i].B;
        }
        cout << find_ans2(n, h) << endl;
    }
    return 0;
}


Compiler output:
a.cc:27:12: error: 'INT_MAX' was not declared in this scope
   27 | ll min_b = INT_MAX;
      |            ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <cstring>
  +++ |+#include <climits>
    4 | #define ll long long
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
 int H;
 int N;
 cin >> H >> N;
 vector<tuple<double, int, int>> a;
 vector<tuple<int, int>> b;
 int x;
 int y;
 double z;
 int i;
 long long int sum = 0;
 for(i=0;i<N;++i){
   cin >> x >> y;
   z = (double)x/y;
   a.push_back(make_tuple(z, x, y));
   b.push_back(make_tuple(y,x));
   }
   sort(a.begin(),a.end());
 while(H>0){
     if(H>a[N-1][1]){
         H -= a[N-1][1];
         sum += a[N-1][2];
     else{
         for(i=0;i<N;i++){
             if(H<b[i][1]){
                 H -= b[i][1];
                 sum += b[i][0];
                 break;
             }
         }
     }
     }
 }
 cout << sum << endl;
 }

Compiler output:
a.cc: In function 'int main()':
a.cc:23:17: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<double, int, int> >, std::tuple<double, int, int> >::value_type' {aka 'std::tuple<double, int, int>'} and 'int')
   23 |      if(H>a[N-1][1]){
      |                 ^
a.cc:24:21: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<double, int, int> >, std::tuple<double, int, int> >::value_type' {aka 'std::tuple<double, int, int>'} and 'int')
   24 |          H -= a[N-1][1];
      |                     ^
a.cc:25:23: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<double, int, int> >, std::tuple<double, int, int> >::value_type' {aka 'std::tuple<double, int, int>'} and 'int')
   25 |          sum += a[N-1][2];
      |                       ^
a.cc:26:6: error: expected '}' before 'else'
   26 |      else{
      |      ^~~~
a.cc:23:21: note: to match this '{'
   23 |      if(H>a[N-1][1]){
      |                     ^
a.cc:28:23: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int> >, std::tuple<int, int> >::value_type' {aka 'std::tuple<int, int>'} and 'int')
   28 |              if(H<b[i][1]){
      |                       ^
a.cc:29:27: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int> >, std::tuple<int, int> >::value_type' {aka 'std::tuple<int, int>'} and 'int')
   29 |                  H -= b[i][1];
      |                           ^
a.cc:30:29: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<std::tuple<int, int> >, std::tuple<int, int> >::value_type' {aka 'std::tuple<int, int>'} and 'int')
   30 |                  sum += b[i][0];
      |                             ^
a.cc: At global scope:
a.cc:37:2: error: 'cout' does not name a type
   37 |  cout << sum << endl;
      |  ^~~~
a.cc:38:2: error: expected declaration before '}' token
   38 |  }
      |  ^
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<ll,ll>

using namespace std;
typedef long long ll;


int main(void) {
	int H, N; cin >> H >> N;
	vint a(N+1), b(N+1);
	rep(i, N) {
		cin >> a[i+1] >> b[i+1];
	}

	vvint dp(N + 1, vint(H + 1,0));
	rep(i, H + 1) {
		dp[0][i] = INT_MAX;
	}
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= H; j++) {
			int x = (int)ceil((double)j / (double)a[i])*b[i];
			int y = dp[i - 1][j];
			dp[i][j] = min(x,dp[i-1][j]);
			if (j < a[i]) {
				dp[i][j] = min(b[i], dp[i - 1][j]);
			}
			else {
				dp[i][j] = min(min(dp[i][j - a[i]],dp[i-1][j-a[i]]) + b[i], dp[i - 1][j]);
			}
		}
	}

	cout << dp[N][H] << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:28: error: 'INT_MAX' was not declared in this scope
   28 |                 dp[0][i] = INT_MAX;
      |                            ^~~~~~~
a.cc:9:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    8 | #include<cmath>
  +++ |+#include <climits>
    9 |
Language: C++

#include <iostream>
#include <stdio.h>
#include <cmath>
#include <algorithm>

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

typedef long long ll;

using namespace std;

const int INF = 1e9;
const int MOD = 1e9+7;
const double PI=3.14159265358979323846;

int dp[10010]={};

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

  int A[10010]={}, B[10010]={};
  rep(i,N) cin >> A[i] >> B[i];

  fill(dp,dp+10010,10010);
  dp[0] = 0;
  rep(i,10000){
    rep(j,N){
      if(i-A[j]<0) continue;
      dp[i] = min(dp[i-A[j]]+B[j],dp[i]);
    }
  }

  ll ans=10010;
  for(int i=H; i<=10010; i++){
    ans = min(dp[i],ans);
  }
  cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:36:14: error: no matching function for call to 'min(int&, ll&)'
   36 |     ans = min(dp[i],ans);
      |           ~~~^~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:36:14: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   36 |     ans = min(dp[i],ans);
      |           ~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:36:14: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   36 |     ans = min(dp[i],ans);
      |           ~~~^~~~~~~~~~~
Language: C

#include <iostream>

using namespace std;

int main() {
  int h, n;
  cin >> h >> n;

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

  long cost[n][h + 1];

  for (int i = 0; i < n; i++) {
    cost[i][0] = 0;
  }

  for (int i = 1; i <= h; i++) {
    int c;
    if (i % a[0] == 0) {
      c = (i / a[0]) * b[0];
    } else {
      c = (i / a[0] + 1) * b[0];
    }
    cost[0][i] = c;
  }

  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= h; j++) {
      int c;
      if (i % a[i] == 0) {
        c = (i / a[i]) * b[i];
      } else {
        c = (i / a[i] + 1) * b[9];
      }

      long min = cost[i - 1][j];
      for (int k = 1; k <= c; k++) {
        int d;
        if (j - a[i] * k >= 0) {
          d = cost[i - 1][j - a[i] * k] + b[i] * k;
        } else {
          d = b[i] * k;
        }
        if (d < min) {
            min = d;
        }
      }
      
      cost[i][j] = min;
    }
  }

  cout << cost[n - 1][h] << endl;

  return 0;
}


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

#include<iostream>
#include<vector>
#include<cstring>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
#include<random>
#include<limits>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

struct HashPair {

    static size_t m_hash_pair_random;

    template<class T1, class T2>
    size_t operator()(const pair<T1, T2> &p) const {

        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);

        size_t seed = 0;
        seed ^= hash1 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        seed ^= hash2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        seed ^= m_hash_pair_random + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        return seed;
    }
};

size_t HashPair::m_hash_pair_random = (size_t) random_device()();

int H, n;
int a[1010];
int b[1010];

unordered_map<pair<int, int>, int, HashPair> cache;
// int cache[1010][1010];

int rec(int sum, int h) {
    auto iter = cache.find(make_pair(sum, h));
    if (iter != cache.end())
        return iter->second;
    // cout << sum << " " << h << endl;
    if (h <= 0) 
        return sum;
    int ans = INT_MAX;
    rep(i, n) {
        if (sum + b[i] > ans)
            continue;
        int x = rec(sum + b[i], h - a[i]);
        chmin(ans, x);
    }
    cache[make_pair(sum, h)] = ans;
    return ans;

}

int main() {
    cin >> H >> n;
    rep(i, n) cin >> a[i] >> b[i];
    cout << rec(0, H) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int rec(int, int)':
a.cc:60:15: error: 'INT_MAX' was not declared in this scope
   60 |     int ans = INT_MAX;
      |               ^~~~~~~
a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include<random>
  +++ |+#include <climits>
   12 | #include<limits>
Language: C++

#include<iostream>
#include<vector>
#include<cstring>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
#include<random>

using namespace std;
using ll = long long;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

struct HashPair {

    static size_t m_hash_pair_random;

    template<class T1, class T2>
    size_t operator()(const pair<T1, T2> &p) const {

        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);

        size_t seed = 0;
        seed ^= hash1 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        seed ^= hash2 + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        seed ^= m_hash_pair_random + 0x9e3779b9 + (seed << 6) + (seed >> 2);
        return seed;
    }
};

size_t HashPair::m_hash_pair_random = (size_t) random_device()();

int H, n;
int a[1010];
int b[1010];

unordered_map<pair<int, int>, int, HashPair> cache;
// int cache[1010][1010];

int rec(int sum, int h) {
    auto iter = cache.find(make_pair(sum, h));
    if (iter != cache.end())
        return iter->second;
    // cout << sum << " " << h << endl;
    if (h <= 0) 
        return sum;
    int ans = INT_MAX;
    rep(i, n) {
        if (sum + b[i] > ans)
            continue;
        int x = rec(sum + b[i], h - a[i]);
        chmin(ans, x);
    }
    cache[make_pair(sum, h)] = ans;
    return ans;

}

int main() {
    cin >> H >> n;
    rep(i, n) cin >> a[i] >> b[i];
    cout << rec(0, H) << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int rec(int, int)':
a.cc:59:15: error: 'INT_MAX' was not declared in this scope
   59 |     int ans = INT_MAX;
      |               ^~~~~~~
a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include<random>
  +++ |+#include <climits>
   12 |
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main (){
  int long long h,n;
  cin>>h>>n;
  int long long ab[n][2];
  for(int i=0;i<n;i++)
    cin>>ab[i][0]>>ab[i][1];
  int long long dp[1100][11000];
  for(int i=0;i<n;i++)
    for(int j=0;j<h;j++)
      dp[i][j]=100000000;
  dp[0][0]=0;
  for(int i=0;i<n;i++)
    for(int j=0;j<h;j++){
      dp[i+1][j]=min(dp[i+1][j],dp[i][j]);
      dp[i+1][j]=min(dp[i+1][j],dp[i][j-ab[i][0]]+ab[i][1]);
    }
  cout<<dp[n][h]

Compiler output:
a.cc: In function 'int main()':
a.cc:19:17: error: expected ';' at end of input
   19 |   cout<<dp[n][h]
      |                 ^
      |                 ;
a.cc:19:17: error: expected '}' at end of input
a.cc:3:12: note: to match this '{'
    3 | int main (){
      |            ^
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using vect=vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}

ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}

int main() {
  cout << fixed << setprecision(30);
  ll h,n;
  cin>>h>>n;
  vec a(n);
  vec b(n);
  loop(i,n)cin>>a[i]>>b[i];
  ll dp[10*h+1];
  loop(j,10*h+1)dp[j]=1000000000;
  dp[0]=0;
for (int i = 0; i < n; ++i) {
        for (int w = a[i]; w <= 10*h+1; ++w) {
            dp[w] = min(dp[w], dp[w - weight[i]] + b[i]);
        }
    }
  ll ans=1000000000;
  Loop(i,h,10*h+1)ans=min(ans,dp[i]);
  putout(ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:77:39: error: 'weight' was not declared in this scope
   77 |             dp[w] = min(dp[w], dp[w - weight[i]] + b[i]);
      |                                       ^~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
long long h,n,a[1010],b[1010],dp[1010][150010],ans=1e9;
int main(){
	cin>>h>>n;
	for (int i=1;i<=n;i++) cin>>a[i]>>b[i];
	for (int i=1;i<=n;i++){
		dp[i][a[i]]=b[i];
		for (int j=a[i];j<=h*15;j++){
			if (dp[i-1][j-a[i]]!=0&&dp[i][j-a[i]]!=0)
				dp[i][j]=min(dp[i-1][j-a[i]],dp[i][j-a[i]])+b[i];
			else if (dp[i-1][j-a[i]]!=0)
				dp[i][j]=dp[i-1][j-a[i]]+b[i];
			else if (dp[i][j-a[i]]!=0)
				dp[i][j]=dp[i][j-a[i]]+b[i];
			if (dp[i][j]==0) dp[i][j]=dp[i-1][j];
			if (dp[i-1][j]!=0) dp[i][j]=min(dp[i][j],dp[i-1][j]);
	}
	for (int i=1;i<=n;i++)
		for (int j=h;j<=h*15;j++)
			if (dp[i][j]!=0) ans=min(ans,dp[i][j]);
	cout<<ans<<endl;
	return 0;
}

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

#include <stdio.h>
#include <assert.h>
#include <algorithm>
using namespace std;

#define INF 1e8 * 8

int a[1111], b[1111], dp[222222];

int main(void)
{
    int h, n, i, j;

    scanf("%d %d" ,&h, &n);
    for (i = 1; i <= n; i++)
		scanf("%d %d" ,&a[i], &b[i]);

	for (i = 1; i <= h * 2; i++)
		dp[i] = INF;

    for (i = 1; i <= n; i++)
		for (j = a[i]; j <= h * 2; j++)
			dp[j] = min(dp[j], dp[j - a[i]] + b[i]);
	assert(h == 10000 && a == 1000);
    printf("%d" ,*min_element(dp + h, dp + h * 2 + 1));
    return 0;
}


Compiler output:
In file included from a.cc:2:
a.cc: In function 'int main()':
a.cc:24:32: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   24 |         assert(h == 10000 && a == 1000);
      |                              ~~^~~~~~~
Language: C++

#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3")
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define EPS (1e-9)
#define INF (1e17)
#define PI (acos(-1))
//const double PI = acos(-1);
//const double EPS = 1e-15;
//long long INF=(long long)1E17;
#define i_7 (long long)(1e9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=std::sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    std::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;
}

//using namespace std;
//using namespace boost::multiprecision;
//using namespace __gnu_pbds;

int main(){
  using namespace std;
  int h, n;
  cin>>h>>n;
  int a[n], b[n];
  REP(i,n){
    cin>>a[i]>>b[i];
  }
  int dp[h+1][n];
  fill(dp[0], dp[h+1], 1'000'000'000);
  REP(i,n){
    REP(j,h+1){
      if(j == 0){
        dp[j][i] = 0;
        continue;
      }
      if(i == 0){
        dp[j][i] = ((j + a[i] - 1)/a[i]) * b[i];
        continue;
      }
      q = h/a[i];
      REP(x, q+1){
        dp[j][i] = min(dp[j][i], dp[j - x*a[i]][i-1] + x*b[i]);
      }
    }
  }
  int ans = dp[h][n-1];
  cout<<ans<<endl;    
  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:89:7: error: 'q' was not declared in this scope
   89 |       q = h/a[i];
      |       ^
Language: C++

#include <iostream>
#include <algorithm>

using namespace std;

int dp[20000];

int main() {
	int h, n; cin >> h >> n;
	vector<pair<int, int> > ab(n);
	for (auto& e : ab) cin >> e.first >> e.second;
	fill(dp, dp + 20000, 1e9);
	dp[0] = 0;
	int ans = 1e9;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j <= h; ++j) {
			dp[j + ab[i].first] = min(dp[j + ab[i].first], dp[j] + ab[i].second);
			if (j + ab[i].first >= h) ans = min(ans, dp[j + ab[i].first]);
		}
	}
	cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: 'vector' was not declared in this scope
   10 |         vector<pair<int, int> > ab(n);
      |         ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <algorithm>
  +++ |+#include <vector>
    3 | 
a.cc:10:31: error: expected primary-expression before '>' token
   10 |         vector<pair<int, int> > ab(n);
      |                               ^
a.cc:10:33: error: 'ab' was not declared in this scope; did you mean 'abs'?
   10 |         vector<pair<int, int> > ab(n);
      |                                 ^~
      |                                 abs
Language: C++

//JSD
#include<algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#define ll long long
#define Mod 1000000007
using namespace std;
ll modular_exponentiation(ll a,ll b){
	if(b==0){
		return 1;
	}
	if(b==1){
		return a%Mod;
	}
	ll x=modular_exponentiation(a,b/2);
	x=(x*x)%Mod;
	if(b%2==1){
		x=(x*a)%Mod;
	}
	return x;
}
ll modular_divison(ll a,ll b){
    return (modular_exponentiation(b,Mod-2)*a)%Mod;
}

bool isPrime(ll n){
	if(n<=1) return 0;
	if(n==2 or n==3 ) return 1;
	if(n%2==0 or n%3==0) return 0;
	for(ll i=5;i*i<=n;i+=6){
		if(n%i==0 or n%(i+2)==0)
			return 0;
	}
	return 1;
}
struct primeFactorInfo{
	map<ll,ll> M;
	set<ll> S;
};
primeFactorInfo pfs(ll n){
	primeFactorInfo p;
	for(ll i=2;i<=sqrt(n);i++){
		if(n%i==0){
			p.S.insert(i);
			while(((n%i)==0)){
				p.M[i]++;
				n/=i;
			}
		}
	}
	if(n>1){
		p.M[n]++;
		p.S.insert(n);
	}
	return p;
}
void sieve(ll n,vector<ll>& v){
	bool isComposite[n+1]={0};
	isComposite[0]=isComposite[1]=1;
	for(ll i=2;i*i<=n;i++){
		if(!isComposite[i]){
			v.push_back(i);
			for(int j=2;j*i<=n;j++){
				isComposite[i*j]=1;
			}
		}
	}
}
primeFactorInfo pfsUsingSieve(ll n){
	primeFactorInfo p;
	vector<ll > v;
	sieve(n,v);
	for(auto i: v){
		if(n%i==0){
			p.S.insert(i);
			while(((n%i)==0)){
				p.M[i]++;
				n/=i;
			}
		}
	}
	if(n>1){
		p.M[n]++;
		p.S.insert(n);
	}
	return p;
}
map<ll,ll> dp;
ll n;
ll a[1001],b[1001];	
ll solve(ll H){
	if(H<0)
		return 0;	
	if(dp.find(H)!=dp.end())
		return dp[H];
	ll ans=INT_MAX;
	for(int i=0;i<n;i++){
		ans=min(ans,solve(H-a[i])+b[i]);
	}
	dp[H]=ans;
	return ans;
}
int main(){
	dp[0]=0;
	ll h;
	cin>>h>>n;
	for(ll i=0;i<n;i++){
		cin>>a[i]>>b[i];		
	}
	cout<<solve(h);
	return 0;
}


Compiler output:
a.cc: In function 'long long int solve(long long int)':
a.cc:99:16: error: 'INT_MAX' was not declared in this scope
   99 |         ll ans=INT_MAX;
      |                ^~~~~~~
a.cc:8:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    7 | #include<cmath>
  +++ |+#include <climits>
    8 | #define ll long long
Language: C++

#include <bits/stdc++.h>
using namespace std;
vector<int> dmg, val;
int cap, n;
long long dp[15000];
long long f(int at)
{
	if(at <= 0)
		return 0;
	if(dp[at] != -1)
		return dp[at];
		
	int rez = 1e9;
	for(int i = 0;i<n;i++)
	{
		int spell = dmg[i], money = val[i];
		rez = min(rez, f(at - dmg[i]) + money);
	}
	return dp[at] = rez;
}
int main()
{
	memset(dp,-1,sizeof(dp));
	cin>>cap>>n;
	for(int i =0;i<n;i++)
	{
		int a, b;
		cin>>a>>b;
		dmg.push_back(a);
		val.push_back(b);
	}
	cout<<f(cap)<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'long long int f(int)':
a.cc:17:26: error: no matching function for call to 'min(int&, long long int)'
   17 |                 rez = min(rez, f(at - dmg[i]) + money);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:17:26: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   17 |                 rez = min(rez, f(at - dmg[i]) + money);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:17:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   17 |                 rez = min(rez, f(at - dmg[i]) + money);
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~