Language: C++

#include <iostream>

using namespace std;

struct Card
{
	int attack;
	int cost;
};



class Solver
{
private:
	vector<Card> cards;
	int card_num; 
	int cost_max;

public:
	Solver(){}

	Solver(vector<Card> cards_, int card_num_, int cost_max_) : cards(cards_), card_num(card_num_), cost_max(cost_max_) {}

	void exec() {
		vector<vector<int> > dp = vector<vector<int> >(card_num + 1, vector<int>(cost_max + 1, 0));
		for (int i = 0; i <= cost_max; ++i)
		{
			dp[0][i] = cards[i].attack;
		}

		for (int i = 1; i < card_num; ++i)
		{
			for (int j = 0; j <= cost_max; ++j)
			{
				if(j - cards[i].cost >= 0) dp[i][j] += dp[i-1][j - cards[i].cost] + cards[i].attack;
			}
		}

		cout << dp[card_num-1][cost_max] << endl;
	}
};




int main(int argc, char *argv[])
{
  	// start from 1 to ignore script name; argv[0] will be a name of processing file.
	for (int i = 1; i < argc; i++) {
		printf ("argv[%i]: %s\n", i, argv[i]);
	}
    int arg_int = 1;
  	int card_num = argv[arg_int];
  	arg_int++;
  	int cost_max = argv[arg_int];
  	arg_int++;

  	vector<Card> cards;
	for (int i = 0; i < card_num; ++i)
	{
		Card tmp_card = {argv[arg_int], argv[arg_int + 1]}
		arg_int += 2;
		cards.push_back(tmp_card);
	}

	cin >> card_num;
	cin >> cost_max;
	for (int i = 0; i < card_num; ++i)
	{
		cin >> cards[i].attack >> cards[i].cost;
	}


	Solver s = Solver(cards, card_num, cost_max);
	s.exec();
	return 0;
}

Compiler output:
a.cc:16:9: error: 'vector' does not name a type
   16 |         vector<Card> cards;
      |         ^~~~~~
a.cc:23:22: error: expected ')' before '<' token
   23 |         Solver(vector<Card> cards_, int card_num_, int cost_max_) : cards(cards_), card_num(card_num_), cost_max(cost_max_) {}
      |               ~      ^
      |                      )
a.cc: In member function 'void Solver::exec()':
a.cc:26:17: error: 'vector' was not declared in this scope
   26 |                 vector<vector<int> > dp = vector<vector<int> >(card_num + 1, vector<int>(cost_max + 1, 0));
      |                 ^~~~~~
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 | 
a.cc:26:31: error: expected primary-expression before 'int'
   26 |                 vector<vector<int> > dp = vector<vector<int> >(card_num + 1, vector<int>(cost_max + 1, 0));
      |                               ^~~
a.cc:29:25: error: 'dp' was not declared in this scope
   29 |                         dp[0][i] = cards[i].attack;
      |                         ^~
a.cc:29:36: error: 'cards' was not declared in this scope
   29 |                         dp[0][i] = cards[i].attack;
      |                                    ^~~~~
a.cc:36:40: error: 'cards' was not declared in this scope
   36 |                                 if(j - cards[i].cost >= 0) dp[i][j] += dp[i-1][j - cards[i].cost] + cards[i].attack;
      |                                        ^~~~~
a.cc:36:60: error: 'dp' was not declared in this scope
   36 |                                 if(j - cards[i].cost >= 0) dp[i][j] += dp[i-1][j - cards[i].cost] + cards[i].attack;
      |                                                            ^~
a.cc:40:25: error: 'dp' was not declared in this scope
   40 |                 cout << dp[card_num-1][cost_max] << endl;
      |                         ^~
a.cc: In function 'int main(int, char**)':
a.cc:54:36: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   54 |         int card_num = argv[arg_int];
      |                        ~~~~~~~~~~~~^
      |                                    |
      |                                    char*
a.cc:56:36: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   56 |         int cost_max = argv[arg_int];
      |                        ~~~~~~~~~~~~^
      |                                    |
      |                                    char*
a.cc:59:9: error: 'vector' was not declared in this scope
   59 |         vector<Card> cards;
      |         ^~~~~~
a.cc:59:9: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:59:20: error: expected primary-expression before '>' token
   59 |         vector<Card> cards;
      |                    ^
a.cc:59:22: error: 'cards' was not declared in this scope
   59 |         vector<Card> cards;
      |                      ^~~~~
a.cc:62:46: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   62 |                 Card tmp_card = {argv[arg_int], argv[arg_int + 1]}
      |                                  ~~~~~~~~~~~~^
      |                                              |
      |                                              char*
a.cc:62:65: error: invalid conversion from 'char*' to 'int' [-fpermissive]
   62 |                 Card tmp_card = {argv[arg_int], argv[arg_int + 1]}
      |                                                 ~~~~~~~~~~~~~~~~^
      |                                                                 |
      |                                                                 char*
a.cc:63:17: error: expected ',' or ';' before 'arg_int'
   63 |                 arg_int += 2;
      |                 ^~~~~~~