Language: C++

#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//modint
template<typename T> T modinv(T a, T m) {
	T b = m, u = 1, v = 0;
	while (b) {
		T t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
template<typename T> T modpow(T x, int k) {
	if (k == 0)return 1;
	if (k % 2 == 0) return modpow(x * x, k / 2);
	else return x * modpow(x, k - 1);
}

template<int mod> class modint {
public:
	ll val;
	modint(ll a) {
		val = a % mod;
	}
	modint operator+(const modint& r) {
		return modint((this->val + r.val) % mod);
	}
	modint operator%(const modint& r) {
		return modint((this->val % r.val) % mod);
	}
	modint operator-(const modint& r) {
		return modint((this->val - r.val) % mod + ((this->val - r.val) % mod < 0) * mod);
	}
	modint operator*(const modint& r) {
		return modint((((this->val % mod) * (r.val % mod))) % mod);
	}
	modint operator/(const modint& r) {
		return modint(this->val * modinv<ll>(r.val, mod) % mod);
	}
	modint& operator+=(const modint& r) {
		*this = *this + r;
		return *this;
	}
	modint& operator-=(const modint& r) {
		*this = *this - r;
		return *this;
	}
	modint& operator*=(const modint& r) {
		*this = *this * r;
		return *this;
	}
	modint& operator/=(const modint& r) {
		*this = *this / r;
		return *this;
	}
	modint& operator/=(const modint& r) {
		*this = *this % r;
		return *this;
	}

};

#define ll modint<MOD>

//最小公倍数、最大公約数
ll gcd(ll a, ll b) {
	return b.val != 0 ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

//最小公倍数、最大公約数
ll lcm(vector<ll> a) {
	ll tmp = a.front();
	for (int i = 1; i < a.size(); i++) {
		tmp = lcm(tmp, a[i]);
	}
	return tmp;
}
ll gcd(vector<ll> a) {
	ll tmp = a.front();
	for (int i = 1; i < a.size(); i++) {
		tmp = gcd(tmp, a[i]);
	}
	return tmp;
}


int main() {
	int N;
	cin >> N;
	vector<ll> a(N);
	for (int i = 0; i < N; i++)cin >> a[i].val;
	
	ll l = lcm(a);
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		ans += l / a[i];
	}
	cout << ans.val << endl;
}

Compiler output:
a.cc:68:17: error: 'modint<mod>& modint<mod>::operator/=(const modint<mod>&)' cannot be overloaded with 'modint<mod>& modint<mod>::operator/=(const modint<mod>&)'
   68 |         modint& operator/=(const modint& r) {
      |                 ^~~~~~~~
a.cc:64:17: note: previous declaration 'modint<mod>& modint<mod>::operator/=(const modint<mod>&)'
   64 |         modint& operator/=(const modint& r) {
      |                 ^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:61,
                 from /usr/include/c++/14/bits/stl_algo.h:69,
                 from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_construct.h: In instantiation of 'void std::_Construct(_Tp*, _Args&& ...) [with _Tp = modint<1000000007>; _Args = {}]':
/usr/include/c++/14/bits/stl_uninitialized.h:643:18:   required from 'static _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = modint<1000000007>*; _Size = long unsigned int; bool _TrivialValueType = false]'
  643 |                 std::_Construct(std::__addressof(*__cur));
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:712:20:   required from '_ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = modint<1000000007>*; _Size = long unsigned int]'
  710 |       return __uninitialized_default_n_1<__is_trivial(_ValueType)
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  711 |                                          && __can_fill>::
      |                                          ~~~~~~~~~~~~~~~~
  712 |         __uninit_default_n(__first, __n);
      |         ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_uninitialized.h:779:44:   required from '_ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, allocator<_Tp>&) [with _ForwardIterator = modint<1000000007>*; _Size = long unsigned int; _Tp = modint<1000000007>]'
  779 |     { return std::__uninitialized_default_n(__first, __n); }
      |              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1720:36:   required from 'void std::vector<_Tp, _Alloc>::_M_default_initialize(size_type) [with _Tp = modint<1000000007>; _Alloc = std::allocator<modint<1000000007> >; size_type = long unsigned int]'
 1720 |           std::__uninitialized_default_n_a(this->_M_impl._M_start, __n,
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1721 |                                            _M_get_Tp_allocator());
      |                                            ~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:558:9:   required from 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = modint<1000000007>; _Alloc = std::allocator<modint<1000000007> >; size_type = long unsigned int; allocator_type = std::allocator<modint<1000000007> >]'
  558 |       { _M_default_initialize(__n); }
      |         ^~~~~~~~~~~~~~~~~~~~~
a.cc:105:16:   required from here
  105 |         vector<ll> a(N);
      |                       ^
/usr/include/c++/14/bits/stl_construct.h:119:7: error: no matching function for call to 'modint<1000000007>::modint()'
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:34:9: note: candidate: 'modint<mod>::modint(ll) [with int mod = 1000000007; ll = long long int]'
   34 |         modint(ll a) {
      |         ^~~~~~
a.cc:34:9: note:   candidate expects 1 argument, 0 provided
a.cc:31:25: note: candidate: 'constexpr modint<1000000007>::modint(const modint<1000000007>&)'
   31 | template<int mod> class modint {
      |                         ^~~~~~
a.cc:31:25: note:   candidate expects 1 argument, 0 provided
a.cc:31:25: note: candidate: 'constexpr modint<1000000007>::modint(modint<1000000007>&&)'
a.cc:31:25: note:   candidate expects 1 argument, 0 provided