Language: C++

typedef pair<int, int> Pii;
typedef pair<double, int> Pdi;
 
void readint(int N, vector<int> &a);
void readdouble(int N, vector<double> &a);
void readindex(int N, vector<int> &a);
 
int calc_num(int i, int p, int c, int G){
    if(G <= 0) return 0;
    if((i + 1) * 100 * p + c < G) return INF;
    if((i + 1) * 100 * p < G) return p;
    
    if(G % ((i + 1) * 100) == 0) return G / ((i + 1) * 100);
    return  G / ((i + 1) * 100) + 1;
}
 
signed main(){
 
    int D, G;
    cin >> D >> G;
    vector<int> p(D), c(D);
 
 
    REP(i, D){
        cin >> p[i] >> c[i];
    }
 
    int ans = 0;
    vector<bool> is_used(D, false);
 
    while(true){
        vector<int> sump(0);
        vector<Pdi> avep(0);
        REP(i, D){
            if(!is_used[i]){
                int v = (i + 1) * 100 * p[i] + c[i];
                if(v > G) v = G;
                sump.push_back(v);
                avep.push_back(Pii((double)(v) / (double)p[i], i));
            }
        }
        sort(avep.begin(), avep.end());
        int use = avep[avep.size() - 1].second;
        int min_n = INF;
        REP(i, avep.size()){
            int n = calc_num(avep[i].second, p[avep[i].second], c[avep[i].second], G);
            if(n < min_n) min_n = n;
        }
        if(min_n < INF){
            ans += min_n;
            break;
        }
        G -= ((use + 1) * 100 * p[use] + c[use]);
        ans += p[use];
        is_used[use] = true;
    }
 
 
    cout << ans;
 
 
    return 0;
}
 
 
 
 
 
 
 
 
void readint(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str());
}
void readdouble(int N, vector<double> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atof(s.c_str());
    }
    getline(cin, s, '\n');
    a[N - 1] = atof(s.c_str());
}
void readindex(int N, vector<int> &a){
    string s;
    for(int i = 0; i < N - 1; i++){
        getline(cin, s, ' ');
        a[i] = atoi(s.c_str()) - 1;
    }
    getline(cin, s, '\n');
    a[N - 1] = atoi(s.c_str()) - 1;
}

Compiler output:
a.cc:1:9: error: 'pair' does not name a type
    1 | typedef pair<int, int> Pii;
      |         ^~~~
a.cc:2:9: error: 'pair' does not name a type
    2 | typedef pair<double, int> Pdi;
      |         ^~~~
a.cc:4:21: error: 'vector' has not been declared
    4 | void readint(int N, vector<int> &a);
      |                     ^~~~~~
a.cc:4:27: error: expected ',' or '...' before '<' token
    4 | void readint(int N, vector<int> &a);
      |                           ^
a.cc:5:24: error: 'vector' has not been declared
    5 | void readdouble(int N, vector<double> &a);
      |                        ^~~~~~
a.cc:5:30: error: expected ',' or '...' before '<' token
    5 | void readdouble(int N, vector<double> &a);
      |                              ^
a.cc:6:23: error: 'vector' has not been declared
    6 | void readindex(int N, vector<int> &a);
      |                       ^~~~~~
a.cc:6:29: error: expected ',' or '...' before '<' token
    6 | void readindex(int N, vector<int> &a);
      |                             ^
a.cc: In function 'int calc_num(int, int, int, int)':
a.cc:10:42: error: 'INF' was not declared in this scope
   10 |     if((i + 1) * 100 * p + c < G) return INF;
      |                                          ^~~
a.cc: In function 'int main()':
a.cc:20:5: error: 'cin' was not declared in this scope
   20 |     cin >> D >> G;
      |     ^~~
a.cc:21:5: error: 'vector' was not declared in this scope
   21 |     vector<int> p(D), c(D);
      |     ^~~~~~
a.cc:21:12: error: expected primary-expression before 'int'
   21 |     vector<int> p(D), c(D);
      |            ^~~
a.cc:24:9: error: 'i' was not declared in this scope
   24 |     REP(i, D){
      |         ^
a.cc:24:5: error: 'REP' was not declared in this scope
   24 |     REP(i, D){
      |     ^~~
a.cc:29:12: error: expected primary-expression before 'bool'
   29 |     vector<bool> is_used(D, false);
      |            ^~~~
a.cc:32:16: error: expected primary-expression before 'int'
   32 |         vector<int> sump(0);
      |                ^~~
a.cc:33:16: error: 'Pdi' was not declared in this scope
   33 |         vector<Pdi> avep(0);
      |                ^~~
a.cc:33:21: error: 'avep' was not declared in this scope
   33 |         vector<Pdi> avep(0);
      |                     ^~~~
a.cc:42:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   42 |         sort(avep.begin(), avep.end());
      |         ^~~~
      |         short
a.cc:44:21: error: 'INF' was not declared in this scope
   44 |         int min_n = INF;
      |                     ^~~
a.cc:53:33: error: 'p' was not declared in this scope
   53 |         G -= ((use + 1) * 100 * p[use] + c[use]);
      |                                 ^
a.cc:53:42: error: 'c' was not declared in this scope
   53 |         G -= ((use + 1) * 100 * p[use] + c[use]);
      |                                          ^
a.cc:55:9: error: 'is_used' was not declared in this scope
   55 |         is_used[use] = true;
      |         ^~~~~~~
a.cc:59:5: error: 'cout' was not declared in this scope
   59 |     cout << ans;
      |     ^~~~
a.cc: At global scope:
a.cc:72:21: error: 'vector' has not been declared
   72 | void readint(int N, vector<int> &a){
      |                     ^~~~~~
a.cc:72:27: error: expected ',' or '...' before '<' token
   72 | void readint(int N, vector<int> &a){
      |                           ^
a.cc: In function 'void readint(int, int)':
a.cc:73:5: error: 'string' was not declared in this scope
   73 |     string s;
      |     ^~~~~~
a.cc:75:17: error: 'cin' was not declared in this scope
   75 |         getline(cin, s, ' ');
      |                 ^~~
a.cc:75:22: error: 's' was not declared in this scope
   75 |         getline(cin, s, ' ');
      |                      ^
a.cc:75:9: error: 'getline' was not declared in this scope
   75 |         getline(cin, s, ' ');
      |         ^~~~~~~
a.cc:76:9: error: 'a' was not declared in this scope
   76 |         a[i] = atoi(s.c_str());
      |         ^
a.cc:76:16: error: 'atoi' was not declared in this scope
   76 |         a[i] = atoi(s.c_str());
      |                ^~~~
a.cc:78:13: error: 'cin' was not declared in this scope
   78 |     getline(cin, s, '\n');
      |             ^~~
a.cc:78:18: error: 's' was not declared in this scope
   78 |     getline(cin, s, '\n');
      |                  ^
a.cc:78:5: error: 'getline' was not declared in this scope
   78 |     getline(cin, s, '\n');
      |     ^~~~~~~
a.cc:79:5: error: 'a' was not declared in this scope
   79 |     a[N - 1] = atoi(s.c_str());
      |     ^
a.cc:79:16: error: 'atoi' was not declared in this scope
   79 |     a[N - 1] = atoi(s.c_str());
      |                ^~~~
a.cc: At global scope:
a.cc:81:24: error: 'vector' has not been declared
   81 | void readdouble(int N, vector<double> &a){
      |                        ^~~~~~
a.cc:81:30: error: expected ',' or '...' before '<' token
   81 | void readdouble(int N, vector<double> &a){
      |                              ^
a.cc: In function 'void readdouble(int, int)':
a.cc:82:5: error: 'string' was not declared in this scope
   82 |     string s;
      |     ^~~~~~
a.cc:84:17: error: 'cin' was not declared in this scope
   84 |         getline(cin, s, ' ');
      |                 ^~~
a.cc:84:22: error: 's' was not declared in this scope
   84 |         getline(cin, s, ' ');
      |                      ^
a.cc:84:9: error: 'getline' was not declared in this scope
   84 |         getline(cin, s, ' ');
      |         ^~~~~~~
a.cc:85:9: error: 'a' was not declared in this scope
   85 |         a[i] = atof(s.c_str());
      |         ^
a.cc:85:16: error: 'atof' was not declared in this scope
   85 |         a[i] = atof(s.c_str());
      |                ^~~~
a.cc:87:13: error: 'cin' was not declared in this scope
   87 |     getline(cin, s, '\n');
      |             ^~~
a.cc:87:18: error: 's' was not declared in this scope
   87 |     getline(cin, s, '\n');
      |                  ^
a.cc:87:5: error: 'getline' was not declared in this scope
   87 |     getline(cin, s, '\n');
      |     ^~~~~~~
a.cc:88:5: error: 'a' was not declared in this scope
   88 |     a[N - 1] = atof(s.c_str());
      |     ^
a.cc:88:16: error: 'atof' was not declared in this scope
   88 |     a[N - 1] = atof(s.c_str());
      |                ^~~~
a.cc: At global scope:
a.cc:90:23: error: 'vector' has not been declared
   90 | void readindex(int N, vector<int> &a){
      |                       ^~~~~~
a.cc:90:29: error: expected ',' or '...' before '<' token
   90 | void readindex(int N, vector<int> &a){
      |                             ^
a.cc: In function 'void readindex(int, int)':
a.cc:91:5: error: 'string' was not declared in this scope
   91 |     string s;
      |     ^~~~~~
a.cc:93:17: error: 'cin' was not declared in this scope
   93 |         getline(cin, s, ' ');
      |                 ^~~
a.cc:93:22: error: 's' was not declared in this scope
   93 |         getline(cin, s, ' ');
      |                      ^
a.cc:93:9: error: 'getline' was not declared in this scope
   93 |         getline(cin, s, ' ');
      |         ^~~~~~~
a.cc:94:9: error: 'a' was not declared in this scope
   94 |         a[i] = atoi(s.c_str()) - 1;
      |         ^
a.cc:94:16: error: 'atoi' was not declared in this scope
   94 |         a[i] = atoi(s.c_str()) - 1;
      |                ^~~~
a.cc:96:13: error: 'cin' was not declared in this scope
   96 |     getline(cin, s, '\n');
      |             ^~~
a.cc:96:18: error: 's' was not declared in this scope
   96 |     getline(cin, s, '\n');
      |                  ^
a.cc:96:5: error: 'getline' was not declared in this scope
   96 |     getline(cin, s, '\n');
      |     ^~~~~~~
a.cc:97:5: error: 'a' was not declared in this scope
   97 |     a[N - 1] = atoi(s.c_str()) - 1;
      |     ^
a.cc:97:16: error: 'atoi' was not declared in this scope
   97 |     a[N - 1] = atoi(s.c_str()) - 1;
      |                ^~~~