Language: C++

#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;
const double PI = 3.14159265358979323846;

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];
    }

    vector<vector<int>> dp(N + 1, vector<int>(H + 1, 1000000));


    for (int i = 0; i <= A[0]; i++)
    {
        dp[1][i] =B[0];
    }

    for (int i = 0; i <= N; i++)
    {
        dp[i][0] =0;
    }


    for(int i=0;i<N;i++){

        for(int j=1;j<H+1;j++){

            if(j>=A[i]){
                dp[i+1][j] = min(dp[i+1][j-A[i]]+ B[i], dp[i][j]);

            }
            else{

                dp[i+1][j] = min(dp[i][j],dp[i+1][0]);

            }

            
        }
    }

    cout<< dp[N][H];

    return 0;
}

Compiler output:
a.cc:7:5: error: cannot declare '::main' to be a global variable
    7 | int main
      |     ^~~~
a.cc:10:5: error: expected primary-expression before 'int'
   10 |     int H, N;
      |     ^~~
a.cc:10:5: error: expected '}' before 'int'
a.cc:8:1: note: to match this '{'
    8 | {
      | ^
a.cc:11:5: error: 'cin' does not name a type
   11 |     cin >> H >> N;
      |     ^~~
a.cc:13:19: error: 'N' was not declared in this scope
   13 |     vector<int> A(N);
      |                   ^
a.cc:14:19: error: 'N' was not declared in this scope
   14 |     vector<int> B(N);
      |                   ^
a.cc:16:5: error: expected unqualified-id before 'for'
   16 |     for (int i = 0; i < N; i++)
      |     ^~~
a.cc:16:21: error: 'i' does not name a type
   16 |     for (int i = 0; i < N; i++)
      |                     ^
a.cc:16:28: error: 'i' does not name a type
   16 |     for (int i = 0; i < N; i++)
      |                            ^
a.cc:22:28: error: 'N' was not declared in this scope
   22 |     vector<vector<int>> dp(N + 1, vector<int>(H + 1, 1000000));
      |                            ^
a.cc:22:47: error: 'H' was not declared in this scope
   22 |     vector<vector<int>> dp(N + 1, vector<int>(H + 1, 1000000));
      |                                               ^
a.cc:25:5: error: expected unqualified-id before 'for'
   25 |     for (int i = 0; i <= A[0]; i++)
      |     ^~~
a.cc:25:21: error: 'i' does not name a type
   25 |     for (int i = 0; i <= A[0]; i++)
      |                     ^
a.cc:25:32: error: 'i' does not name a type
   25 |     for (int i = 0; i <= A[0]; i++)
      |                                ^
a.cc:30:5: error: expected unqualified-id before 'for'
   30 |     for (int i = 0; i <= N; i++)
      |     ^~~
a.cc:30:21: error: 'i' does not name a type
   30 |     for (int i = 0; i <= N; i++)
      |                     ^
a.cc:30:29: error: 'i' does not name a type
   30 |     for (int i = 0; i <= N; i++)
      |                             ^
a.cc:36:5: error: expected unqualified-id before 'for'
   36 |     for(int i=0;i<N;i++){
      |     ^~~
a.cc:36:17: error: 'i' does not name a type
   36 |     for(int i=0;i<N;i++){
      |                 ^
a.cc:36:21: error: 'i' does not name a type
   36 |     for(int i=0;i<N;i++){
      |                     ^
a.cc:54:5: error: 'cout' does not name a type
   54 |     cout<< dp[N][H];
      |     ^~~~
a.cc:56:5: error: expected unqualified-id before 'return'
   56 |     return 0;
      |     ^~~~~~
a.cc:57:1: error: expected declaration before '}' token
   57 | }
      | ^