Language: C++

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;

 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    REP(i, n)
    cin >> a[i];

    map<int, int> lcm;
    for (int i = 0; i < n; i++)
    {
        int x = a[i];
      
        map<int, int> mp;
       
        int cnt = 2;
        while (cnt * cnt <= x)
        {
            if(x%cnt==0){
                mp[cnt]++;
                x /= cnt;
            }
            else{
                cnt++;
            }
        }
        mp[x]++;
      /*  for (auto itr = mp.begin(); itr != mp.end(); ++itr)
        {
            cout << itr->first << " " << itr->second << endl;
        }*/
        for (auto itr = mp.begin(); itr != mp.end(); ++itr){
            if(lcm[itr->first] < itr->second){
                lcm[itr->first] = itr->second;
            }
        }
    }
 /*   ll mod = 1e9 + 7;
    ll ans = 0;
    for (int i = 0; i < n; i++)
    {
        int x = a[i];

        map<int, int> mp;

        int cnt = 2;
        while (cnt * cnt <= x)
        {
            if (x % cnt == 0)
            {
                mp[cnt]++;
                x /= cnt;
            }
            else
            {
                cnt++;
            }
        }
        mp[x]++;
        ll tmp = 1;
        for (auto itr = lcm.begin(); itr != lcm.end(); itr++)
        {
         
                tmp *= pow(itr->first, (lcm[itr->first] - mp[itr->first]));
                tmp %= mod;
                //cerr << ans << endl;
        }
       // cerr << tmp << endl;
        ans += tmp;
        ans %= mod;
        //cerr << ans << endl;
    }

  /*  for (auto itr = lcm.begin(); itr != lcm.end();++itr){
        cout << itr->first << " " << itr->second << endl;
    }*/
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:106:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
  106 |     cout << ans << endl;
      |             ^~~
      |             abs