Language: C++

#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

#define DAY 365
#define TEST 26
#define DIM 50 
#define I 100
#define LOOP 1000

using namespace std;



class GAI{
    private:
        int[DAY] code;
        int[TEST] test_dis;
        int[DAY][TEST] test_pls;
        int[TEST] lastday;
        int sat;
        int lock;
    public:
        GA(char *argv[]) {
            
            for(int i = 0; i < TEST; i++){
                test_dis[i] = stoi(argv[i + 1]);
            }
            for(int i = 0; i < DAY;i++){
                for(int j = 0; j < TEST; test++){
                    test_pls[i][j] = stoi(argv[i+j+27]);
                }
            }
            random_device rnd;
            mt19937 mt(rnd());
            uniform_int_distribution<> rand26(0, 25);
            for(int i;i < DAY; i++){
                code[i] = rand26(mt);
            }
            for(int i;i < TEST; i++){
                lastday[i] = 0;
            }
            sat = 0;
            lock = 0;
        }
        
        void cal_val(){
            for(int i = 0; i < TEST; i++){
                for(int j = 0; j < DAY; j++){
                    if(code[i] == i) {
                        sat += test_pls[j][i];
                        lastday[i] = j;
                    } else {
                        sat -= test_dis[i]*(i - lastday[i]);
                    }
                }
            }
        }
        int get_sat(){
            return sat;
        }
        int get_code(int change){
            return code[change];
        }
        
        void set_code(int change,int value){
            code[change] = value;
        }
        int get_lock(){
            return lock;
        }
        void set_lock(){
            lock = 1;
        }
        void reset_lock (){
            lock = 0;
        }
        
};

class GA{
    private:
        GAI[I] gai;
        int best;
    public:
        GA(char *argv[]){
            for(int i = 0; i < I;i++){
                gai[i] = new GAI(argv);
            }
        }
        
        void lock(){
            for(int i = 1;i < I;i++){
               gai(i).cal_val();
            }
            best = 0;
            for(int i = 1;i < I;i++){
                if(GAI[stack].get_sat() < GAI[i]) best = i;
            }
            gai(best).set_lock();
        }
        
        void mix(){
            random_device rnd;
            mt19937 mt(rnd());
            int par;
            uniform_int_distribution<> rand2(0, 1);
            uniform_int_distribution<> randI(0, I);
            for(int i = 0; i < I;i++){
                if(gai[i].get_lock() == 1) gai[i].reset_lock();
                else{
                    par = randI(mt);
                    for(int j= 0; j < DAY; j++){
                        if(rand2(mt) == 0) gai[i].set_code(j,gai[par].get_code(j));
                    }
                }
            }
        }
        
        int get_best(int num){
            return gai[best].get_code(num);
        }
        
};

int main(int argc, char *argv[]){
    GA ga(argv);
    for(int i = 0; i < LOOP; i++){
        ga.lock();
        ga.mix();
    }
    
    for(int i = 0; i < DAY; i++){
        cout << GA.get_best(i) << endl;
    }// Your code here!
    
}


Compiler output:
a.cc:19:12: error: expected unqualified-id before '[' token
   19 |         int[DAY] code;
      |            ^
a.cc:20:12: error: expected unqualified-id before '[' token
   20 |         int[TEST] test_dis;
      |            ^
a.cc:21:12: error: expected unqualified-id before '[' token
   21 |         int[DAY][TEST] test_pls;
      |            ^
a.cc:22:12: error: expected unqualified-id before '[' token
   22 |         int[TEST] lastday;
      |            ^
a.cc:26:9: error: ISO C++ forbids declaration of 'GA' with no type [-fpermissive]
   26 |         GA(char *argv[]) {
      |         ^~
a.cc: In member function 'int GAI::GA(char**)':
a.cc:29:17: error: 'test_dis' was not declared in this scope
   29 |                 test_dis[i] = stoi(argv[i + 1]);
      |                 ^~~~~~~~
a.cc:32:42: error: 'test' was not declared in this scope
   32 |                 for(int j = 0; j < TEST; test++){
      |                                          ^~~~
a.cc:33:21: error: 'test_pls' was not declared in this scope
   33 |                     test_pls[i][j] = stoi(argv[i+j+27]);
      |                     ^~~~~~~~
a.cc:36:13: error: 'random_device' was not declared in this scope; did you mean 'random_data'?
   36 |             random_device rnd;
      |             ^~~~~~~~~~~~~
      |             random_data
a.cc:37:13: error: 'mt19937' was not declared in this scope
   37 |             mt19937 mt(rnd());
      |             ^~~~~~~
a.cc:38:13: error: 'uniform_int_distribution' was not declared in this scope
   38 |             uniform_int_distribution<> rand26(0, 25);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:38:38: error: expected primary-expression before '>' token
   38 |             uniform_int_distribution<> rand26(0, 25);
      |                                      ^
a.cc:38:40: error: 'rand26' was not declared in this scope; did you mean 'random'?
   38 |             uniform_int_distribution<> rand26(0, 25);
      |                                        ^~~~~~
      |                                        random
a.cc:40:17: error: 'code' was not declared in this scope
   40 |                 code[i] = rand26(mt);
      |                 ^~~~
a.cc:40:34: error: 'mt' was not declared in this scope; did you mean 'tm'?
   40 |                 code[i] = rand26(mt);
      |                                  ^~
      |                                  tm
a.cc:43:17: error: 'lastday' was not declared in this scope
   43 |                 lastday[i] = 0;
      |                 ^~~~~~~
a.cc:47:9: warning: no return statement in function returning non-void [-Wreturn-type]
   47 |         }
      |         ^
a.cc: In member function 'void GAI::cal_val()':
a.cc:52:24: error: 'code' was not declared in this scope
   52 |                     if(code[i] == i) {
      |                        ^~~~
a.cc:53:32: error: 'test_pls' was not declared in this scope
   53 |                         sat += test_pls[j][i];
      |                                ^~~~~~~~
a.cc:54:25: error: 'lastday' was not declared in this scope
   54 |                         lastday[i] = j;
      |                         ^~~~~~~
a.cc:56:32: error: 'test_dis' was not declared in this scope
   56 |                         sat -= test_dis[i]*(i - lastday[i]);
      |                                ^~~~~~~~
a.cc:56:49: error: 'lastday' was not declared in this scope
   56 |                         sat -= test_dis[i]*(i - lastday[i]);
      |                                                 ^~~~~~~
a.cc: In member function 'int GAI::get_code(int)':
a.cc:65:20: error: 'code' was not declared in this scope
   65 |             return code[change];
      |                    ^~~~
a.cc: In member function 'void GAI::set_code(int, int)':
a.cc:69:13: error: 'code' was not declared in this scope
   69 |             code[change] = value;
      |             ^~~~
a.cc: At global scope:
a.cc:85:12: error: expected unqualified-id before '[' token
   85 |         GAI[I] gai;
      |            ^
a.cc: In constructor 'GA::GA(char**)':
a.cc:90:17: error: 'gai' was not declared in this scope
   90 |                 gai[i] = new GAI(argv);
      |                 ^~~
a.cc:90:38: error: no matching function for call to 'GAI::GAI(char**&)'
   90 |                 gai[i] = new GAI(argv);
      |                                      ^
a.cc:17:7: note: candidate: 'GAI::GAI()'
   17 | class GAI{
      |       ^~~
a.cc:17:7: note:   candidate expects 0 arguments, 1 provided
a.cc:17:7: note: candidate: 'constexpr GAI::GAI(const GAI&)'
a.cc:17:7: note:   no known conversion for argument 1 from 'char**' to 'const GAI&'
a.cc:17:7: note: candidate: 'constexpr GAI::GAI(GAI&&)'
a.cc:17:7: note:   no known conversion for argument 1 from 'char**' to 'GAI&&'
a.cc: In member function 'void GA::lock()':
a.cc:96:16: error: 'gai' was not declared in this scope
   96 |                gai(i).cal_val();
      |                ^~~
a.cc:100:23: error: expected unqualified-id before '[' token
  100 |                 if(GAI[stack].get_sat() < GAI[i]) best = i;
      |                       ^
a.cc:102:13: error: 'gai' was not declared in this scope
  102 |             gai(best).set_lock();
      |             ^~~
a.cc: In member function 'void GA::mix()':
a.cc:106:13: error: 'random_device' was not declared in this scope; did you mean 'random_data'?
  106 |             random_device rnd;
      |             ^~~~~~~~~~~~~
      |             random_data
a.cc:107:13: error: 'mt19937' was not declared in this scope
  107 |             mt19937 mt(rnd());
      |             ^~~~~~~
a.cc:109:13: error: 'uniform_int_distribution' was not declared in this scope
  109 |             uniform_int_distribution<> rand2(0, 1);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:109:38: error: expected primary-expression before '>' token
  109 |             uniform_int_distribution<> rand2(0, 1);
      |                                      ^
a.cc:109:40: error: 'rand2' was not declared in this scope; did you mean 'rand'?
  109 |             uniform_int_distribution<> rand2(0, 1);
      |                                        ^~~~~
      |                                        rand
a.cc:110:38: error: expected primary-expression before '>' token
  110 |             uniform_int_distribution<> randI(0, I);
      |                                      ^
a.cc:110:40: error: 'randI' was not declared in this scope; did you mean 'rand'?
  110 |             uniform_int_distribution<> randI(0, I);
      |                                        ^~~~~
      |                                        rand
a.cc:112:20: error: 'gai' was not declared in this scope
  112 |                 if(gai[i].get_lock() == 1) gai[i].reset_lock();
      |                    ^~~
a.cc:114:33: error: 'mt' was not declared in this scope; did you mean 'tm'?
  114 |                     par = randI(mt);
      |                                 ^~
      |                                 tm
a.cc: In member function 'int GA::get_best(int)':
a.cc:123:20: error: 'gai' was not declared in this scope
  123 |             return gai[best].get_code(num);
      |                    ^~~
a.cc: In function 'int main(int, char**)':
a.cc:136:19: error: expected primary-expression before '.' token
  136 |         cout << GA.get_best(i) << endl;
      |                   ^