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

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

const int M = 1e9+7;

vector<int> minp(1000005);
void soe() {
	for(int i = 0; i < 1000005; i++) minp[i] = i;
	for(int i = 2; i*i <= 1000005; i++) {
		if(minp[i] == i) {
			for(int j = i*i; j < 1000005; j += i) if(minp[j] == j) minp[j] = i;
		}
	}
}

map<int,int> lcm;
map<int,int> pfact(int n) {
	map<int,int> map;
	while(n != 1) {
		map[minp[n]]++;
		n /= minp[n];
	}
	for(auto p:map) {
		lcm[p.first] = max(lcm[p.first] , p.second);
	}
	return map;
}

int _power(int x , int p) {
	int res = 1;
	while(p) {
		if(p & 1) res = (res * x)%M;
		p /= 2;
		x = (x * x)%M;
	}
	return res;
}

int quot(map<int,int> &m) {
	int res = 1;
	for(auto p:lcm) {
		int power = p.second - m[p.first];
		res = (res * _power(p.first , power))%M;
	}
	return res;
}
 
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
	soe();
	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++) cin >> a[i];
	vector<map<int,int>> vec(n);
	for(int i = 0; i < n; i++) {
		vec[i] = pfact(a[i]);
	}
	int ans = 0;
	for(int i = 0; i < n; i++) {
		int res = quot(vec[i]);
		ans = (ans + res)%M;
	}
	cout << ans << "\n";
		
    return 0;
}


Compiler output:
a.cc: In function 'std::map<long long int, long long int> pfact(long long int)':
a.cc:26:17: error: reference to 'lcm' is ambiguous
   26 |                 lcm[p.first] = max(lcm[p.first] , p.second);
      |                 ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:1:
/usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)'
  188 |     lcm(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:18:14: note:                 'std::map<long long int, long long int> lcm'
   18 | map<int,int> lcm;
      |              ^~~
a.cc:26:36: error: reference to 'lcm' is ambiguous
   26 |                 lcm[p.first] = max(lcm[p.first] , p.second);
      |                                    ^~~
/usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)'
  188 |     lcm(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:18:14: note:                 'std::map<long long int, long long int> lcm'
   18 | map<int,int> lcm;
      |              ^~~
a.cc: In function 'long long int quot(std::map<long long int, long long int>&)':
a.cc:43:20: error: reference to 'lcm' is ambiguous
   43 |         for(auto p:lcm) {
      |                    ^~~
/usr/include/c++/14/numeric:188:5: note: candidates are: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Mn, _Nn> std::lcm(_Mn, _Nn)'
  188 |     lcm(_Mn __m, _Nn __n) noexcept
      |     ^~~
a.cc:18:14: note:                 'std::map<long long int, long long int> lcm'
   18 | map<int,int> lcm;
      |              ^~~
Language: C++

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

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

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

long long LCM(vector<long long> x) {
  ans = lcm(x[0], x[1]);
  for (long long i = 0; i < x.size(); i++) {
    ans = lcm(ans, x[i]);
  }
  return ans;
}

int main() {
  int N;
  vector<ll> A(N);
  ll sum = 0;
  ll const devider = 10e9 + 7;
  for (ll i = 0; i < N; i++) cin >> A[i];
  ll const x = LCM(A);
  for (ll i = 0; i < N; i++) sum += x / A[i];

  cout << x % devider << endl;
  return 0;
}


Compiler output:
a.cc: In function 'long long int LCM(std::vector<long long int>)':
a.cc:19:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |   ans = lcm(x[0], x[1]);
      |   ^~~
      |   abs
Language: C++

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

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

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

long long LCM(vector<long long> x) {
  ans = lcm(x[0], x[1]);
  for (long long i = 0; i < x.size(); i++) {
    ans = lcm(ans, x[i]);
  }
  return ans;
}

int main() {
  int N;
  vector<ll> A(N);
  ll sum = 0;
  for (ll i = 0; i < N; i++) cin >> A[i];
  ll const x = LCM(A);
  for (ll i = 0; i < N; i++) sum += x / A[i];

  cout << x % (10e9 + 7) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'long long int LCM(std::vector<long long int>)':
a.cc:19:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |   ans = lcm(x[0], x[1]);
      |   ^~~
      |   abs
a.cc: In function 'int main()':
a.cc:34:13: error: invalid operands of types 'const ll' {aka 'const long long int'} and 'double' to binary 'operator%'
   34 |   cout << x % (10e9 + 7) << endl;
      |           ~ ^ ~~~~~~~~~~
      |           |         |
      |           |         double
      |           const ll {aka const long long int}
Language: Java

import java.util.*;
import java.io.*;
public class Main{
/// functions
static long gcd(long a,long b){if(b==0){return a;}return gcd(b,a%b);}
static long Modpow(long a,long p,long m){if(p==1){return a;}long x=Modpow(a,p/2,m);x=(x*x)%m;return (p&1l)!=0? (x*a)%m:x;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
// end
static long[] f;

public static void main(String[] args) throws FileNotFoundException, IOException{
       Scanner s=new Scanner(System.in);
       StringBuilder sb=new StringBuilder();
       BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
       int n=s.nextInt();
        int[] arr=new int[n];
        long mod=(long)1e9+7;
        Map<Integer,Integer>map=new HashMap<>();
        for(int i=0;i<n;i++){arr[i]=s.nextInt();}
        	long res=0;
        for(int i=0;i<n;i++){
        	int tmp=arr[i];
        	for(int j=2;j*j<=k;j++){
        		if(tmp%j==0){
        			int count=0;
        		while(tmp%j==0){count++;tmp/=j;}
        		map.put(j,Math.max(map.getOrDefault(j,0),count));
        		}
        	}
        	if(tmp!=1){map.put(tmp,Math.max(map.getOrDefault(tmp,0),1));}
        }
        long lcm=1;
        for(int x:map.keySet()){
        	lcm=Modmul(lcm,Modpow(x,map.get(x),mod),mod);
        }
        for(int i=0;i<n;i++){
        	res=(res+Modmul(lcm,ModInv(arr[i],mod),mod))%mod;
        }
       out.write(res+"");
        out.flush();
  }
}


Compiler output:
Main.java:25: error: cannot find symbol
        	for(int j=2;j*j<=k;j++){
        	                 ^
  symbol:   variable k
  location: class Main
1 error
Language: C++

MOD = 1000000007
 
 
def GCD(a, b):
    if b == 0:
        return a
    else:
        return GCD(b, a % b)
 
 
def modinv(a, mod=MOD):
    b = mod
    u = 1
    v = 0
    while b > 0:
        t = a // b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    u %= mod
    if u < 0:
        u += mod
    return u
 
 
def LCM(a, b):
    return (a // GCD(a, b)) * b
 
 
n = int(input())
a = list(map(int, input().split()))
 
l = 1
for i in range(n):
    l = LCM(l, a[i])
ans = 0
l %= MOD
for i in range(n):
    ans += l /a[i]
    ans %= MOD
print(ans)

Compiler output:
a.cc:1:1: error: 'MOD' does not name a type
    1 | MOD = 1000000007
      | ^~~
Language: C

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
int acs(const void *a, const void *b){return *(int*)a - *(int*)b;} /* 1,2,3,4.. */
int des(const void *a, const void *b){return *(int*)b - *(int*)a;} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b){return *(char*)a - *(char*)b;} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b){return strcmp(*(const char **)a, *(const char **)b);} /* aaa,aab.. */
#define min(a,b) (a < b ? a: b)
#define max(a,b) (a > b ? a: b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 10001
#define MOD 1000000007

typedef long long int lli;


void swap(lli *a, lli *b)
{
  lli tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}

// a ÷ b (mod MOD) →(a % MOD) * modinv(b, MOD) % MDO
lli modinv(lli a, lli m) {
    lli b = m, u = 1, v = 0;
    while (b) {
        lli t = a / b;
        a -= t * b; swap(&a, &b);
        u -= t * v; swap(&u, &v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}


lli Gcd(lli x, lli y)
{
  if (y == 0) return x;
  return Gcd(y, x % y);
}

int main(void) {
  lli n;
  scanf("%lld", &n);
  lli a[MAX];
  rep(i, 0, n) scanf("%lld", &a[i]);

  lli lcm = a[0];
  rep(i, 1, n) {
    lli gcd = Gcd(a[i], lcm);
    lcm = lcm * a[i] / gcd; 
  }
  lli ans = 0;
  rep(i, 0, n) {
    ans = (ans + (lcm * modinv(a[i], MOD) % MOD) % MOD;
  }
  printf("%lld\n", ans);
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:62:55: error: expected ')' before ';' token
   62 |     ans = (ans + (lcm * modinv(a[i], MOD) % MOD) % MOD;
      |           ~                                           ^
main.c:62:56: error: expected ';' before '}' token
   62 |     ans = (ans + (lcm * modinv(a[i], MOD) % MOD) % MOD;
      |                                                        ^
      |                                                        ;
   63 |   }
      |   ~
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long MOD=1000000007;
long power(long x,long p){return (p==0?1:(p%2?power(x,p-1)*x%MOD:power(x,p/2)*power(x,p/2)%MOD));}
int main(){
  long N;cin>>N;
  long M=0;
  vector<long>A(N);for(long i=0;i<N;i++){cin>>A[i];M=max(M,A[i]);}
  vector<bool>IP(M+1,1);IP[0]=0;IP[1]=0;
  set<long>P;
  for(long i=2;i<=M;i++)if(IP[i]){
    P.insert(i);
    for(long j=2;j*i<=M;j++)IP[i*j]=0;
  }
  //Lの計算
  vector<long>L(P.size(),0);
  set<long>S;
  vector<long>SL(M+1);
  for(long i=0;i<N;i++){
    vector<long>C(P.size(),0);
    long t=A[i];
    long j=0;
    for(long p:P){
      while(t>1&&t%p==0){
        S.insert(p);SL[p]=j;
        t/=p;C[j]++;L[j]=max(L[j],C[j]);}
      if(t<=1)break;
      j++;
    }
  }
  //Sの要素に対して, それが何番目の素数であるか
  /*
  long ans=0;
  for(long i=0;i<N;i++){
    long t=A[i],b=1;
    for(long s:S){
      long c=0;
      while(t>1&&t%s==0){
        c++;
        t/=s;
      }
      b=b*power(s,L[SL[s]]-c)%MOD;
    }
    ans=(ans+b)%MOD;
  }*/
  cout<<ans;  
}


/*

素数を前に計算して頑張る



*/



Compiler output:
a.cc: In function 'int main()':
a.cc:46:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   46 |   cout<<ans;
      |         ^~~
      |         abs
Language: C++

#include <bits/stdc++.h> 

using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()
#define int ll

ull modpow(ull x,ull n){
  if(n==0)return 1;
  if(n%2)return ((x%MOD)*(modpow(x,n-1)%MOD))%MOD;
  else {
    ll half=modpow(x,n/2)%MOD;
    return (half*half)%MOD;
  }
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  int N;
  cin>>N;
  vector<ull>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  vector<ull>B=A;

  vector<bool>p(1001,true);
  p[0]=false,p[1]=false;
  for(int i=2;i<=1000;i++){
    if(p[i])for(int j=i+i;j<=1000;j+=i)p[j]=false;
  }
  vector<int>pp;
  for(int i=0;i<=1000;i++)if(p[i])pp.push_back(i);
  vector<vector<int>>m(pp.size(),vector<int>(N,0));

  set<int>b;
  for(int i=0;i<N;i++){
    for(int j=0;j<pp.size();j++){
      while(B[i]%pp[j]==0){
        m[j][i]++;
        B[i]/=pp[j];
      }
    }
    if(B[i]!=1)b.insert(B[i]);
  }
  int LCM=1;
  for(int i=0;i<pp.size();i++){
    LCM=((LCM%MOD)*(modpow(pp[i],*max_element(rng(m[i])))%MOD))%MOD;
  }
  for(auto it:b){
    LCM=((LCM%MOD)*(it%MOD));
  }
  int ans=0;
  for(int i=0;i<N;i++)ans=((ans%MOD)+(LCM*(modpow(A[i],MOD-2)))%MOD)%MOD;
  cout<<ans<<endl;
  return 0;
}


Compiler output:
a.cc:12:13: error: '::main' must return 'int'
   12 | #define int ll
      |             ^~
a.cc:23:1: note: in expansion of macro 'int'
   23 | int main(){
      | ^~~
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/math/common_factor_rt.hpp>

namespace mp = boost::multiprecision;
typedef mp::cpp_int BigInt;
typedef long long ll;

const ll MOD = 1000000007; // 1e9 + 7

ll modInv(ll a, ll modVal) {
    ll b = modVal, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; std::swap(a, b);
        u -= t * v; std::swap(u, v);
    }
    u %= modVal; 
    if (u < 0) u += modVal;
    return u;
}

ll solve(const std::vector<ll> a)
{
    const ll n = a.size();
    ll m = a[0];
    std::vector<ll> lcmArray;

    BigInt mBigInt = a[0];
    for (int i = 1; i < n; i++) {
        mBigInt = boost::math::lcm(mBigInt, a[i]);
    }

    m = static_cast<ll>(mBigInt % MOD);

    ll sum = 0;
    for (int i = 0; i < n; i++) {
        sum += m * modInv(a[i], MOD);
        sum %= MOD;
    }

    return sum;
}

int main(int argc, char *argv[])
{
    ll n;
    std::vector<ll> a;

    std::cin >> n;

    a.resize(n);

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

    ll ans = solve(a);

    std::cout << ans << std::endl;

    return 0;
}


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

#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/integer/common_factor_rt.hpp>

namespace mp = boost::multiprecision;
typedef mp::cpp_int BigInt;
typedef long long ll;

const ll MOD = 1000000007; // 1e9 + 7

ll modInv(ll a, ll modVal) {
    ll b = modVal, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; std::swap(a, b);
        u -= t * v; std::swap(u, v);
    }
    u %= modVal; 
    if (u < 0) u += modVal;
    return u;
}

ll solve(const std::vector<ll> a)
{
    const ll n = a.size();
    ll m = a[0];
    std::vector<ll> lcmArray;

    BigInt mBigInt = a[0];
    for (int i = 1; i < n; i++) {
        mBigInt = boost::math::lcm(mBigInt, a[i]);
    }

    m = static_cast<ll>(mBigInt % MOD);

    ll sum = 0;
    for (int i = 0; i < n; i++) {
        sum += m * modInv(a[i], MOD);
        sum %= MOD;
    }

    return sum;
}

int main(int argc, char *argv[])
{
    ll n;
    std::vector<ll> a;

    std::cin >> n;

    a.resize(n);

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

    ll ans = solve(a);

    std::cout << ans << std::endl;

    return 0;
}


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

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

#define MAX 1000000
#define MOD 1000000007
vector<int> p;
void prime(){
  for(int i=2;i<=1000000;i++){
    bool flag=true;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
        flag=false;
        break;
      }
    }
    if(flag){
      p.push_back(i);
    }
  }
}


long int modpow(long int a,long int n){
  long int res=1;
  while(n>0){
    if(n&1){      
      res=(res*a)%MOD;
    }
    a=(a*a)%MOD;
    n>>=1;
  }
  return res;
}

long int modinv(long int a){
  return modpow(a,MOD-2,MOD);
}


int main(){
  int N;
  cin>>N;
  vector<long int> A(N);
  
  prime();
  vector<int> p_count(p.size(),0);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    int x=A.at(i);
    for(int j=0;j<p.size();j++){
      if(x==1){
        break;
      }
      int count=0;
      while(x%p.at(j)==0){
        x/=p.at(j);
        count++;
      }
      p_count.at(j)=max(p_count.at(j),count);
    }
  }

  long int M=1;
  for(int i=0;i<p.size();i++){
    M=M*modpow(p.at(i),p_count.at(i))%MOD;
  }

  long int sum=0;
  for(int i=0;i<N;i++){
    sum=(sum+M*modinv(A.at(i))%MOD)%MOD;
  }
  cout<<sum<<endl;
}



Compiler output:
a.cc: In function 'long int modinv(long int)':
a.cc:36:16: error: too many arguments to function 'long int modpow(long int, long int)'
   36 |   return modpow(a,MOD-2,MOD);
      |          ~~~~~~^~~~~~~~~~~~~
a.cc:23:10: note: declared here
   23 | long int modpow(long int a,long int n){
      |          ^~~~~~
Language: C++

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

#define MAX 1000000
#define MOD 1000000007
vector<int> p;
void prime(){
  for(int i=2;i<=1000000;i++){
    bool flag=true;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
        flag=false;
        break;
      }
    }
    if(flag){
      p.push_back(i);
    }
  }
}


long int modpow(long int a,long int n,long int mod){
  long int res=1;
  while(n>0){
    if(n&1){      
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}


int main(){
  int N;
  cin>>N;
  vector<long int> A(N);
  
  prime(0);
  vector<int> p_count(p.size(),0);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    x=A.at(i);
    for(int j=0;j<p.size();j++){
      if(x==1){
        break;
      }
      int count=0;
      while(x%p.at(j)==0){
        x/=p.at(j);
        count++;
      }
      p_count.at(j)=max(p_count.at(j),count);
    }
  }

  long int M=1;
  for(int i=0;i<p.size();i++){
    M=M*modpow(p.at(i),p_count.at(i),MOD)%MOD;
  }

  long int sum=0;
  for(int i=0;i<N;i++){
    sum=(sum+(M%MOD)*modinv(A.at(i),MOD)%MOD)%MOD;
  }
  cout<<sum<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:45:8: error: too many arguments to function 'void prime()'
   45 |   prime(0);
      |   ~~~~~^~~
a.cc:7:6: note: declared here
    7 | void prime(){
      |      ^~~~~
a.cc:49:5: error: 'x' was not declared in this scope
   49 |     x=A.at(i);
      |     ^
Language: C++

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

#define MAX 1000000
#define MOD 1000000007
vector<int> p;
void prime(int &A){
  for(int i=2;i<=A;i++){
    bool flag=true;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
        flag=false;
        break;
      }
    }
    if(flag){
      p.push_back(i);
    }
  }
}


long int modpow(long int a,long int n,long int &mod){
  long int res=1;
  while(n>0){
    if(n&1){      
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

long int modinv(long int &a,long int &mod){
  return modpow(a,mod-2,mod);
}


int main(){
  int N;
  cin>>N;
  vector<long int> A(N);
  int k=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    k=max<int>(k,A.at(i));
  }

  vector<long int> B=A;

  prime(k);
  vector<int> p_count(p.size(),0);
  for(int i=0;i<N;i++){
    for(int j=0;j<p.size();j++){
      if(B.at(i)==1){
        break;
      }
      int count=0;
      while(B.at(i)%p.at(j)==0){
        B.at(i)/=p.at(j);
        count++;
      }
      p_count.at(j)=max(p_count.at(j),count);
    }
  }

  long int M=1;
  for(int i=0;i<p.size();i++){
    M=M*modpow(p.at(i),p_count.at(i),MOD)%MOD;
  }

  long int sum=0;
  for(int i=0;i<N;i++){
    sum=(sum+(M%MOD)*modinv(A.at(i),MOD)%MOD)%MOD;
  }
  cout<<sum<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'int'
    5 | #define MOD 1000000007
      |             ^~~~~~~~~~
a.cc:70:38: note: in expansion of macro 'MOD'
   70 |     M=M*modpow(p.at(i),p_count.at(i),MOD)%MOD;
      |                                      ^~~
a.cc:23:49: note:   initializing argument 3 of 'long int modpow(long int, long int, long int&)'
   23 | long int modpow(long int a,long int n,long int &mod){
      |                                       ~~~~~~~~~~^~~
a.cc:5:13: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'int'
    5 | #define MOD 1000000007
      |             ^~~~~~~~~~
a.cc:75:37: note: in expansion of macro 'MOD'
   75 |     sum=(sum+(M%MOD)*modinv(A.at(i),MOD)%MOD)%MOD;
      |                                     ^~~
a.cc:35:39: note:   initializing argument 2 of 'long int modinv(long int&, long int&)'
   35 | long int modinv(long int &a,long int &mod){
      |                             ~~~~~~~~~~^~~
Language: C++

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

#define MAX 1000000
#define MOD 1000000007
vector<int> p;
void prime(int A){
  for(int i=2;i<=A;i++){
    bool flag=true;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
        flag=false;
        break;
      }
    }
    if(flag){
      p.push_back(i);
    }
  }
}


long int modpow(long int a,long int n,long int mod){
  long int res=1;
  while(n>0){
    if(n&1){      
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}


int main(){
  int N;
  cin>>N;
  vector<long int> A(N);
  int k=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if(A.at(i)>k){
      k=A.at(i);
    }
  }

  vector<long int> B=A;

  prime(k);
  //COMinit();
  vector<int> p_count(p.size(),0);
  for(int i=0;i<N;i++){
    for(int j=0;j<p.size();j++){
      if(B.at(i)==1){
        break;
      }
      if(B.at(i)%modpow(p.at(j),p_count.at(j),MOD)==0){
        B.at(i)/=modpow(p.at(j),p_count.at(j).MOD);
        while(B.at(i)%p.at(j)==0){
          B.at(i)/=p.at(j);
          p_count.at(j)++;
        }
      }
    }
  }

  long int M=1;
  for(int i=0;i<p.size();i++){
    M=M*modpow(p.at(i),p_count.at(i),MOD)%MOD;
  }

  long int sum=0;
  for(int i=0;i<N;i++){
    sum=(sum+(M%MOD)*modinv(A.at(i),MOD)%MOD)%MOD;
  }
  cout<<sum<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:5:13: error: expected unqualified-id before numeric constant
    5 | #define MOD 1000000007
      |             ^~~~~~~~~~
a.cc:63:47: note: in expansion of macro 'MOD'
   63 |         B.at(i)/=modpow(p.at(j),p_count.at(j).MOD);
      |                                               ^~~
Language: C++

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

#define MAX 1000000
#define MOD 1000000007
vector<int> p;
void prime(int A){
  for(int i=2;i<=A;i++){
    bool flag=true;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
        flag=false;
        break;
      }
    }
    if(flag){
      p.push_back(i);
    }
  }
}


long int modpow(long int a,long int n,long int mod){
  long int res=1;
  while(n>0){
    if(n&1){      
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}


int main(){
  int N;
  cin>>N;
  vector<long int> A(N);
  int k=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if(A.at(i)>k){
      k=A.at(i);
    }
  }

  vector<long int> B=A;

  prime(k);
  //COMinit();
  vector<int> p_count(p.size(),0);
  for(int i=0;i<N;i++){
    for(int j=0;j<p.size();j++){
      if(B.at(i)==1){
        break;
      }
      if(B.at(i)%modpow(p.at(j),p_count.at(j),MOD)==0){
        B.at(i)/=modpow(a.at(j),p_count.at(j).MOD);
        while(B.at(i)%a.at(j)==0){
          B.at(i)/=a.at(j);
          p_count.at(j)++;
        }
      }
    }
  }

  long int M=1;
  for(int i=0;i<p.size();i++){
    M=M*modpow(p.at(i),p_count.at(i),MOD)%MOD;
  }

  long int sum=0;
  for(int i=0;i<N;i++){
    sum=(sum+(M%MOD)*modinv(A.at(i),MOD)%MOD)%MOD;
  }
  cout<<sum<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:63:25: error: 'a' was not declared in this scope
   63 |         B.at(i)/=modpow(a.at(j),p_count.at(j).MOD);
      |                         ^
a.cc:5:13: error: expected unqualified-id before numeric constant
    5 | #define MOD 1000000007
      |             ^~~~~~~~~~
a.cc:63:47: note: in expansion of macro 'MOD'
   63 |         B.at(i)/=modpow(a.at(j),p_count.at(j).MOD);
      |                                               ^~~
Language: C++

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

#define MAX 1000000
#define MOD 1000000007
vector<int> p;
void prime(int A){
  for(int i=2;i<=A;i++){
    bool flag=true;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
        flag=false;
        break;
      }
    }
    if(flag){
      p.push_back(i);
    }
  }
}


long int modpow(long int a,long int n,long int mod){
  long int res=1;
  while(n>0){
    if(n&1){       //nのbitと...00001を比較  nが2で割り切れるならtrue
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

long int fac[MAX],finv[MAX],inv[MAX];

void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<MAX;i++){
    fac[i]=(fac[i-1]*i)%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}

long int COM(int n,int k){
  if(n<k){
    return 0;
  }
  if(n<0||k<0){
    return 0;
  }
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}


int main(){
  int N;
  cin>>N;
  vector<long int> A(N);
  int k=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if(A.at(i)>k){
      k=A.at(i);
    }
  }

  vector<long int> B=A;

  prime(k);
  //COMinit();
  vector<int> p_count(p.size(),0);
  for(int i=0;i<N;i++){
    for(int j=0;j<p.size();j++){
      int count=0;
      while(B.at(i)%p.at(j)==0){
        B.at(i)/=p.at(j);
        count++;
      }
      if(count>p_count.at(j)){
        p_count.at(j)=count;
      }
    }
  }

  long int M=1;
  for(int i=0;i<p.size();i++){
    M=M*modpow(p.at(i),p_count.at(i),MOD);
  }

  long int sum=0;
  for(int i=0;i<N;i++){
    sum=(sum+(M%MOD)*modinv(A.at(i))%MOD)%MOD;
  }
  cout<<sum<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:100:28: error: too few arguments to function 'long int modinv(long int, long int)'
  100 |     sum=(sum+(M%MOD)*modinv(A.at(i))%MOD)%MOD;
      |                      ~~~~~~^~~~~~~~~
a.cc:35:10: note: declared here
   35 | long int modinv(long int a,long int mod){
      |          ^~~~~~
Language: C++

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

#define MAX 1000000
#define MOD 1000000007
vector<int> p;
void prime(int A){
  for(int i=2;i<=A;i++){
    bool flag=true;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
        flag=false;
        break;
      }
    }
    if(flag){
      p.push_back(i);
    }
  }
}


long int modpow(long int a,long int n,long int mod){
  long int res=1;
  while(n>0){
    if(n&1){       //nのbitと...00001を比較  nが2で割り切れるならtrue
      res=(res*a)%mod;
    }
    a=(a*a)%mod;
    n>>=1;
  }
  return res;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

long int fac[MAX],finv[MAX],inv[MAX];

void COMinit(){
  fac[0]=fac[1]=1;
  finv[0]=finv[1]=1;
  inv[1]=1;
  for(int i=2;i<MAX;i++){
    fac[i]=(fac[i-1]*i)%MOD;
    inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
    finv[i]=finv[i-1]*inv[i]%MOD;
  }
}

long int COM(int n,int k){
  if(n<k){
    return 0;
  }
  if(n<0||k<0){
    return 0;
  }
  return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}


int main(){
  int N;
  cin>>N;
  vector<long int> A(N);
  int k=0;
  for(int i=0;i<N;i++){
    cin>>A.at(i);
    if(A.at(i)>k){
      k=A.at(i);
    }
  }

  vector<long int> B=A;

  prime(k);
  //COMinit();
  vector<int> p_count(p.size(),0);
  for(int i=0;i<N;i++){
    for(int j=0;j<p.size();j++){
      int count=0;
      while(B.at(i)%p.at(j)==0){
        B.at(i)/=p.at(j);
        count++;
      }
      if(count>p_count.at(j)){
        p_count.at(j)=count;
      }
    }
  }

  long int M=1;
  for(int i=0;i<p.size();i++){
    M=M*modpow(p.at(i),p_count.at(i),MOD);
  }

  long int sum=0;
  for(int i=0;i<N;i++){
    sum=(sum+(M%MOD)*modinv[A.at(i)]%MOD)%MOD;
  }
  cout<<sum<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:100:36: warning: pointer to a function used in arithmetic [-Wpointer-arith]
  100 |     sum=(sum+(M%MOD)*modinv[A.at(i)]%MOD)%MOD;
      |                                    ^
a.cc:100:21: error: invalid operands of types 'long int' and 'long int(long int, long int)' to binary 'operator*'
  100 |     sum=(sum+(M%MOD)*modinv[A.at(i)]%MOD)%MOD;
      |              ~~~~~~~^~~~~~~~~~~~~~~~
      |                |                   |
      |                long int            long int(long int, long int)
Language: C++

#include<bits/stdc++.h>
using namespace std;
int MIN(int x,int y)   //先求两个数的最小公倍数的函数
{    
	int i,z,min,max;
	if(x == 0)
		return y;      //先考虑x,y为0的情况，在这儿出过错
	if(y == 0)
		return x;
	if(x<y)
		z=x;
	else z=y;
	for(i = z;i >= 1;i--)
	{              
		if(x%i==0&&y%i==0)    
		{                    //求出两个数的最大公约数数
			max = i;
			break;
		}
	}
	min = (x/max)*y;     //x*y=min*max 
	min=min%(10^9+7);
	return min;
}
int main()
{
	int n;
	cin>>n;
	int a[n];
	for (int i=1;i<=n;i++)
	{
		cin>>a[i];
	}           
	for(int i = 1;i <= n-1;i++)    
	{                             
		min = MIN(min,a[i]);   
	}
	int ans=0;
	for (int i=1;i<=n;i++)
	{
		ans=ans+min/a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:36:26: error: cannot resolve overloaded function 'min' based on conversion to type 'int'
   36 |                 min = MIN(min,a[i]);
      |                       ~~~^~~~~~~~~~
a.cc:41:28: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator/'
   41 |                 ans=ans+min/a[i];
      |                         ~~~^~~~~
Language: Java

#include<bits/stdc++.h>

using namespace std;
#define ll long long

const int N = 10005, P = 1000000007;
int n, ans, a[N], f[1000005];
int Pow(ll x, int y=P-2){
	int ans=1;
	for(; y; y>>=1, x=x*x%P) if(y&1) ans=ans*x%P;
	return ans;
}
int main() {
	scanf("%d", &n);
	for(int i=1; i<=n; ++i){
		scanf("%d", a+i);
		int x=a[i];
		for(int j=2; j*j<=x; ++j) if(x%j==0){
			int cnt=1;
			while((x/=j)%j==0) ++cnt;
			f[j]=max(f[j], cnt);
		}
		if(x>1) f[x]=max(f[x], 1);
	}
	int s=1;
	for(int i=1; i<=1000000; ++i) while(f[i]--) s=(ll)s*i%P;
	for(int i=1; i<=n; ++i) ans=(ans+(ll)s*Pow(a[i]))%P;
	printf("%d\n", ans);
	return 0;
}



Compiler output:
Main.java:1: error: illegal character: '#'
#include<bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include<bits/stdc++.h>
        ^
Main.java:4: error: illegal character: '#'
#define ll long long
^
Main.java:4: error: class, interface, enum, or record expected
#define ll long long
        ^
Main.java:7: error: class, interface, enum, or record expected
int n, ans, a[N], f[1000005];
^
Main.java:8: error: unnamed classes are a preview feature and are disabled by default.
int Pow(ll x, int y=P-2){
^
  (use --enable-preview to enable unnamed classes)
Main.java:8: error: ',', ')', or '[' expected
int Pow(ll x, int y=P-2){
                   ^
Main.java:14: error: illegal start of expression
	scanf("%d", &n);
	            ^
8 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
int MIN(int x,int y)   //先求两个数的最小公倍数的函数
{    
	int i,z,min,max;
	if(x == 0)
		return y;      //先考虑x,y为0的情况，在这儿出过错
	if(y == 0)
		return x;
	if(x<y)
		z=x;
	else z=y;
	for(i = z;i >= 1;i--)
	{              
		if(x%i==0&&y%i==0)    
		{                    //求出两个数的最大公约数数
			max = i;
			break;
		}
	}
	min = (x/max)*y;     //x*y=min*max 
	min=min%(10^9+7);
	return min;
}
int main()
{
	int n;
	cin>>n;
	int a[n];
	for (int i=1;i<=n;i++)
	{
		cin>>a[i];
	}           
	for(i = 1;i <= n-1;i++)    
	{                             
		min = MIN(min,a[i]);   
	}
	int ans=0;
	for (int i=1;i<=n;i++)
	{
		ans=ans+min/a[i];
	}
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:13: error: 'i' was not declared in this scope
   34 |         for(i = 1;i <= n-1;i++)
      |             ^
a.cc:41:28: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator/'
   41 |                 ans=ans+min/a[i];
      |                         ~~~^~~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;
 
int64_t gyaku(int64_t a){
  int64_t s = 1;
  vector<int64_t> v(40);
  v[0] = a % 1000000007;
  rep(i, 39) v[i+1] = v[i] * v[i] % 1000000007;
  string t = "111011100110101100101000000101";
  rep(i, t.size()){
    if(t[t.size()-1-i] == '1'){
    s *= v[i];
    s %= 1000000007;
    }
  }
  return s;
}
 
int main() {
  map<int64_t, int64_t> m;
  int64_t n;
  cin >> n;
  vector<int64_t> v(n);
  rep(i, n) cin >> v[i];
  rep(i, n){
    int64_t a = v[i];
    for(int64_t j = 2; j <= pow(v[i], 0.5); ++j){
      int64_t b = 0;
      while(a % j == 0){
        a /= j;
        ++b;
      }
      if(b != 0) m[j] = max(m[j], b);
      if(a < i+1) break;
    }
      if(a != 1&&m[a]==0) m[a]1;
  }
  int64_t t = 1, s = 0, mod = 1000000007;
  for(auto p: m){
    rep(i, p.second){
      t *= p.first;
      t %= mod;
    }
  }
  rep(i, n){
    s += t * gyaku(v[i]);
    s %= mod;
  }
  cout << s << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:31: error: expected ';' before numeric constant
   38 |       if(a != 1&&m[a]==0) m[a]1;
      |                               ^
      |                               ;
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;
 
int64_t gyaku(int64_t a){
  int64_t s = 1;
  vector<int64_t> v(40);
  v[0] = a % 1000000007;
  rep(i, 39) v[i+1] = v[i] * v[i] % 1000000007;
  string t = "111011100110101100101000000101";
  rep(i, t.size()){
    if(t[t.size()-1-i] == '1'){
    s *= v[i];
    s %= 1000000007;
    }
  }
  return s;
}
 
int main() {
  map<int64_t, int64_t> m;
  int64_t n;
  cin >> n;
  vector<int64_t> v(n);
  rep(i, n) cin >> v[i];
  rep(i, n){
    int64_t a = v[i];
    for(int64_t j = 2; j <= pow(v[i], 0.5); ++j){
      int64_t b = 0;
      while(a % j == 0){
        a /= j;
        ++b;
      }
      if(b != 0) m[j] = max(m[j], b);
      if(a < i+1) break;
    }
    if(a != 1) m[a] = max(m[a],1LL);
  }
  int64_t t = 1, s = 0, mod = 1000000007;
  for(auto p: m){
    rep(i, p.second){
      t *= p.first;
      t %= mod;
    }
  }
  rep(i, n){
    s += t * gyaku(v[i]);
    s %= mod;
  }
  cout << s << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:26: error: no matching function for call to 'max(std::map<long int, long int>::mapped_type&, long long int)'
   38 |     if(a != 1) m[a] = max(m[a],1LL);
      |                       ~~~^~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:38:26: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   38 |     if(a != 1) m[a] = max(m[a],1LL);
      |                       ~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:38:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   38 |     if(a != 1) m[a] = max(m[a],1LL);
      |                       ~~~^~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;
 
int64_t gyaku(int64_t a){
  int64_t s = 1;
  vector<int64_t> v(40);
  v[0] = a % 1000000007;
  rep(i, 39) v[i+1] = v[i] * v[i] % 1000000007;
  string t = "111011100110101100101000000101";
  rep(i, t.size()){
    if(t[t.size()-1-i] == '1'){
    s *= v[i];
    s %= 1000000007;
    }
  }
  return s;
}
 
int main() {
  map<int64_t, int64_t> m;
  int64_t n;
  cin >> n;
  vector<int64_t> v(n);
  rep(i, n) cin >> v[i];
  rep(i, n){
    int64_t a = v[i];
    for(int64_t j = 2; j <= pow(v[i], 0.5); ++j){
      int64_t b = 0;
      while(a % j == 0){
        a /= j;
        ++b;
      }
      if(b != 0) m[j] = max(m[j], b);
      if(a < i+1) break;
    }
    if(a != 1) m[a] = max(m[a],1);
  }
  int64_t t = 1, s = 0, mod = 1000000007;
  for(auto p: m){
    rep(i, p.second){
      t *= p.first;
      t %= mod;
    }
  }
  rep(i, n){
    s += t * gyaku(v[i]);
    s %= mod;
  }
  cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:26: error: no matching function for call to 'max(std::map<long int, long int>::mapped_type&, int)'
   38 |     if(a != 1) m[a] = max(m[a],1);
      |                       ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:38:26: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   38 |     if(a != 1) m[a] = max(m[a],1);
      |                       ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:38:26: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   38 |     if(a != 1) m[a] = max(m[a],1);
      |                       ~~~^~~~~~~~
Language: C++

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;

int64_t gyaku(int64_t a){
  int64_t s = 1;
  vector<int64_t> v(40);
  v[0] = a % 1000000007;
  rep(i, 39) v[i+1] = v[i] * v[i] % 1000000007;
  string t = "111011100110101100101000000101";
  rep(i, t.size()){
    if(t[t.size()-1-i] == '1'){
    s *= v[i];
    s %= 1000000007;
    }
  }
  return s;
}

int main() {
  map<int64_t, int64_t> m;
  int64_t n;
  cin >> n;
  vector<int64_t> v(n);
  rep(i, n) cin >> v[i];
  rep(i, n){
    int64_t a = v[i];
    for(int64_t j = 2; j <= pow(v[i], 0.5); ++j){
      int b = 0;
      while(a % j == 0){
        a /= j;
        ++b;
      }
      if(b != 0) m[j] = max(m[j], b);
      if(a < i+1) break;
    }
    if(a != 1) m[a] = 1;
  }
  int64_t t = 1, s = 0, mod = 1000000007;
  for(auto p: m){
    rep(i, p.second){
      t *= p.first;
      t %= mod;
    }
  }
  rep(i, n){
    s += t * gyaku(v[i]);
    s %= mod;
  }
  cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:35:28: error: no matching function for call to 'max(std::map<long int, long int>::mapped_type&, int&)'
   35 |       if(b != 0) m[j] = max(m[j], b);
      |                         ~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:35:28: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'int')
   35 |       if(b != 0) m[j] = max(m[j], b);
      |                         ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:35:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   35 |       if(b != 0) m[j] = max(m[j], b);
      |                         ~~~^~~~~~~~~
Language: C++

from fraction import gcd
n=int(input())
a=list(map(int,input().split()))
t=1
for i in a:
  t=t/gcd(t,i)*i
ans=0
MOD=1000000007
for i in a:
  ans+=t/i
  ans%=MOD
print(ans)


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

#include <iostream>
#include <vector>
#include <boost/math/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::math;
using namespace boost::multiprecision;

int modpow(auto x, int n, int mod)
{
    int res=1;
    for(; n>0; n>>=1) {
        if (n&1) res=res*x%mod;
        x=x*x%mod;
    }
    return res;
}

int main()
{
    int n; cin>>n;
    vector<int> a(n);
    cpp_int LCM=1;
    for(auto& e: a) {
        cin>>e;
        LCM=lcm(LCM, e);
    }
    const int MOD=1e9+7;

    int L=LCM%MOD;
    int res=0;
    for(auto& e: a) (res+=L*modpow(e, MOD-2, MOD))%=MOD;
    cout<<res<<endl;
}


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

#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int64_t i = 0; i < n; ++i)
using namespace std;

int64_t gyaku(int64_t a){
  int64_t s = 1;
  vector<int64_t> v(40);
  v[0] = a % 1000000007;
  rep(i, 39) v[i+1] = v[i] * v[i] % 1000000007;
  string t = "111011100110101100101000000101";
  rep(i, t.size()){
    if(t[t.size()-1-i] == '1'){
    s *= v[i];
    s %= 1000000007;
    }
  }
  return s;
}

int main() {
  map<int, int> m;
  int n;
  cin >> n;
  vector<int> v(n);
  rep(i, n) cin >> v[i];
  rep(i, n){
    int a = v[i];
    for(int j = 2; j <= pow(v[i], 0.5); ++j){
      int b = 0
      while(a % j == 0){
        a /= j;
        ++b;
      }
      if(b != 0) m[i] = max(m[i], b);
      if(a < i+1) break;
    }
    if(a != 1) m[a] = 1;
  }
  int64_t t = 1, s = 0, mod = 1000000007;
  for(auto p: m){
    rep(i, p.second){
      t *= p.first;
      t %= mod;
    }
  }
  rep(i, n){
    s += t * gyaku(v[i]);
    s %= mod;
  }
  cout << s << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:7: error: expected ',' or ';' before 'while'
   31 |       while(a % j == 0){
      |       ^~~~~
Language: C++

#include <cstring>
#include <iostream>
#define MOD 1000000007
using namespace std;
int a[10005];
long long f[10005],lf[10005],lcm=1;
void calc(int x)
{
 memset(f,0,sizeof(f));
 int x1=x;
 for(int i=2;x!=1&&x*x<=x1;i++)
 {
  while(x%i==0)
   x/=i,f[i]++;
  while(lf[i]<f[i])
   lcm=lcm*i%MOD,lf[i]++;
 }
 if(x)
 {
  f[i]++;
  while(lf[i]<f[i])
   lcm=lcm*i%MOD,lf[i]++;
 }
}
long long fpow(long long x,long long y)
{
 long long ans=1;
 while(y)
 {
  if(y&1)ans=ans*x%MOD;
  x=x*x%MOD;
  y>>=1;
 }
 return ans;
}
int main()
{
 int n,maxa=0;
 cin>>n;
 for(int i=1;i<=n;i++)
 {
  cin>>a[i];
  maxa=max(maxa,a[i]);
  calc(a[i]);
 }
 long long ans=0;
 for(int i=1;i<=n;i++)
  ans=(ans+lcm*fpow(a[i],MOD-2))%MOD;
 cout<<ans<<endl;
 return 0;
}

Compiler output:
a.cc: In function 'void calc(int)':
a.cc:20:5: error: 'i' was not declared in this scope
   20 |   f[i]++;
      |     ^
Language: C++

#include <iostream>
#include <vector>
#include <boost/math/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using namespace boost::math;
using namespace boost::multiprecision;

int main()
{
    int n; cin>>n;
    vector<cpp_int> a(n);
    cpp_int LCM=1;
    for(auto& e: a) {
        cin>>e;
        LCM=lcm(LCM, e);
    }
    int res=0;
    const int MOD=1e9+7;
    for(auto& e: a) (res+=LCM/e%MOD)%=MOD;
    cout<<res<<endl;
}


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

from functools import reduce
# python > pypy
MOD = 10**9 + 7
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

def gcd_list(numbers):
    return reduce(gcd, numbers)

def lcm_list(numbers):
    return reduce(lcm, numbers)

n = int(input())
a = list(map(int, input().split()))

lcm_ = lcm_list(a)
b = list(map(lambda x: lcm_//x, a))
ans = 0
for i in range(len(b)):
    ans += b[i]
print(ans%MOD)


Compiler output:
a.cc:2:3: error: invalid preprocessing directive #python
    2 | # python > pypy
      |   ^~~~~~
a.cc:1:1: error: 'from' does not name a type
    1 | from functools import reduce
      | ^~~~
Language: C++

import math
n = int(input())
a = list(map(int,input().split()))
lcm = 1
for v in a:
	lcm *= v//math.gcd(v,lcm)
ans = 0
for v in a:
	ans += lcm // v
print(ans%1000000007)

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

def gcd(a, b):
    while(b > 0):
        a = a%b
        c = b
        b = a
        a = c
    return a

n = int(input())
s = input()

s = s.split(" ")
# for i s:
#     x = int(input())
#     arr.append(x)

l = int(s[0])

for i in range(1, n):
    l = (l*int(s[i]))//gcd(l, int(s[i]))

ans = 0
for x in s:
    x = int(x)
    ans += l//x

print(ans%1000000007)




Compiler output:
a.cc:13:3: error: invalid preprocessing directive #for
   13 | # for i s:
      |   ^~~
a.cc:14:7: error: invalid preprocessing directive #x
   14 | #     x = int(input())
      |       ^
a.cc:15:7: error: invalid preprocessing directive #arr
   15 | #     arr.append(x)
      |       ^~~
a.cc:1:1: error: 'def' does not name a type
    1 | def gcd(a, b):
      | ^~~