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

import sys
import math
input = sys.stdin.readline


mod = 10 ** 9 + 7
N = int(input())
A = list(map(int, input().split(" ")))

lcm = 1
for a in A:
    lcm = a // math.gcd(a, lcm) * lcm

ans = 0
for a in A:
    ans += lcm // a

print(ans % mod)

Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

def gcd(a,b):
    if(a==0):
        return b
    return gcd(b%a , a)
MOD = 10**9 + 7
    
n = int(input())
arr = map(int , input().strip().split())
ar = []
lcc = 0
for x in arr:
    ar.append(x)
    if(lcc==0):
        lcc = x
    lcc = (lcc*x)/gcd(lcc,x)
lcc = int(lcc)
res = 0 
for y in ar:
    #print(lcc / y)
    res = res + (lcc/y)
res = res%MOD
print(int(res))

    

Compiler output:
a.cc:19:6: error: invalid preprocessing directive #print
   19 |     #print(lcc / y)
      |      ^~~~~
a.cc:1:1: error: 'def' does not name a type
    1 | def gcd(a,b):
      | ^~~
Language: C++

def lcm(a, b):
    from math import gcd

    return a // gcd(a, b) * b


def main():
    _ = int(input())
    a = list(map(int, input().split()))
    x = 1

    for e in a:
        x = lcm(x, e)

    ans = 0
    for e in a:
        ans += x // e

    print(ans % int(1e9 + 7))


main()


Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def lcm(a, b):
      | ^~~
Language: C++

#include<iostream>
#include<cmath>
#include<numeric>
#include<functional>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define ll long long
using namespace std;

ll gcd(ll a,ll b){
  if(a<b){
    ll tmp=a; a=b; b=tmp;
  }
  ll r=a%b;
  while(r!=0){
    a=b;
    b=r;
    r=a%b;
  }
  return b;
}

int main(){
  ll modbig=10**9+7;
  ll inv[1000000]; inv[1]=1;
  for(int i=2;i<=1000000;i++){
    inv[i]=modbig-inv[modbig%i]*(modbig/i)%modbig;
  }
  ll n; cin>>n; ll a[n];
  rep(i,n){
    cin>>a[i];
  }
  ll ans=0,lcm=a[0];
  rep(i,n){
    ans+=inv[a[i]];
    ans%=modbig;
  }
  for(int i=1;i<n;i++){
    lcm*=a[i]; lcm%=modbig;
    ll tmp=gcd(lcm,a[i])%modbig;
    lcm*=inv[tmp]; lcm%=modbig;
  }
  ans*=lcm; cout<<ans%modbig;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:16: error: invalid type argument of unary '*' (have 'int')
   29 |   ll modbig=10**9+7;
      |                ^~
Language: C++

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define l_ength size
const int inf = (1<<30);
const int mod = 1000000007;	// 998244353
using ll = long long;
using namespace std;

ll power( ll a, int b ){
	ll res = 1;
	while( b > 0 ){
		if( b & 1 ) res = res*a % mod;
		a = a*a % mod;
		b >>= 1;
	}
	return res;
}

int main(){
	int n; cin >> n;

	vector<ll> a(n);
	for( auto &k : a ) cin >> k;

	vector<int> l(1000010, 0);
	vector<int> pset;
	
	for( auto k : a ){
		if( a[i] == 1 ) continue;
		ll t = k;
		for( int p = 2; p*p <= k; ++p ){
			int cnt = 0;
			while( t % p == 0 ){
				t /= p;
				++cnt;
			}
			if( cnt > 0 ){
				pset.push_back(p);
				l[p] = max(l[p], cnt);
			}
		}
		if( t != 1 ){
			pset.push_back(t);
			l[t] = max(l[t], 1);
		}
	}
	
	sort( pset.begin(), pset.end() );
    pset.erase( unique( pset.begin(), pset.end() ), pset.end() );

	ll ans = 0;
	
	for( auto &t : a ){
		ll pro = 1;
		for( auto p : pset ){
			int cnt = 0;
			while( t % p == 0 ){
				t /= p;
				++cnt;
			}
			pro *= pow(p, l[p]-cnt);
			pro %= mod;
		}
		ans += pro;
		ans %= mod;
	}

	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:23: error: 'i' was not declared in this scope
   31 |                 if( a[i] == 1 ) continue;
      |                       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define rep3(i, s, n) for (int i = s; i > (int)(n); i--)
#define all(obj) obj.begin(), obj.end()
#define db(x) cerr << #x << ":" << x << " "
#define dbl(x) cerr << #x << ":" << x << "\n"
#define dbv(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << ", "; cout << "\n"
#define dbvv(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << ", "; cerr << "\n"; }
#define dbm(map) cerr << #map << ":"; for (auto p : map) cerr << "(" << p.first << ", " << p.second << "), "; cerr << "\n";
#define YN(f) cout << (f ? "YES" : "NO") << "\n"
#define Yn(f) cout << (f ? "Yes" : "No") << "\n"
#define yn(f) cout << (f ? "yes" : "no") << "\n"
using ll = long long;
using vi = vector<int>; using vl = vector<ll>; using vs = vector<string>; using vb = vector<bool>;
using vvi = vector<vi>; using vvl = vector<vl>; using vvb = vector<vb>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using vpii = vector<pii>; using vpll = vector<pll>;
using ti3 = tuple<int, int, int>; using tl3 = tuple<ll, ll, ll>;
using mii = map<int, int>; using mil = map<int, ll>; using mli = map<ll, int>; using mll = map<ll, ll>;

const int MOD = 1000000007; // 998244353;

ll modadd(ll x, ll y) {
	ll xp = x % MOD;
	if (x < 0) x += MOD;
	ll yp = y % MOD;
	if (y < 0) y += MOD;
	return (x + y) % MOD;
}

ll modsub(ll x, ll y) {
	return modadd(x, -y);
}

ll modmul(ll x, ll y) {
	return x * y % MOD;
}

// power(mod) x^n
ll modpow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = modmul(res, x);
		x = modmul(x, x);
		n >>= 1;
	}
	return res;
}

// inverse(mod) x^(-1)
ll inv(ll x) {
	return modpow(x, MOD - 2);
}

ll moddiv(ll x, ll y) {
	return modmul(x, inv(y));
}

pii divs(int N, int prm) {
	int deg = 0;
	while (N % prm == 0) {
		N /= prm; deg++;
	}
	pii res(N, deg);
	return res;
}

mii pf(int N) {
	mii res;
	prm = 2;
	while (prm * prm <= N) {
		if (N % prm == 0) {
			tie(N, deg) = divs(N, prm);
			res[prm] = deg;
		}
		prm++;
	}
	if (N > 1) res[N] = 1;
	return res;	
}

int main() {	
	int N; cin >> N;
	vector<int> A(N); rep(i, N) cin >> A.at(i);
	vector<mii> pfA(N);
	mii pfK;
	rep(i, N) {
		for (pii pd : pf(A[i])) {
			int prm, deg; tie(prm, deg) = pd;
			if (pfK.count(prm)) pfK[prm] = max(pfK[prm], deg);
			else pfK[prm] = deg;
		}
	}
	ll K = 1;
	for (pii pd : pfK) {
		int prm, deg; tie(prm, deg) = pd;
		K = modmul(K, modpow(prm, deg));
	}
	ll ans = 0;
	rep(i, N) ans = modadd(ans, moddiv(K, A[i]));
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'mii pf(int)':
a.cc:72:9: error: 'prm' was not declared in this scope
   72 |         prm = 2;
      |         ^~~
a.cc:75:32: error: 'deg' was not declared in this scope
   75 |                         tie(N, deg) = divs(N, prm);
      |                                ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, 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);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
using mint = Fp<1000000007>;
vector<pair<ll,ll>>prime_factorize(ll n){
  vector<pair<ll,ll>>res;
  for(ll p=2;p*p<=n;p++){
    if(n%p!=0)continue;
    ll num=0;
    while(n%p==0){
      num++;
      n/=p;
    }
    res.push_back(make_pair(p,num));
  }
  if(n!=1)res.push_back(make_pair(n,1));
  return res;
}
int main(){
  ios::sync_with_stdio(false);
　std::cin.tie(nullptr);
  int n;
  cin >> n;
  vector<ll>a(n);
  map<ll,ll>mp;
  rep(i,n){
    cin >> a[i];
    auto pf=prime_factorize(a[i]);
    for(auto p:pf){
      mp[p.first]=max(mp[p.first],p.second);
    }
  }
  mint lcm=1;
  for(auto p:mp){
    lcm*=modpow(mint(p.first),p.second);
  }
  mint ans=0;
  rep(i,n){
    ans+=lcm/a[i];
  }
  cout << ans << endl;
}


Compiler output:
a.cc:82:1: error: extended character 　 is not valid in an identifier
   82 | 　std::cin.tie(nullptr);
      | ^
a.cc: In function 'int main()':
a.cc:82:1: error: '\U00003000std' has not been declared
   82 | 　std::cin.tie(nullptr);
      | ^~~~~
Language: C++


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+10;
int n,mod=1e9+7;
ll arr[N],arr2[N];
bool found[N]={};
ll fp(ll base, ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}


int main()
{
    ll cnt[1000]= {};
    bool primes[1005];
    int n = 1000;
    memset(primes, true, sizeof primes);
    for(int i = 2; i*i <= n; i++)
    {
        if(primes[i])
        {
            for(int j = i*i; j <= n; j += i)
                primes[j] = false;
        }
    }
    vector<int>v;
    ll ans=1,aa;
    cin>>aa;
    for(int i=0; i<aa; i++)
    {
        cin>>arr[i];
        arr2[i]=arr[i];
    }

    for(int i = 2; i <= n; i++)
    {
        if(primes[i])
            v.push_back(i);
    }
//cout<<v.size();
    ll lcm=1;
    for(int i=0; i<v.size(); i++)
    {
        for(int j=0; j<aa; j++)
        {
            ll k=0;
            while(arr[j]%v[i]==0)
            {
                found[arr[j]]=1;
                k++;
                arr[j]/=v[i];
            }
            cnt[i]=max(k,cnt[i]);
        }

        lcm*=fp(v[i],cnt[i]);
        lcm%=mod;

    }
    for(int i=0;i<aa;i++){
        if(!found[arr[j]]){
            lcm*=arr[i];
            lcm%=mod;
        }
    }
    //cout<<lcm<<endl;

    ll answer=0;

    for(int i=0; i<aa; i++)
    {
        answer+=(lcm*fp(arr2[i],mod-2))%mod;
        answer%=mod;
        //ans%=mod;
    }
    cout<<answer;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:23: error: 'j' was not declared in this scope
   70 |         if(!found[arr[j]]){
      |                       ^
Language: C++

#include <iostream>
#include <map>
#include <algorithm>
#define ll long long
#define mod 1000000007
using namespace std;

ll n, arr[10004];
map<ll, ll>mp;

ll fp(ll base, ll power)
{
    if (power == 0) return 1;
    ll ans = fp(base, power / 2);
    ans = (ans * ans) % mod;
    if (power % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}

void get_max(ll key, ll val)
{
    map<ll, ll>::iterator it = mp.find(key);
    if (it == mp.end())
        mp.insert({ key,val });
    else
        it->second = max(it->second, val);
}

void get_factors(ll x)
{
    ll xx = x;
    bool prime = 1;
    for (int i = 2; i <= sqrt(x); i++)
    {
        if (xx % i == 0)
        {
            prime = 0;
            ll power = 0;
            while (xx % i == 0)
            {
                power++;
                xx /= i;
            }
            get_max(i, power);
        }
    }
    if (prime)
        get_max(x, 1);
}

int main()
{
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
        get_factors(arr[i]);
    }
    ll lcm = 1, ans = 0;
    for (auto i : mp)
        lcm = (lcm * fp(i.first, i.second)) % mod;
    for (int i = 0; i < n; i++)
        ans = (ans + (lcm * fp(arr[i], mod - 2))) % mod;
    cout << ans % mod << '\n';
    return 0;
}


Compiler output:
a.cc: In function 'void get_factors(long long int)':
a.cc:34:26: error: 'sqrt' was not declared in this scope
   34 |     for (int i = 2; i <= sqrt(x); i++)
      |                          ^~~~
Language: C++

#include <bits\stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
ll spf[1000009],n, arr[10009];
map<ll, ll>prime_factors;
ll fp(ll base, ll exp)
{
	if (exp == 0)
		return 1;
	ll ans = fp(base, exp / 2);
	ans = (ans * ans) % mod;
	if (exp % 2 != 0)
		ans = (ans * (base % mod)) % mod;
	return ans;
}
void sieve()
{
	spf[1] = 1;
	for (int i = 2; i <= 1000000; i++)
		spf[i] = i;
	for (int i = 2; i <= 1000000; i += 2)
		spf[i] = 2;
	for (int i = 3; i * i <= 1000000; i++)
	{
		if (spf[i] == i)
		{
			for (int j = i; j <= 1000000; j += i)
				spf[j] = i;
		}
	}
}
vector<ll>getFactorization(ll x)
{
	vector<ll> ret;
	while (x != 1)
	{
		ret.push_back(spf[x]);
		x = x / spf[x];
	}
	return ret;
}
int main()
{
	sieve();
	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	for (int i = 0; i < n; i++)
	{
		ll a = arr[i];
		vector<ll>v = getFactorization(a);
		for (auto x : v)
		{
			int c = 0;
			while (a % x == 0 && a>1)
			{
				c++;
				a /= x;
			}
			if (c)
			{
				if (c > prime_factors[x])
					prime_factors[x] = c;
			}
		}
	}
	ll lcm = 1, sum = 0;
	for (auto m : prime_factors)
	{
		while (m.second--)
		{
			
			lcm *=(m.first % mod);
		}
	}
	for (int i = 0; i < n; i++)
		sum +=lcm /arr[i];
	cout << sum % mod;
}

Compiler output:
a.cc:1:10: fatal error: bits\stdc++.h: No such file or directory
    1 | #include <bits\stdc++.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

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

public class ACM {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        ArrayList<BigInteger> arr = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            BigInteger x = input.nextBigInteger();
            arr.add(x);
        }
        BigInteger LCM = arr.get(0), ans = BigInteger.ZERO, MOD = BigInteger.valueOf(1000000007);
        for (int i = 1; i < n; i++) {
            LCM = lcm(LCM, arr.get(i));
        }
        for (int i = 0; i < n; i++) {
            //System.out.println("sum is : "+ans);
            ans = ans.add(LCM.divide(arr.get(i)));
            ans = ans.mod(MOD);
        }

        System.out.print(ans);
    }

    static BigInteger gcd(BigInteger a, BigInteger b) {
        return a.gcd(b);
    }

    static BigInteger lcm(BigInteger a, BigInteger b) {
        return a.multiply(b).divide(gcd(a, b));
    }

}


Compiler output:
Main.java:5: error: class ACM is public, should be declared in a file named ACM.java
public class ACM {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
#define ll long long
using namespace std;
map<ll,ll> primeFac;
ll n,mod=1e9+7,arr[100000];

ll fp(ll base, ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * base ) % mod;
    return ans;
}
void factors(ll n)
{
    ll cnt=0;
    while (n % 2 == 0)
    {
        n = n/2;
        cnt++;
    }
    if(primeFac[2]<cnt)
        primeFac[2]=cnt;



    for (int i = 3; i*i <= n; i = i + 2)
    {
        cnt=0;
        while (n % i == 0)
        {
            n = n/i;
            cnt++;
        }
        if(primeFac[i]<cnt)
            primeFac[i]=cnt;

    }
    if(n>2)
        if(primeFac[n]<1)
            primeFac[n]=1;
}



int main()
{
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>arr[i],factors(arr[i]);
    ll lcm=1;
    for(auto x : primeFac)
        lcm*=fp(x.first,x.second),lcm%=mod;

    ll ans=0;
    for(int i=0; i<n; i++)
        ans += (lcm * fp(x, mod - 2)) % mod,ans %= mod;

    cout << ans << endl;


    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:60:26: error: 'x' was not declared in this scope
   60 |         ans += (lcm * fp(x, mod - 2)) % mod,ans %= mod;
      |                          ^
Language: C++

#pragma GCC optimize(3,"Ofast","inline")
#include<cstdio>
#include<iostream>
#define Mod 1000000007
#define RG register
#define IL inline
using namespace std;
const int N = 1000009;
typedef long long LL;
int n, k;
LL g[N], ans;
LL cnt;
int d[N], p[N];
bool f[N];
IL void init()
{
	for(RG int i = 2; i <= N; i++)
	{
		if(!f[i])
			p[++k] = i;
		for(RG int j = 1; p[j] * i <= N; j++)0
		{
			f[p[j]*i] = 1;
			if(i % p[j] == 0)
				break;
		}
	}
	return;
}
IL void disolve(int x)
{
	int t = 1;
	while(x != 1 && p[t] <= x)
	{
		int sum = 0;
		while(x % p[t] == 0)
		{
			sum++;
			x /= p[t];
		}
		d[t] = max(d[t], sum);
		++t;
	}
}
IL LL ksm(LL a, int b)
{
	LL sum = 1;
	while(b)
	{
		if(b&1)
			sum = (sum * a) % Mod;
		b >>= 1;
		a = (a * a) % Mod;
	}
	return sum;
}
IL int read()
{
	char c; int num = 0; bool flag = 0;
	while((c = getchar()) == ' ' || c == '\r' || c == 'n');
	if(c == '-') flag = 1; else num = c - '0';
	while(isdigit(c = getchar()))
		num = num * 10 + c - '0';
	return flag?-num:num;
}
int main()
{
	n = read();
	init();
	for(RG int i = 1; i <= n; i++)
	{
		g[i] = read();
		disolve(g[i]);
	}
	cnt = 1;
	for(RG int i = 1; i <= k; i++)
	{
		if(d[i])
			cnt = (cnt * ksm(1LL*p[i], d[i])) % Mod;
	}
	for(RG int i = 1; i <= n; i++)
		ans = (ans + cnt * ksm(g[i], Mod-2)) % Mod;
	printf("%lld\n", ans);
	return 0;
}



Compiler output:
a.cc: In function 'void init()':
a.cc:17:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   17 |         for(RG int i = 2; i <= N; i++)
      |                    ^
a.cc:21:28: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   21 |                 for(RG int j = 1; p[j] * i <= N; j++)0
      |                            ^
a.cc:21:55: error: expected ';' before '{' token
   21 |                 for(RG int j = 1; p[j] * i <= N; j++)0
      |                                                       ^
      |                                                       ;
   22 |                 {
      |                 ~                                      
a.cc: In function 'int main()':
a.cc:70:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   70 |         for(RG int i = 1; i <= n; i++)
      |                    ^
a.cc:76:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   76 |         for(RG int i = 1; i <= k; i++)
      |                    ^
a.cc:81:20: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   81 |         for(RG int i = 1; i <= n; i++)
      |                    ^
Language: C++

#include<bits/stdc++.h>
typedef long long ll;
const int maxn=1e6+9;
using namespace std;
ll kpow(ll a,ll b)
{
	ll ans=1;
	while(b)
	{
		if(b&1)ans=(ans*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return ans;
}
int main()
{
	ll n,i,j,a[maxn],la=1,ans=0,f[maxn]={0};
	scanf("%lld",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&a[i]);
		ll b=a[i];
		for(j=2;j*j<=b;j++)
		{
			if(b%j==0)
			{
				ll cnt=0;
				while(b%j==0)b/=j,cnt++;
				f[j]=max(f[j],cnt);
			}
		}
		if(b>1)f[b]=max(f[b],1ll);
	}
	for(i=2;i<=1e6;i++)la=(la*kpow(i,f[i]))%mod;
	for(i=1;i<=n;i++)ans=(ans+la*kpow(a[i],mod-2)%mod)%mod;
	printf("%lld\n",ans);
}

Compiler output:
a.cc: In function 'll kpow(ll, ll)':
a.cc:10:36: error: 'mod' was not declared in this scope; did you mean 'modf'?
   10 |                 if(b&1)ans=(ans*a)%mod;
      |                                    ^~~
      |                                    modf
a.cc:11:25: error: 'mod' was not declared in this scope; did you mean 'modf'?
   11 |                 a=(a*a)%mod;
      |                         ^~~
      |                         modf
a.cc: In function 'int main()':
a.cc:35:49: error: 'mod' was not declared in this scope; did you mean 'modf'?
   35 |         for(i=2;i<=1e6;i++)la=(la*kpow(i,f[i]))%mod;
      |                                                 ^~~
      |                                                 modf
a.cc:36:48: error: 'mod' was not declared in this scope; did you mean 'modf'?
   36 |         for(i=1;i<=n;i++)ans=(ans+la*kpow(a[i],mod-2)%mod)%mod;
      |                                                ^~~
      |                                                modf
Language: C++

#include <iostream>
#include <utility>
#include <vector>
#include <unordered_map>
#include <cmath>

using namespace std;

const int m = 1e9 + 7;

long long pow(long long a, long long b) {
    long long ans = 1;
    while (b > 0) {
        if (b % 2 == 1) ans = ans * a % m;
        b >>= 1;
        a = a * a % m;
    }
    return ans;
}

void lcmf(const vector<int>& prime, unordered_map<int, int>& lcm, int x) {
    double root_x = sqrt(x);
    for (auto p: prime) {
        int e = 0;
        while ( x % p == 0 ) {
            x /= p;
            e++;
        }
        lcm[p] = max(lcm[p], e);
        if (x == 1) break;
        if (root_x < p) {
            lcm[x] = max(lcm[x], 1);
            break;
        }
    }
}

int main() {
    int n;
    vector<int> v;
    cin >> n;
    long long l = 1;
    vector<int> prime;
    unordered_map<int, int> lcm;
    int a;
    int p[1000001] = {0};
    for (int i = 2; i <= 1e6; i++) {
        if (p[i] == 1) continue;
        prime.push_back(i);
        lcm[i] = 0;
        for (int j = i*2; j <= 1e6; j += i) {
            p[j] = 1;
        }
    }
    for (int i = 0; i < n; i++) {
        cin >> a;
        v.push_back(a);
        lcmf(prime, lcm, a);
    }
    for (auto pair: lcm) {
        l = (l * pow(pair.first, pair.second)) % m;
    }
    long long ans = 0;
    for (auto x: v) {
        ans = (ans + l * pow(x, m-2)) % m;
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:61:48: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'const int' to binary 'operator%'
   61 |         l = (l * pow(pair.first, pair.second)) % m;
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
      |                |                                 |
      |                |                                 const int
      |                __gnu_cxx::__promote<double>::__type {aka double}
a.cc:65:39: error: invalid operands of types '__gnu_cxx::__promote<double>::__type' {aka 'double'} and 'const int' to binary 'operator%'
   65 |         ans = (ans + l * pow(x, m-2)) % m;
      |               ~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
      |                    |                    |
      |                    |                    const int
      |                    __gnu_cxx::__promote<double>::__type {aka double}
Language: C++


/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

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

#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double d;
typedef long long ll;

const int N=2e5+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    int n;
    cin>>n;
    int a[n+5];
    rep(i,1,n) cin>>a[i];
    ll lcm=a[1],ans=0;
    rep(i,2,n){
        lcm=lcm*a[i]/__gcd(lcm,a[i]);
    }
    rep(i,1,n) ans+=lcm/a[i];
    cout<<ans<<'\n';
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:27: error: no matching function for call to '__gcd(ll&, int&)'
   41 |         lcm=lcm*a[i]/__gcd(lcm,a[i]);
      |                      ~~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:41:27: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   41 |         lcm=lcm*a[i]/__gcd(lcm,a[i]);
      |                      ~~~~~^~~~~~~~~~
Language: C++

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

vector<int> prime(int n){
    vector<int> is_prime(n+1, true);
    is_prime.at(0) = false;
    is_prime.at(1) = false;
    for (int i = 4; i < n+1; i += 2){
        is_prime.at(i) = false;
    }
    for (int i = 3; i < sqrt(n)+1; i += 2){
        if (is_prime.at(i) == false){
            continue;
        }
        for (int j = i*2; j < n+1; j += i){
            is_prime.at(j) = false;
        }
    }
    
    vector<int> ans(0);
    for(int i = 0; i < is_prime.size(); i++){
        if (is_prime.at(i) == true){
            ans.push_back(i);
        }
    }
    return ans;
}

long long pow_mod(long long n, long long k, long long mod){
    long long result = 1;
    while (k > 0){
        if (k % 2 != 0){
            result = result * n % mod;
        }
        n = (n * n) % mod;
        k = k / 2;
    }
    return result;
}

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    int k;
    int max_a = 0;
    for(int i = 0; i < n; i++){
        cin >> k;
        if (k > max_a){
            max_a = k;
        }
        a.at(i) = k;
    }
    vector<int> prime_list = prime(max_a);
    int len = prime_list.size();
    int k1, k2, k3, key;
    long long s = 1;
    long long inf = 1000000007;
    for (int i = 0; i < len; i++){
        k1 = prime_list.at(i);
        key = 0;
        for (int j = 0; j < n; j++){
            k2 = 0;
            k3 = a[j];
            while (k3%k1 == 0){
                k2 += 1;
                k3 /= k1;
            }
            if (key < k2){
                key = k2;
            }
        s *= pow_mod(k1, key, inf);
        s %= inf;
        }
    }
    long long ans = 0;
    long long x;
    long long s = 1;
    

    for (int i = 0; i < n; i++){
        x = (s * pow_mod(a.at(i), inf-2, inf)) % inf;
        ans += x;
        ans %= inf;
    }
    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:78:15: error: redeclaration of 'long long int s'
   78 |     long long s = 1;
      |               ^
a.cc:57:15: note: 'long long int s' previously declared here
   57 |     long long s = 1;
      |               ^
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    int n;
    cin >> n;
    vector <ll> ar(n);
    for(auto &i : ar)
        cin >> i;
    long double lc = 1;
    for(auto i : ar){
        lc = lc / __gcd(lc,i) * i;
    }
    ll sum = 0;
    for(auto i : ar){
        sum += lc / i;
        sum %= (ll)1e9 + 7;
    }
    cout << sum << "\n";
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:24: error: no matching function for call to '__gcd(long double&, long long int&)'
   25 |         lc = lc / __gcd(lc,i) * i;
      |                   ~~~~~^~~~~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1137:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1137 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:1137:5: note:   template argument deduction/substitution failed:
a.cc:25:24: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long double' and 'long long int')
   25 |         lc = lc / __gcd(lc,i) * i;
      |                   ~~~~~^~~~~~
Language: C++

#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    int n;
    vector <ll> ar(n);
    for(auto &i : ar)
        cin >> i;
    ll lc;
    for(auto i : ar){
        lc = __lcm(lc,i);
    }
    ll sum = 0;
    for(auto i : ar){
        sum += lc / i;
        sum %= (ll)1e9 + 7;
    }
    cout << sum << "\n";
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:14: error: '__lcm' was not declared in this scope
   24 |         lc = __lcm(lc,i);
      |              ^~~~~
Language: C++

from fractions import gcd
import math
n = int(input())
a = list(map(int, input().split()))
MOD=10**9+7
lcm=1
for i in range(n):
    lcm*=a[i]//math.gcd(lcm,a[i])
res=0
for i in range(n):
    res+=lcm//a[i]
print(res%MOD)

Compiler output:
a.cc:1:1: error: 'from' does not name a type
    1 | from fractions import gcd
      | ^~~~
Language: C++

typedef long long ll;

namespace {

ll modPow(ll x, ll y, ll mod)
{
    ll res = 1;
    x = x % mod;

    while (y > 0) {
        if (y & 1)
            res = (res * x) % mod;

        y = y >> 1;
        x = (x * x) % mod;
    }
    return res;
}

ll modFactN1N2(ll n1, ll n2, ll mod)
{
    if (mod == 1) return 0;

    n1 = n1 % mod;

    ll fact = n1;
    --n1;
    --n2;

    while (n2 >= 1) {
        fact = (fact * n1) % mod;
        --n1;
        --n2;
    }
    return fact;
}

ll modFactN(ll n, ll mod)
{
    return modFactN1N2(n, n, mod);
}

ll gcdExtended(ll a, ll b, ll* x, ll* y)
{
    if (a == 0) {
        *x = 0, * y = 1;
        return b;
    }

    ll x1, y1;
    ll gcd = gcdExtended(b % a, a, &x1, &y1);

    *x = y1 - (b / a) * x1;
    *y = x1;

    return gcd;
}

ll modInverse(ll a, ll mod)
{
    ll x, y;
    ll gcd = gcdExtended(a, mod, &x, &y);
    if (gcd != 1) return 0;

    return (x % mod + mod) % mod;
}

}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using PL = pair<ll,ll>;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
constexpr int INF = (1 << 29);
constexpr ll INF_ = (1LL << 58);
constexpr ld EPS = (1e-10);
constexpr ld PI_ = 3.141592653589793238;//46264338327950288
constexpr ld E_ = 2.71828182845904523;//5360287471352
constexpr ll MOD = 1000000007;
//// functions (integer)_________________________________
ll modpow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a % m;
		a = a * a%m; n >>= 1;
	}
	return res;
}
long long modinv(long long a, long long p, long long mod){
  return modpow(a,p-2,mod);
}
////-----------------------------------------------------



int main(){
  int N;vector<int> A; set<int>P; map<int,int> B;
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  RPT(i,0,N){
    ll a; cin >> a;
    A.push_back(a);
  }
  sort(A.begin(),A.end());

  FOR(i,2,1000003){
    bool ynprime = true;
    for(auto x : P){
      if(i % x == 0){ ynprime = false; break; }
      if( x*x > i ) break;
    }
    if(ynprime) P.insert(i);
  }

  RPT(i,0,N){
    int ttl = A[i];
    set<lnt>::iterator it = P.find(A[i]);
    if(it!=P.end()){
      ttl = 1;
      if(B[A[i]]<1) B[A[i]] = 1;
    }
    for(auto &xx : P){
      auto x = xx;
      int cnt = 0;
      if(x > A[i] || ttl == 1) break;
      while(ttl % x == 0){
        ttl /= x;
        cnt++;
      }
      if(cnt){
        if(B[x]<cnt) B[x] = cnt;
      }
    }
    if(ttl != 1) {
      P.insert(A[i]);
      B[A[i]] = 1;
    }
  }

  ll L=1, Ainv = 0;
  for(auto x : P){
    if(B[x] != 0)L = ((L * (modpow(x,B[x],MOD))%MOD)) % MOD;
  }
  RPT(i,0,N){
    Ainv = (Ainv + ((modpow(A[i],MOD-2,MOD)%MOD)%MOD) ) % MOD;
  }
  ll ans = (Ainv * L) % MOD;
  //ll ans = (Ainv % MOD);
  cout << ans << endl; 
  //cout << L << endl << Ainv << endl;for(auto x: P) if(B[x]) cout << x << "^" << B[x] << " ";
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:9: error: 'lnt' was not declared in this scope; did you mean 'int'?
   54 |     set<lnt>::iterator it = P.find(A[i]);
      |         ^~~
      |         int
a.cc:54:12: error: template argument 1 is invalid
   54 |     set<lnt>::iterator it = P.find(A[i]);
      |            ^
a.cc:54:12: error: template argument 2 is invalid
a.cc:54:12: error: template argument 3 is invalid
a.cc:54:24: error: expected initializer before 'it'
   54 |     set<lnt>::iterator it = P.find(A[i]);
      |                        ^~
a.cc:55:8: error: 'it' was not declared in this scope; did you mean 'i'?
   55 |     if(it!=P.end()){
      |        ^~
      |        i
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
ll modpow(ll a, ll p);
int main(){
  int N, A[10010],Ainv[10010];ll K=1,Ainvsum = 0,primeTable[10010],Aprime[10010][10010],primeNum=0;
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  sort(A,A+N)
  for(int i = 0; i < N; i++){
    Ainv[i] = modpow(A[i],MOD-2);
    Ainvsum += Ainv[i];
  }
  for(int i = 2; i < 1002; i++){
    int flg = 1;
    for(int j = 0; j < primeNum && primeTable[j]*primeTable[j] <= i; j++){
      if(i % primeTable[j]==0) {flg = 0; j = 10000000;}
    }
    if(flg){primeTable[primeNum] = i; primeNum++;}
  }
  for(int i = 0; i < N; i++){
    int flg = 1;
    for(int j = 0; j < primeNum && primeTable[j]*primeTable[j]<=A[i]; j++){
      if(A[i] % primeTable[j]==0) {flg = 0; j = 10000000;}
    }
    if(flg){primeTable[primeNum] = A[i]; primeNum++;}
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < primeNum; j++){
      ll AA = A[i];
      while(AA % primeTable[j] == 0){
        AA /= primeTable[j];
        Aprime[i][j]++;
      }
    }
  }
  for(int i = 0; i < primeNum; i++){
    ll maxnum = -100;
    for(int j = 0; j < N; j++){
      if(maxnum < Aprime[j][i]) maxnum = Aprime[j][i];
    }
    Aprime[10005][i] = maxnum;
  }
  K = 1;
  for(int i = 0; i < primeNum; i++){
    K = (K * (modpow(primeTable[i],Aprime[10005][i])%MOD) )% MOD;
  }
  Ainvsum %= MOD;
  K %= MOD;
  Ainvsum = (Ainvsum * K) % MOD;
  cout << Ainvsum;
  return 0;
}
ll gcd(ll a, ll b){
  ll x = a * b;
  if(a < b) swap(a,b);
  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return ((b) % MOD);
}
ll lcm(ll a, ll b){
  ll x = a * b % MOD;
  x *= modpow(gcd(a,b),MOD-2);
  x %= MOD;
  return x;
}
ll modpow(ll a, ll p){
  if(p == 0) return 1;
  if(p % 2 == 0) {ll tmp=modpow(a,p/2); tmp *= tmp; tmp %= MOD; return tmp; }
  else{ ll tmp=modpow(a,p-1); tmp *= a; tmp %= MOD; return tmp;}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: expected ';' before 'for'
   12 |   sort(A,A+N)
      |              ^
      |              ;
   13 |   for(int i = 0; i < N; i++){
      |   ~~~         
a.cc:13:18: error: 'i' was not declared in this scope
   13 |   for(int i = 0; i < N; i++){
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
ll modpow(ll a, ll p);
int main(){
  int N, A[10010],Ainv[10010];ll K=1,Ainvsum = 0,primeTable[1010],Aprime[10010][1010],primeNum=0;
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  sort(A,A+N)
  for(int i = 0; i < N; i++){
    Ainv[i] = modpow(A[i],MOD-2);
    Ainvsum += Ainv[i];
  }
  for(int i = 2; i < 1002; i++){
    int flg = 1;
    for(int j = 0; j < primeNum && primeTable[j]*primeTable[j] <= i; j++){
      if(i % primeTable[j]==0) {flg = 0; j = 10000000;}
    }
    if(flg){primeTable[primeNum] = i; primeNum++;}
  }
  for(int i = 0; i < N; i++){
    int flg = 1;
    for(int j = 0; j < primeNum && primeTable[j]*primeTable[j]<=A[i]; j++){
      if(A[i] % primeTable[j]==0) {flg = 0; j = 10000000;}
    }
    if(flg){primeTable[primeNum] = A[i]; primeNum++;}
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < primeNum; j++){
      ll AA = A[i];
      while(AA % primeTable[j] == 0){
        AA /= primeTable[j];
        Aprime[i][j]++;
      }
    }
  }
  for(int i = 0; i < primeNum; i++){
    ll maxnum = -100;
    for(int j = 0; j < N; j++){
      if(maxnum < Aprime[j][i]) maxnum = Aprime[j][i];
    }
    Aprime[10005][i] = maxnum;
  }
  K = 1;
  for(int i = 0; i < primeNum; i++){
    K = (K * (modpow(primeTable[i],Aprime[10005][i])%MOD) )% MOD;
  }
  Ainvsum %= MOD;
  K %= MOD;
  Ainvsum = (Ainvsum * K) % MOD;
  cout << Ainvsum;
  return 0;
}
ll gcd(ll a, ll b){
  ll x = a * b;
  if(a < b) swap(a,b);
  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return ((b) % MOD);
}
ll lcm(ll a, ll b){
  ll x = a * b % MOD;
  x *= modpow(gcd(a,b),MOD-2);
  x %= MOD;
  return x;
}
ll modpow(ll a, ll p){
  if(p == 0) return 1;
  if(p % 2 == 0) {ll tmp=modpow(a,p/2); tmp *= tmp; tmp %= MOD; return tmp; }
  else{ ll tmp=modpow(a,p-1); tmp *= a; tmp %= MOD; return tmp;}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:12:14: error: expected ';' before 'for'
   12 |   sort(A,A+N)
      |              ^
      |              ;
   13 |   for(int i = 0; i < N; i++){
      |   ~~~         
a.cc:13:18: error: 'i' was not declared in this scope
   13 |   for(int i = 0; i < N; i++){
      |                  ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
ll modpow(ll a, ll p);
int main(){
  int N, A[10010],Ainv[10010];ll K=1,Ainvsum = 0,primeTable[1010],Aprime[10010][1010],primenum=0;
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < N; i++){
    Ainv[i] = modpow(A[i],MOD-2);
    Ainvsum += Ainv[i];
  }
  for(int i = 2; i < 1002; i++){
    int flg = 1;
    for(int j = 0; j < primeNum; j++){
      if(i % primeTable[j]==0) {flg = 0; j = -100;}
    }
    if(flg){primeTable[primeNum] = i; primeNum++;}
  }
  for(int i = 0; i < N; i++){
    for(int j = 0; j < primeNum; j++){
      ll AA = A[i];
      while(AA % primeTable[j] == 0){
        AA /= primeTable[j];
        Aprime[i][j]++;
      }
    }
  }
  for(int i = 0; i < primeNum; i++){
    ll maxnum = -100;
    for(int j = 0; j < N; j++){
      if(maxnum < Aprime[j][i]) maxnum = Aprime[j][i];
    }
    Aprime[10005][i] = maxnum;
  }
  for(int i = 0; i < primeNum; i++){
    K = (K * modpow(primeTable[i],Aprime[10005][i]) )% MOD;
  }
  Ainvsum = (Ainvsum * K) % MOD;
  cout << Ainvsum;
  return 0;
}
ll gcd(ll a, ll b){
  ll x = a * b;
  if(a < b) swap(a,b);
  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return ((b) % MOD);
}
ll lcm(ll a, ll b){
  ll x = a * b % MOD;
  x *= modpow(gcd(a,b),MOD-2);
  x %= MOD;
  return x;
}
ll modpow(ll a, ll p){
  if(p == 0) return 1;
  if(p % 2 == 0) {ll tmp=modpow(a,p/2); tmp *= tmp; tmp %= MOD; return tmp; }
  else{ ll tmp=modpow(a,p-1); tmp *= a; tmp %= MOD; return tmp;}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:24: error: 'primeNum' was not declared in this scope; did you mean 'primenum'?
   18 |     for(int j = 0; j < primeNum; j++){
      |                        ^~~~~~~~
      |                        primenum
a.cc:21:24: error: 'primeNum' was not declared in this scope; did you mean 'primenum'?
   21 |     if(flg){primeTable[primeNum] = i; primeNum++;}
      |                        ^~~~~~~~
      |                        primenum
a.cc:24:24: error: 'primeNum' was not declared in this scope; did you mean 'primenum'?
   24 |     for(int j = 0; j < primeNum; j++){
      |                        ^~~~~~~~
      |                        primenum
a.cc:32:22: error: 'primeNum' was not declared in this scope; did you mean 'primenum'?
   32 |   for(int i = 0; i < primeNum; i++){
      |                      ^~~~~~~~
      |                      primenum
a.cc:39:22: error: 'primeNum' was not declared in this scope; did you mean 'primenum'?
   39 |   for(int i = 0; i < primeNum; i++){
      |                      ^~~~~~~~
      |                      primenum
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
ll modpow(ll a, ll p);
int main(){
  int N, A[10010],Ainv[10010];ll K=1,Ainvsum = 0;
  cin >> N;
  for(int i = 0; i < N; i++) cin >> A[i];
  for(int i = 0; i < N; i++){
    Ainv[i] = modpow(A[i],MOD-2) % MOD;
    K = lcm(K,A[i]) % MOD;
  }
  for(int i = 0; i < N; i++){
    ll x = (K * Ainv[i]) % MOD;
    Ainvsum += x;
    Ainvsum %= MOD;
  }
  cout << Ainvsum;
  return 0;
}
ll gcd(ll a, ll b){
  a %= MOD;
  b %= MOD;
  ll x = a * b;
  if(a < b){ 
    ll tmp = a;
    a = b;
    b = tmp;
  }
  ll r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return ((b) % MOD);
}
/*
ll lcm(ll a, ll b){
  ll x = ((a%MOD) * (b%MOD)) % MOD;
  x *= (modpow(gcd(a,b),MOD-2)%MOD);
  x %= MOD;
  return x;
}
ll modpow(ll a, ll p){
  a %= MOD;
  if(p == 0) return 1;
  if(p % 2 == 0) {ll tmp=modpow(a,p/2); tmp *= tmp; tmp %= MOD; return tmp; }
  else{ ll tmp=modpow(a,p-1); tmp *= a; tmp %= MOD; return tmp;}
}
*/
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;
}

Compiler output:
a.cc:55:4: error: redefinition of 'll gcd(ll, ll)'
   55 | ll gcd(ll a,ll b){
      |    ^~~
a.cc:24:4: note: 'll gcd(ll, ll)' previously defined here
   24 | ll gcd(ll a, ll b){
      |    ^~~
Language: C

#include<stdio.h>

int gcd(unsigned long long a,int b){
    if(a%(unsigned long long)b){
        b=gcd(b,a%b);
        return b;
    }else{
        return b;
    }
}

unsigned long long l_cm(long long lcm,long long a){
    if(lcm%a){
        return lcm*a/gcd((int)lcm,a);
    }else{
        return lcm;
    }
}

int main(void){
    int n;
    int a[10000];
    unsigned long long min=0;

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

    unsigned long long lcm=1;

    for(int i=0;i<n;i++){
        lcm=l_cm(lcm,(unsigned long long)a[i]);
    }

    for(int i=0;i<n;i++){
        min+=(lcm/(unsigned long long)a[i];)%1000000007;
        for(;min>=1000000007;){
            min-=1000000007;
        }
    }

    printf("%llu",min);

}

Compiler output:
main.c: In function 'main':
main.c:37:43: error: expected ')' before ';' token
   37 |         min+=(lcm/(unsigned long long)a[i];)%1000000007;
      |              ~                            ^
      |                                           )
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9+7;

sync_with_stdio(false);
cin.tie(nullptr);

ll modPow(ll a, ll b) {
    ll res = 1;
    while(b > 0) {
        if(b & 1) res = res * a % MOD;
        if(res==0) res = MOD;
        a = a * a % MOD;
        if(a==0) a = MOD;
        b >>= 1;
    }
    return res;
}

bool isPrime[1000005];
vector<int> primes;

void eratos(int maxi) {
    isPrime[1] = false;
    for(int i=2;i<=maxi;i++) isPrime[i] = true;
    for(int i=2;i<=maxi;i++) {
        if(isPrime[i]) {
            for(int j=2*i;j<=maxi;j+=i) {
                isPrime[j] = false;
            }
        }
    }
    for(int i=2;i<=maxi;i++)
        if(isPrime[i])
            primes.push_back(i);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    vector<ll> A(N);
    ll maxa = 0;
    for(auto &a : A) {
        cin >> a;
        maxa = max(a, maxa);
    }
    eratos(maxa);
    vector<int> lcm_prime(primes.size(), 0);
    for(int i=0;i<N;i++) {
        ll tmp = A[i];
        int key = 0;
        while(tmp > 1 && primes[key] <= maxa) {
            int cnt = 0;
            while(tmp%primes[key] == 0) {
                tmp /= primes[key];
                cnt++;
            }
            lcm_prime[key] = max(lcm_prime[key], cnt);
            key++;
        }
    }

    ll ans = 0;

    ll l = 1LL;
    for(int i=0;i<primes.size();i++) {
        l *= modPow(primes[i],lcm_prime[i]);
        l %= MOD;
    }

    for(int i=0;i<N;i++) {
        ans += (l * modPow(A[i], MOD-2)) % MOD;
        ans %= MOD;
    }
    cout << ans << "\n";
}

Compiler output:
a.cc:6:16: error: expected constructor, destructor, or type conversion before '(' token
    6 | sync_with_stdio(false);
      |                ^
a.cc:7:1: error: 'cin' does not name a type
    7 | cin.tie(nullptr);
      | ^~~
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ll long long
#define MOD 1000000007
#define MAX 1000010
using namespace std;

// a^n mod
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

// a^{-1} mod
ll modinv(ll a) {
    return modpow(a, MOD - 2);
}

int main(){
  ll n;
  cin >> n;
  ll a[n];
  ll cpy_a[n];
  REP(i,n) cin >> a[i];
  REP(i,n) cpy_a[i] = a[i];
  ll x_max[MAX] = {0};
  
  REP(i,n){
    ll x[a[i]+1] = {0};
    //FOR(j,2,sqrt(a[i])+1){
      while(cpy_a[i]%j == 0){
        x[j]++;
        cpy_a[i] /= j;
      }
      x_max[j] = max(x_max[j], x[j]);
    //}
    if(cpy_a[i] != 1){
      x[cpy_a[i]]++;
      x_max[cpy_a[i]] = max(x_max[cpy_a[i]], x[cpy_a[i]]);
    }
  }
  
  ll lcm = 1;
  REP(i,MAX){
    if(x_max[i] != 0){
      lcm *= modpow(i,x_max[i]);
      lcm %= MOD;
    }
  }
  
  ll ans = 0;
  REP(i,n){
    ans += lcm * modinv(a[i]) % MOD;
    ans %= MOD;
  }
  
  cout << ans % MOD;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:22: error: 'j' was not declared in this scope
   38 |       while(cpy_a[i]%j == 0){
      |                      ^
a.cc:42:13: error: 'j' was not declared in this scope
   42 |       x_max[j] = max(x_max[j], x[j]);
      |             ^
Language: C++

def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 
  
def lcm(a,b): 
    return (a*b) // gcd(a,b) 

mod = 1000000007
n = int(input())
arr = input()
a = list(map(int, arr.split(' ')))
lc = a[0]
res = 0
for i in range(n):
    lc = lcm(lc, a[i])
for i in range(n):
    res = res + 1//a[i]
print(ans % mod)

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def gcd(a,b):
      | ^~~