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

# cook your dish here
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 
  
def lcm(a,b): 
    return (a*b) // gcd(a,b) 
  
n = int(input())
arr=input()
a=list(map(int,arr.split(' ')))
l = a[0]
ans = 0
for i in range(n):
    l = lcm(l, a[i])
for i in range(n):
    ans = ans + l//a[i]
print(ans%1000000007)


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #cook
    1 | # cook your dish here
      |   ^~~~
a.cc:2:1: error: 'def' does not name a type
    2 | def gcd(a,b):
      | ^~~
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define PB push_back
#define MP make_pair
#define ll long long
#define MOD 1000000007

inline ll toll(string s){ll v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}

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

bool visited[1000100];
ll main(){
    std::ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    ll a[n];
    vector<ll> primes;
    for(ll i=2;(i*i)<1000100;++i)
    {
        if(visited[i]) continue;
        primes.push_back(i);
        for(ll j=i;(j*i)<1000100;++j)
        {
            visited[i*j] = true;
        }
    }

    for(ll i=0;i<n;++i){
        cin >> a[i];
    }

    map<ll,ll> factors;
    for(ll i=0;i<n;++i)
    {
        ll tmp = a[i];
        ll cnt = 0;
        for(ll ind=0; (primes[ind] * primes[ind]) <= tmp; ++ind)
        {
            while((tmp % primes[ind]) == 0) {
                cnt++;
                tmp /= primes[ind];
            }

            if(cnt != 0)
            {
                factors[primes[ind]] = max(factors[primes[ind]], cnt);
            }
            cnt = 0;
        }

        if(tmp != 1)
        {
            factors[tmp] = max(factors[tmp], 1ll);
        }
    }
    // for each a, would like to calc gcd / a mod MOD
    ll lcm_mod = 1;
    for(const auto& factor : factors) {
        lcm_mod *= mod_pow(factor.first, factor.second, MOD);
        lcm_mod %= MOD;
    }

    ll res = 0;
    for(ll i=0;i<n;++i)
    {
        ll tmp = lcm_mod * mod_pow(a[i], MOD-2, MOD);
        res += tmp;
        res %= MOD;
    }

    cout << res << endl;

    return 0;
}


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <iostream>
#define MAX 10000
#define F 1000000007

typedef long long long int lli;
lli gcd(lli,lli);

int main(void){
  lli N;
  lli A[MAX];
  lli B[MAX];

  std::cin >> N;
  for(int i=0;i<N;i++){
    std::cin >> A[i]; 
  }
  //B1はA1とA2の最小公倍数を作るように作成する
  lli gcdab = gcd(A[0],A[1]);
  lli lcmab = (lli)(A[0]/gcdab)*A[1];
  B[0] = (lli)lcmab/A[0];
  B[1] = (lli)lcmab/A[1];
  for(int i=1;i<N-1;i++){
    //現在の最小公倍数
    lli cur = B[i]*A[i];
    //この最小公倍数とA[i+1]との最小公倍数を求める
    lli tmpgcd = gcd(cur,A[i+1]);
    lli tmplcm = (lli)(cur/tmpgcd)*A[i+1];
    // B[i+1]を求める
    B[i+1] = (lli)tmplcm/A[i+1];
    // B[i]に乗する係数を求める
    // いままでのものすべてにかける
    lli coef = (lli)(tmplcm/cur);
    for(int j=0;j<=i;j++){
      B[j] = B[j]*coef;
    }
  }

  //たす
  lli sum = 0;
  for(int i=0;i<N;i++){
    //std::cout << B[i] << std::endl;
    sum = (sum%F + B[i]%F)%F;
  }
  std::cout << sum << std::endl;
  
  return 0;
}

lli gcd(lli a,lli b){
  if(b > a){
    lli tmp = a;
    a = b;
    b = tmp;
  }
  while(true){
    lli rem = a%b;
    if(rem == 0){
      return b;
    }
    lli tmp;
    a = b;
    b = rem;
  }
}


Compiler output:
a.cc:5:19: error: 'long long long' is too long for GCC
    5 | typedef long long long int lli;
      |                   ^~~~
Language: C++

#include<map>
#include<cmath>
#include<cstdio>
#include<algorithm>
const int mod=1e9+7;
int n;
std::map<int,int> a[10010],lcm;
std::map<int,int>::iterator it;
int main()
{
	scanf("%d",&n);
	for(int i=1,x,xx;i<=n;i++)
	{
		scanf("%d",&x);
		xx=x;
		for(int j=2;j*j<=x;j++)
		{
			while(xx%j==0)
			{
				xx/=j;
				a[i][j]++;
			}
		}
		if(xx>1) a[i][xx]++;
		for(it:a[i])
			lcm[it->first]=std::max(lcm[it->first],it->second);
	}
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		long long b=1;
		for(it:lcm)
		{
			b*=(long long)pow(it->first,it->second-a[i][it->first])%mod;
			b%=mod;
		}
		ans+=b,ans%=mod;
	}
	printf("%lld\n",ans);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:25:23: error: found ':' in nested-name-specifier, expected '::'
   25 |                 for(it:a[i])
      |                       ^
      |                       ::
a.cc:25:21: error: 'it' is not a class, namespace, or enumeration
   25 |                 for(it:a[i])
      |                     ^~
a.cc:27:9: error: expected primary-expression before '}' token
   27 |         }
      |         ^
a.cc:26:76: error: expected ';' before '}' token
   26 |                         lcm[it->first]=std::max(lcm[it->first],it->second);
      |                                                                            ^
      |                                                                            ;
   27 |         }
      |         ~                                                                   
a.cc:27:9: error: expected primary-expression before '}' token
   27 |         }
      |         ^
a.cc:26:76: error: expected ')' before '}' token
   26 |                         lcm[it->first]=std::max(lcm[it->first],it->second);
      |                                                                            ^
      |                                                                            )
   27 |         }
      |         ~                                                                   
a.cc:25:20: note: to match this '('
   25 |                 for(it:a[i])
      |                    ^
a.cc:27:9: error: expected primary-expression before '}' token
   27 |         }
      |         ^
a.cc:32:23: error: found ':' in nested-name-specifier, expected '::'
   32 |                 for(it:lcm)
      |                       ^
      |                       ::
a.cc:32:21: error: 'it' is not a class, namespace, or enumeration
   32 |                 for(it:lcm)
      |                     ^~
a.cc:38:9: error: expected primary-expression before '}' token
   38 |         }
      |         ^
a.cc:37:33: error: expected ')' before '}' token
   37 |                 ans+=b,ans%=mod;
      |                                 ^
      |                                 )
   38 |         }
      |         ~                        
a.cc:32:20: note: to match this '('
   32 |                 for(it:lcm)
      |                    ^
a.cc:38:9: error: expected primary-expression before '}' token
   38 |         }
      |         ^
Language: C++

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

#define MOD 1000000007;

int main(){
    int n;
    while( cin >> n ){
        ll lcm = 1;
        vector<ll>v(n);
        cin >> v[0];
        lcm = v[0];
        for( int i = 1; i < n; i++ ){
            cin >> v[i];
            ll gc = __gcd( lcm, v[i] );
            lcm = (lcm*v[i])/gc;
        }
        ll sum = 0;
        for( int i = 0; i < n; i++ ){
            sum = sum+(lcm/v[i]);
            sum = sum%MOD;
            sum = (sum+MOD)%MOD;
        }
        cout << sum << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:23: error: expected ')' before ';' token
    5 | #define MOD 1000000007;
      |                       ^
a.cc:23:24: note: in expansion of macro 'MOD'
   23 |             sum = (sum+MOD)%MOD;
      |                        ^~~
a.cc:23:19: note: to match this '('
   23 |             sum = (sum+MOD)%MOD;
      |                   ^
a.cc:23:27: error: expected primary-expression before ')' token
   23 |             sum = (sum+MOD)%MOD;
      |                           ^
Language: Java

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Flatten {

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		StringTokenizer st;
		st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(br.readLine());
		int a[] = new int[n];
		long pre = Integer.parseInt(st.nextToken());
		n--;
		a[n] = (int) pre;
		while(n-->0) {
			a[n] = Integer.parseInt(st.nextToken());
			pre = lcm(a[n],pre);
		}
		int cnt = 0;
		for(int e:a) {
			cnt = (int) ((cnt+pre/e)%(1e9+7));
		}
		out.println(cnt);
		out.flush();
	}
	static long gcd(long n, long m) {
		if(n == 0)
			return m;
		return gcd(m % n, n);
	}
	static long lcm(long n, long m) {
		return (n*m)/gcd(n, m);
	}
}


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

#include<stdio.h>
#define inf 1000000007
struct stack{
	long long st[50005],t;
	stack(){
		for(int i=0;i<=50003;i++) st[i]=0;
		t=0;
	}
	void push(long long x){
		t++;
		st[t]=x;
	}
	void pop(){
		if(t>=1) t--;
	}
	long long top(){
		if(t>=1) return st[t];
		return -1;
	}
	bool empty(){
		if(t==0) return true;
		return false;
	}
};
long long mx_mn_mp(long long x,long long y){
	int r,a=x,b=y;
	do{
		r=a%b;
		a=b;
		b=r;
	}while(r!=0);
	return x*(y/a);
}
int main(){
	long long n,x,A[20005],ans=0;stack s;
	scanf("%lld",&n);
	for(int i=1;i<=(int)n;i++) scanf("%lld",&A[i]),s.push(A[i]);
	while(s.t!=1){
		s.st[s.t-1]=mx_mn_mp(s.st[s.t],s.st[s.t-1]);
		s.pop();
	}
	x=s.top();
	for(int i=1;i<=(int)n;i++) ans+=x/A[i];
	printf("%lld",ans%inf);
	return 0;
}

Compiler output:
main.c:5:9: error: expected specifier-qualifier-list before 'stack'
    5 |         stack(){
      |         ^~~~~
main.c: In function 'main':
main.c:35:38: error: unknown type name 'stack'; use 'struct' keyword to refer to the type
   35 |         long long n,x,A[20005],ans=0;stack s;
      |                                      ^~~~~
      |                                      struct 
main.c:37:57: error: request for member 'push' in something not a structure or union
   37 |         for(int i=1;i<=(int)n;i++) scanf("%lld",&A[i]),s.push(A[i]);
      |                                                         ^
main.c:38:16: error: request for member 't' in something not a structure or union
   38 |         while(s.t!=1){
      |                ^
main.c:39:18: error: request for member 'st' in something not a structure or union
   39 |                 s.st[s.t-1]=mx_mn_mp(s.st[s.t],s.st[s.t-1]);
      |                  ^
main.c:39:23: error: request for member 't' in something not a structure or union
   39 |                 s.st[s.t-1]=mx_mn_mp(s.st[s.t],s.st[s.t-1]);
      |                       ^
main.c:39:39: error: request for member 'st' in something not a structure or union
   39 |                 s.st[s.t-1]=mx_mn_mp(s.st[s.t],s.st[s.t-1]);
      |                                       ^
main.c:39:44: error: request for member 't' in something not a structure or union
   39 |                 s.st[s.t-1]=mx_mn_mp(s.st[s.t],s.st[s.t-1]);
      |                                            ^
main.c:39:49: error: request for member 'st' in something not a structure or union
   39 |                 s.st[s.t-1]=mx_mn_mp(s.st[s.t],s.st[s.t-1]);
      |                                                 ^
main.c:39:54: error: request for member 't' in something not a structure or union
   39 |                 s.st[s.t-1]=mx_mn_mp(s.st[s.t],s.st[s.t-1]);
      |                                                      ^
main.c:40:18: error: request for member 'pop' in something not a structure or union
   40 |                 s.pop();
      |                  ^
main.c:42:12: error: request for member 'top' in something not a structure or union
   42 |         x=s.top();
      |            ^
Language: C++

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


int64_t calc(int64_t a, int64_t b,int64_t p) {
    if (b == 0) {
        return 1;
    } else if (b % 2 == 0) {
        int64_t d = calc(a, b / 2, p);
        return (d * d) % p;
    } else {
        return (a * calc(a, b - 1, p)) % p;
    }
}

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

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;//偶数はあらかじめ除く

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}
 
int main(){
  int64_t MOD=1000000007;
  int N;
  cin>>N;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  vector<int>p(1010,0);
  for(int i=0;i<N;i++){
   for(int j=2;j*j<=A[i];j++){
   	int part=0;
   	if(IsPrime(j)){
   		while(A[i]%j==0){
   			A[i]/=j;
   			part++;
   			}
   			}
   	if(part>p[j])p[j]=part;
   			}
   			}
  int G=1;
  for(int i=2;i<1010;i++){
  	while(p[i]>0){
  		G*=i;
  		G%=MOD
  		p[i]--;
  		}
  		}
  		
  
  int sum=0;
  for(int i=0;i<N;i++){
    sum+=calc(A[i],MOD-2,MOD);
    sum%=MOD;
  }
  cout<<sum*G%MOD<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:74:23: error: expected ';' before 'p'
   74 |                 G%=MOD
      |                       ^
      |                       ;
   75 |                 p[i]--;
      |                 ~      
a.cc: In function 'int64_t gcd(int64_t, int64_t)':
a.cc:29:1: warning: control reaches end of non-void function [-Wreturn-type]
   29 | }
      | ^
Language: C++

#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


int gcd(int m, int n)
{
    if (n == 0) return m;
    return gcd(n, m % n);
}

int lcm(int a, int b)
{
    return a / gcd(a, b) * b;
}

const int MOD = 1000000009;

int main() {
    int n;
    cin >> n;
    vi a(n); 
    rep(i, n) cin >> a[i];
    int x = lcm(a[0], a[1]);
    srep(i, 2, n) {
        x = lcm(x, a[i]);
    }
    int ans = 0;
    rep(i, n) {
        ans += (x / a[i];
    }
    cout << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:80:25: error: expected ')' before ';' token
   80 |         ans += (x / a[i];
      |                ~        ^
      |                         )
Language: C++

//#include <bits/stdc++.h>
#include <cstdio>
#include <iostream>
#include <algorithm>
#define repe(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define mst(a, b)   memset((a), (b), sizeof(a))
#define gc() gutchar()
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pr;
typedef long long ll;
const double eps = 1e-5;
const int inf = 0x3f3f3f3f;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
const ll mod = 1e9+7;
const int N = 1e4+5;

ll p[N], mp[N];

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

int main()
{
	int n; cin >> n;
	ll cs = 0;
	repe(i, 1, n){
		scanf("%lld", &p[i]);
		cs = max(cs, p[i]);
	}
	ll pos = 0;
	repe(i, 1, n){
		ll x = p[i];
		ll y = sqrt(x);
		repe(j, 2, y){
			ll cnt = 0;
			while (x % j == 0)
			{
				x /= j;
				cnt++;
			}
			mp[j] = max(mp[j], cnt);
		}
		if (x != 1)	mp[x] = max(mp[x], 1ll);
	}
	ll sum = 1;
	repe(i, 1, cs){
		sum = (sum + power(i, mp[i]) % mod) % mod;
	}
	ll res = 0;
	repe(i, 1, n){
		res += sum * power(p[i], mod - 2) % mod;
	}
	cout << res % mod << '\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:24: error: 'sqrt' was not declared in this scope
   45 |                 ll y = sqrt(x);
      |                        ^~~~
Language: C++

#include <bits/stdc++.h>
#define repe(i, a, b) for (int i = (a); i <= (b); i++)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define mst(a, b)   memset((a), (b), sizeof(a))
#define gc() gutchar()
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pr;
typedef long long ll;
const double eps = 1e-5;
const int inf = 0x3f3f3f3f;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
const ll mod = 1e9+7;
const int N = 1e4+5;

ll p[N], mp[N];

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

int main()
{
	int n; cin >> n;
	ll cs = 0;
	repe(i, 1, n){
		scanf("%lld", &p[i]);
		cs = max(cs, p[i]);
	}
	ll pos = 0;
	repe(i, 1, n){
		ll x = p[i];
		ll y = sqrt(x);
		repe(j, 2, y){
			ll cnt = 0;
			while (x % j == 0)
			{
				x /= j;
				cnt++;
			}
			mp[j] = max(mp[j], cnt);
		}
		if (x != 1)	mp[x] = max(mp[x], 1ll);
	}
	ll sum = 1;
	repe(i, 1, cs){
		sum = (sum + power(i, mp[i]) % mod) % mod;
	}
	ll res = 0;
	repe(i, 1, n){
		res += sum * power(p[i], mod - 2) % modl
	}
	cout << res % mod << '\n';
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:53: error: 'modl' was not declared in this scope; did you mean 'modfl'?
   60 |                 res += sum * power(p[i], mod - 2) % modl
      |                                                     ^~~~
      |                                                     modfl
Language: C++

from fractions import gcd


def lcm(x, y):
    return x // gcd(x, y) * y


def greatLcm(array):
    ans = 1
    for i in array:
        ans = lcm(ans, i)
    return ans


mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
p = greatLcm(a)
ans = 0
for j in a:
    ans += p // j
    ans %= mod
print(ans)


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

#include <iostream>
#include <unordered_map>
using namespace std;
typedef long long ll;
int N;
int A[10005];

unordered_map <int, int> factors;
unordered_map <int, int> newfactors[10005];
ll mod = 1000000007;

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

int main() {
    cin >> N;
    for (int i=0; i<N; i++){
        scanf("%d", &A[i]);
    }
    for (int i=0; i<N; i++){
        int p = sqrt(A[i])+1;
        int copy = A[i];
        for (int j=2; j<=p; j++){
            while (copy%j == 0) {
                newfactors[i][j]++;
                copy/=j;
            }
        }
        if (copy != 1) newfactors[i][copy]++;
        for (auto it: newfactors[i]){
            factors[it.first] = max(factors[it.first], it.second);
        }
    }
//    for (auto it: factors){
//        cout << it.first << " " << it.second << endl;
//    }
    ll sum = 0;
    for (int i=0; i<N; i++){
        ll number = 1;
        for (auto it: factors){
            number = number * power(it.first, it.second-newfactors[i][it.first]) % mod;
        }
        //cout << number << endl;
        sum = (sum + number) % mod;
    }
    cout << sum << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:17: error: 'sqrt' was not declared in this scope
   28 |         int p = sqrt(A[i])+1;
      |                 ^~~~
Language: C++

#include<bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define _GLIBCXX_DEBUG
using namespace std;
using cint = boost::multiprecision::cpp_int;
using ll = long long;
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main() {
    int n;
    cin >> n;
    vector<cint> a(n);
    rep(i,n) cin >> a[i];
    cint alcm = 1;
    rep(i,n) alcm = lcm(alcm,a[i]);
    mint ans = 0;
    rep(i,n) {
        mint b = alcm/a[i];
        ans += b;
    }
    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;
 
const int MOD = 1000000007;
using bigint = boost::multiprecision::cpp_int;
 
template<typename T>
T enuclidean_gcd(T a, T b){
    if(a==0) return b;
    while(a){
        swap(a, b);
        a %= b;
    }
    return b;
}
 
int main(){
    int N; cin >> N;
    vector<int> A;
    A.reserve(N);
    bigint ablcm = 1;
    for(int i=0; i<N; i++){
        int a; cin >> a;
        A.push_back(a);
        ablcm = ablcm * a / enuclidean_gcd(boost::multiprecision::integer_modules(ablcm, a), a);
    }

    bigint b = 0;
    for(int i=0; i<N; i++){
        b += ablcm/A[i] % MOD;
    }
    b %= MOD;
    cout << b << 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 <iostream>
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>

using namespace boost::multiprecision;
using namespace std;

cpp_int gcd(cpp_int a, cpp_int b){
  if(b<a) swap(a, b);
  cpp_int r = a % b;
  if(r==0) return b;
  while(r!=0) r = a % b, a = b, b = r;
  return a;
}
cpp_int lcm(cpp_int a, cpp_int b){ return (a*b)/gcd(a, b);}
int main()
{
  int n;cin >> n;
  vector<int> v(n);
  cpp_int t = 1;
  for(int i=0;i<n;i++) {
    scanf("%d", &v[i]);
    t = lcm(t, (cpp_int)v[i]);
  }
  cpp_int ans = 0;
  for(int i=0;i<n;i++) v[i] = (t/v[i])%1000000007;
  //cout << ans%1000000007 << '\n';
}




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

#include<bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define X first
#define Y second
#define pb push_back
#define make_unique(x) sort(all(x)), x.resize(unique(all(x)) - x.begin())

const LL mod = 1e9 + 7;


template<class T>
istream& operator >> (istream& in, vector<T>& v){ for (auto &x : v) { in >> x; } return in; }

template<class T, class U>
istream& operator >> (istream& in, pair<T, U> & v){ in >> v.X >> v.Y;return in; }

template<class T, class U>
ostream& operator << (ostream& out, pair<T, U> & v){ out << v.X << " " << v.Y;return out; }

void chkmax(int &a, int b) {
    a = max(a, b);
    return;
}

void chkmin(int &a, int b) {
    a = min(a, b);
    return;
}

LL ppow (LL x, LL s) {
    if (!s) return 1;
    if (!(s - 1)) return x % mod;
    if (s % 2) return (x * ppow (x, s - 1)) % mod;
    LL b = ppow (x, s / 2);
    return (b * b) % mod;
}

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //freopen("ILUXA.in", "r", stdin);
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    int MAXN = 1e6 + 10;
    vector<int> cnt(MAXN, 0);
    vector<int> res(MAXN, 1);
    for (int i = 2;i < MAXN;i++) {
        if (res[i] == 1) {
            for (int j = i;j < MAXN;j += i) {
                res[j] = i;
            }
        }
    }

    for (auto x : a) {
        int g = x;
        unordered_map<int,int> m;
        while (g != 1) {
            m[res[g]]++;
            g /= res[g];
        }
        for (auto y : m) {
            chkmax(cnt[y.X], y.Y);
        }
    }


    int ans = 0;

    unordered_map<int,int> gg;

    for (int i = 2;i < MAXN;i++) {
        if (cnt[i]) {
            gg[i] = cnt[i];
        }
    }

    for (auto x : a) {
        int g = x;
        unordered_map<int,int> m;
        while (g != 1) {
            m[res[g]]++;
            g /= res[g];
        }
        int cur = 1;
        for (auto y : gg) {
            (cur *= ppow(y.X, y.Y - m[y.X]) %= mod;
        }
        //cout << '\n';
        //cout << cur << '\n';
        (ans += cur) %= mod;
    }

    cout << ans;

    return 0;
}


Compiler output:
a.cc:46:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   46 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:96:25: error: lvalue required as left operand of assignment
   96 |             (cur *= ppow(y.X, y.Y - m[y.X]) %= mod;
      |                     ~~~~^~~~~~~~~~~~~~~~~~~
a.cc:96:51: error: expected ')' before ';' token
   96 |             (cur *= ppow(y.X, y.Y - m[y.X]) %= mod;
      |             ~                                     ^
      |                                                   )
Language: C++

def gcd(a,b):
  if b==0:
    return a
  return gcd(b,a%b)
def lcm(arr):
  ans = 1
  for i in arr:
    ans = (ans*i)//gcd(ans,i)
  return ans
n = int(input())
arr = list(map(int,input().split())) #list(map(int, input().split()))
l = lcm(arr)
ans = 0;
for i in arr:
  ans+= l//i
print(ans%(10**9+7))


Compiler output:
a.cc:11:38: error: stray '#' in program
   11 | arr = list(map(int,input().split())) #list(map(int, input().split()))
      |                                      ^
a.cc:1:1: error: 'def' does not name a type
    1 | def gcd(a,b):
      | ^~~
a.cc:14:1: error: expected unqualified-id before 'for'
   14 | for i in arr:
      | ^~~
Language: C++

#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("section-anchors")
#pragma GCC optimize("profile-values, profile-reorder-functions, tracer")
#pragma GCC optimize("vpt")
#pragma GCC optimize("rename-registers")
#pragma GCC optimize("move-loops-invariant")
#pragma GCC optimize("unswitch-loops")
#pragma GCC optimize("function-sections")
#pragma GCC optimize("data-sections")
#pragma GCC optimize("branch-target-load-optimize")
#pragma GCC optimize("btr-bb-exclusive")

Compiler output:
a.cc:3:39: error: section anchors must be disabled when toplevel reorder is disabled
    3 | #pragma GCC optimize("section-anchors")
      |                                       ^
a.cc:4:73: warning: bad option '-fprofile-values' to pragma 'optimize' [-Wpragmas]
    4 | #pragma GCC optimize("profile-values, profile-reorder-functions, tracer")
      |                                                                         ^
a.cc:4:73: warning: bad option '-f profile-reorder-functions' to pragma 'optimize' [-Wpragmas]
a.cc:4:73: warning: bad option '-f tracer' to pragma 'optimize' [-Wpragmas]
a.cc:7:44: warning: bad option '-fmove-loops-invariant' to pragma 'optimize' [-Wpragmas]
    7 | #pragma GCC optimize("move-loops-invariant")
      |                                            ^
a.cc:9:41: warning: bad option '-ffunction-sections' to pragma 'optimize' [-Wpragmas]
    9 | #pragma GCC optimize("function-sections")
      |                                         ^
a.cc:10:37: warning: bad option '-fdata-sections' to pragma 'optimize' [-Wpragmas]
   10 | #pragma GCC optimize("data-sections")
      |                                     ^
a.cc:11:51: warning: bad option '-fbranch-target-load-optimize' to pragma 'optimize' [-Wpragmas]
   11 | #pragma GCC optimize("branch-target-load-optimize")
      |                                                   ^
a.cc:12:40: warning: bad option '-fbtr-bb-exclusive' to pragma 'optimize' [-Wpragmas]
   12 | #pragma GCC optimize("btr-bb-exclusive")
      |                                        ^
Language: C++

from fractions import gcd

def lcm(c,d):
    return c//gcd(c,d)*d
mod=10**9+7
n=int(input())
a=[int(i) for i in input().split()]
l=a[0]
for i in range(1,n):
    l=lcm(l,a[i])
ans=0
for i in range(n):
    ans+=l//a[i]
    ans%=mod
print(ans%mod)


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

def gcd(a,b):
  if b == 0: 
    return a
  return gcd(b, a % b);

def lcm(a,b):
  return a * (b / gcd(a, b));

N = int(input())
A = list(map(int, input().split()))

c = A[0]
for a in A[1:]:
  c = lcm(c, a)

ans = 0
for a in A:
  ans += c//a
  ans %= (1e9+7)
  
print(int(ans))

Compiler output:
a.cc:1:1: error: 'def' does not name a type
    1 | def gcd(a,b):
      | ^~~
a.cc:6:1: error: 'def' does not name a type
    6 | def lcm(a,b):
      | ^~~
a.cc:9:1: error: 'N' does not name a type
    9 | N = int(input())
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;

int main(){
  int N;
  cin >> N;
  int A[N];
  FOR(i,0,N){
    cin >>A[i];
  }

  int x=A[0];
  FOR(i,1,N){
    x = x*A[i]/gcd(x, A[i]);
  }

  int sum=0;
  FOR(i,0,N){
    sum += x/A[i];
  }

  cout << sum%(10e9-7) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:14: error: invalid operands of types 'int' and 'double' to binary 'operator%'
   47 |   cout << sum%(10e9-7) << endl;
      |           ~~~^~~~~~~~~
      |           |        |
      |           int      double
Language: C++

def gcd(a,b):
	if b==0:
		return a
	else:
		return gcd(b,a%b)

def lcm(a,b):
	return a*b/gcd(a,b)

n=int(input())
a=[int(i) for i in input().split()]
tmp=1
for i in a:
	tmp=lcm(i,tmp)
mod=1e9+7
ans=int(0)
for i in a:
	ans=(ans+tmp/i)%mod
print(int(ans))

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

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
#define MAX 1000000

#if 1
//√MAXでアクセスができるようなvectorに全て突っ込む
map<ll,ll> lcm_all;
ll sieve_check[MAX+1]={0};//i番目が整数iに対応(1~100000)
//エラトステネスの篩を実装する
void es(){
  //0のところが素数、ここでは-1が素数でない
  for(ll i=2;i<=1000;i++){
    if(sieve_check[i]==0){
      lcm_all[i]=0;
      for(ll j=1;j<=floor(MAX/i);j++){
        if(j!=1) sieve_check[j*i]=-1;
      }
    }
  }
}
#endif

//n個の場合のlcmも2個で比べて順に適用していくだけ
signed main(){
  ll inf=pow(10,9)+7;
  ll n;cin >> n;
  vector<ll> a(n);for(ll i=0;i<n;i++){cin >> a[i];}
  es();
  vector< vector<ll> > prime_factors(n,vector<ll>(1001,0));
  for(ll i=0;i<n;i++){
    for(ll j=2;j<=1000;j++){
      while(a[i]%j==0){prime_factors[i][j]++;a[i]/=j;}
    }
    if(a[i]!=1) prime_factors[i][a[i]]=1;
  }
  for(ll i=0;i<n;i++){
    for(ll j=2;j<=1000;j++){
      if(lcm_all.find(j)!=lcm.end()){
        lcm_all[j]=max(prime_factors[i][j],lcm_all[j]);
      }
    }
  }
  ll cnt=0;
  for(ll i=0;i<n;i++){
    ll cnt_sub=1;
    for(auto& lcm_all_sub : lcm_all){
      cnt_sub*=pow(lcm_all_sub.first,lcm_all_sub.second-prime_factors[i][lcm_all_sub.first]);cnt_sub%=inf;
    }
    cnt+=cnt_sub;
    cnt%=inf;
  }
  cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:27: error: 'lcm' was not declared in this scope
   44 |       if(lcm_all.find(j)!=lcm.end()){
      |                           ^~~
Language: C++

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
#define MAX 1000000

#if 1
//√MAXでアクセスができるようなvectorに全て突っ込む
map<ll,ll> lcm_all;
ll sieve_check[MAX+1]={0};//i番目が整数iに対応(1~100000)
//エラトステネスの篩を実装する
void es(){
  //0のところが素数、ここでは-1が素数でない
  for(ll i=2;i<=1000;i++){
    if(sieve_check[i]==0){
      lcm_all[i]=0;
      for(ll j=1;j<=floor(MAX/i);j++){
        if(j!=1) sieve_check[j*i]=-1;
      }
    }
  }
}
#endif

//n個の場合のlcmも2個で比べて順に適用していくだけ
signed main(){
  ll inf=pow(10,9)+7;
  ll n;cin >> n;
  vector<ll> a(n);for(ll i=0;i<n;i++){cin >> a[i];}
  es();
  vector< vector<ll> > prime_factors(n,vector<ll>(1001,0));
  for(ll i=0;i<n;i++){
    for(ll j=2;j<1001;j++){
      while(a[i]%j==0){prime_factors[i][j]++;a[i]/=j;}
    }
    if(a[i]!=1) prime_factors[i][a[i]]=1;
  }
  for(ll i=0;i<n;i++){
    for(auto& now_sub : prime_factors[i]){
      lcm_all[now_sub.first]=max(now_sub.second,lcm_all[now_sub.first]);
    }
  }
  ll cnt=0;
  for(ll i=0;i<n;i++){
    ll cnt_sub=1;
    map<ll,ll> now=prime_factors[i];
    for(auto& lcm_all_sub : lcm_all){
      cnt_sub*=pow(lcm_all_sub.first,lcm_all_sub.second-now[lcm_all_sub.first]);cnt_sub%=inf;
    }
    cnt+=cnt_sub;
    cnt%=inf;
  }
  cout << cnt << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:23: error: request for member 'first' in 'now_sub', which is of non-class type 'long long int'
   44 |       lcm_all[now_sub.first]=max(now_sub.second,lcm_all[now_sub.first]);
      |                       ^~~~~
a.cc:44:42: error: request for member 'second' in 'now_sub', which is of non-class type 'long long int'
   44 |       lcm_all[now_sub.first]=max(now_sub.second,lcm_all[now_sub.first]);
      |                                          ^~~~~~
a.cc:44:65: error: request for member 'first' in 'now_sub', which is of non-class type 'long long int'
   44 |       lcm_all[now_sub.first]=max(now_sub.second,lcm_all[now_sub.first]);
      |                                                                 ^~~~~
a.cc:50:35: error: conversion from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<long long int> >, std::vector<long long int> >::value_type' {aka 'std::vector<long long int>'} to non-scalar type 'std::map<long long int, long long int>' requested
   50 |     map<ll,ll> now=prime_factors[i];
      |                                   ^
Language: C++

n=gets.to_i
A=gets.split.map(&:to_i)

L=A.inject:lcm
ans=A.map{|e|lcm/e}.inject:+

ans%=(10**9+7)
puts ans

Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n=gets.to_i
      | ^
a.cc:5:20: error: expected unqualified-id before '.' token
    5 | ans=A.map{|e|lcm/e}.inject:+
      |                    ^
Language: C++

N=gets.to_i
A=gets.split.map(&:to_i)

L=A.inject:lcm
ans=A.map{|e|lcm/e}.inject:+

ans%=(10**9+7)
puts ans

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N=gets.to_i
      | ^
a.cc:5:20: error: expected unqualified-id before '.' token
    5 | ans=A.map{|e|lcm/e}.inject:+
      |                    ^
Language: C++

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
typedef vector<vector<P>> vvP;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 1000010;

vl Prime(MAX_N, 1);  // Prime[i] : iが素数のとき1、iが素数でないとき0

void Eratosthenes(ll n) {  // n未満の素数を求める
    Prime[0] = Prime[1] = 0;
    for(ll i = 2; i*i < n; i++) {
        if(Prime[i]) {
            for(ll j = 2; i*j < n; j++) {
                Prime[i*j] = 0;
            }
        }
    }
}

// aのn乗を求める。計算量はO(logn)
ll modpow(ll a, ll n) {
    if(n == 0) {
        return 1;
    }
    if(n%2 == 1) {
        return (a * modpow(a, n-1))%mod;
    }
    return (modpow(a, n/2) * modpow(a, n/2))%mod;
}

ll inv[MAX_N];  // inv[i] : iの逆数のmod
ll fact[MAX_N];  // fact[i] : iの階乗のmod
ll invfact[MAX_N];

void init() {
    inv[0] = fact[0] = invfact[0] = 1;
    inv[1] = 1;
    for(ll i = 1; i < MAX_N; i++) {
        if(i >= 2) {
            inv[i] = mod - inv[mod%i]*(mod/i)%mod;
        }
        fact[i] = (i * fact[i-1])%mod;
        invfact[i] = inverse(fact[i]);
    }
}

//--- main関数でinit()を呼び出すのを忘れるな ---//
int main() {
    ll n;
    cin >> n; 

    Eratosthenes(MAX_N);
    init(); 

    vl a(n);
    vl emax(MAX_N);  // emax[i] : aの素因数iの指数の最大値(iが素数でないときは0)
    rep(x, n) {
        cin >> a[x];
        vl e(MAX_N);  // e[i] : a[x]の素因数iの指数(iが素数でないときは0)
        ll k = a[x];
        for(ll i = 2; i*i <= a[x]; i++) {
            if(Prime[i]) {
                while(k%i == 0) {
                    k /= i;
                    e[i]++;
                }
                chmax(emax[i], e[i]);
            }
        }
        if(k != 1) {
            e[k]++;
            chmax(emax[k], e[k]);
        }
    }

    ll LCM = 1;  // aのすべての要素のLCM
    rep(i, MAX_N) {
        if(Prime[i]) {
            LCM *= modpow(i, emax[i]);
            LCM %= mod;
        }
    }
    
    ll ans = 0;
    rep(i, n) {
        ans += LCM*inv[a[i]];
        ans %= mod;
    }

    out(ans);
    re0;
}



Compiler output:
a.cc: In function 'void init()':
a.cc:68:22: error: 'inverse' was not declared in this scope
   68 |         invfact[i] = inverse(fact[i]);
      |                      ^~~~~~~
Language: C++

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

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

long long int lcm(long long int a, long long int b) {
    return a * b / gcd(a, b);
}

int main() {
    long long int n;
    cin >> n;
    long long int a[n];
    for(int i=0; i<n; i++) cin >> a[i];
    unsigned long long int num = 1;
    for(int i=0; i<n; i++) {
      num = lcm(a[i], num) %= 1000000007;
    }
    unsigned long long ans = 0;
    for(int i=0; i<n; i++) ans += num/a[i];
    ans %= 1000000007;
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:23:16: error: lvalue required as left operand of assignment
   23 |       num = lcm(a[i], num) %= 1000000007;
      |             ~~~^~~~~~~~~~~
Language: C++

#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

int ctoi(const char c) {
	return c - '0';
}
int keta(int a) {
	return to_string(a).size();
}
int a[10010],m[1010];
signed main() {
	int n;
	cin>>n;
	rep(i,n){
		cin>>a[i];
		int s=a[i];
		for(int j=2;j*j<=s;++j){
			int memo=0;
			while(s%j==0){
				s/=j;
				memo++;
			}
			if(memo>m[j])m[j]=memo;
		}
	}
	int ans=0;
	rep(i,n){
		int sum=0;
		Rep(j,1010){
			int iwa=0;
			while(
}




Compiler output:
a.cc: In function 'int main()':
a.cc:135:1: error: expected primary-expression before '}' token
  135 | }
      | ^
a.cc:134:31: error: expected ')' before '}' token
  134 |                         while(
      |                              ~^
      |                               )
  135 | }
      | ~                              
a.cc:135:1: error: expected primary-expression before '}' token
  135 | }
      | ^
a.cc:135:2: error: expected '}' at end of input
  135 | }
      |  ^
a.cc:130:17: note: to match this '{'
  130 |         rep(i,n){
      |                 ^
a.cc:135:2: error: expected '}' at end of input
  135 | }
      |  ^
a.cc:114:15: note: to match this '{'
  114 | signed main() {
      |               ^
Language: Java

import java.util.*;
import java.math.*;
import java.io.*;
 
public class Main {
	
	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
				
		//int T = in.nextInt();
		//for(int t = 1; t <= T; ++t) {
			int n = in.nextInt();
			BigInteger a[] = new BigInteger[n];

			//System.out.print("Case " + t + ": ");
			BigInteger ans = in.nextBigInteger();
			a[0] = ans;
			for(int i = 1; i < n; ++i) {
				BigInteger x = in.nextBigInteger();
				a[i] = x;
				//BigInteger g = ans.gcd(x);
				if(ans.mod(x).equals(0)!=0)ans = ans.multiply(x).divide(ans.gcd(x));
			}
			BigInteger res=new BigInteger("0");
			BigInteger mm=new BigInteger("1000000007");
			for(int i=0;i<n;i++){
				res = res.add(ans.divide(a[i]));
				res=res.mod(mm);
			}
			System.out.println(res);
			System.gc();
	}
}


Compiler output:
Main.java:23: error: incomparable types: boolean and int
				if(ans.mod(x).equals(0)!=0)ans = ans.multiply(x).divide(ans.gcd(x));
				                       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod =  1e9 + 7;
const int maxn = 10'000 + 5;
const int maxv = 1'000'000 + 5;
int arr[maxn], pf[maxv];
ll modpow(ll base, ll power) {
    ll res = 1;
    while (power) {
        if (power & 1)
            res = res * base % mod;
        base = base * base % mod;
        power >>= 1;
    }
    return res;
}
void fac(int num) {
    int cnt = 0;
    if (num % 2 == 0) {
        while (num % 2 == 0) {
            ++cnt;
            num /= 2;
        }
        pf[2] = max(pf[2], cnt);
    }
    for (int i = 3; i <= bound && i <= num; i += 2) {
        if (num % i == 0) {
            cnt = 0;
            while (num % i == 0) {
                ++cnt;
                num /= i;
            }
            pf[i] = max(pf[i], cnt);
        }
    }
    if (num > 2)
        pf[num] = max(pf[num], 1);
}
int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int n; cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> arr[i];
        fac(arr[i]);
    }
    ll lcm = 1;
    for (int i = 2; i < maxv; ++i)
        lcm = lcm * modpow(i, pf[i]) % mod;
    ll res = 0;
    for (int i = 0; i < n; ++i)
        res = (res + lcm * modpow(arr[i], mod - 2) % mod) % mod;
    cout << res << '\n';
    return 0;
}

Compiler output:
a.cc: In function 'void fac(int)':
a.cc:27:26: error: 'bound' was not declared in this scope; did you mean 'round'?
   27 |     for (int i = 3; i <= bound && i <= num; i += 2) {
      |                          ^~~~~
      |                          round
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<climits>

#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll=long long;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

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

int lcm(int a, int b)
{
   return a * b / gcd(a, b);
}

int main()
{
  int MOD = 1000000007;
   int N;
   cin >> N;

   vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }

  Bint x = 1;
  for (int i = 0; i < N; i++) {
    x = lcm(x, vec[i]);
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans += x / vec[i];
  }  

  cout << ans%MOD << endl;
  
}


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