Language: C++

int main() {
    ifstream fin("read.txt");
    li n, m, num;
    vector<li> v;
    fin >> n >> m;
    
    for (int i = 0; i < n; i++) {
        fin >> num;
        v.push_back(num);
    }
    
    li twos = 0, lcm = v[0];
    
    num = v[0];
    
    while(num > 0 && num % 2 == 0) {
        num /= 2;
        twos++;
    }
    
    for (int i = 1; i < v.size(); i++) {
        num = v[i];
        int t = 0;
        
        while(num > 0 && num % 2 ==0) {
            num /= 2;
            t++;
        }
        
        if (t != twos) {
            cout << 0 << endl;
            return 0;
        }
        
        lcm = lcm * v[i] / __gcd(lcm, v[i]);
    }
    
    lcm /= 2;
    
    li ans = m / lcm;
    ans = ans % 2 + ans / 2;
    
    cout << ans << endl;
    
    
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:2:5: error: 'ifstream' was not declared in this scope
    2 |     ifstream fin("read.txt");
      |     ^~~~~~~~
a.cc:3:5: error: 'li' was not declared in this scope
    3 |     li n, m, num;
      |     ^~
a.cc:4:5: error: 'vector' was not declared in this scope
    4 |     vector<li> v;
      |     ^~~~~~
a.cc:4:16: error: 'v' was not declared in this scope
    4 |     vector<li> v;
      |                ^
a.cc:5:5: error: 'fin' was not declared in this scope
    5 |     fin >> n >> m;
      |     ^~~
a.cc:5:12: error: 'n' was not declared in this scope
    5 |     fin >> n >> m;
      |            ^
a.cc:5:17: error: 'm' was not declared in this scope
    5 |     fin >> n >> m;
      |                 ^
a.cc:8:16: error: 'num' was not declared in this scope; did you mean 'enum'?
    8 |         fin >> num;
      |                ^~~
      |                enum
a.cc:12:7: error: expected ';' before 'twos'
   12 |     li twos = 0, lcm = v[0];
      |       ^~~~~
      |       ;
a.cc:14:5: error: 'num' was not declared in this scope; did you mean 'enum'?
   14 |     num = v[0];
      |     ^~~
      |     enum
a.cc:18:9: error: 'twos' was not declared in this scope
   18 |         twos++;
      |         ^~~~
a.cc:30:18: error: 'twos' was not declared in this scope
   30 |         if (t != twos) {
      |                  ^~~~
a.cc:31:13: error: 'cout' was not declared in this scope
   31 |             cout << 0 << endl;
      |             ^~~~
a.cc:31:26: error: 'endl' was not declared in this scope
   31 |             cout << 0 << endl;
      |                          ^~~~
a.cc:35:9: error: 'lcm' was not declared in this scope
   35 |         lcm = lcm * v[i] / __gcd(lcm, v[i]);
      |         ^~~
a.cc:35:28: error: '__gcd' was not declared in this scope
   35 |         lcm = lcm * v[i] / __gcd(lcm, v[i]);
      |                            ^~~~~
a.cc:38:5: error: 'lcm' was not declared in this scope
   38 |     lcm /= 2;
      |     ^~~
a.cc:40:7: error: expected ';' before 'ans'
   40 |     li ans = m / lcm;
      |       ^~~~
      |       ;
a.cc:41:5: error: 'ans' was not declared in this scope
   41 |     ans = ans % 2 + ans / 2;
      |     ^~~
a.cc:43:5: error: 'cout' was not declared in this scope
   43 |     cout << ans << endl;
      |     ^~~~
a.cc:43:20: error: 'endl' was not declared in this scope
   43 |     cout << ans << endl;
      |                    ^~~~