Language: C++

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

map<ll,ll> lcm;

void prime_factor(ll n){
	map<ll,ll> res;
	for(ll i = 2; i * i  <= n; i++) {
		while(n % i == 0){
			res[i]++;
			n /= i;
		}
		lcm[i] = max(lcm[i],res[i]);
	}
	if (n != 1){
		res[n] = 1;
		lcm[n] = max(lcm[n],res[n]);
	}
}

ll mod_pow(ll x,ll n){
	ll res = 1;
	while(n > 0){
		if(n & 1){
			res = res * x % mod;
		}
		x = x * x % mod;
		n >>= 1;
	}
	return res;
}


int main(){
	ll n;cin>>n;
	vector<ll> a(n);
	ll m = 0;
	for(int i = 0; i < n; i++) {
		cin>>a[i];
		prime_factor(a[i]);
		m = max(m,a[i]);
	}
	ll l = 1;

	for (const auto& [key, value] : lcm){
		l *= (mod_pow(key,value)) % mod;
    }
	l %= mod;
	
	ll ans = 0;
	for(int i = 0; i < n; i++) {
		ans += (l * mod_pow(a[i],mod - 2)) % mod;
	}
	cout << ans % mod << endl;
	
	return 0;
}

Compiler output:
a.cc: In function 'void prime_factor(ll)':
a.cc:25:17: error: reference to 'lcm' is ambiguous
   25 |                 lcm[i] = max(lcm[i],res[i]);
      |                 ^~~
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:16:12: note:                 'std::map<long long int, long long int> lcm'
   16 | map<ll,ll> lcm;
      |            ^~~
a.cc:25:30: error: reference to 'lcm' is ambiguous
   25 |                 lcm[i] = max(lcm[i],res[i]);
      |                              ^~~
/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:16:12: note:                 'std::map<long long int, long long int> lcm'
   16 | map<ll,ll> lcm;
      |            ^~~
a.cc:29:17: error: reference to 'lcm' is ambiguous
   29 |                 lcm[n] = max(lcm[n],res[n]);
      |                 ^~~
/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:16:12: note:                 'std::map<long long int, long long int> lcm'
   16 | map<ll,ll> lcm;
      |            ^~~
a.cc:29:30: error: reference to 'lcm' is ambiguous
   29 |                 lcm[n] = max(lcm[n],res[n]);
      |                              ^~~
/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:16:12: note:                 'std::map<long long int, long long int> lcm'
   16 | map<ll,ll> lcm;
      |            ^~~
a.cc: In function 'int main()':
a.cc:57:41: error: reference to 'lcm' is ambiguous
   57 |         for (const auto& [key, value] : lcm){
      |                                         ^~~
/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:16:12: note:                 'std::map<long long int, long long int> lcm'
   16 | map<ll,ll> lcm;
      |            ^~~