Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int D;
int c[26];
int s[365][26];
int select[365];

int calculateScore(int t){
    int retVal = 0;
    int last = -1;
    for(int i=0;i<D;i++){
        if(select[i] == t){
            last = i;
            retVal += s[i][t];
        }else{
            retVal -= c[t] * (i-last);
        }
    }
    return retVal;
}


int main() {
    clock_t start = clock();
    cin >> D;
    for(int i=0;i<26;i++){
        cin >> c[i];
    }
    for(int i=0;i<D;i++)for(int j=0;j<26;j++){
        cin >> s[i][j];
    }

    int scores[26];
    for(int i=0;i<26;i++){
        scores[i] = rand()%26;
    }
    for(int i=0;i<26;i++){
        scores[i] = calculateScore(i);
    }
    int itr = 1;
    while(clock()-start<(CLOCKS_PER_SEC*2- 1000)){
        // cerr <<"itr =" << itr <<"\n";
        itr++;
        int q = rand()%26;
        int t = rand()%D;
        int oldq = select[t];
        int oldscore = scores[oldq] + scores[q];
        select[t] = q;
        int newScore = calculateScore(oldq) + calculateScore(q);
        // cerr <<"oldScore=" << oldscore <<"newScore=" << newScore << "\n";
        if(newScore <oldscore){
            select[t] = oldq;
        }
    }
    for(int i=0;i<D;i++){
        cout << select[i]+1 <<"\n";
    }
    return 0;
}

Compiler output:
a.cc:7:15: error: 'int select [365]' redeclared as different kind of entity
    7 | int select[365];
      |               ^
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:179,
                 from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
                 from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/select.h:102:12: note: previous declaration 'int select(int, fd_set*, fd_set*, fd_set*, timeval*)'
  102 | extern int select (int __nfds, fd_set *__restrict __readfds,
      |            ^~~~~~
a.cc: In function 'int calculateScore(int)':
a.cc:13:20: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   13 |         if(select[i] == t){
      |                    ^
a.cc:13:22: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   13 |         if(select[i] == t){
      |            ~~~~~~~~~~^~~~
a.cc: In function 'int main()':
a.cc:47:28: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   47 |         int oldq = select[t];
      |                            ^
a.cc:47:28: error: invalid conversion from 'int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)' to 'int' [-fpermissive]
   47 |         int oldq = select[t];
      |                            ^
      |                            |
      |                            int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)
a.cc:49:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   49 |         select[t] = q;
      |                 ^
a.cc:49:19: error: assignment of read-only location '*(select + ((sizetype)t))'
   49 |         select[t] = q;
      |         ~~~~~~~~~~^~~
a.cc:53:21: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   53 |             select[t] = oldq;
      |                     ^
a.cc:53:23: error: assignment of read-only location '*(select + ((sizetype)t))'
   53 |             select[t] = oldq;
      |             ~~~~~~~~~~^~~~~~
a.cc:57:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   57 |         cout << select[i]+1 <<"\n";
      |                         ^
a.cc:57:26: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   57 |         cout << select[i]+1 <<"\n";
      |                 ~~~~~~~~~^~