criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <map>
using namespace std;

const int Mod = 1000000007;
class mll {
public:
	long long x;
	mll(long long x = 0) : x((x% Mod + Mod) % Mod) {};
	void operator += (const mll& a) {
		if ((x += a.x) >= Mod) x -= Mod;
	}
	void operator *= (const mll& a) {
		(x *= a.x) %= Mod;
	}
	mll operator * (const mll& a) const {
		mll ans = *this;
		ans *= a;
		return ans;
	}
	mll inv() {
		long long a = x, b = Mod, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= Mod;
		if (u < 0) u += Mod;
		a = u;
		return mll(a);
	}
};

map<int, int> Factorize(int A) {
	int a = A;
	map<int, int> Ans;
	for (int i = 2; i <= sqrt(A) + 1; i++) {
		while (a % i == 0) {
			Ans[i]++;
			a /= i;
		}
	}
	if (a > 1) Ans[a]++;
	return Ans;
}

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	map<int, int> FactorizedLCM;
	for (int i = 0; i < N; i++) {
		map<int, int> FactorizedA = Factorize(A[i]);
		for (auto p : FactorizedA) FactorizedLCM[p.first] = max(FactorizedLCM[p.first], p.second);
	}
	mll LCM = 1;
	for (auto p : FactorizedLCM) for (int i = 0; i < p.second; i++) LCM *= p.first;
	mll ans = 0;
	for (int i = 0; i < N; i++) {
		mll a = A[i];
		ans += LCM * a.inv();
	}
	cout << ans.x << endl;
}

Compiler output:
a.cc: In function 'std::map<int, int> Factorize(int)':
a.cc:41:30: error: 'sqrt' was not declared in this scope
   41 |         for (int i = 2; i <= sqrt(A) + 1; i++) {
      |                              ^~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;

const int N=1e4+20,MAX=1e6+20, MOD=1e9+7;

int n,x,lp[MAX],a[N],mx[MAX],ans;
map <int,int> lcm;

int power(int a, int b)
{
	if(b==0) return 1;
	int ans = power(a, b / 2);
	ans = (1ll * ans * ans) % MOD;
	if(b%2 == 1) ans = (ans * a) % MOD;
	return ans;
}


int f(map <int,int> m)
{
	map <int,int> nlcm = lcm;

	for(auto i: m) {
		nlcm[i.first] -= i.second;
	}

	int ans = 1;
	for(auto i: nlcm) {
		ans = (1ll * ans * power(i.first, i.second)) % MOD;
	}
	return ans;
}

int main()
{
	for(int i = 2; i < MAX; i++)
		for(int j = i; j < MAX; j+=i)
			if(lp[j] == 0) lp[j] = i;

	scanf("%d",&n);
	for(int i = 0; i < n;i++)
	{
		scanf("%d",&a[i]);

		map <int,int> m;
		int x = a[i];
		while(x != 1) {
			m[lp[x]]++;
			x /= lp[x];
		}

		for(auto i:m) {
			mx[i.first] = max(mx[i.first], i.second);
		}
	}

	for(int i = 0; i < MAX; i++)
	{
		if(mx[i]==0) continue;
		lcm[i] = mx[i];
	}

	for(int i = 0;i < n; i++)
	{
		map <int,int> m;
		int x = a[i];
		while(x != 1) {
			m[lp[x]]++;
			x /= lp[x];
		}

		ans+=f(m);
		ans%=MOD;
	}

	printf("%d",ans);
}

Compiler output:
a.cc: In function 'int f(std::map<int, int>)':
a.cc:21:30: error: reference to 'lcm' is ambiguous
   21 |         map <int,int> nlcm = lcm;
      |                              ^~~
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:7:15: note:                 'std::map<int, int> lcm'
    7 | map <int,int> lcm;
      |               ^~~
a.cc: In function 'int main()':
a.cc:60:17: error: reference to 'lcm' is ambiguous
   60 |                 lcm[i] = mx[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:7:15: note:                 'std::map<int, int> lcm'
    7 | map <int,int> lcm;
      |               ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int N=1e6+6;
int s[N];
void sieve(){
	for(int i=2;i<N;i++){
		if(s[i]==0){
			s[i]=i;
			for(int j=i+i;j<N;j+=i){
				if(!s[j])s[j]=i;
			}
		}
	}
}
ll sq(ll a){return (a*a)%mod;}
ll pw(ll a,ll b){
	if(b==0)return 1;
	if(b==1)return a;
	if(b&1)return (a*sq(pw(a,b>>1)))%mod;
	return sq(pw(a,b>>1))%mod;
}

int lcm[N];
int main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int n;cin>>n;
	sieve();
	vector<ll>v;
	for(int i=0;i<n;i++){
		ll a;cin>>a;v.push_back(a);
		map<int,int>mp;
		while(a!=1){
			mp[s[a]]++;
			a/=s[a];
		}
		for(auto u:mp){
			lcm[u.first]=max(lcm[u.first],u.second);
		}
	}
	ll l=1;
	for(int i=2;i<=N;i++){
		while(lcm[i]--){
			l*=i;
			l%=mod;
		}
	}
	ll ans=0;
	for(int i=0;i<n;i++){
		ans+=(l*pw(v[i],mod-2));
		ans%=mod;
	}
	cout<<ans;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: reference to 'lcm' is ambiguous
   39 |                         lcm[u.first]=max(lcm[u.first],u.second);
      |                         ^~~
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:25:5: note:                 'int lcm [1000006]'
   25 | int lcm[N];
      |     ^~~
a.cc:39:42: error: reference to 'lcm' is ambiguous
   39 |                         lcm[u.first]=max(lcm[u.first],u.second);
      |                                          ^~~
/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:25:5: note:                 'int lcm [1000006]'
   25 | int lcm[N];
      |     ^~~
a.cc:44:23: error: reference to 'lcm' is ambiguous
   44 |                 while(lcm[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:25:5: note:                 'int lcm [1000006]'
   25 | int lcm[N];
      |     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;

ll mod = 1000000007;

ll modpow(ll a, ll n, ll mod){
  if(n == 1) return a;
  ll ret = modpow(a, n / 2, mod);
  if(n % 2 == 0) ret = (ret * ret) % mod;
  else ret = (((ret * ret) % mod) * a) % mod;
  return ret;
}

ll gakugen(ll x, ll mod){
  return modpow(x, mod - 2, mod);
}


vector<ll> elatostenesnohurui(ll n){
  vector<ll> elatostenes(n + 1, 0);
  for(ll i = 2; i <= n; i++){
    if(elatostenes[i] == 0){
      elatostenes[i] = -1;
      for(ll j = i * i; j <= n; j++){
        if(j % i == 0){
          elatostenes[j] = i;
        }
      }
    }
  }
  return elatostenes;
}

map<ll, ll> soinsubunkai(ll x, vector<ll>& elatostenes){
  if(x == 1) return 1;
  map<ll, ll> soinsu;
  while(elatostenes[x] != -1){
    soinsu[elatostenes[x]]++;
    x /= elatostenes[x];
  }
  soinsu[x]++;
  return soinsu;
}

void solve(){
  ll n; cin >> n;
  vector<ll> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  vector<ll> elatostenes = elatostenesnohurui(1000005);

  map<ll, ll> mp;
  for(int i = 0; i < n; i++){
    map<ll, ll> soinsu = soinsubunkai(a[i], elatostenes);
    for(auto it = soinsu.begin(); it != soinsu.end(); it++){
      ll num = it->first, beki = it->second;
      if(mp.find(num) == mp.end()){
        mp[num] = beki;
      }
      else{
        mp[num] = max(mp[num], beki);
      }
    }
  }
  ll lcm = 1;
  for(auto it = mp.begin(); it != mp.end(); it++){
    lcm = (lcm * modpow(it->first, it->second, mod) % mod);
  }
  ll ans = 0;
  for(int i = 0; i < n; i++){
    ll gakua = gakugen(a[i], mod);
    ans = (ans + (lcm * gakua) % mod) % mod;
  }
  cout << ans << endl;

  return;
}

int main(){
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'std::map<long long int, long long int> soinsubunkai(ll, std::vector<long long int>&)':
a.cc:41:21: error: could not convert '1' from 'int' to 'std::map<long long int, long long int>'
   41 |   if(x == 1) return 1;
      |                     ^
      |                     |
      |                     int
Language: C++

package abc152.e;

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        BigInteger a[] = new BigInteger[n];
        BigInteger Lcm = BigInteger.ONE;
        for(int i=0;i<n;i++){
            a[i]= BigInteger.valueOf(sc.nextLong());
            Lcm = Lcm.multiply(a[i]).divide(Lcm.gcd(a[i]));
    
        }
        BigInteger ans = BigInteger.ZERO;
        for(int i=0;i<n;i++){
            ans = ans.add(Lcm.divide(a[i]));
            
        }
        System.out.println(ans.mod(BigInteger.valueOf(1000000007)));
        
    }

    
}

Compiler output:
a.cc:1:1: error: 'package' does not name a type
    1 | package abc152.e;
      | ^~~~~~~
a.cc:3:1: error: 'import' does not name a type
    3 | import java.math.BigInteger;
      | ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
    4 | import java.util.Scanner;
      | ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: expected unqualified-id before 'public'
    6 | public class Main {
      | ^~~~~~
Language: C++


#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getint(_T& a) {
	std::cin >> a;
}
template<class _T> static void getint(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getint(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}

static void ABC152E();

int main()
{
	ABC152E();
	fflush(stdout);
	return 0;
}

template <class _T> static _T tp_lcm(_T first, _T second) {
	_T gcd = tp_gcd<_T>(first, second);
	return first * second / gcd;
}

static void ABC152E()
{
	int N;
	getint(N);

	std::vector<LLONG> ai(N, 0);
	for (int i = 0; i < N; i++) {
		getint(ai[i]);
	}

	LLONG lcm = ai[0];
	for (int i = 1; i < N; i++) {
		lcm = tp_lcm(lcm, ai[i]);
	}

	LLONG bi = 0;
	LLONG ans = 0;
	for (int i = 0; i < N; i++) {
		bi = lcm / ai[i];
		ans = (ans + bi) % MOD_NUM;
	}
	printf("%lld\n", ans);
}


Compiler output:
a.cc: In function '_T tp_lcm(_T, _T)':
a.cc:38:18: error: 'tp_gcd' was not declared in this scope; did you mean 'tp_lcm'?
   38 |         _T gcd = tp_gcd<_T>(first, second);
      |                  ^~~~~~
      |                  tp_lcm
a.cc:38:27: error: expected primary-expression before '>' token
   38 |         _T gcd = tp_gcd<_T>(first, second);
      |                           ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair

const int MAX_N = 10005;
const int MOD = 1e9+7;
int N;
int A[MAX_N];
vector<int> primes;
const int MAX_P = 1e6+10;
bool is_prime[MAX_P];
unoredered_map<int, int> factors;

ll modpow(ll x, int y)
{
	ll res = 1;
	while(y){
		if(y & 1) (res*=x)%=MOD;
		(x *= x) %= MOD;
		y>>=1;
	}
	while(res < 0) res += MOD;
	return res % MOD;
}

void solve()
{
	memset(is_prime, true, sizeof(is_prime));
	is_prime[0]=is_prime[1]=false;
	for(int i=2;i<MAX_P;++i){
		if(is_prime[i]){
			primes.pb(i);
			for(int j=2*i;j<MAX_P;j+=i) is_prime[j]=false;
		}
	}
	const int n = primes.size();
	for(int i=0;i<N;++i){
		int x = A[i];
		for(int j=0;j<n && primes[j]<=x;++j)if(x % primes[j] == 0){
			int cnt = 0;
			while(x % primes[j] == 0){
				cnt++;
				x /= primes[j];
			}
			if(factors.count(primes[j])) factors[primes[j]]=max(factors[primes[j]],cnt);
			else factors[primes[j]]=cnt;
		}
		if(x!=1 && !factors.count(x)) factors[x]=1;
	}
	ll ans = 0;
	ll lcm = 1;
	for(const auto& p : factors) (lcm *= modpow(p.first, p.second))%=MOD;
	for(int i=0;i<N;++i){
		ans = (ans+lcm*modpow(A[i],MOD-2))%MOD;
	}
	cout << ans << '\n';
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N;
	for(int i=0;i<N;++i) cin >> A[i];
	solve();
	return 0;
}


Compiler output:
a.cc:21:1: error: 'unoredered_map' does not name a type
   21 | unoredered_map<int, int> factors;
      | ^~~~~~~~~~~~~~
a.cc: In function 'void solve()':
a.cc:54:28: error: 'factors' was not declared in this scope; did you mean 'acos'?
   54 |                         if(factors.count(primes[j])) factors[primes[j]]=max(factors[primes[j]],cnt);
      |                            ^~~~~~~
      |                            acos
a.cc:57:29: error: 'factors' was not declared in this scope; did you mean 'acos'?
   57 |                 if(x!=1 && !factors.count(x)) factors[x]=1;
      |                             ^~~~~~~
      |                             acos
a.cc:61:29: error: 'factors' was not declared in this scope; did you mean 'acos'?
   61 |         for(const auto& p : factors) (lcm *= modpow(p.first, p.second))%=MOD;
      |                             ^~~~~~~
      |                             acos
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
#define ld long double
//a^n modをO(logN)で計算
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
//a/bをmodで割った余り、フェルマーの小定理
int64_t div(int64_t a,int64_t b,int64_t mod){
    return (a%mod)*(modpow(b,mod-2,mod)%mod)%mod;
}

map<int,int64_t> rp;
map<int,int64_t> p;

//O(√n)
//素因数分解
void fl(int64_t n){
    p.clear();
    if(n==1){
        return ;
    }
    int tmp = n;
    while(tmp%2==0 ){
        tmp /= 2;
        p[2]++;
    }
    for(int i=3;i*i<=tmp;i++){
        while(tmp % i ==0){
            tmp /= i;
            p[i]++;
        }
    }
    if(tmp!=1){//まだ割り切れてない場合、√Nまでは見てるから
        p[tmp]++;
    }
    for (auto c:p){
        if(rp[c.first]<c.second){
            rp[c.first] = c.second;
        }
    }
}
int main(){
    int n;
    cin>>n;
    vector<int64_t> a(n);
    int64_t l=1;
    int64_t ans=0;
    rep(i,n){
        cin>>a[i];
        fl(a[i]);
    }
    /*
    for (auto c:rp){
        cout<<c.first<<" "<<c.second<<endl;
    }
    */
    //cout<<l%big<<endl;
    int64_t l=1;
    for(auto c:rp){
        rep(i,c.second){
            l *= c.first;
            l %=big;
        }
    }
    rep(i,n){
        ans += div(l,a[i],big);
    }
    cout<<ans%big<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:13: error: redeclaration of 'int64_t l'
   72 |     int64_t l=1;
      |             ^
a.cc:60:13: note: 'int64_t l' previously declared here
   60 |     int64_t l=1;
      |             ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#include <functional>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back()
#define ALL(a) (a).begin(),(a).end()
#define int long long
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;

const ll MOD = 1e9+7;
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(a%b==0)return b;
    return gcd(a%b,b);
}
ll lcm(ll a,ll b){
    return a/gcd(a,b)*b;
}
signed main(){
    COMinit();
    int n; cin >> n;
    ll res=1,a[n];
    rep(i,n){
        cin >> a[i];
        res=lcm(res,a[i]);
    }
    ll ans=0;
    rep(i,n){
        ans+=res/a[i];
        ans%=MOD;
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:5: error: 'COMinit' was not declared in this scope
   39 |     COMinit();
      |     ^~~~~~~
Language: C++

N = int(input())
A = list(map(int,input().split()))
MOD = 1000000007
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

lcma={}
for ai in A:
  f=factorization(ai)
  for fi in f:
    if fi[0] in lcma:
      lcma[fi[0]]=max(lcma[fi[0]],fi[1])
    else:
      lcma[fi[0]]=fi[1]
l=1
for k,v in lcma.items():
  l*=pow(k,v,MOD)
  l%=MOD
ans=0
for ai in A:
  ans+=l*pow(ai,MOD-2,MOD)
  ans%=MOD

print(ans)


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
a.cc:24:1: error: expected unqualified-id before 'for'
   24 | for ai in A:
      | ^~~
Language: C++

N = int(input())
A = list(map(int,input().split()))
MOD = 1000000007
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

lcma={}
for ai in A:
  f=factorization(ai)
  for fi in f:
    if fi[0] in lcma:
      lcma[fi[0]]=max(lcma[fi[0]],fi[1])
    else:
      lcma[fi[0]]=fi[1]
l=1
for k,v in lcma.items():
  l*=pow(k,v,MOD)
  l%=MOD
ans=0
for ai in A:
  ans+=l*pow(ai,MOD-2,MOD)
  ans%=MOD

print(ans)
s


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N = int(input())
      | ^
a.cc:24:1: error: expected unqualified-id before 'for'
   24 | for ai in A:
      | ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
long long lcm(long long a, long long b)
{
   return a / gcd(a, b) * y;
}
int main() {
long long ans = 0;
long long N;
long long MOD = 1000000007;
cin >> N;
vector<long long> A(N);
long long LCM = 1;
for (int i = 0; i < N; i++)
{
    cin >> A.at(i);
    LCM = lcm(LCM, A.at(i));
}
LCM %= MOD;
for (int i = 0; i < N; i++)
{
    long long inv = 1;
    long long n = MOD-2;
    while(n>0){
        if(n%2)inv = inv * A.at(i) %MOD;
        A.at(i) = A.at(i) * A.at(i) % MOD;
        n/= 2;
    }
    ans = (ans + (LCM * inv)% MOD) % MOD;
    
}


cout << ans << endl;
}

Compiler output:
a.cc: In function 'long long int lcm(long long int, long long int)':
a.cc:16:27: error: 'y' was not declared in this scope
   16 |    return a / gcd(a, b) * y;
      |                           ^
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::multiprecision::cpp_int;
const cpp_int mod=1e9+7;

cpp_int gcd(cpp_int x, cpp_int y){
 cpp_int tmp;
 cpp_int r;
 if(x > y){
    tmp = x;
    x = y;
    y = tmp;
  }
  r = y % x;
  while(r!=0){
    y = x;
    x = r;
    r = y % x;
  }
  return x;
}
int main(){
    int n;
    cin >> n;
    cpp_int a;
    cpp_int ans=0;
    cpp_int GCD=1;
    cpp_int LCM=1;
    cpp_int tmp;
    for(int i=0;i<n;i++){
        cin >> a;
        GCD=gcd(LCM,a);
        tmp=LCM/GCD;
        ans *= a/GCD % mod;
        ans += tmp;
        ans %= mod;
        LCM = a * tmp;
    }
    cout << ans << endl;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::multiprecision::cpp_int;
const int64_t mod=1e9+7;

long long int gcd(cpp_int x, long long int y){
 long long int tmp;
 long long int r;
 if(x > y){
    tmp = x;
    x = y;
    y = tmp;
  }
  r = y % x;
  while(r!=0){
    y = x;
    x = r;
    r = y % x;
  }
  return x;
}
int main(){
    int n;
    cin >> n;
    long long int a;
    cpp_int ans=0;
    long long int GCD=1;
    cpp_int LCM=1;
    cpp_int tmp;
    for(int i=0;i<n;i++){
        cin >> a;
        GCD=gcd(LCM,a);
        tmp=LCM/GCD;
        ans *= a/GCD % mod;
        ans += tmp;
        ans %= mod;
        LCM = a * tmp;
    }
    cout << ans << endl;
}

Compiler output:
a.cc:2:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
    2 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
using boost::multiprecision::cpp_int;
const int64_t mod=1e9+7;

long long int gcd(cpp_int x, long long int y){
 long long int tmp;
 long long int r;
 if(x > y){
    tmp = x;
    x = y;
    y = tmp;
  }
  r = y % x;
  while(r!=0){
    y = x;
    x = r;
    r = y % x;
  }
  return x;
}
int main(){
    int n;
    cin >> n;
    long long int a;
    cpp_int ans=0;
    long long int GCD=1;
    cpp_int LCM=1;
    cpp_int tmp;
    for(int i=0;i<n;i++){
        cin >> a;
        GCD=gcd(LCM,a);
        tmp=LCM/GCD;
        ans *= a/GCD % mod;
        ans += tmp;
        ans %= mod;
        LCM = a * tmp;
    }
    cout << ans << endl;
}

Compiler output:
a.cc:3:7: error: 'boost' has not been declared
    3 | using boost::multiprecision::cpp_int;
      |       ^~~~~
a.cc:6:19: error: 'cpp_int' was not declared in this scope; did you mean 'u_int'?
    6 | long long int gcd(cpp_int x, long long int y){
      |                   ^~~~~~~
      |                   u_int
a.cc:6:30: error: expected primary-expression before 'long'
    6 | long long int gcd(cpp_int x, long long int y){
      |                              ^~~~
a.cc:6:45: error: expression list treated as compound expression in initializer [-fpermissive]
    6 | long long int gcd(cpp_int x, long long int y){
      |                                             ^
a.cc: In function 'int main()':
a.cc:26:5: error: 'cpp_int' was not declared in this scope; did you mean 'u_int'?
   26 |     cpp_int ans=0;
      |     ^~~~~~~
      |     u_int
a.cc:28:12: error: expected ';' before 'LCM'
   28 |     cpp_int LCM=1;
      |            ^~~~
      |            ;
a.cc:29:12: error: expected ';' before 'tmp'
   29 |     cpp_int tmp;
      |            ^~~~
      |            ;
a.cc:32:13: error: reference to 'gcd' is ambiguous
   32 |         GCD=gcd(LCM,a);
      |             ^~~
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:173:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::gcd(_Mn, _Nn)'
  173 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:6:15: note:                 'long long int gcd'
    6 | long long int gcd(cpp_int x, long long int y){
      |               ^~~
a.cc:32:17: error: 'LCM' was not declared in this scope
   32 |         GCD=gcd(LCM,a);
      |                 ^~~
a.cc:33:9: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   33 |         tmp=LCM/GCD;
      |         ^~~
      |         tm
a.cc:34:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   34 |         ans *= a/GCD % mod;
      |         ^~~
      |         abs
a.cc:39:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   39 |     cout << ans << endl;
      |             ^~~
      |             abs
Language: C++

#include <bits/stdc++.h>
using namespace std;

const int64_t mod=1e9+7;
map< int64_t, int64_t > ans;
map< int64_t, int64_t > prime_factor(int64_t n) {
  map< int64_t, int64_t > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n]++;
  return ret;
}

int main(){
    int n;
    cin >> n;
    int64_t a;
    vector<map< int64_t, int64_t >> A;
    for(int i=0;i<n;i++){
        cin >> a;
        A.push_back(prime_factor(a[i]));
        for(auto u:A.at(i)){
            ans[u.first]=max(ans[u.first],u.second);
        }
    }
    int64_t solve=0;
    int64_t tmp; 
    for(auto v:A){
        tmp=1;
        for(auto u:ans){
            for(int j=0;j<u.second-v[u.first];j++){
                tmp *= u.first;
                tmp %=mod;
            }
        }
        solve += tmp;
        solve %= mod;
    }    
    cout << solve << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:35: error: invalid types 'int64_t {aka long int}[int]' for array subscript
   25 |         A.push_back(prime_factor(a[i]));
      |                                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

const int64_t mod=1e9+7;
map< int64_t, int64_t > ans;
map< int64_t, int64_t > prime_factor(int64_t n) {
  map< int64_t, int64_t > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n]++;
  return ret;
}

int main(){
    int n;
    cin >> n;
    int64_t a;
    map< int64_t, int64_t > A[n];
    for(int i=0;i<n;i++){
        cin >> a;
        A[i]=prime_factor(a[i]);
        for(auto u:A[i]){
            ans[u.first]=max(ans[u.first],u.second);
        }
    }
    int64_t solve=0;
    int64_t tmp; 
    for(int i=0;i<n;i++){
        tmp=1;
        for(auto u:ans){
            for(int j=0;j<u.second-A[i][u.first];j++){
                tmp *= u.first;
                tmp %=mod;
            }
        }
        solve += tmp;
        solve %= mod;
    }    
    cout << solve << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:28: error: invalid types 'int64_t {aka long int}[int]' for array subscript
   25 |         A[i]=prime_factor(a[i]);
      |                            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

const int64_t mod=1e9+7;
map< int64_t, int64_t > ans;
map< int64_t, int64_t > prime_factor(int64_t n) {
  map< int64_t, int64_t > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n]++;
  return ret;
}
int64_t modpow(int64_t a, int64_t b){
	int64_t res = 1;
	while (b > 0){
		if (b & 1) res = res * a % mod;
		a = a * a % mod;
		b /= 2;
	}
	return res;
}
int main(){
    int n;
    cin >> n;
    int64_t a[n];
    for(int i=0;i<n;i++){
        cin >> a[i];
        for(auto u:prime_factor(a[i])){
            ans[u.first]=max(ans[u.first],u.second);
        }
    }
    int64_t solve=0;
    int64_t tmp; 
    for(int i=0;i<n;i++){
        tmp=1;
        map< int64_t, int64_t > tmp_pri=prime_factor(a[i]);
        for(auto u:ans){
            tmp*=modpow(u.first,max(0L,u.second-tmp_pri[u.first]))
        }
        solve += tmp;
        solve %= mod;
    }    
    cout << solve << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:42:67: error: expected ';' before '}' token
   42 |             tmp*=modpow(u.first,max(0L,u.second-tmp_pri[u.first]))
      |                                                                   ^
      |                                                                   ;
   43 |         }
      |         ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    long a[n];
    for(int i=0;i<n;i++)cin >> a[i];
    long const mod = 1e9+7;
    vector<long>p;
    p.push_back(2);
    for(long i=3;i<=1000000;i+=2){
        bool chk = true;
        for(int j=0;j<p.size() && p[j]*p[j] <= i;j++){
            if(i%p[j]==0){
                chk=false;
                break;
            }
        }
        if(chk)p.push_back(i);
    }
    map<long,int>pToj;
    
    for(int j=0;j<p.size();j++){
        pToj[p[j]] = j;
    }



    vector<vector<int> >soinsu(n,vector<int>(p.size(),0));
    vector<set<int> >setj(n);
    set<int>ss;
    for(int i=0;i<n;i++){
        for(int j=0;j<p.size() && p[j]*p[j]<= a[i];j++){
            while(a[i]%p[j]==0){
                soinsu[i][j]++;
                a[i]/=p[j];
                setj[i].insert(j);
            }
        }
        if(a[i] >1){
            soinsu[i][pToj[a[i]]]++;
            setj[i].insert(pToj(a[i]));
        }
    }
    vector<int>gcd(p.size(),0);
    for(int i=0;i<n;i++){
        for(int j=0;j<p.size();j++){
            gcd[j] = max(gcd[j],soinsu[i][j]);
        }
    }
    for(int i=0;i<p.size();i++){
        if(gcd[i]>0){
            ss.insert(i);
        }
    }

    vector<vector<int> >ppow(p.size(),vector<int>(101));
    for(int i=0;i<p.size();i++){
        ppow[i][0] = 1;
        for(int j=1;j<=100;j++){
            ppow[i][j] = p[i]*ppow[i][j-1];
            ppow[i][j] %= mod;
        }
    }

    long ans = 0;
    for(int i=0;i<n;i++){
        long tmp = 1;
        for(int j:ss){
            tmp *= ppow[j][gcd[j]-soinsu[i][j]];
            tmp %= mod;
        }
        ans += tmp;
        ans %= mod;
    }
    
    cout << ans << endl;
    

    

}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:32: error: no match for call to '(std::map<long int, int>) (long int&)'
   42 |             setj[i].insert(pToj(a[i]));
      |                            ~~~~^~~~~~
Language: C++

#include<bits/stdc++.h>
using ll = long long;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ll MAX_N = 1 << 17;
ll nn, dat[2 * MAX_N - 1]; //セグメント木を持つグローバル配列
void init(ll n_) { //初期化
	nn = 1; //簡単のため、要素数を2のべき乗に
	while (nn < n_)nn *= 2;
	//全ての値をINT_MAXに
	for (int i = 0; i < 2 * nn - 1; i++) dat[i] = INT_MAX;
}
void update(ll k, ll a) { //k番目の値(0-indexed)をaに変更
	k += nn - 1; dat[k] = a; //葉の節点
	while (k > 0) { //登りながら更新
		k = (k - 1) / 2;
		if (dat[k * 2 + 2] == INT_MAX) { dat[k] = dat[k * 2 + 1]; }
		else if (dat[k * 2 + 1] == INT_MAX) { dat[k] = dat[k * 2 + 2]; }
		else { dat[k] = dat[k * 2 + 1] * dat[k * 2 + 2] % mod; }
	}
}
//[a, b)の最小値を求める
//kは節点の番号、l, rはその節点が[l, r)に対応づいていることを表す。
//したがって外からはquery(a, b, 0, 0, nn)として呼ぶ。
ll query(ll a, ll b, ll k, ll l, ll r) {
	if (r <= a || b <= l) { return INT_MAX; }
	if (a <= l && r <= b) { return dat[k]; }
	else {
		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		if (vr == INT_MAX) { return vl; }
		if (vl == INT_MAX) { return vr; }
		return vl * vr % mod;
	}
}
ll res[1234567];
void prime_factor(ll n) {
	vector<ll> kari(1234567);
	for (int i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			kari[i]++; res[i] = max(res[i], kari[i]);
			n /= i;
		}
	}
	if (n != 1) { res[n] = max(kari[n] + 1, res[n]); }
}
vector<ll> s(ll num) {
	vector<ll>res;
	for (int i = 2; i <= num; i++) { // 他の素数で割っていく
		while (num % i == 0) {
			res.push_back(i);
			num /= i;
		}
	}
	return res;
}
ll aa[12345678], cost[12345678];
signed main() {
	ll n, m, a = 0, x = 0, y = 0, ans = 0; cin >> n;
	vector<ll> v;
	for (int h = 0; h < n; h++) {
		cin >> aa[h]; prime_factor(aa[h]);
	}
	for (int h = 1; h <= 1000000; h++) {
		if (res[h] != 0) {
			cost[h] = v.size();
			for (int i = 0; i < res[h]; i++) {
				v.push_back(h);
			}
		}
	}
	init(v.size());
	for (int h = 0; h < v.size(); h++) {
		update(h, v[h]);
	}
	for (int h = 0; h < n; h++) {
		int z = 0, cnt = 1; //vector<ll>uio(12345);
		vector<ll> sa = s(aa[h]);
		for (int i = 0; i < sa.size(); i++) {
			if (query(z, cost[sa[i]] /*+ uio[sa[i]]*/, 0, 0, nn) != INT_MAX) {
				cnt *= query(z, cost[sa[i]] /*+ uio[sa[i]]*/, 0, 0, nn);
				cnt %= mod;
			}
			uio[sa[i]]++; z = cost[sa[i]]/* + uio[sa[i]]*/;
		}
		if (query(z, v.size(), 0, 0, nn) != INT_MAX) {
			cnt *= query(z, v.size(), 0, 0, nn);
		}
		ans += cnt; ans %= mod;
	}
	while (ans < 0) { ans += mod; }
	cout << ans % mod << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:85:25: error: 'uio' was not declared in this scope
   85 |                         uio[sa[i]]++; z = cost[sa[i]]/* + uio[sa[i]]*/;
      |                         ^~~
Language: C++

#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;
const ll MOD = 1000000007;

ll gcd(ll a, ll b)
{
    if (a>b) swap(a, b);
    if (b % a == 0)
        return a;
    else
        return gcd(a, b%a);
}

ll power_mod(ll n, ll m)
{
    ll res = 1;
    ll base = n;
    while (m)
    {
        if (m&1)
        {
            res *= base;
            res %= MOD;
        }
        base *= base;
        base %= MOD;
        m >>= 1;
    }
    return res;
}

ll inv_mod(ll n)
{
    return power_mod(n, MOD-2);
}

vector<ll> primes;
int maxn = 10000;
void init_prime()
{
    vector<bool> is_prime(maxn, true);
    is_prime[0] = is_prime[1] = false;
    for (ll i=0; i<maxn; ++i)
    if (is_prime[i])
    {
        primes.emplace_back(i);
        for (ll j=i*i; j<maxn; j+=i)
            is_prime[j] = false;
    }
}


int main()
{
    init_prime();
    rep()

    int N;
    cin >> N;
    vector<ll> values(N);
    rep(i, 0, N) cin >> values[i];

    // calc LCM
    unordered_map<ll, ll> prime_map;
    rep(i, 0, N)
    {
        ll now = values[i];
        unordered_map<ll, ll> cnt_map;
        for (auto prime: primes)
        {
            while (now%prime== 0)
            {
                ++cnt_map[prime];
                now /= prime;
            }
        }
        ++cnt_map[now];

        for (auto elem: cnt_map)
            prime_map[elem.first] = max(prime_map[elem.first], elem.second);
    }

    ll LCM = 1;
    for (auto elem: prime_map)
    {
        LCM *= power_mod(elem.first, elem.second);
        LCM %= MOD;
    }

    // sum up B
    ll res = 0;
    rep(i, 0, N)
    {
        // cout << now << endl;
        res += LCM * inv_mod(values[i]);
        res %= MOD;
    }
    cout << res << endl;
    return 0;
}

Compiler output:
a.cc:62:9: error: macro "rep" requires 3 arguments, but only 1 given
   62 |     rep()
      |         ^
a.cc:2:9: note: macro "rep" defined here
    2 | #define rep(i,n,m) for(int i = (n); i <(m); i++)
      |         ^~~
a.cc: In function 'int main()':
a.cc:62:5: error: 'rep' was not declared in this scope
   62 |     rep()
      |     ^~~
a.cc:65:12: error: 'N' was not declared in this scope
   65 |     cin >> N;
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int64_t gcd(int64_t x,int64_t y){
if(y==0)
  return x;
  else{
  return gcd(y,x%y)%mod;
  }

}
int64_t f(int64_t x,int64_t y){
if(y%2==0)
  return (f(x,y/2)*f(x,y/2))%mod;
  else{
  return (((x*f(x,y/2))%mod)*f(x,y/2))%mod;
  }

}
int64_t lcm(int64_t x,int64_t y){
return (((x*y)%mod)*f(gcd(x,y),mod-2))%mod;

}
int main(){
int N;
  cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  int64_t L=A.at(0);
  for(int i=1;i<N;i++)
    L=lcm(L,A.at(i));
  int64_t ans=0;
  for(int i=0;i<N;i++){
  ans=(ans+(L*f(A.at(i),mod-2))%mod))%mod;
  
  }cout<<ans<<endl;
      return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:37: error: expected ';' before ')' token
   35 |   ans=(ans+(L*f(A.at(i),mod-2))%mod))%mod;
      |                                     ^
      |                                     ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
static const int64_t mod=1000000007;
int 64_t gcd(int64_t x,int64_t y){
if(y==0)
  return x;
  else{
  return gcd(y,x%y)%mod;
  }

}
int64_t f(int64_t x,int64_t y){
if(y%2==0)
  return (f(x,y/2)*f(x,y/2))%mod;
  else{
  return (((x*f(x,y/2))%mod)*f(x,y/2))%mod;
  }

}
int64_t lcm(int64_t x,int64_t y){
return (((x*y)%mod)*f(gcd(x,y),mod-2))%mod;

}
int main(){
int N;
  cin>>N;
  vector<int64_t>A(N);
  for(int i=0;i<N;i++)
    cin>>A.at(i);
  int64_t L=A.at(0);
  for(int i=1;i<N;i++)
    L=lcm(L,A.at(i));
  int64_t ans=0;
  for(int i=0;i<N;i++){
  ans=(ans+(L*f(A.at(i),mod-2))%mod))%mod;
  
  }cout<<ans<<endl;
      return 0;
}

Compiler output:
a.cc:4:5: error: expected unqualified-id before numeric constant
    4 | int 64_t gcd(int64_t x,int64_t y){
      |     ^~~~
a.cc: In function 'int main()':
a.cc:35:37: error: expected ';' before ')' token
   35 |   ans=(ans+(L*f(A.at(i),mod-2))%mod))%mod;
      |                                     ^
      |                                     ;
Language: C++

#include<bits/stdc++.h>
using namespace std;

long long spf[1000009],ara[1000009],lcm=1,mod=1000000007;
map<long long,long long>mp;

long long bigmod(long long n,long long p)
{
     if(p==0)return 1;
     if(p%2==0)
     {
         long long ret=bigmod(n,p/2);
         return ((ret%mod)*(ret%mod))%mod;
     }
     else
        return ((n%mod)*(bigmod(n,p-1)%mod))%mod;
}


void getfactor(long long num)
{
    while(num!=1)
    {
        long long x=spf[num];  mp[x]++;
        if(mp[x]>ara[x])
        {
            lcm=(lcm*x)%mod;  ara[x]=mp[x];
        }

        num=num/x;


    }


}


int main()
{


    long long n,m,i,j,k,a,b,c,d,ans=0;  vector<long long>v;

    spf[1]=1;

    for(i=2;i<=1000006;i+=2)spf[i]=2;

    for(i=3;i<=1000006;i+=2)
    {
        if(spf[i]==0)
        {

            spf[i]=i;

            for(j=3*i;j<=1000006;j+=(2*i))
            {
                spf[j]=i;
            }

        }


    }

    scanf("%lld",&n);

    for(i=1;i<=n;i++)
    {
        scanf("%lld",&a);  v.push_back(a);

        mp.clear();  getfactor(a);


    }


    for(i=0;i<n;i++)
    {

        b=v[i];  c=bigmod(b,mod-2);  d=(c*lcm)%mod;  ans=(ans+d)%mod;


    }


    printf("%lld\n",ans);


    return 0;
}


Compiler output:
a.cc: In function 'void getfactor(long long int)':
a.cc:27:13: error: reference to 'lcm' is ambiguous
   27 |             lcm=(lcm*x)%mod;  ara[x]=mp[x];
      |             ^~~
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:4:37: note:                 'long long int lcm'
    4 | long long spf[1000009],ara[1000009],lcm=1,mod=1000000007;
      |                                     ^~~
a.cc:27:18: error: reference to 'lcm' is ambiguous
   27 |             lcm=(lcm*x)%mod;  ara[x]=mp[x];
      |                  ^~~
/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:4:37: note:                 'long long int lcm'
    4 | long long spf[1000009],ara[1000009],lcm=1,mod=1000000007;
      |                                     ^~~
a.cc: In function 'int main()':
a.cc:81:43: error: reference to 'lcm' is ambiguous
   81 |         b=v[i];  c=bigmod(b,mod-2);  d=(c*lcm)%mod;  ans=(ans+d)%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:4:37: note:                 'long long int lcm'
    4 | long long spf[1000009],ara[1000009],lcm=1,mod=1000000007;
      |                                     ^~~
Language: C++

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

constexpr int MOD = 1e9 + 7;

map<int, int> pri(int n) {
  map<int, int> res;
  int tmp = n;
  for (int i=2; i*i<=n; ++i) {
    while (tmp%i == 0) {
      tmp /= i;
      res[i]++;
    }
  }
  if (tmp != 1) res[tmp]++;
  return res;
}

long long inv(long long n) {
  long long res = 1;
  while (n > 1) {
    res *= (MOD - MOD / n);
    res %= MOD;
    n = MOD % n;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0; i<n; ++i) cin >> a.at(i);
  
  vector<int> cnt(1e6+1);
  for (int i=0; i<n; ++i) {
    for (auto p : pri(a.at(i))) {
      cnt.at(p.first) = max(cnt.at(p.first), p.second);
    }
  }
  
  long long g = 1;
  for (int i=2; i<1e6+1; ++i) {
    for (int j=0; j<cnt.at(i); ++j) {
      g *= i;
      g %= MOD;
    }
  }
  cout << res << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:53:11: error: 'res' was not declared in this scope
   53 |   cout << res << endl;
      |           ^~~
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

constexpr int MOD = 1e9 + 7;

set<int> pri(int n) {
  set<int> res;
  int tmp = n;
  for (int i=2; i*i<=n; ++i) {
    while (tmp%i == 0) {
      tmp /= i;
      res[i]++;
    }
  }
  if (tmp != 1) res[tmp]++;
  return res;
}

long long inv(long long n) {
  long long res = 1;
  while (n > 1) {
    res *= (MOD - MOD / n);
    res %= MOD;
    n = MOD % n;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0; i<n; ++i) cin >> a.at(i);
  
  vector<int> cnt(1e6+1);
  for (int i=0; i<n; ++i) {
    for (auto p : pri(a.at(i))) {
      cnt.at(p.first) = max(cnt.at(p.first), p.second);
    }
  }
  
  long long g = 1;
  for (int i=2; i<1e6+1; ++i) {
    for (int j=0; j<cnt.at(i); ++j) {
      g *= i;
      g %= MOD;
    }
  }
  cout << res << endl;
  return 0;
}

  
  long long res = 0;
  for (int i=0; i<n; ++i) {
    res += (g * inv(a.at(i))) % MOD;
   	res %= MOD;
  }


Compiler output:
a.cc: In function 'std::set<int> pri(int)':
a.cc:16:10: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'int')
   16 |       res[i]++;
      |          ^
a.cc:19:20: error: no match for 'operator[]' (operand types are 'std::set<int>' and 'int')
   19 |   if (tmp != 1) res[tmp]++;
      |                    ^
a.cc: In function 'int main()':
a.cc:42:16: error: request for member 'first' in 'p', which is of non-class type 'int'
   42 |       cnt.at(p.first) = max(cnt.at(p.first), p.second);
      |                ^~~~~
a.cc:42:38: error: request for member 'first' in 'p', which is of non-class type 'int'
   42 |       cnt.at(p.first) = max(cnt.at(p.first), p.second);
      |                                      ^~~~~
a.cc:42:48: error: request for member 'second' in 'p', which is of non-class type 'int'
   42 |       cnt.at(p.first) = max(cnt.at(p.first), p.second);
      |                                                ^~~~~~
a.cc:53:11: error: 'res' was not declared in this scope
   53 |   cout << res << endl;
      |           ^~~
a.cc: At global scope:
a.cc:59:3: error: expected unqualified-id before 'for'
   59 |   for (int i=0; i<n; ++i) {
      |   ^~~
a.cc:59:17: error: 'i' does not name a type
   59 |   for (int i=0; i<n; ++i) {
      |                 ^
a.cc:59:22: error: expected unqualified-id before '++' token
   59 |   for (int i=0; i<n; ++i) {
      |                      ^~
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

constexpr int MOD = 1e9 + 7;

set<int, int> pri(int n) {
  set<int, int> res;
  int tmp = n;
  for (int i=2; i*i<=n; ++i) {
    while (tmp%i == 0) {
      tmp /= i;
      res[i]++;
    }
  }
  if (tmp != 1) res[tmp]++;
  return res;
}

long long inv(long long n) {
  long long res = 1;
  while (n > 1) {
    res *= (MOD - MOD / n);
    res %= MOD;
    n = MOD % n;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i=0; i<n; ++i) cin >> a.at(i);
  
  vector<int> cnt(1e6+1);
  for (int i=0; i<n; ++i) {
    for (auto p : pri(a.at(i)) {
      cnt.at(p.first) = max(cnt.at(p.first), p.second);
    }
  }
  
  long long g = 1;
  for (int i=2; i<1e6+1; ++i) {
    for (int j=0; j<cnt.at(i); ++j) {
      g *= i;
      g %= MOD;
    }
  }
  
  long long res = 0;
  for (int i=0; i<n; ++i) {
    res += (g * inv(a.at(i))) % MOD;
   	res %= MOD;
  }

Compiler output:
a.cc: In function 'std::set<int, int> pri(int)':
a.cc:16:10: error: no match for 'operator[]' (operand types are 'std::set<int, int>' and 'int')
   16 |       res[i]++;
      |          ^
a.cc:19:20: error: no match for 'operator[]' (operand types are 'std::set<int, int>' and 'int')
   19 |   if (tmp != 1) res[tmp]++;
      |                    ^
a.cc: In function 'int main()':
a.cc:41:31: error: expected ')' before '{' token
   41 |     for (auto p : pri(a.at(i)) {
      |         ~                     ^~
      |                               )
a.cc:42:16: error: request for member 'first' in 'p', which is of non-class type 'int'
   42 |       cnt.at(p.first) = max(cnt.at(p.first), p.second);
      |                ^~~~~
a.cc:42:38: error: request for member 'first' in 'p', which is of non-class type 'int'
   42 |       cnt.at(p.first) = max(cnt.at(p.first), p.second);
      |                                      ^~~~~
a.cc:42:48: error: request for member 'second' in 'p', which is of non-class type 'int'
   42 |       cnt.at(p.first) = max(cnt.at(p.first), p.second);
      |                                                ^~~~~~
a.cc:58:4: error: expected '}' at end of input
   58 |   }
      |    ^
a.cc:33:12: note: to match this '{'
   33 | int main() {
      |            ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define int long long
typedef pair<int,int>pii;
const int mxN=1e4+10,mxA=1e6+10,M=1e9+7;
int mod(int a,int M){int ret=a%M;if(ret<0)ret+=M;return ret;}
int exp(int a,int b,int M){
    if(b==0LL)return 1LL;
    if(b==1LL)return mod(a,M);

    int t=exp(a,b/2,M);
    if(b&1)return mod(a*mod(t*t,M),M);
    return mod(t*t,M);
}

int n,x;
int v[mxN],p[mxA];
int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin>>n;
    for(int i=0;i<n;i++){
        cin>>v[i];
        x=v[i];
        for(int i=2;i*i<=x;i++){
            int cnt=0;
            if(x%i==0){
                while(x%i==0){
                    cnt++;
                    x/=i;
                }
                p[i]=max(p[i],cnt);
            }
        }
        if(x>1)p[x]=max(p[x],1LL);
    }
    int k=1LL;
    for(int i=2;i<=mxA;i++){
        while(p[i]--)k=mod(k*i,M)
    }
    int ans=0LL;
    for(int i=0;i<n;i++){
        ans=mod(ans+k*exp(v[i],M-2,M),M);
    }
    cout<<ans;

}

Compiler output:
a.cc: In function 'int32_t main()':
a.cc:43:34: error: expected ';' before '}' token
   43 |         while(p[i]--)k=mod(k*i,M)
      |                                  ^
      |                                  ;
   44 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

void prime_map(map<ll, ll> &m, ll num) {
    for (ll i = 2; i * i <= num; i++) {
        while (num % i == 0) {
            m[i]++;
            num /= i;
        }
    }
    if (num != 1) {
        m[num] = 1;
    }
    return;
}

int main() {
source:
    ll n;
    cin >> n;
    ll a[n];
    rep(i, n) { cin >> a[i]; }
    vector<map<ll, ll>> v(n);
    rep(i, n) { prime_map(v[i], a[i]); }

    map<ll, ll> m;
    rep(i, n) {
        for (auto iter = v[i].begin(); iter != v[i].end(); iter++) {
            m[iter->first] = max(m[iter->first], iter->second);
        }
    }

    ll lcm_mod = 1;
    for (auto iter = m.begin(); iter != m.end(); iter++) {
        rep(i, iter->second) {
            temp *= iter->first;
            temp %= mod;
        }
    }

    ll ans = 0;

    cout << ans << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:45:13: error: 'temp' was not declared in this scope; did you mean 'tm'?
   45 |             temp *= iter->first;
      |             ^~~~
      |             tm