Language: C++

#include<bits/stdc++.h>
#define ll          long long int
#define lld          long double
#define pb          push_back
#define pii         pair<ll,ll>
#define mi          map<ll,ll>
#define vec         vector<ll>
#define all(a)     (a).begin(),(a).end()
#define F           first
#define S           second
#define mod         1000000007
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repi(i,a,b)	for(ll  i=a;i<=b;i++)
#define per(i,a,b)  for(ll i=a;i>=b;i--)
#define mp          make_pair
#define mit         map<ll,ll>::iterator
#define sit         set<ll>::iterator
#define pit         pair<ll,ll>::iterator
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;
ll xo(ll x, ll y) 
{ 
   return (x | y) & (~x | ~y); 
}  
ll bin_Expo(ll x,ll n)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return bin_Expo(x*x,n/2);
    else                             //n is odd
        return x*bin_Expo(x*x,(n-1)/2);
}
ll mod_Expo(ll x,ll n,ll M)
{
		if(x==0)
		return 0;
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return mod_Expo((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*mod_Expo((x*x)%M,(n-1)/2,M))%M;
 
}
ll NcR(int n, int r) 
{ 
    ll p = 1, k = 1; 
    if (n - r < r) 
        r = n - r; 
  
    if (r != 0) { 
        while (r) { 
            p *= n; 
            k *= r; 
            ll m=__gcd(p, k); 
            p /= m; 
            k /= m; 
            n--; 
            r--; 
        } 
    } 
    else
        p = 1; 
    return p;
}
bool prime_check(ll x)
{
    bool prime = (x >= 2);
    for (ll i = 2; i * i <= x; i++) 
    {
        if (x % i == 0) 
        {
            prime = false;
            break;
        }
    }
    return prime;
}
ll logg(ll base,ll x)
{
    return (ll)(log(x)/log(base));
}
int MA = pow(10, 6);
ll po[10000][75000],lcm[75000];
vector<bool> pf(MA + 1, true);
vector<long long> prim;
ll pow1(ll x,ll y)
{
	if(y==0)
	return 1;
	ll ans=1;
	while(y)
	{
		if(y%2)
		ans=(ans*x)%mod;
		x=(x*x)%mod;
		y=y/2;
	}
	return ans;
}
int main()
{
	pf[0] = pf[1] = false;
    for (int i = 2; i <= MA; i++) {
        if (pf[i]) {
            prim.push_back(i);
            for (int j = i + i; j <= MA; j+=i) {
                pf[j] = false;
            }
        }
    }
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
    while(TESTS--)
    {
    	ll i,j,l,m,k,ans,ans1,h,b,x,y,n;
    	cin>>n;
    	ll a[n];
    	rep(i,0,n)
    	cin>>a[i];
//    	repi(i,2,N)
//    	{
//    		if(prime[i]==true)
//    		{
//    			prim.pb(i);
//			}
//		}
		m=prim.size();
		//ll po[n][m],lcm[m];
		set<ll> s;
		rep(i,0,n)
		{
			rep(j,0,m)
			po[i][j]=0;
		}
    	rep(i,0,n)
    	{
    		k=a[i]; l=0;
    		rep(xx,0,m)
    		{
    			j=prim[xx];
    			x=0;
				while(true)
				{
					if(k<2)
					break;
					if(k%j==0)
					{
						k=k/j;
						x++;
						l=1;
					}
					else
					break;
				}
				po[i][xx]=x;
			}
			//if(l==0)
			//s.insert(k);
		}
    	rep(j,0,m)
    	lcm[j]=po[0][j];
    	rep(i,1,n)
    	{
    		rep(j,0,m)
    		{
    			lcm[j]=max(lcm[j],po[i][j]);
			}
		}
		ans=0;
		rep(i,0,n)
		{
			ans1=1;
			rep(j,0,m)
			{
				if(lcm[j]>po[i][j] && lcm[j]!=0)
				ans1=(ans1*(pow1(prim[j],lcm[j]-po[i][j])))%mod;
			}
			ans=(ans+ans1)%mod;
		}
		//tr(s,it)
		//ans=(ans*(*it))%mod;
		cout<<ans;
		prim.clear();
		s.clear();
    } 
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:168:9: error: reference to 'lcm' is ambiguous
  168 |         lcm[j]=po[0][j];
      |         ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)'
  188 |     lcm(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:87:21: note:                 'long long int lcm [75000]'
   87 | ll po[10000][75000],lcm[75000];
      |                     ^~~
a.cc:173:25: error: reference to 'lcm' is ambiguous
  173 |                         lcm[j]=max(lcm[j],po[i][j]);
      |                         ^~~
/usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)'
  188 |     lcm(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:87:21: note:                 'long long int lcm [75000]'
   87 | ll po[10000][75000],lcm[75000];
      |                     ^~~
a.cc:173:36: error: reference to 'lcm' is ambiguous
  173 |                         lcm[j]=max(lcm[j],po[i][j]);
      |                                    ^~~
/usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)'
  188 |     lcm(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:87:21: note:                 'long long int lcm [75000]'
   87 | ll po[10000][75000],lcm[75000];
      |                     ^~~
a.cc:182:36: error: reference to 'lcm' is ambiguous
  182 |                                 if(lcm[j]>po[i][j] && lcm[j]!=0)
      |                                    ^~~
/usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)'
  188 |     lcm(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:87:21: note:                 'long long int lcm [75000]'
   87 | ll po[10000][75000],lcm[75000];
      |                     ^~~
a.cc:182:55: error: reference to 'lcm' is ambiguous
  182 |                                 if(lcm[j]>po[i][j] && lcm[j]!=0)
      |                                                       ^~~
/usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)'
  188 |     lcm(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:87:21: note:                 'long long int lcm [75000]'
   87 | ll po[10000][75000],lcm[75000];
      |                     ^~~
a.cc:183:58: error: reference to 'lcm' is ambiguous
  183 |                                 ans1=(ans1*(pow1(prim[j],lcm[j]-po[i][j])))%mod;
      |                                                          ^~~
/usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)'
  188 |     lcm(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:87:21: note:                 'long long int lcm [75000]'
   87 | ll po[10000][75000],lcm[75000];
      |                     ^~~