Language: C++

// chmin(dp[val + v[i]], dp[val] + cost[i])

#include <iostream>
#include <vector>

int main() {
  int N, H;
  cin >> N >> H;
  vector<int> values(N);
  vector<int> costs(N);
  for (int i = 0; i < N; i++) cin >> values[i] >> costs[i];
  
  vector<int> dp(H+1, 0);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= H; j++) {
      if (j + values[i] > H) continue;
      dp[j + values[i]] = min(dp[j + values[i]], dp[j] + costs[i]);
    }
  }
  
  cout << dp[H] << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    8 |   cin >> N >> H;
      |   ^~~
      |   std::cin
In file included from a.cc:3:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:9:3: error: 'vector' was not declared in this scope
    9 |   vector<int> values(N);
      |   ^~~~~~
a.cc:9:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:9:10: error: expected primary-expression before 'int'
    9 |   vector<int> values(N);
      |          ^~~
a.cc:10:10: error: expected primary-expression before 'int'
   10 |   vector<int> costs(N);
      |          ^~~
a.cc:11:38: error: 'values' was not declared in this scope
   11 |   for (int i = 0; i < N; i++) cin >> values[i] >> costs[i];
      |                                      ^~~~~~
a.cc:11:51: error: 'costs' was not declared in this scope
   11 |   for (int i = 0; i < N; i++) cin >> values[i] >> costs[i];
      |                                                   ^~~~~
a.cc:13:10: error: expected primary-expression before 'int'
   13 |   vector<int> dp(H+1, 0);
      |          ^~~
a.cc:16:15: error: 'values' was not declared in this scope
   16 |       if (j + values[i] > H) continue;
      |               ^~~~~~
a.cc:17:7: error: 'dp' was not declared in this scope
   17 |       dp[j + values[i]] = min(dp[j + values[i]], dp[j] + costs[i]);
      |       ^~
a.cc:17:14: error: 'values' was not declared in this scope
   17 |       dp[j + values[i]] = min(dp[j + values[i]], dp[j] + costs[i]);
      |              ^~~~~~
a.cc:17:58: error: 'costs' was not declared in this scope
   17 |       dp[j + values[i]] = min(dp[j + values[i]], dp[j] + costs[i]);
      |                                                          ^~~~~
a.cc:17:27: error: 'min' was not declared in this scope; did you mean 'std::min'?
   17 |       dp[j + values[i]] = min(dp[j + values[i]], dp[j] + costs[i]);
      |                           ^~~
      |                           std::min
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:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: 'std::min' declared here
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
a.cc:21:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   21 |   cout << dp[H] << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:21:11: error: 'dp' was not declared in this scope
   21 |   cout << dp[H] << endl;
      |           ^~
a.cc:21:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   21 |   cout << dp[H] << endl;
      |                    ^~~~
      |                    std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~