Language: C++

#include<bits/stdc++.h>
using namespace std;

int n;
int cnt[101], perfect[101];
int req;
int index[101];

int simulate()
{
    int curScore = 0, curC = 0;
    int lastIndex = -1;
    for(int i = 0; i < n; i++)
    {
        if(curScore + (cnt[index[i]] * (index[i] + 1) * 100) + perfect[index[i]] >= req)
        {
            lastIndex = i;
            break;
        }
        curScore += (cnt[index[i]] * (index[i] + 1) * 100) + perfect[index[i]];
        curC += cnt[index[i]];
    }
    int s = 0, e = cnt[index[lastIndex]], mid;
    int res;
    while(s < e)
    {
        mid = s + (e - s) / 2;
        if(mid == cnt[index[lastIndex]])
        {
            if(curScore + mid * (index[lastIndex] + 1) * 100 + perfect[index[lastIndex]] >= req)
                e = mid;
            else
                s = mid + 1;
        }
        else if(curScore + mid * (index[lastIndex] + 1) * 100 >= req)
        {
            e = mid;
        }
        else
        {
            s = mid + 1;
        }
    }

    return curC + e;
}

int main()
{
    while(cin >> n >> req)
    {
        int res = INT_MAX;
        for(int i = 0; i < n; i++)
        {
            cin >> cnt[i] >> perfect[i];
            index[i] = i;
        }
        do{
            res = min(res, simulate());
        }while(next_permutation(index, index + n));

        cout << res << endl;
    }
    return 0;
}


Compiler output:
a.cc:7:14: error: 'int index [101]' redeclared as different kind of entity
    7 | int index[101];
      |              ^
In file included from /usr/include/string.h:462,
                 from /usr/include/c++/14/cstring:43,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
                 from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
   50 | extern const char *index (const char *__s, int __c)
      |                    ^~~~~
a.cc: In function 'int simulate()':
a.cc:15:33: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |         if(curScore + (cnt[index[i]] * (index[i] + 1) * 100) + perfect[index[i]] >= req)
      |                                 ^
a.cc:15:46: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |         if(curScore + (cnt[index[i]] * (index[i] + 1) * 100) + perfect[index[i]] >= req)
      |                                              ^
a.cc:15:77: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   15 |         if(curScore + (cnt[index[i]] * (index[i] + 1) * 100) + perfect[index[i]] >= req)
      |                                                                             ^
a.cc:20:31: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |         curScore += (cnt[index[i]] * (index[i] + 1) * 100) + perfect[index[i]];
      |                               ^
a.cc:20:44: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |         curScore += (cnt[index[i]] * (index[i] + 1) * 100) + perfect[index[i]];
      |                                            ^
a.cc:20:75: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   20 |         curScore += (cnt[index[i]] * (index[i] + 1) * 100) + perfect[index[i]];
      |                                                                           ^
a.cc:21:26: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   21 |         curC += cnt[index[i]];
      |                          ^
a.cc:23:29: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   23 |     int s = 0, e = cnt[index[lastIndex]], mid;
      |                             ^
a.cc:27:9: error: 'mid' was not declared in this scope
   27 |         mid = s + (e - s) / 2;
      |         ^~~
a.cc:28:28: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   28 |         if(mid == cnt[index[lastIndex]])
      |                            ^
a.cc:30:39: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   30 |             if(curScore + mid * (index[lastIndex] + 1) * 100 + perfect[index[lastIndex]] >= req)
      |                                       ^
a.cc:30:77: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   30 |             if(curScore + mid * (index[lastIndex] + 1) * 100 + perfect[index[lastIndex]] >= req)
      |                                                                             ^
a.cc:35:40: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   35 |         else if(curScore + mid * (index[lastIndex] + 1) * 100 >= req)
      |                                        ^
a.cc: In function 'int main()':
a.cc:56:18: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   56 |             index[i] = i;
      |                  ^
a.cc:60:46: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
   60 |         }while(next_permutation(index, index + n));
      |                                        ~~~~~~^~~