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

#incldue <limits>
#include <iostream>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;

const int N = 20007;

int main() {
    int dp[N];
    memset(dp, -1, sizeof(dp));
    int h, n;
    cin >> h >> n;   
    vector<int> a(n), b(n);
    for(int i=0; i<n; i++)
        cin >> a[i] >> b[i];

    dp[0] = 0;
    for(int i=0; i<n; i++) {
        for(int j = a[i]; j<N; j++) {
            if(dp[j-a[i]] == -1)
                continue;
            if(dp[j] == -1)
                dp[j] = dp[j-a[i]] + b[i];
            else
                dp[j] = min(dp[j], dp[j-a[i]] + b[i]);
        }
    }
    int ans = INT_MAX;
    for(int i=h; i<N; i++) {
        if(dp[i] != -1) {
            ans = min(ans, dp[i]);
        }
    }
    cout << ans << "\n";
    return 0;
}


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #incldue; did you mean #include?
    1 | #incldue <limits>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:13:5: error: 'memset' was not declared in this scope
   13 |     memset(dp, -1, sizeof(dp));
      |     ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <vector>
  +++ |+#include <cstring>
    7 | using namespace std;
a.cc:31:15: error: 'INT_MAX' was not declared in this scope
   31 |     int ans = INT_MAX;
      |               ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include <vector>
  +++ |+#include <climits>
    7 | using namespace std;
Language: C++





























































#include <iostream>
#include <math.h>
#include <string>
#include <utility>
#include <vector>
using namespace std;

const int N = 20007;

int main() {
    int dp[N];
    memset(dp, -1, sizeof(dp));
    int h, n;
    cin >> h >> n;   
    vector<int> a(n), b(n);
    for(int i=0; i<n; i++)
        cin >> a[i] >> b[i];

    dp[0] = 0;
    for(int i=0; i<n; i++) {
        for(int j = a[i]; j<N; j++) {
            if(dp[j-a[i]] == -1)
                continue;
            if(dp[j] == -1)
                dp[j] = dp[j-a[i]] + b[i];
            else
                dp[j] = min(dp[j], dp[j-a[i]] + b[i]);
        }
    }
    int ans = INT_MAX;
    for(int i=h; i<N; i++) {
        if(dp[i] != -1) {
            ans = min(ans, dp[i]);
        }
    }
    cout << ans << "\n";
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:5: error: 'memset' was not declared in this scope
   72 |     memset(dp, -1, sizeof(dp));
      |     ^~~~~~
a.cc:66:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   65 | #include <vector>
  +++ |+#include <cstring>
   66 | using namespace std;
a.cc:90:15: error: 'INT_MAX' was not declared in this scope
   90 |     int ans = INT_MAX;
      |               ^~~~~~~
a.cc:66:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   65 | #include <vector>
  +++ |+#include <climits>
   66 | using namespace std;
Language: C++


//https://webbibouroku.com/Blog/Article/atcoder-abc153

#include<bits/stdc++.h>

#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)

using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;

struct magic
{
    int at;
    int mp;
}

int main(){
    int H,N;
    cin>>H>>N;
    vector<int> dp(H+1,INT_MAX)
    vector<magic> S(N);

    for(int i=0; i<N;i++){
        cin>>S[i].at>>S[i].mp;
    }

    for(int i=0;i<H+1;i++)
    {
        if(dp[i]==INT_MAX) continue;

        for(int j=0;j<N;j++)
        {
            int next=min(H,i+S[j].at);
            dp[next]=min(dp[next],dp[i]+S[j].mp);
        }
    }
}

Compiler output:
a.cc:19:2: error: expected ';' after struct definition
   19 | }
      |  ^
      |  ;
a.cc: In function 'int main()':
a.cc:25:5: error: expected ',' or ';' before 'vector'
   25 |     vector<magic> S(N);
      |     ^~~~~~
a.cc:28:14: error: 'S' was not declared in this scope
   28 |         cin>>S[i].at>>S[i].mp;
      |              ^
a.cc:37:30: error: 'S' was not declared in this scope
   37 |             int next=min(H,i+S[j].at);
      |                              ^
Language: C++

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

const int INF = 1001001001;

int main() {
  int N, H;
  cin >> H >> N;
  vector<int> dp(H + 1, MAX);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    for (int j = 0; j < H; j++) {
      int index = min(j + a, H);
      dp[index] = min(dp[index], dp[j] + b); 
    }
  }
  cout << dp[H] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:25: error: 'MAX' was not declared in this scope
   10 |   vector<int> dp(H + 1, MAX);
      |                         ^~~
Language: C++

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

const int INF = 1001001001;

int main() {
  int N, H;
  cin >> H >> N;
  vector<int> dp(H + 1, MAX);
  dp[0] = 0;
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    for (int j = 0; j < H; j++) {
      int index = min(j + a, H);
      dp[index] = min(dp[index], dp[j] + b); 
    }
  }
  cout << dp[H] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:25: error: 'MAX' was not declared in this scope
    9 |   vector<int> dp(H + 1, MAX);
      |                         ^~~
Language: C++

#include <iostream>
using namespace std;

int MAX = 100000;
int main() {
  int N, H;
  cin >> N >> H;
  vector<int> dp(H + 1, MAX);
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    for (int j = 0; j < H; j++) {
      int index = min(j + a, H);
      dp[index] = min(dp[index], dp[j] + b); 
    }
  }
  cout >> dp[H] >> endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'vector' was not declared in this scope
    8 |   vector<int> dp(H + 1, MAX);
      |   ^~~~~~
a.cc:2:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    1 | #include <iostream>
  +++ |+#include <vector>
    2 | using namespace std;
a.cc:8:10: error: expected primary-expression before 'int'
    8 |   vector<int> dp(H + 1, MAX);
      |          ^~~
a.cc:14:7: error: 'dp' was not declared in this scope
   14 |       dp[index] = min(dp[index], dp[j] + b);
      |       ^~
a.cc:17:11: error: 'dp' was not declared in this scope
   17 |   cout >> dp[H] >> endl;
      |           ^~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <list>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
const int INF = 1001001001;
ll mod = 1000000007;

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}



int main()
{
	int h, n;
	cin >> h >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

	vector<vector<int>> mp(n + 1, vector<int>(h + 1));
	int minimum = INT_MAX;
	for (int i = 0; i <= n; i++) mp[i][0] = 0;
	for (int j = 0; j <= h; j++) mp[0][j] = INF;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= h; j++) {
			mp[i][j] = mp[i - 1][j];
			if (0 <= j - a[i - 1]) mp[i][j] = min(mp[i][j], mp[i][j - a[i - 1]] + b[i - 1]);
		}
	}
	cout << mp[n][h] << endl;
}

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

#include<bits/stdc++.h>
using namespace std;
 
int main()
{
  int w,n;
  cin>>w>>n;
  int arr_a[n],arr_m[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr_a[i]>>arr_m[i];
  }
  int dp[w+1]={0};
  for(int i=0;i<=w;i++)
  {
   	for(int j=0;j<n;j++)
    {
      if(wt[j]<=i)
      {
        dp[i] = max(dp[i],dp[i-arr_a[j]]+arr_m[j]);
      }
    }
  }
  cout<<dp[w]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:10: error: 'wt' was not declared in this scope; did you mean 'w'?
   18 |       if(wt[j]<=i)
      |          ^~
      |          w
Language: C++

import java.util.Scanner;
import java.util.Arrays;
public class Main {

	
	public static void main(String[] args) {
		// Write your code here
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int n = sc.nextInt();
        int a[] = new int[n+1];
        long b[] = new long[n+1];
        for(int i=1;i<=n;i++) {
            a[i]=sc.nextInt();
            b[i]=sc.nextLong();
        }
        int max=(int)Math.pow(10,4);
        long dp[][] = new long[n+1][max+1];
        for(long row[]:dp)
        {
            Arrays.fill(row,Long.MAX_VALUE);
        }
        for(int i=0;i<=n;i++)
        {
            dp[i][0]=0;
        }
        for(int i=1;i<=max;i++) dp[0][i]=Long.MAX_VALUE;
        long min=Long.MAX_VALUE;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=max;j++)
            {
                if(a[i]>j){
                    dp[i][j]=dp[i-1][j];
                }
                else if(dp[i-1][j-a[i]]!=Long.MAX_VALUE && dp[i-1][j-a[i]]!=Long.MAX_VALUE)
                {
                    dp[i][j]=Math.min(dp[i-1][j-a[i]]+b[i],Math.min(dp[i-1][j],dp[i][j-a[i]]+b[i]));
                }
                else if(dp[i-1][j-a[i]]!=Long.MAX_VALUE)
                {
                    dp[i][j]=Math.min(dp[i-1][j],dp[i-1][j-a[i]]+b[i]);
                }
                else if(dp[i][j-a[i]]!=Long.MAX_VALUE)
                {
                    dp[i][j]=Math.min(dp[i-1][j],dp[i][j-a[i]]+b[i]);
                }
                else dp[i][j]=dp[i-1][j];
                if(j>=h) min=Math.min(min,dp[i][j]);
                
                
            }
            
        }
        System.out.println(min);
	}
}

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

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

int main()
{
  int w,n;
  cin>>w>>n;
  int arr_a[n],arr_w[n];
  for(int i=0;i<n;i++)
  {
    cin>>arr_a[i]>>arr_m[i];
  }
  int dp[w+1]={0};
  for(int i=0;i<=w;i++)
  {
   	for(int j=0;j<n;j++)
    {
      if(wt[j]<=i)
      {
        dp[i] = max(dp[i],dp[i-wt[j]]+val[j]);
      }
    }
  }
  cout<<dp[w]<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:20: error: 'arr_m' was not declared in this scope; did you mean 'arr_w'?
   11 |     cin>>arr_a[i]>>arr_m[i];
      |                    ^~~~~
      |                    arr_w
a.cc:18:10: error: 'wt' was not declared in this scope; did you mean 'w'?
   18 |       if(wt[j]<=i)
      |          ^~
      |          w
a.cc:20:39: error: 'val' was not declared in this scope
   20 |         dp[i] = max(dp[i],dp[i-wt[j]]+val[j]);
      |                                       ^~~
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <list>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int h, n;
	cin >> h >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

	vector<vector<int>> mp(n, vector<int>(h + 1));
	int minimum = INT_MAX;
	mp[0][0] = 0;
	for (int i = 1; i <= h; i++) {
		
		for (int j = 0; j < n; j++) {
			int tmp = i;
			int res = 0;
			while (0 < tmp) {
				tmp -= a[j];
				res += b[j];
			}
			minimum = min(minimum, res);
		}
		mp[0][i] = minimum;
	}

	for (int i = 1; i < n; i++) {
		for (int j = 0; j <= h; j++) {
			mp[i][j] = mp[i - 1][j];
			if (0 <= j - a[i]) mp[i][j] = min(mp[i][j], mp[i][j - a[i]] + b[i]);
		}
	}
	cout << mp[n - 1][h] << endl;
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <list>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int h, n;
	cin >> h >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

	vector<vector<int>> mp(n, vector<int>(h + 1));
	mp[0][0] = 0;
	for (int i = 1; i <= h; i++) {
		int minimum = INT_MAX;
		for (int j = 0; j < n; j++) {
			int tmp = i;
			int res = 0;
			while (0 < tmp) {
				tmp -= a[j];
				res += b[j];
			}
			minimum = min(minimum, res);
		}
		mp[0][i] = minimum;
	}

	for (int i = 1; i < n; i++) {
		for (int j = 0; j <= h; j++) {
			mp[i][j] = mp[i - 1][j];
			if (0 <= j - a[i]) mp[i][j] = min(mp[i][j], mp[i][j - a[i]] + b[i]);
		}
	}
	cout << mp[n - 1][h] << endl;
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <list>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int h, n;
	cin >> h >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

	vector<vector<int>> mp(n, vector<int>(h + 1));
	mp[0][0] = 0;
	for (int i = 1; i <= h; i++) {
		int minimum = INT_MAX;
		int res = 0;
		for (int j = 0; j < n; j++) {
			int tmp = i;
			while (0 < tmp) {
				tmp -= a[j];
				res += b[j];
			}
			minimum = min(minimum, res);
		}
		mp[0][i] = minimum;
	}

	for (int i = 1; i < n; i++) {
		for (int j = 0; j <= h; j++) {
			mp[i][j] = mp[i - 1][j];
			if (0 <= j - a[i]) mp[i][j] = min(mp[i][j], mp[i][j - a[i]] + b[i]);
		}
	}
	cout << mp[n - 1][h] << endl;
}

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

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <list>
#include <iomanip>
#include <numeric>

using namespace std;
typedef long long ll;
ll mod = 1000000007;

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	int h, n;
	cin >> h >> n;
	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

	vector<vector<int>> mp(n, vector<int>(h + 1, INT_MAX));
	mp[0][0] = 0;
	for (int i = 1; i <= h; i++) {
		if (0 <= i - a[0]) mp[0][i] = mp[0][i - a[0]] + b[0];
	}

	for (int i = 1; i < n; i++) {
		for (int j = 0; j <= h; j++) {
			mp[i][j] = mp[i - 1][j];
			if (0 <= j - a[i]) mp[i][j] = min(mp[i][j], mp[i][j - a[i]] + b[i]);
		}
	}
	cout << mp[n - 1][h] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:105:54: error: 'INT_MAX' was not declared in this scope
  105 |         vector<vector<int>> mp(n, vector<int>(h + 1, INT_MAX));
      |                                                      ^~~~~~~
a.cc:12:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include <numeric>
  +++ |+#include <climits>
   12 |
Language: C++

// E.

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

using namespace std;

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		const int INF = 1 << 29;
		int h = -1, n = -1, a, b;
		cin >> h >> n;
		if (h < 0) return 0;
		vector<int> a(n), b(n);
		for (int i = 0; i < n; ++i) {
			cin >> a[i] >> b[i];
		}
		vector<int> dp(20002, INF);
		dp[0] = 0;
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j <= 20000 - a[i]; ++j) {
				dp[j + a[i]] = min(dp[j + a[i]], dp[j] + b[i]);
			}
		}
		int ans = INF;
		for (int i = h; i <= 20000; ++i) {
			ans = min(ans, dp[i]);
		}
		cout << ans << endl;
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:19:29: error: conflicting declaration 'std::vector<int> a'
   19 |                 vector<int> a(n), b(n);
      |                             ^
a.cc:16:37: note: previous declaration as 'int a'
   16 |                 int h = -1, n = -1, a, b;
      |                                     ^
a.cc:19:35: error: conflicting declaration 'std::vector<int> b'
   19 |                 vector<int> a(n), b(n);
      |                                   ^
a.cc:16:40: note: previous declaration as 'int b'
   16 |                 int h = -1, n = -1, a, b;
      |                                        ^
a.cc:21:33: error: invalid types 'int[int]' for array subscript
   21 |                         cin >> a[i] >> b[i];
      |                                 ^
a.cc:21:41: error: invalid types 'int[int]' for array subscript
   21 |                         cin >> a[i] >> b[i];
      |                                         ^
a.cc:26:55: error: invalid types 'int[int]' for array subscript
   26 |                         for (int j = 0; j <= 20000 - a[i]; ++j) {
      |                                                       ^
a.cc:27:41: error: invalid types 'int[int]' for array subscript
   27 |                                 dp[j + a[i]] = min(dp[j + a[i]], dp[j] + b[i]);
      |                                         ^
a.cc:27:60: error: invalid types 'int[int]' for array subscript
   27 |                                 dp[j + a[i]] = min(dp[j + a[i]], dp[j] + b[i]);
      |                                                            ^
a.cc:27:75: error: invalid types 'int[int]' for array subscript
   27 |                                 dp[j + a[i]] = min(dp[j + a[i]], dp[j] + b[i]);
      |                                                                           ^
Language: C++

#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define repr(i,n) for(ll i=(n-1);i>=0;i--)
#define pb push_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define br cout << endl;
using namespace std;
const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>;
template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b) { if(a < b){ a = b; return true;} return false;}

// 0 false, 1 true 
// stringの数字をint型にしてアスキーコードになったら -48する
// 切り上げ　ceil(a)


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

    rep(i,n){
        cin >> a.at(i) >> b.at(i);
    } 

    vector<ll> dp(h+1, INF);
    dp.at(0) = 0;
    rep(i,n){
        rep(j,h+1){
            ll tmp;
            if(j + a.at(i) > h){
                tmp = h;
            }else{
                tmp = j + a.at(i);
            }
            chmin(dp[tmp] = dp[j] + b.at(i));
        }
    }

    cout << dp[h] << endl;
    

}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:18: error: no matching function for call to 'chmin(__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type&)'
   41 |             chmin(dp[tmp] = dp[j] + b.at(i));
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:13:31: note: candidate: 'template<class T> bool chmin(T&, T)'
   13 | template<class T> inline bool chmin(T &a, T b) { if(a > b){ a = b; return true;} return false;}
      |                               ^~~~~
a.cc:13:31: note:   candidate expects 2 arguments, 1 provided
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define MAX_N 20000
#define INF 0x3f3f3f3f
using namespace std;

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int h,n;
    cin>>h>>n;
    int a[n];
    int b[n];
    for(int i =0; i<n; i++){
        cin>>a[i]>>b[i];
    }
    dp[MAX_N+10];
    fill(dp, dp+MAX_N, INF);
    dp[0] = 0;
    for(int i= 0;i<n;i++){
        for(int j = a[i]; j < MAX_N; j++){
            dp[j] = min(dp[j], dp[ j-a[i]] + b[i] ); 
        }
    }
    int minc = INF;
    for(int i = h; h < MAX_N; i++){
        minc = (minc,dp[i]);
    }
    cout<< minc <<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:5: error: 'dp' was not declared in this scope; did you mean 'dup'?
   16 |     dp[MAX_N+10];
      |     ^~
      |     dup
Language: C++

#include<iostream>
#define rep(i,f,t) for(int i=f;i<t;i++)
#define ll long long
#define inf 1000000009
using namespace std;
int main(){
	int h,n;
  	cin>>h>>n;
  	int a[n],b[n],int dp[h+1];
  	rep(i,0,h+1)dp[i]=inf;
  	dp[0]=0;
  	rep(i,0,n){
      	cin>>a[i]>>b[i];
    	rep(j,1,h+1){
        	dp[min(j+a[i],h)]=min(dp[min(j+a[i],h)],dp[j]+b[i]);
        }
    }
  	cout<<dp[h]<<endl;
 	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: expected unqualified-id before 'int'
    9 |         int a[n],b[n],int dp[h+1];
      |                       ^~~
a.cc:10:21: error: 'dp' was not declared in this scope
   10 |         rep(i,0,h+1)dp[i]=inf;
      |                     ^~
a.cc:11:9: error: 'dp' was not declared in this scope
   11 |         dp[0]=0;
      |         ^~
Language: C++

#include<iostream>
#define rep(i,f,t) for(int i=f;i<t;i++)
#define ll long long
#define inf 1000000009
using namespace std;
int main(){
	int h,n;
  	cin>>h>>n;
  	int a[n],b[n],int dp[h+1];
  	rep(i,0,h+1)dp[i]=inf;
  	dp[0]=0;
  	rep(i,0,n){
      	cin>>a[i]>>b[i];
    	rep(j,1,h+1){
        	dp[min(j+a[i],h)]=min(dp[min(j+a[i],h],dp[j]+b[i]);
        }
    }
  	cout<<dp[h]<<endl;
 	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:23: error: expected unqualified-id before 'int'
    9 |         int a[n],b[n],int dp[h+1];
      |                       ^~~
a.cc:10:21: error: 'dp' was not declared in this scope
   10 |         rep(i,0,h+1)dp[i]=inf;
      |                     ^~
a.cc:11:9: error: 'dp' was not declared in this scope
   11 |         dp[0]=0;
      |         ^~
a.cc:15:54: error: expected ')' before ']' token
   15 |                 dp[min(j+a[i],h)]=min(dp[min(j+a[i],h],dp[j]+b[i]);
      |                                             ~        ^
      |                                                      )
Language: C++

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

using namespace std;

int main(){
  int h, n;
  int dp[10010];
  vector<mi> v;
  vector<co> w;

  cin>> h >> n;
  v.resize(n);
  for(int i=0;i<n;i++) cin>> v[i].a >> v[i].b;

  copy(v.begin(), v.end(), w.begin());
  sort(v.begin(), v.end());
  sort(w.begin(), w.end());
  
  for(int i=0;i<)
  
  return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:10:10: error: 'mi' was not declared in this scope
   10 |   vector<mi> v;
      |          ^~
a.cc:10:12: error: template argument 1 is invalid
   10 |   vector<mi> v;
      |            ^
a.cc:10:12: error: template argument 2 is invalid
a.cc:11:10: error: 'co' was not declared in this scope
   11 |   vector<co> w;
      |          ^~
a.cc:11:12: error: template argument 1 is invalid
   11 |   vector<co> w;
      |            ^
a.cc:11:12: error: template argument 2 is invalid
a.cc:14:5: error: request for member 'resize' in 'v', which is of non-class type 'int'
   14 |   v.resize(n);
      |     ^~~~~~
a.cc:15:31: error: invalid types 'int[int]' for array subscript
   15 |   for(int i=0;i<n;i++) cin>> v[i].a >> v[i].b;
      |                               ^
a.cc:15:41: error: invalid types 'int[int]' for array subscript
   15 |   for(int i=0;i<n;i++) cin>> v[i].a >> v[i].b;
      |                                         ^
a.cc:17:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   17 |   copy(v.begin(), v.end(), w.begin());
      |          ^~~~~
a.cc:17:21: error: request for member 'end' in 'v', which is of non-class type 'int'
   17 |   copy(v.begin(), v.end(), w.begin());
      |                     ^~~
a.cc:17:30: error: request for member 'begin' in 'w', which is of non-class type 'int'
   17 |   copy(v.begin(), v.end(), w.begin());
      |                              ^~~~~
a.cc:18:10: error: request for member 'begin' in 'v', which is of non-class type 'int'
   18 |   sort(v.begin(), v.end());
      |          ^~~~~
a.cc:18:21: error: request for member 'end' in 'v', which is of non-class type 'int'
   18 |   sort(v.begin(), v.end());
      |                     ^~~
a.cc:19:10: error: request for member 'begin' in 'w', which is of non-class type 'int'
   19 |   sort(w.begin(), w.end());
      |          ^~~~~
a.cc:19:21: error: request for member 'end' in 'w', which is of non-class type 'int'
   19 |   sort(w.begin(), w.end());
      |                     ^~~
a.cc:21:17: error: expected primary-expression before ')' token
   21 |   for(int i=0;i<)
      |                 ^
a.cc:21:17: error: expected ';' before ')' token
   21 |   for(int i=0;i<)
      |                 ^
      |                 ;
Language: C++

#include<iostream>
#include<vector>

using namespace std;

int A[100000];
int B[100000];
int H, N;
vector<long long int> dp(50000000,5e15);


long long int dpf(int h){
  if(dp[h]<1e15){
    return dp[h];
  }else if(h==0){
    dp[h]=0;
    return 0;
  }else{
    dp[h]=1e14
    for(int i=0;i<N;i++){
      if(h-A[i]>=0){
        dp[h]=min(dpf(h-A[i])+B[i], dp[h]);
      }
    }
    return dp[h];
  }
}


int main(void){
  cin >> H >> N;
  int maxval=0;
  for(int i=0;i<N;i++){
    int tmp1, tmp2;cin >> tmp1 >> tmp2;
    A[i]=tmp1;
    B[i]=tmp2;
    maxval = max(maxval, tmp1);
  }
  long long int minval=5e15;
  for(int i=maxval-1;i>=0;i--){
    long long int tmp=dpf(H+i);
    if(minval>tmp)minval=tmp;
  }
  cout << minval;
  return 0;
}




Compiler output:
a.cc: In function 'long long int dpf(int)':
a.cc:19:15: error: expected ';' before 'for'
   19 |     dp[h]=1e14
      |               ^
      |               ;
   20 |     for(int i=0;i<N;i++){
      |     ~~~        
a.cc:20:17: error: 'i' was not declared in this scope
   20 |     for(int i=0;i<N;i++){
      |                 ^
Language: C++

#include<iostream>
using L=int;
L INF=1e9;
using namespace std;
#define R for(L i=H;i>=0;i--)
#define P for(L j=0;j<N;j++)



L H,N,A[1005],B[1005],d[30004]={},M;
main(){
	cin>>H>>N;
	M=N;
	P cin>>A[j]>>B[j]
	R d[i]=INF;
	d[H]=0;
	R P d[max(i-A[j],0)]=min(d[max(i-A[j],0)],d[i]+B[j]);
	cout<<d[0];
} 


Compiler output:
a.cc:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:14:26: error: expected ';' before 'for'
   14 |         P cin>>A[j]>>B[j]
      |                          ^
      |                          ;
a.cc:5:21: error: 'i' was not declared in this scope
    5 | #define R for(L i=H;i>=0;i--)
      |                     ^
a.cc:15:9: note: in expansion of macro 'R'
   15 |         R d[i]=INF;
      |         ^
Language: C++

#include<iostream>
using L=int;
L INF=1e9;
using namespace std;
#define R for(L i=H;i>=0;i--)
#define P for(L j=0,j<N;j++)



L H,N,A[1005],B[1005],d[30004]={},M;
main(){
	cin>>H>>N;
	M=N;
	P cin>>A[j]>>B[j]
	R d[i]=INF;
	d[H]=0;
	R P d[max(i-A[j],0)]=min(d[max(i-A[j],0)],d[i]+B[j]);
	cout<<d[0];
} 


Compiler output:
a.cc:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:6:22: error: expected ';' before '<' token
    6 | #define P for(L j=0,j<N;j++)
      |                      ^
a.cc:14:9: note: in expansion of macro 'P'
   14 |         P cin>>A[j]>>B[j]
      |         ^
a.cc:6:22: error: expected primary-expression before '<' token
    6 | #define P for(L j=0,j<N;j++)
      |                      ^
a.cc:14:9: note: in expansion of macro 'P'
   14 |         P cin>>A[j]>>B[j]
      |         ^
a.cc:14:26: error: expected ';' before 'for'
   14 |         P cin>>A[j]>>B[j]
      |                          ^
      |                          ;
a.cc:5:21: error: 'i' was not declared in this scope
    5 | #define R for(L i=H;i>=0;i--)
      |                     ^
a.cc:15:9: note: in expansion of macro 'R'
   15 |         R d[i]=INF;
      |         ^
a.cc:6:22: error: expected ';' before '<' token
    6 | #define P for(L j=0,j<N;j++)
      |                      ^
a.cc:17:11: note: in expansion of macro 'P'
   17 |         R P d[max(i-A[j],0)]=min(d[max(i-A[j],0)],d[i]+B[j]);
      |           ^
a.cc:6:22: error: expected primary-expression before '<' token
    6 | #define P for(L j=0,j<N;j++)
      |                      ^
a.cc:17:11: note: in expansion of macro 'P'
   17 |         R P d[max(i-A[j],0)]=min(d[max(i-A[j],0)],d[i]+B[j]);
      |           ^
Language: C++

#include<iostream>
using L=int;
L INF=1e9;
using namespace std;
#define R for(L i=H;i>=0;i--)

L H,N,A[1005],B[1005],d[30004]={},M;
main(){
	cin>>H>>N;
	M=N;
	R{
		if(i<N){cin>>A[M-N]>>B[M-N];i++;N--;}
		d[i]=INF;
	}
	d[H]=0;
	R for(L j=0;j<N;j++)d[mim(i-A[j],0)]=min(d[min(i-A[j],0)],d[i]+B[j]);
	cout<<dp[0];
} 


Compiler output:
a.cc:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:16:31: error: 'mim' was not declared in this scope
   16 |         R for(L j=0;j<N;j++)d[mim(i-A[j],0)]=min(d[min(i-A[j],0)],d[i]+B[j]);
      |                               ^~~
a.cc:17:15: error: 'dp' was not declared in this scope; did you mean 'd'?
   17 |         cout<<dp[0];
      |               ^~
      |               d
Language: C++

#include<iostream>
using L=int;
L INF=1e9;
using namespace std;
#define R for(L i=H;i>=0;i--)

L H,N,A[1005],B[1005],r=0,n=1,d[30004]={};
main(){
	cin>>H>>N;
	R{
		if(i<N){cin>>A[i]>>B[i];i++;N--;}
		d[i]=INF;
	}
	d[H]=0;
	R for(L j=0;j<N;j++)d[mim(i-A[j],0)]=min(d[min(i-A[j],0)],d[i]+B[j]);
	cout<<d[0];
} 


Compiler output:
a.cc:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:15:31: error: 'mim' was not declared in this scope
   15 |         R for(L j=0;j<N;j++)d[mim(i-A[j],0)]=min(d[min(i-A[j],0)],d[i]+B[j]);
      |                               ^~~
Language: C++

#include<iostream>
using L=int;
L INF=1e9;
using namespace std;
#define R for(L i=H;i>=0;i--)

L H,N,A[1005],B[1005],r=0,n=1,d[30004]={};
main(){
	cin>>H>>N;
	R{
		if(I<N){cin>>A[i]>>B[i];i++;N--;}
		d[i]=INF;
	}
	d[H]=0;
	R for(L j=0;j<N;j++)d[mim(i-A[j],0)]=min(d[min(i-A[j],0)],d[i]+B[j]);
	cout<<dp[0];
} 


Compiler output:
a.cc:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:11:20: error: 'I' was not declared in this scope
   11 |                 if(I<N){cin>>A[i]>>B[i];i++;N--;}
      |                    ^
a.cc:15:31: error: 'mim' was not declared in this scope
   15 |         R for(L j=0;j<N;j++)d[mim(i-A[j],0)]=min(d[min(i-A[j],0)],d[i]+B[j]);
      |                               ^~~
a.cc:16:15: error: 'dp' was not declared in this scope; did you mean 'd'?
   16 |         cout<<dp[0];
      |               ^~
      |               d
Language: C++

#include<iostream>
using L=int;
L INF=1e9;
using namespace std;


L H,N,A[1005],B[1005],r=0,n=1,d[30004]={};
main(){
	cin>>H>>N;
	for(L i=0;i<N;i++){
		cin>>A[i]>>B[i];
	}
	for(L i=H-1;i>=0;i--){
		d[i]=INF;
	}
	d[H]=0;
	for(L i=H;i>=0;i--)for(L j=0;j<N;j++)d[min(i-A[j],0)]=min(d[min(i-A[j],0)],d[i]+B[j]);
	cout<<dp[0];
} 


Compiler output:
a.cc:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:18:15: error: 'dp' was not declared in this scope; did you mean 'd'?
   18 |         cout<<dp[0];
      |               ^~
      |               d
Language: C++

#include<iostream>
using L=int;
L INF=1e9;
using namespace std;


L H,N,A[1005],B[1005],r=0,n=1,d[30004]={};
main(){
	cin>>H>>N;
	for(L i=0;i<N;i++){
		cin>>A[i]>>B[i];
	}
	for(L i=H-1;i>=0;i--){
		d[i]=INF;
	}
	d[H]=0;
	for(L i=H;i>=0;i--)for(L j=0;j<N;j++)d[mim(i-A[j],0)]=min(d[min(i-A[j],0)],d[i]+B[j]);
	cout<<dp[0];
} 


Compiler output:
a.cc:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:17:48: error: 'mim' was not declared in this scope
   17 |         for(L i=H;i>=0;i--)for(L j=0;j<N;j++)d[mim(i-A[j],0)]=min(d[min(i-A[j],0)],d[i]+B[j]);
      |                                                ^~~
a.cc:18:15: error: 'dp' was not declared in this scope; did you mean 'd'?
   18 |         cout<<dp[0];
      |               ^~
      |               d
Language: C++

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

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

typedef struct{
    int ap;int mp;
}spell;

const long long INF = 1LL<<60;
int n,h;
vector<long long> dp(20002,INF);
dp[0]=0

int main()
{
    cin>>h>>n;
    vector<spell> S(1002);

    int max_ap=0;

    for(int i=0;i<n;i++){
        cin>>S[i].ap>>S[i].mp;
        chmax(max_ap,S[i].ap);
    }

    for(int i=0;i<h+max_ap+1;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(i-S[i].ap>=0) chmin(dp[i],dp[i-S[i].ap]+S[i].mp);
        }
    }
    for(int i = h;i < h+max_ap+1;i++)chmin(ans,dp[i]);
    cout<<ans<<endl;
    return 0;
}

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

#include<iostream>
#include<map>
#include<tuple>
#include<vector>
#include<string>
#include<algorithm>
typedef long long int ll;
using namespace std;

map<tuple<int,int>,int> dp;
const int N = 10005;
 int a[N],b[N];
  
int calculate(int ind,int health){
 
//cout << ind <<" , "<< health << "," <<endl;

 if( health <= 0){
     return 0;
 } 
 if( ind < 0) return INT_MAX;  
  if( dp.find(make_tuple(ind,health)) != dp.end()) return dp[make_tuple(ind,health)];

  int ans = min(calculate(ind,health-a[ind]) + b[ind], calculate(ind-1,health));
  
  dp[make_tuple(ind,health)] = ans;

  return ans;
  
}




int main(){
  
  int h,n;
  cin >> h >> n;
 
  for(int i =0;i<n;i++){
      cin >> a[i] >> b[i];
  }
  //cout << "ans" << endl;
 
int ans = calculate(n-1,h);
  cout << ans << endl;
 }


Compiler output:
a.cc: In function 'int calculate(int, int)':
a.cc:21:22: error: 'INT_MAX' was not declared in this scope
   21 |  if( ind < 0) return INT_MAX;
      |                      ^~~~~~~
a.cc:7:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    6 | #include<algorithm>
  +++ |+#include <climits>
    7 | typedef long long int ll;
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<=b;i++)
const ll max_n = 1e3+5;
const ll max_h = 1e4+5;
const ll inf = 1e12;

int main() {
    // your code goes here
    ll h, n, a[max_n], b[max_n], dp[max_h];
    cin >> h >> n;
    rep(i,1,n) cin >> a[i] >> b[i];
    rep(i,1,h) dp[i] = inf;
    dp[0] = 0;
    rep(i,1,n) rep(j,0,h) dp[j =min(dp[j], dp[max(0ll, j-a[i])] + b[i]);
    cout << dp[h] << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:72: error: expected ']' before ';' token
   16 |     rep(i,1,n) rep(j,0,h) dp[j =min(dp[j], dp[max(0ll, j-a[i])] + b[i]);
      |                                                                        ^
      |                                                                        ]
Language: C++

#include<cstdio>
#include<vector>

using ll = long long;

void chmin(ll &a, comst ll b){
  if(b<a)a=b;
}

ll h;
ll c;
ll ans;
struct m_t{
  ll a;
  ll b;
  bool operator<(const m_t &r)const{
    return
      std::make_pair(a*r.b,a)<
      std::make_pair(r.a*b,r.a);
  }
};
m_t v[1000];
m_t *i;
ll ceildiv(ll a,ll b){
  return (a+b-1)/b;
}
void solve(){
  if(h<=0){
    chmin(ans,c);
    return;
  }
  if(i==v)return;
  --i;
  if(c+ceildiv(h*i->b,i->a)<ans){
    ll j=ceildiv(h,i->a);
    c+=j*i->b;
    h-=j*i->a;
    solve();
    while(--j>=0){
      c-=i->b;
      h+=i->a;
      solve();
    }
  }
  ++i;
}

int get(){
  int r = 0;
  int t;
  while((t = getchar_unlocked())>='0')
    r=r*10+t-'0';
  return r;
}

int main(){
  h=get();
  i=v+get();
  ans=100000000;
  for(m_t* j=v;j!=i;++j){
    j->a=get();
    j->b=get();
  }
  std::sort(v,i);
  solve();
  printf("%lld",ans);
}


Compiler output:
a.cc:6:19: error: 'comst' has not been declared
    6 | void chmin(ll &a, comst ll b){
      |                   ^~~~~
a.cc:6:28: error: expected ',' or '...' before 'b'
    6 | void chmin(ll &a, comst ll b){
      |                            ^
a.cc: In function 'void chmin(ll&, int)':
a.cc:7:6: error: 'b' was not declared in this scope
    7 |   if(b<a)a=b;
      |      ^
a.cc: In function 'int main()':
a.cc:64:8: error: 'sort' is not a member of 'std'
   64 |   std::sort(v,i);
      |        ^~~~
Language: C++

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

using namespace std;

class cf {
public:
  int A;  //�U����
  int B;  //�����
  int pos;
  double r;  //�������U���́^�����
//  bool operator <(const cf& x) {return r < x.r; }
  vset(int va, int vb) {
    A=va; B=vb;
    r = (double)va/vb;
  }
};

int H,N;
vector<cf> v1;

int minm(int, int);
int minmem[10001];

int main()
{
  int i;
  int A,B;
  cf ab;
  int ret=0;
  int maxA, maxB;
  int minB;

  cin >> H >> N;

  for(i=0; i<N; i++) {
    cin >> A >> B;
    if (A>H) A=H;
    ab.vset(A, B);
    ab.pos = i;
    v1.push_back(ab);
  }

  /*
  //�ő������H��0�ɂ��钼�O�܂ōU������
  sort(v1.begin(), v1.end(), [](const cf& x, const cf& y) {return x.r > y.r;});  //������������
  maxA = v1[0].A; maxB = v1[0].B;
  while (H>=maxA) {
    ret += H/maxA*maxB;
    H %= maxA;
printf("maxA=%d, maxB=%d, ret=%d, H=%d\n", maxA, maxB, ret, H);
    if (H==0) {
      printf("%d\n", ret);
      return 0;
    }
    
    for (i=0; i<N; i++) {
      if (v1[i].A>H) v1[i].vset(H, v1[i].B);
    }
    sort(v1.begin(), v1.end(), [](const cf& x, const cf& y) {return x.r > y.r;});  //������������
    maxA = v1[0].A; maxB = v1[0].B;
  }
    */

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

int minm(int h, int d) {
  int i;
  int minx=-1;
  int tm;
  int av;

  if (minmem[h]) return minmem[h];
  for (i=0; i<N; i++) {
    if (h<=v1[i].A) {
      if (v1[i].B<minx || minx < 0) {
        minx = v1[i].B;
      }
      continue;
    }
    tm = minm(h-v1[i].A, d+1)+v1[i].B;
    if (tm<minx || minx < 0) {
      minx = tm;
    }
  }
//printf("minm(%d, %d)=%d\n", h, d, minx);
  minmem[h] = minx;
  return minx;
}


Compiler output:
a.cc:15:3: error: ISO C++ forbids declaration of 'vset' with no type [-fpermissive]
   15 |   vset(int va, int vb) {
      |   ^~~~
a.cc: In member function 'int cf::vset(int, int)':
a.cc:18:3: warning: no return statement in function returning non-void [-Wreturn-type]
   18 |   }
      |   ^