Language: C++

#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    ll H, N; cin >> H >> N;
    vector<ll> a(N, 0), b(N, 0);
    rep(i, N) cin >> a[i] >> b[i];
    
    ll const inf = 1LL<<60;
    vector<vector<ll>> dp(N+5, vector<ll>(H+5, inf));
    dp[1][0] = 0;

    repr(i, 1, N+1) rep(j, H+1) {
        if (dp[i][j]==inf) continue;
        if (i<N) chmin(dp[i+1][j], dp[i][j]);
        c#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
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; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n==0) return 1;
    ll res=modpow(x, n/2);

    if(n%2==0) return res*res%mod;
    else return res*res%mod*x%mod;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };


// 線分 ab の偏角 返り値は[-π, π]
double argument(const pair<double, double> &a, const pair<double, double> &b){
    double ax=a.first, ay=a.second, bx=b.first, by=b.second;
    return atan2(by-ay, bx-ax);
}

/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */
/* <-----------------------------------------------------------------------------------> */


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

    ll H, N; cin >> H >> N;
    vector<ll> a(N, 0), b(N, 0);
    rep(i, N) cin >> a[i] >> b[i];
    
    ll const inf = 1LL<<60;
    vector<vector<ll>> dp(N+5, vector<ll>(H+5, inf));
    dp[1][0] = 0;

    repr(i, 1, N+1) rep(j, H+1) {
        if (dp[i][j]==inf) continue;
        if (i<N) chmin(dp[i+1][j], dp[i][j]);
        chmin(dp[i][min(H, j+a[i-1])], dp[i][j]+b[i-1]);
    }
    cout << dp[N][H] << endl;
    
    return 0;
}




Compiler output:
a.cc:66:10: error: stray '#' in program
   66 |         c#include <bits/stdc++.h>
      |          ^
a.cc: In function 'int main()':
a.cc:66:9: error: 'c' was not declared in this scope
   66 |         c#include <bits/stdc++.h>
      |         ^
a.cc:74:1: error: a template declaration cannot appear at block scope
   74 | template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
      | ^~~~~~~~
a.cc:84:18: error: a function-definition is not allowed here before '{' token
   84 | void chmod(ll &M){
      |                  ^
a.cc:92:22: error: a function-definition is not allowed here before '{' token
   92 | ll modpow(ll x, ll n){
      |                      ^
a.cc:100:24: error: a function-definition is not allowed here before '{' token
  100 | int getl(int i, int N) { return i==0? N-1:i-1; };
      |                        ^
a.cc:101:24: error: a function-definition is not allowed here before '{' token
  101 | int getr(int i, int N) { return i==N-1? 0:i+1; };
      |                        ^
a.cc:105:78: error: a function-definition is not allowed here before '{' token
  105 | double argument(const pair<double, double> &a, const pair<double, double> &b){
      |                                                                              ^
a.cc:116:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  116 | int main(){
      |         ^~
a.cc:116:9: note: remove parentheses to default-initialize a variable
  116 | int main(){
      |         ^~
      |         --
a.cc:116:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:116:11: error: a function-definition is not allowed here before '{' token
  116 | int main(){
      |           ^
a.cc:136:2: error: expected '}' at end of input
  136 | }
      |  ^
a.cc:63:33: note: to match this '{'
   63 |     repr(i, 1, N+1) rep(j, H+1) {
      |                                 ^
a.cc:136:2: error: expected '}' at end of input
  136 | }
      |  ^
a.cc:51:11: note: to match this '{'
   51 | int main(){
      |           ^