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;

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!
    
}


class GAI{
    pribate:
        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);
        }
        
}

Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:16:5: error: 'GA' was not declared in this scope
   16 |     GA ga(argv);
      |     ^~
a.cc:18:9: error: 'ga' was not declared in this scope
   18 |         ga.lock();
      |         ^~
a.cc: At global scope:
a.cc:30:5: error: 'pribate' does not name a type
   30 |     pribate:
      |     ^~~~~~~
a.cc:32:12: error: expected unqualified-id before '[' token
   32 |         int[TEST] test_dis;
      |            ^
a.cc:33:12: error: expected unqualified-id before '[' token
   33 |         int[DAY][TEST] test_pls;
      |            ^
a.cc:34:12: error: expected unqualified-id before '[' token
   34 |         int[TEST] lastday;
      |            ^
a.cc:38:9: error: ISO C++ forbids declaration of 'GA' with no type [-fpermissive]
   38 |         GA(char *argv[]) {
      |         ^~
a.cc:93:2: error: expected ';' after class definition
   93 | }
      |  ^
      |  ;
a.cc: In member function 'int GAI::GA(char**)':
a.cc:41:17: error: 'test_dis' was not declared in this scope
   41 |                 test_dis[i] = stoi(argv[i + 1]);
      |                 ^~~~~~~~
a.cc:44:42: error: 'test' was not declared in this scope
   44 |                 for(int j = 0; j < TEST; test++){
      |                                          ^~~~
a.cc:45:21: error: 'test_pls' was not declared in this scope
   45 |                     test_pls[i][j] = stoi(argv[i+j+27]);
      |                     ^~~~~~~~
a.cc:48:13: error: 'random_device' was not declared in this scope; did you mean 'random_data'?
   48 |             random_device rnd;
      |             ^~~~~~~~~~~~~
      |             random_data
a.cc:49:13: error: 'mt19937' was not declared in this scope
   49 |             mt19937 mt(rnd());
      |             ^~~~~~~
a.cc:50:13: error: 'uniform_int_distribution' was not declared in this scope
   50 |             uniform_int_distribution<> rand26(0, 25);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:50:38: error: expected primary-expression before '>' token
   50 |             uniform_int_distribution<> rand26(0, 25);
      |                                      ^
a.cc:50:40: error: 'rand26' was not declared in this scope; did you mean 'random'?
   50 |             uniform_int_distribution<> rand26(0, 25);
      |                                        ^~~~~~
      |                                        random
a.cc:52:17: error: 'code' was not declared in this scope
   52 |                 code[i] = rand26(mt);
      |                 ^~~~
a.cc:52:34: error: 'mt' was not declared in this scope; did you mean 'tm'?
   52 |                 code[i] = rand26(mt);
      |                                  ^~
      |                                  tm
a.cc:55:17: error: 'lastday' was not declared in this scope
   55 |                 lastday[i] = 0;
      |                 ^~~~~~~
a.cc:59:9: warning: no return statement in function returning non-void [-Wreturn-type]
   59 |         }
      |         ^
a.cc: In member function 'void GAI::cal_val()':
a.cc:64:24: error: 'code' was not declared in this scope
   64 |                     if(code[i] == i) {
      |                        ^~~~
a.cc:65:32: error: 'test_pls' was not declared in this scope
   65 |                         sat += test_pls[j][i];
      |                                ^~~~~~~~
a.cc:66:25: error: 'lastday' was not declared in this scope
   66 |                         lastday[i] = j;
      |                         ^~~~~~~
a.cc:68:32: error: 'test_dis' was not declared in this scope
   68 |                         sat -= test_dis[i]*(i - lastday[i]);
      |                                ^~~~~~~~
a.cc:68:49: error: 'lastday' was not declared in this scope
   68 |                         sat -= test_dis[i]*(i - lastday[i]);
      |                                                 ^~~~~~~
a.cc: In member function 'int GAI::get_code(int)':
a.cc:77:20: error: 'code' was not declared in this scope
   77 |             return code[change];
      |                    ^~~~
a.cc: In member function 'void GAI::set_code(int, int)':
a.cc:81:13: error: 'code' was not declared in this scope
   81 |             code[change] = value;
      |             ^~~~
a.cc: At global scope:
a.cc:97:12: error: expected unqualified-id before '[' token
   97 |         GAI[I] gai;
      |            ^
a.cc:138:2: error: expected ';' after class definition
  138 | }
      |  ^
      |  ;
a.cc: In constructor 'GA::GA(char**)':
a.cc:102:17: error: 'gai' was not declared in this scope
  102 |                 gai[i] = new GAI(argv);
      |                 ^~~
a.cc:102:38: error: no matching function for call to 'GAI::GAI(char**&)'
  102 |                 gai[i] = new GAI(argv);
      |                                      ^
a.cc:29:7: note: candidate: 'GAI::GAI()'
   29 | class GAI{
      |       ^~~
a.cc:29:7: note:   candidate expects 0 arguments, 1 provided
a.cc:29:7: note: candidate: 'constexpr GAI::GAI(const GAI&)'
a.cc:29:7: note:   no known conversion for argument 1 from 'char**' to 'const GAI&'
a.cc:29:7: note: candidate: 'constexpr GAI::GAI(GAI&&)'
a.cc:29:7: note:   no known conversion for argument 1 from 'char**' to 'GAI&&'
a.cc: In member function 'void GA::lock()':
a.cc:108:16: error: 'gai' was not declared in this scope
  108 |                gai(i).cal_val();
      |                ^~~
a.cc:112:23: error: expected unqualified-id before '[' token
  112 |                 if(GAI[stack].get_sat() < GAI[i]) best = i;
      |                       ^
a.cc:114:13: error: 'gai' was not declared in this scope
  114 |             gai(best).set_lock();
      |             ^~~
a.cc: In member function 'void GA::mix()':
a.cc:118:13: error: 'random_device' was not declared in this scope; did you mean 'random_data'?
  118 |             random_device rnd;
      |             ^~~~~~~~~~~~~
      |             random_data
a.cc:119:13: error: 'mt19937' was not declared in this scope
  119 |             mt19937 mt(rnd());
      |             ^~~~~~~
a.cc:121:13: error: 'uniform_int_distribution' was not declared in this scope
  121 |             uniform_int_distribution<> rand2(0, 1);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:121:38: error: expected primary-expression before '>' token
  121 |             uniform_int_distribution<> rand2(0, 1);
      |                                      ^
a.cc:121:40: error: 'rand2' was not declared in this scope; did you mean 'rand'?
  121 |             uniform_int_distribution<> rand2(0, 1);
      |                                        ^~~~~
      |                                        rand
a.cc:122:38: error: expected primary-expression before '>' token
  122 |             uniform_int_distribution<> randI(0, I);
      |                                      ^
a.cc:122:40: error: 'randI' was not declared in this scope; did you mean 'rand'?
  122 |             uniform_int_distribution<> randI(0, I);
      |                                        ^~~~~
      |                                        rand
a.cc:124:20: error: 'gai' was not declared in this scope
  124 |                 if(gai[i].get_lock() == 1) gai[i].reset_lock();
      |                    ^~~
a.cc:126:33: error: 'mt' was not declared in this scope; did you mean 'tm'?
  126 |                     par = randI(mt);
      |                                 ^~
      |                                 tm
a.cc: In member function 'int GA::get_best(int)':
a.cc:135:20: error: 'gai' was not declared in this scope
  135 |             return gai[best].get_code(num);
      |                    ^~~