Language: C++

#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <functional>
#include <iomanip>
#include <typeinfo>
#include <iterator>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <tuple>
#include <map>
#include <set>
using namespace std;


typedef long long       ll;
struct edge { ll to; ll cost; };
typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<string>  vs;
typedef vector<char>    vc;
typedef vector<edge>    ve;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;
typedef vector<vll>		vvll;
typedef vector<ve>      vve;
typedef vector<vc>		vvc;

// マクロ
#define repr(itr, bgn, end) for (ll itr = (ll)bgn; itr < (ll)end; ++itr)
#define rep(itr, end) repr(itr, 0, end)
#define reprrev(itr, bgn, end) for (ll itr = (ll)end - 1; itr >= (ll)bgn; --i)
#define reprev(itr, end) reprrev(itr, 0, end)
#define all(container) container.begin(), container.end()
#define sortall(container) sort(all(container))
#define yn(cond) cond ? (cout << "Yes" << endl) : (cout << "No" << endl)
#define YN(cond) cond ? (cout << "YES" << endl) : (cout << "NO" << endl)

// 定数
#define LLONG_MAX 9223372036854775807
constexpr double PI = 3.14159265358979323846;
constexpr ll INF = 1 << 15;
constexpr ll MOD = (ll)1e9 + 7;
constexpr double EPS = 1e-7;

// よく使うもの
constexpr int dy[4] = { 0, 1, 0, -1 };
constexpr int dx[4] = { 1, 0, -1, 0 };


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
	for (T& x : vec) os << x << " ";
	return os;
}

// ***<ここから>****************************************************************



int main(void) {

	ll D, G;
	cin >> D >> G;
	vi p, c;
	p = c = vi(D);
	rep(i, D) {
		cin >> p[i] >> c[i];
	}

	vvll table(D);
	rep(i, D) table[i].push_back(0);

	rep(i, D) {
		int points = (i + 1) * 100;
		rep(j, p[i]) {
			table[i].push_back(points * (j + 1));
		}
		table[i][p[i]] += c[i];
	}


	vi num = p;
	rep(i, D) p[i];

	ll score = 0;
	rep(i, D) score += table[i][p[i]];
	//cout << score << endl;

	while (score > G) {
		ll mindiff = INT_MAX;
		int minp = -1;
		rep(i, D) {
			if (p[i] == 0) continue;
			if (mindiff > table[i][p[i]] - table[i][p[i] - 1]) {
				mindiff = table[i][p[i]] - table[i][p[i] - 1];
				minp = i;
			}
		}

		score -= table[minp][p[minp]] - table[minp][p[minp] - 1];
		p[minp]--;
	}

	int ans = 0;
	rep(i, D) {
		ans += p[i];
	}

	cout << ans << endl;
	return 0;

	rep(i, D) {
		cout << table[i] << endl;
	}


	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:100:22: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
  100 |         rep(i, D) p[i];
      |                      ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from a.cc:6:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:107:30: error: 'INT_MAX' was not declared in this scope
  107 |                 ll mindiff = INT_MAX;
      |                              ^~~~~~~
a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   16 | #include <set>
  +++ |+#include <climits>
   17 | using namespace std;