Language: C++

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

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 code[DAY];
        int test_dis[TEST];
        int test_pls[DAY][TEST];
        int lastday[TEST];
        int sat;
        int lock;
    public:
        GA(int ent[]) {
            
            for(int i = 0; i < TEST; i++){
                test_dis[i] = ent[i+1];
            }
            for(int i = 0; i < DAY;i++){
                for(int j = 0; j < TEST; j++){
                    test_pls[i][j] = ent[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 gai[I];
        int best;
    public:
        GA(int ent[]){
            for(int i = 0; i < I;i++){
                gai[i] = new GAI(ent);
            }
        }
        
        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[]){
    int ent[DAY*TEST + TEST + 1];
    
    for(int i = 0; i < (DAY*TEST + TEST + 1); i++){
        ent[i] = stoi(argv[i]);
    }
    
    GA ga(ent);
    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:27:9: error: ISO C++ forbids declaration of 'GA' with no type [-fpermissive]
   27 |         GA(int ent[]) {
      |         ^~
a.cc: In member function 'int GAI::GA(int*)':
a.cc:48:9: warning: no return statement in function returning non-void [-Wreturn-type]
   48 |         }
      |         ^
a.cc: In constructor 'GA::GA(int*)':
a.cc:91:37: error: no matching function for call to 'GAI::GAI(int*&)'
   91 |                 gai[i] = new GAI(ent);
      |                                     ^
a.cc:18:7: note: candidate: 'GAI::GAI()'
   18 | class GAI{
      |       ^~~
a.cc:18:7: note:   candidate expects 0 arguments, 1 provided
a.cc:18:7: note: candidate: 'constexpr GAI::GAI(const GAI&)'
a.cc:18:7: note:   no known conversion for argument 1 from 'int*' to 'const GAI&'
a.cc:18:7: note: candidate: 'constexpr GAI::GAI(GAI&&)'
a.cc:18:7: note:   no known conversion for argument 1 from 'int*' to 'GAI&&'
a.cc: In member function 'void GA::lock()':
a.cc:101:24: error: 'stack' was not declared in this scope
  101 |                 if(gai[stack].get_sat() < gai[i]) best = i;
      |                        ^~~~~
a.cc:5:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
    4 | #include <random>
  +++ |+#include <stack>
    5 | 
a.cc:103:16: error: expression cannot be used as a function
  103 |             gai(best).set_lock();
      |             ~~~^~~~~~