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


#pragma GCC optimize ("O3")

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

using namespace std;

typedef int64_t ll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 10e16;
int inf = 10e8;
const int MOD = 1e9+7;

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "[ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "]";

    return os;
}

ll power(ll x, int p) {
    x %= MOD;
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * x) % MOD;
        x = (x * x) % MOD;
        p >>= 1;
    }

    return res;
}

map<ll, int> factorize(ll n, const vector<int> &pr) {
    map<ll, int> res;

    while(n > 1) {
        ++res[pr[n]];
        n /= pr[n];
    }

    return res;
}

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

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    
    int N;
    cin >> N;

    // soe
    vector<ll> pr(1000005);
    REP(i, pr.size()) pr[i] = i;

    for (int i=2; i * i < pr.size(); ++i) {
        if(pr[i] != i) continue;
        for (int j=i*i; j < pr.size(); j+=i) {
            if (pr[j] == j) pr[j] = i;
        }
    }

    // get lcm as prior
    map<ll, int> lcm;
    int a[N];
    REP(i, N) {
        cin >> a[i];

        map<ll, int> fa;
        fa = factorize(a[i], pr);

        for(auto p: fa) {
            lcm[p.fi] = max(lcm[p.fi], p.se);
        }
    }

    // get remainder of lcm
    ll LCM = 1;
    for(auto p: lcm) {
        LCM = (LCM * power(p.fi, p.se)) % MOD;
    }
    ll res = 0;
    REP(i, N) {
        ll val = LCM * power(a[i], MOD-2);
        res = (res + val) % MOD;
    }

    cout << fixed << setprecision(20);
    cout << res << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:89:30: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<long int>'
   89 |         fa = factorize(a[i], pr);
      |                              ^~
a.cc:48:49: note: in passing argument 2 of 'std::map<long int, int> factorize(ll, const std::vector<int>&)'
   48 | map<ll, int> factorize(ll n, const vector<int> &pr) {
      |                              ~~~~~~~~~~~~~~~~~~~^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> pint;
template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};

using mint = Fp<1000000007>;
vector<pint> prime_factorize(ll n){
  vector<pint> ans;
  for(ll i=2;i<=sqrt(n);i++){
    if(n%i!=0) continue;
    ll num=0;
    while(n%i==0){
      n/=i;
      num++;
    }
    ans.push_back(make_pair(i,num));
  }
  if(n!=1) ans.push_back(make_pair(n,1));
  return ans;
}

int main(){
  ll n;
  cin>>n;
  vector<ll> v(n);
  vector<ll> num(1100000,0);
  rep(i,n){
    cin>>v[i];
    auto pf=prime_factorize(v[i]);
    for(auto p:pf) num[p.first]=max(num[p.first],p.second);
  }
  mint LCM=1;
  rep(i,1100000){
    LCM*=modpow((mint)i,num[i]);
  }
  mint ans=0;
  rep(i,n){
    ans+=LCM/v[i];
  }
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:82:7: error: 'i' was not declared in this scope
   82 |   rep(i,n){
      |       ^
a.cc:82:3: error: 'rep' was not declared in this scope
   82 |   rep(i,n){
      |   ^~~
Language: C++

#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using BigInt = boost::multiprecision::cpp_int;

BigInt gcd(BigInt x, BigInt y) {
  while (y > 0){
    BigInt tmp = x % y;
    x = y;
    y = tmp;
  }
  return x;
}

BigInt lcm(BigInt x, BigInt y) {
  if (x == 0 || y == 0) return 0;
  else return x * y / gcd(x, y);
}

using namespace std;

class Combination {
 public:
  constexpr Combination() { Build(); }
  static constexpr int mod_ = 1000000007;
  static constexpr int n_ = 1000000 + 5;
  struct LookupTable {
    int64 factorial_[n_];
    int64 inverse_[n_];
    int64 finverse_[n_];
  };
  LookupTable lt{};

  // return nCk
  constexpr int64 Get(int n, int k) const noexcept {
    if (n < k || n < 0 || k < 0) return 0;
    return lt.factorial_[n] * (lt.finverse_[k] * lt.finverse_[n - k] % mod_) %
           mod_;
  }

 private:
  constexpr void Build() noexcept {
    lt.factorial_[0] = 1;
    lt.factorial_[1] = 1;
    lt.finverse_[0] = 1;
    lt.finverse_[1] = 1;
    lt.inverse_[1] = 1;
    for (int i = 2; i < n_; ++i) {
      lt.factorial_[i] = lt.factorial_[i - 1] * i % mod_;
      lt.inverse_[i] = mod_ - lt.inverse_[mod_ % i] * (mod_ / i) % mod_;
      lt.finverse_[i] = lt.finverse_[i - 1] * lt.inverse_[i] % mod_;
    }
  }
} kyomu;

BigInt MOD = 1000000007;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  int a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  
  BigInt l = 1;
  for (int i = 0; i < n; ++i) l = lcm(l, a[i]);
  BigInt ans = 0;
  for (int i = 0; i < n; ++i) (ans += l * kyomu.lt.inverse_[a[i]]) %= MOD;
  
  cout << ans << endl;
  
  return 0;
}


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 BigInt = boost::multiprecision::cpp_int;

using int64 = int64_t;

BigInt gcd(BigInt x, BigInt y) {
  while (y > 0){
    BigInt tmp = x % y;
    x = y;
    y = tmp;
  }
  return x;
}

BigInt lcm(BigInt x, BigInt y) {
  if (x == 0 || y == 0) return 0;
  else return x * y / gcd(x, y);
}

using namespace std;

class Combination {
 public:
  constexpr Combination() { Build(); }
  static constexpr int mod_ = 1000000007;
  static constexpr int n_ = 1000000 + 5;
  struct LookupTable {
    int64 factorial_[n_];
    int64 inverse_[n_];
    int64 finverse_[n_];
  };
  LookupTable lt{};

  // return nCk
  constexpr int64 Get(int n, int k) const noexcept {
    if (n < k || n < 0 || k < 0) return 0;
    return lt.factorial_[n] * (lt.finverse_[k] * lt.finverse_[n - k] % mod_) %
           mod_;
  }

 private:
  constexpr void Build() noexcept {
    lt.factorial_[0] = 1;
    lt.factorial_[1] = 1;
    lt.finverse_[0] = 1;
    lt.finverse_[1] = 1;
    lt.inverse_[1] = 1;
    for (int i = 2; i < n_; ++i) {
      lt.factorial_[i] = lt.factorial_[i - 1] * i % mod_;
      lt.inverse_[i] = mod_ - lt.inverse_[mod_ % i] * (mod_ / i) % mod_;
      lt.finverse_[i] = lt.finverse_[i - 1] * lt.inverse_[i] % mod_;
    }
  }
} kyomu;

BigInt MOD = 1000000007;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  BigInt a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  
  BigInt l = 1;
  for (int i = 0; i < n; ++i) l = lcm(l, a[i]);
  BigInt ans = 0;
  for (int i = 0; i < n; ++i) (ans *= kyomu.lt.inverse_[a[i]]) %= MOD;
  
  cout << ans << endl;
  
  return 0;
}


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<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 1e9+7
#define F first
#define S second
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)

bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}
int power(int x, unsigned int y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
int gcd(int a, int b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b); 
} 
signed main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  cin>>a[i];
  int lcm=a[0],hcf=a[0];
for(int i=1;i<n;i++)
  {
      hcf=gcd(lcm,a[i]);
      lcm=((lcm*a[i])/hcf)%M;
  }
int ans=0;
for(int i=0;i<n;i++)
    ans=(ans+(lcm/a[i]))%M;
cout<<ans<<endl;
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:48:27: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   48 |       lcm=((lcm*a[i])/hcf)%M;
      |           ~~~~~~~~~~~~~~~~^
      |                      |
      |                      long long int
a.cc:52:25: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   52 |     ans=(ans+(lcm/a[i]))%M;
      |         ~~~~~~~~~~~~~~~~^
      |             |
      |             long long int
Language: C++

#include<iostream>
#include<algorithm>
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
#define int long long
#define pi 3.141592653589793238462643383279502
#define M 1000000007
#define F first
#define S second
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)

bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}
int power(int x, unsigned int y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
signed main()
{
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
  cin>>a[i];
  int lcm=a[0],hcf=a[0];
  
  for(int i=1;i<n;i++)
  {
      hcf=__gcd(lcm,a[i]);
      lcm=((lcm*a[i])/hcf);
  }

for(int i=0;i<n;i++)
    ans=(ans+(lcm/a[i]))%M;
cout<<ans<<endl;
return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:47:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   47 |     ans=(ans+(lcm/a[i]))%M;
      |     ^~~
      |     abs
a.cc:48:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   48 | cout<<ans<<endl;
      |       ^~~
      |       abs
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <cmath>

using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

const ll mod = 1000000007;

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


    vector<ll> p;
    vector<ll > a(n);

    p.push_back(2);
    for (ll i = 3; i <= 2000; i += 2) {
        bool is_ok = true;
        ll max_i = sqrt(i) + 10;
         for(ll cur : p) {
            if (cur >= max_i) {
                break;
            }
            if (i % cur == 0) {
                is_ok = false;
                break;
            }
         }
         if (is_ok) {
            p.push_back(i);
         }
    }

    //vector<ll> ps(1000001,0);
    map<ll,ll> lcm;

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

        for(int i = 0; p[i] <= val * val; i++)
            int cur = p[i];

            ll count = 0;
            while (val % cur == 0) {
                val /= cur;
                count++;
            }
            if (count > 0) {
                lcm[cur] = max(count, lcm[cur]);
                if (val == 1) {
                    break;
                }
            }
        }
        if (val > 1) {
            lcm[val] = 1;
        }
    }

    ll ans = 0;
    
    for (int i = 0; i < n; i++) {
        ll cur = a[i];
        ll cur_ans = 1;
        for(auto itr : lcm) {
            ll k = itr.first;
            ll v = itr.second; 

            for (int i = 0; i < v; i++) {
                if (cur % k == 0) {
                    cur /= k; 
                } else {
                    cur_ans = (cur_ans * k) % mod;
                }
            }
        }
        ans = (ans + cur_ans) % mod;
    }
    
 	cout << ans << endl;
 	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:57:26: error: 'cur' was not declared in this scope
   57 |             while (val % cur == 0) {
      |                          ^~~
a.cc:62:21: error: 'cur' was not declared in this scope
   62 |                 lcm[cur] = max(count, lcm[cur]);
      |                     ^~~
a.cc:68:13: error: 'val' was not declared in this scope
   68 |         if (val > 1) {
      |             ^~~
a.cc: At global scope:
a.cc:75:5: error: expected unqualified-id before 'for'
   75 |     for (int i = 0; i < n; i++) {
      |     ^~~
a.cc:75:21: error: 'i' does not name a type
   75 |     for (int i = 0; i < n; i++) {
      |                     ^
a.cc:75:28: error: 'i' does not name a type
   75 |     for (int i = 0; i < n; i++) {
      |                            ^
a.cc:93:9: error: 'cout' does not name a type
   93 |         cout << ans << endl;
      |         ^~~~
a.cc:95:9: error: expected unqualified-id before 'return'
   95 |         return 0;
      |         ^~~~~~
a.cc:96:1: error: expected declaration before '}' token
   96 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <cmath>

using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

const ll mod = 1000000007;

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

  	vector<ll> a(n);
    vector<ll> p;
    set<ll> pm;
    vector<ll > a(n);

    p.push_back(2);
    for (ll i = 3; i <= 1010; i += 2) {
        bool is_ok = true;
        ll max_i = sqrt(i) + 10;
         for(ll cur : p) {
            if (cur >= max_i) {
                break;
            }
            if (i % cur == 0) {
                is_ok = false;
                break;
            }
         }
         if (is_ok) {
            p.push_back(i);
            pm.insert(i);
         }
    }

    //vector<ll> ps(1000001,0);
    map<ll,ll> lcm;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        ll val = a[i];
        ll max_v = 1010;
        //ll max_v = sqrt(val) + 10;

        for (ll cur : p) {
            if (cur > val) {
                break;
            }
            if (cur > max_v) {
                // val is prime
                lcm[val] = 1;
                break;
            }
            ll count = 0;
            while (val % cur == 0) {
                val /= cur;
                count++;
            }
            if (count > 0) {
                lcm[cur] = max(count, lcm[cur]);
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        ll cur = a[i];
        ll cur_ans = 1;
        for(auto itr : lcm) {
            ll k = itr.first;
            ll v = itr.second; 

            for (int i = 0; i < v; i++) {
                if (cur % k == 0) {
                    cur /= k; 
                } else {
                    cur_ans = (cur_ans * k) % mod;
                }
            }
        }
        ans = (ans + cur_ans) % mod;
    }
 	cout << ans << endl;
 	
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:27:17: error: redeclaration of 'std::vector<long long int> a'
   27 |     vector<ll > a(n);
      |                 ^
a.cc:24:20: note: 'std::vector<long long int> a' previously declared here
   24 |         vector<ll> a(n);
      |                    ^
Language: C++

import sys
 
def compute_gcd(x, y):
   while(y):
       x, y = y, x % y
   return x
 
def compute_lcm(x, y):
   lcm = (x*y)//compute_gcd(x,y)
   return lcm
   
n = int(input())

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

MOD = 10 ** 9 + 7

ans = 1
d = 1
cur = 0

for i in a:
	ans = compute_lcm(ans, i)

for i in a:
	cur += ans / i

print(cur % MOD)


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

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;


vector <ll> ss;
void Eratosthenes(){
    bool arr[100100];
	for(int i = 0; i < 100100; i++){
		arr[i] = 1;
	}
	for(int i = 2; i < sqrt(100100); i++){
		if(arr[i]){
			for(int j = 0; i * (j + 2) < N; j++){
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for(int i = 2; i < 100100; i++){
		if(arr[i]){
			ss.push_back(i);
		}
	}
}

    


ll sosuu[100100] = {0};
void soinsuu(ll n){
  ll tempsosuu[100100] = {0};
  ll a = 2;
  while(n>=a*a){
    if (n%a == 0){
      tempsosuu[a]++;
      n /= a;
    }
    else{
      a++;
    }
  }
  tempsosuu[n]++;
  for(ll i = 0;i<ss.size();i++){
    if(tempsosuu[ss[i]]>sosuu[ss[i]]){
      sosuu[ss[i]] = tempsosuu[ss[i]];
    }
}
  
    



int main(){
  ll N;
  cin>>N;
  ll a[N];
  for(ll i = 0;i<N;i++){
    cin>>a[i];
  }
  for(ll i = 0;i<N;i++){
    soiusuu(a[i]);
  }


Compiler output:
a.cc: In function 'void Eratosthenes()':
a.cc:16:54: error: 'N' was not declared in this scope
   16 |                         for(int j = 0; i * (j + 2) < N; j++){
      |                                                      ^
a.cc: In function 'void soinsuu(ll)':
a.cc:56:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   56 | int main(){
      |         ^~
a.cc:56:9: note: remove parentheses to default-initialize a variable
   56 | int main(){
      |         ^~
      |         --
a.cc:56:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:56:11: error: a function-definition is not allowed here before '{' token
   56 | int main(){
      |           ^
a.cc:65:4: error: expected '}' at end of input
   65 |   }
      |    ^
a.cc:33:19: note: to match this '{'
   33 | void soinsuu(ll n){
      |                   ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
vector <ll> ss;
void sosu(){
  for(ll i = 0;i<100100;i++){
    





ll sosuu[100100] = {0};
void soinsuu(ll n){
  ll tempsosuu[100100] = {0};
  ll a = 2;
  while(n>=a*a){
    if (n%a == 0){
      tempsosuu[a]++;
      n /= a;
    }
    else{
      a++;
    }
  }
  tempsosuu[n]++;
  
  
  
}
  
    



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

Compiler output:
a.cc: In function 'void sosu()':
a.cc:16:19: error: a function-definition is not allowed here before '{' token
   16 | void soinsuu(ll n){
      |                   ^
a.cc:38:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   38 | int main(){
      |         ^~
a.cc:38:9: note: remove parentheses to default-initialize a variable
   38 | int main(){
      |         ^~
      |         --
a.cc:38:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:38:11: error: a function-definition is not allowed here before '{' token
   38 | int main(){
      |           ^
a.cc:44:4: error: expected '}' at end of input
   44 |   }
      |    ^
a.cc:8:29: note: to match this '{'
    8 |   for(ll i = 0;i<100100;i++){
      |                             ^
a.cc:44:4: error: expected '}' at end of input
   44 |   }
      |    ^
a.cc:7:12: note: to match this '{'
    7 | void sosu(){
      |            ^
Language: C++

import math
n=int(input())
mod=1000000007
ans=0
sum=0
s=[int(n) for n in input().split()]
ans=1
for i in s:
    ans*=i//math.gcd(ans,i)
for i in range(0, n):
    sum=(sum+ans//(s[i]))%mod
print(sum)


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++

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

const long long MODULO = 1000000007;

template<typename T> void maxi(T &a, T b) { a = (a > b ? a : b); return; }

long long prime[1000001];
 
void add(long long n) {
  for (long long d = 2; d * d <= n; ++d) {
    if (n % d) continue;
    int alpha = 0;
    while (n % d == 0) {
      n /= d;
      ++alpha;
    }
    maxi(prime[d], alpha);
  }
  if (n != 1) maxi(prime[n], 1);
  return;
}
 
long long binpow(long long a, long long b) {
  long long ret = 1;
  while (b) {
  	if (b & 1) {
      ret *= a;
      ret %= MODULO;
    }
    a *= a;
    a %= MODULO;
    b >>= 1;
  }
  return ret;
}
 
long long inv(long long n) {
  return binpow(n, MODULO - 2);
}
 
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
  	cin >> a[i];
    add(a[i]);
  }
  long long lcm = 1;
  for (int i = 1; i <= 1000000; ++i) {
    lcm *= prime[i];
    lcm %= MODULO;
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += (lcm * inv(a[i])) % MODULO;
    ans %= MODULO;
  }
  cout << ans << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'void add(long long int)':
a.cc:19:9: error: no matching function for call to 'maxi(long long int&, int&)'
   19 |     maxi(prime[d], alpha);
      |     ~~~~^~~~~~~~~~~~~~~~~
a.cc:7:27: note: candidate: 'template<class T> void maxi(T&, T)'
    7 | template<typename T> void maxi(T &a, T b) { a = (a > b ? a : b); return; }
      |                           ^~~~
a.cc:7:27: note:   template argument deduction/substitution failed:
a.cc:19:9: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   19 |     maxi(prime[d], alpha);
      |     ~~~~^~~~~~~~~~~~~~~~~
a.cc:21:19: error: no matching function for call to 'maxi(long long int&, int)'
   21 |   if (n != 1) maxi(prime[n], 1);
      |               ~~~~^~~~~~~~~~~~~
a.cc:7:27: note: candidate: 'template<class T> void maxi(T&, T)'
    7 | template<typename T> void maxi(T &a, T b) { a = (a > b ? a : b); return; }
      |                           ^~~~
a.cc:7:27: note:   template argument deduction/substitution failed:
a.cc:21:19: note:   deduced conflicting types for parameter 'T' ('long long int' and 'int')
   21 |   if (n != 1) maxi(prime[n], 1);
      |               ~~~~^~~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>

using namespace std;

const long long MODULO = 1000000007;

long long prime[1000001];

void add(long long n) {
  for (long long d = 2; d * d <= n; ++d) {
    if (n % d) continue;
    int alpha = 0;
    while (n % d == 0) {
      n /= d;
      ++alpha;
    }
    maxi(prime[d], alpha);
  }
  if (n != 1) maxi(prime[n], 1);
  return;
}

long long binpow(long long a, long long b) {
  long long ret = 1;
  while (b) {
  	if (b & 1) {
      ret *= a;
      ret %= MODULO;
    }
    a *= a;
    a %= MODULO;
    b >>= 1;
  }
  return ret;
}

long long inv(long long n) {
  return binpow(n, MODULO - 2);
}

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
  	cin >> a[i];
    add(a[i]);
  }
  long long lcm = 1;
  for (int i = 1; i <= 1000000; ++i) {
    lcm *= prime[i];
    lcm %= MODULO;
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += (lcm * inv(a[i])) % MODULO;
    ans %= MODULO;
  }
  cout << ans << '\n';
  return 0;
}

Compiler output:
a.cc: In function 'void add(long long int)':
a.cc:17:5: error: 'maxi' was not declared in this scope
   17 |     maxi(prime[d], alpha);
      |     ^~~~
a.cc:19:15: error: 'maxi' was not declared in this scope
   19 |   if (n != 1) maxi(prime[n], 1);
      |               ^~~~
Language: C++

#include<bits/stdc++.h>
#define int long long 
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define all(a) a.begin(),a.end()
#define ld long double
#define ub upper_bound
#define lb lower_bound
#define pii pair<int,int>
using namespace std;
int mod = 1e9+7;
int add(int a,int b){
	return ((a%mod)+(b%mod))%mod;
}
int mul(int a,int b){
	return ((a%mod)*(b%mod))%mod;
}
int power(int a,int b){
	int res = 1;
	while(b>0){
		if(b&1)
			res = mul(res,a);
		b = b/2;
		a = mul(a,a);
	}
	return res;
}
int divi(int a,int b){
	return mul(a,power(b,mod-2));
}
signed main()
{
    fast;
	int n;
	cin>>n;
	int a[n+1];
	map<int,int> mp;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		map<int,int> tmp;
		int x = a[i];
		for(int j=2;j*j<=x;j++){
			while(x%j == 0){
				x = x/j;
				tmp[j]++;
				mp[j] = max(mp[j],tmp[j]);
			}
		}
		if(x>1)
			tmp[x]++;
		mp[x] = max(mp[x],tmp[x]);
	}
	int lcm = 1;
	for(auto it:mp){
		lcm = mul(lcm,power(it.first,it.second));
	}
	int ans = 0;
	for(int i=1;i<=n;i++){
		ans = add(ans,divi(lcm,a[i]))
	}
	cout<<ans;
}   


Compiler output:
a.cc: In function 'int main()':
a.cc:59:46: error: expected ';' before '}' token
   59 |                 ans = add(ans,divi(lcm,a[i]))
      |                                              ^
      |                                              ;
   60 |         }
      |         ~
Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N;
int A[10010];
umap<int,int> L;


map<int,int> dec2(int n){
	map<int,int> m;
	int a=2;
	while(n>=a*a){
		if(n%a==0){
			m[a]++;
			n/=a;
		}
		else{
			a++;
		}
	}
	m[n]++;
	return m;
}

int mod_pow(int b,int e,int m){
    if(e==0){
        return 1;
    }else{
        int sum = mod_pow(b,e/2,m);
        if(e%2==0){
            return (sum*sum)%m;
        }else{
            return (((sum*sum)%m)*b)%m;
        }
    }
}

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
	}
	REP(i,N){
		map<int,int> H=dec2(A[i]);
		set<int> U;
		for(auto x:H)U.insert(x.first);
		for(auto x:L)U.insert(x.first);
		for(auto x:U){
			L[x]=max(L[x],H[x]);
			DEB(x)DEB(L[x])END
		}
	}
	int ans=0;
	REP(i,N){
		map<int,int> h=dec2(A[i]);
		map<int,int> h2=L;
		int R=1;
		for(auto x:h){
			h2[x.first]-=x.second;
		}
		for(auto x:h2){
			R*=mod_pow(x.first,x.second,MOD);
			R%=MOD;
		}
		ans+=R;
		ans%=MOD;
	}
	cout<<ans<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:100:33: error: conversion from 'std::unordered_map<long long int, long long int>' to non-scalar type 'std::map<long long int, long long int>' requested
  100 |                 map<int,int> h2=L;
      |                                 ^
Language: C++

#include<cstdio>
const long long mod=1e9+7;
long long n,mx[1000007],a[1000007];
long long pow(long long a,long long b){
	long long ret=1;
	for(;b;b>>=1,a=a*a%mod)
        if(b&1)
            ret=ret*a%mod;
	return ret;
}
int main(){
	scanf("%d",&n);
	for(long long i=1;i<=n;++i){
		scanf("%d",a+i);
		long long x=a[i];
		for(long long i=2;i*i<=x;++i)
            if(x%i==0){
                long long cnt=0;
                while(x%i==0)
                    ++cnt,x/=i;
			if(cnt>mx[i])
                mx[i]=cnt;
		}
		if(x>1&&!mx[x])
            mx[x]=1;
	}
	long long s=1,ans=0;
	for(long long i=1;i<=1000000;++i)
        if(mx[i])
            s=1ll*s*pow(i,mx[i])%mod;
	for(long long i=1;i<=n;++i)
        ans=(ans+s*pow(a[i],mod-2))%mod;
	prlong longf("%d",ans);
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:9: error: 'prlong' was not declared in this scope; did you mean 'long'?
   33 |         prlong longf("%d",ans);
      |         ^~~~~~
      |         long
Language: C

#include <cstdio>
#include <array>
#include <utility>

template <unsigned int N> struct shuumai{
    unsigned int minPrime[N + 1];
    unsigned int Next[N + 1];
    unsigned int Primes[N + 1];
    unsigned int size_;

    constexpr shuumai(void): minPrime(), Primes(), Next(), size_(0U){
        minPrime[0] = 1; minPrime[1] = 1;
        for(int even = 2, odd = 3; odd <= N; even += 2, odd += 2){
            minPrime[even] = 2;
            minPrime[odd] = odd;
        }
        if(!(N & 1)) minPrime[N] = 2;
        Primes[size_++] = 2;

        for(int x = 3; x <= N; x += 2){
            if(minPrime[x] == x) Primes[size_++] = x;
            for(int y = 0; y < size_ and Primes[y] <= minPrime[x] and x * Primes[y] <= N; ++y)
                    minPrime[x * Primes[y]] = Primes[y];
        }
        for(int x = 2; x <= N; ++x) Next[x] = x / minPrime[x];
    }
    // 範囲for文用の begin() と end()
    const unsigned int *begin(void) const noexcept{ return Primes; }
    const unsigned int *end(void) const noexcept{ return Primes + size_;}
    const unsigned int size(void) const {return this.size_;}
};

using uint = unsigned int;
constexpr uint N = 1e6;
constexpr uint mod = 1e9 + 7;
constexpr uint M = mod - 2;
constexpr shuumai<N> P;
std::array<uint, N + 1> Count;

// aの逆元を求める関数
const unsigned int inverse(unsigned int a) noexcept {
    unsigned int b = mod;
             int u = 1,   v = 0;
    while (b) {
        unsigned int t = a / b; 
        std::swap(a -= t * b, b);
        std::swap(u -= t * v, v);
    }
    if(u < 0) u += mod;
    return u;
}

// a^nを返す関数
const uint power(uint a, uint n)noexcept{
    unsigned long long res = 1, waiting = a;
    while(n){ 
        if(n & 1) { res *= waiting; res %= mod; }
        waiting *= waiting; waiting %= mod; 
        n >>= 1;
    }
    return res;
}

uint fastRead(void) {
    char c;
    while(true){
        c = getchar_unlocked();
        if('0' <= c) break;
    }
    uint res = c - '0';
	while(true){
        c = getchar_unlocked();
        if(c < '0') break;
        res = 10 * res + (c - '0');
    }
    return res;
}


int main(void){
    uint n = fastRead();
    uint inv_sum = 0;
    for(uint _ = 0; _ < n; ++_){
        uint a = fastRead();
        inv_sum += power(a, M); if(inv_sum >= mod) inv_sum -= mod;
        while(a - 1U){
            uint fac = P.minPrime[a];
            uint cnt = 1; a = P.Next[a];
            while(fac == P.minPrime[a]) a = P.Next[a], cnt++;
            if(Count[fac] < cnt) Count[fac] = cnt; 
        }
    }

    unsigned long long int lcm = 1;
    for(unsigned int x : P) if(Count[x]) (lcm *= power(x, Count[x])) %= mod;
    unsigned int res = lcm * inv_sum % mod;
    
    printf("%u\n", res);
    return 0;
}


Compiler output:
main.c:1:10: fatal error: cstdio: No such file or directory
    1 | #include <cstdio>
      |          ^~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T,class U> using P = pair<T,U>;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

constexpr ll mod = 1e9+7;
struct mint {
    ll x;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    friend ostream &operator<<(ostream& os,const mint& a){
        return os << a.x;
    }

    friend istream &operator>>(istream& is,mint& a){
        ll t;
        is >> t;
        a = mint(t);
        return (is);
    }

    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(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;

    auto prime = [](int x){
        unordered_map<int,int> mp;
        int n = x;
        for(int i=2;i*i<=x;i++){
            while(n%i==0){
                mp[i]++;
                n /= i;
            }
        }
        if(n!=1) mp[n]++;
        return mp;
    };

    vec<unordered_map<int,int>> mps;
    for(int i=0;i<N;i++){
        int a;
        cin >> a;
        mps.push_back(prime(a));
    }

    unordered_map<int,int> pmax;
  	mint lcm = 1;
    for(auto& mp:mps){
        for(auto& x:mp){
            if(!pmax.count(x.first)) pmax[x.first] = x.second;
            else pmax[x.first] = max(pmax[x.first],x.second);
        }
      	mint p = x.first;
      	lcm *= p.pow(pmax[x.first]);
    }

    mint ans = 0;
  	for(int i=0;i<N;i++){
      ans += lcm/A[i];
    }
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:101:18: error: 'x' was not declared in this scope
  101 |         mint p = x.first;
      |                  ^
a.cc:107:18: error: 'A' was not declared in this scope
  107 |       ans += lcm/A[i];
      |                  ^
Language: C++

#a,bの最大公約数
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#a,bの最小公倍数
def lcm(a, b):
    return a * b // gcd (a, b)
B = int(input())
L = list(map(int, input().split()))
d=L[0]
mod=1000000007
for i in range(B):
  d=lcm(d,L[i])
ans=0
for i in range(B):
  ans+=d//L[i]
print(ans%mod)


Compiler output:
a.cc:1:2: error: invalid preprocessing directive #a
    1 | #a,bの最大公約数
      |  ^
a.cc:7:2: error: invalid preprocessing directive #a
    7 | #a,bの最小公倍数
      |  ^
a.cc:2:1: error: 'def' does not name a type
    2 | def gcd(a, b):
      | ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)
#include<boost/multiprecision/cpp_int.hpp>
using Int=boost::multiprecision::cpp_int;

struct modint{
    using i64=int_fast64_t;
    i64 a;
    static constexpr i64 MOD=1e9+7;
    modint(){a=0;}
    modint(i64 a_){
        a=a_%MOD;
        if(a<0) a+=MOD;
    }
    modint inv()const{
        i64 n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    bool operator!=(const modint& x){
        return a!=x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y;
        y.a=a+x.a;
        if(y.a>MOD) y.a-=MOD;
        return y;
    }
    modint operator-(const modint& x){
        modint y;
        y.a=a-x.a;
        if(y.a<0) y.a+=MOD;
        return y;
    }
    modint operator*(const modint& x){
        modint y;
        y.a=(a*x.a)%MOD;
        return y;
    }
    modint operator/(const modint& x){
        modint y;
        y.a=(a*x.inv().a)%MOD;
        return y;
    }
    modint& operator+=(const modint& x){
        a+=x.a;
        if(a>=MOD) a-=MOD;
        return *this;
    }
    modint& operator-=(const modint& x){
        a-=x.a;
        if(a<0) a+=MOD;
        return *this;
    }
    modint& operator*=(const modint& x){
        (a*=x.a)%=MOD;
        return *this;
    }
    modint& operator/=(const modint& x){
        (a*=x.inv().a)%=MOD;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    int_fast64_t a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(int_fast64_t a,int_fast64_t b){
    modint _;
    int_fast64_t n=1,A=a;
    while(b){
        if(b&1) (n*=A)%=modint::MOD;
        (A*=A)%=modint::MOD;
        b>>=1;
    }
    _.a=n;
    return _;
}

Int gcd(Int n,Int m){
    if(n<0) n=-n;
    if(m<0) m=-m;
    if(n>m) swap(n,m);
    T tmp;
    while(n){
        tmp=n;
        n%=m;
        m=tmp;
    }
    return m;
}


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    istream& in(cin);
    ostream& out(cout);
    int n;
    in>>n;
    vector<int> a(n);
    for(auto&i:a) in>>i;
    Int lcm{1};
    fr(i,n) lcm*=a[i]/gcd(a[i],lcm);
    lcm%=1000000007;
    modint ans{};
    fr(i,n) ans+=modint(a[i]).inv();
    ans*=(int)lcm;
    cout<<ans<<endl;
}

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

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

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

    int n;
    cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }

    map<int, long long> mp; // 配列A全体の素因数
    for(int i = 0; i < n; i++){
        int tmp = A[i];
        for(int j = 2; j <= sqrt(A[i]); j++){
            if(tmp % j != 0){
                continue;
            }
            long long cnt = 0;
            while(tmp % j == 0){
                tmp /= j;
                cnt++;
            }
            if(cnt > mp[j] and cnt > 0){
                mp[j] = cnt;
            }
            if(tmp == 1){
                break;
            }
        }
        if(tmp != 1){
            mp[tmp]++;
        }
    }

    long long lcm = 1;
    for(auto x : mp){
        for(int i = 0; i < x.second; i++){
            lcm *= x.first;
          lcm%=ll(1e9+7);
        }
    }

    long long ans = 0;
    const long long MOD = 1e9 + 7;
    for(int i = 0; i < n; i++){
        ans = ((ans % MOD) + (lcm / A[i]) % MOD) % MOD;
    }

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:16: error: 'll' was not declared in this scope
   43 |           lcm%=ll(1e9+7);
      |                ^~
Language: C++

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

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

    int n;
    cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }

    map<int, long long> mp; // 配列A全体の素因数
    for(int i = 0; i < n; i++){
        int tmp = A[i];
        for(int j = 2; j <= sqrt(A[i]); j++){
            if(tmp % j != 0){
                continue;
            }
            long long cnt = 0;
            while(tmp % j == 0){
                tmp /= j;
                cnt++;
            }
            if(cnt > mp[j] and cnt > 0){
                mp[j] = cnt;
            }
            if(tmp == 1){
                break;
            }
        }
        if(tmp != 1){
            mp[tmp]++;
        }
    }

    long long lcm = 1;
    for(auto x : mp){
        for(int i = 0; i < x.second; i++){
            lcm *= x.first;
          lcm%=(1e9+7);
        }
    }

    long long ans = 0;
    const long long MOD = 1e9 + 7;
    for(int i = 0; i < n; i++){
        ans = ((ans % MOD) + (lcm / A[i]) % MOD) % MOD;
    }

    cout << ans << endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:43:14: error: invalid operands of types 'long long int' and 'double' to binary 'operator%'
   43 |           lcm%=(1e9+7);
      |           ~~~^~~~~~~~~
a.cc:43:14: note:   in evaluation of 'operator%=(long long int, double)'
Language: C++

#include<stdio.h>

long int inv(long int x){
  long int j[30],y,k;
  j[0]=x;
  for(k=1;k<=29;k++){
    j[k]=(j[k-1]*j[k-1])%1000000007;
  }
  y=(j[0]*j[2])%1000000007;
  y=(y*j[9])%1000000007;
  y=(y*j[11])%1000000007;
  y=(y*j[14])%1000000007;
  y=(y*j[15])%1000000007;
  y=(y*j[17])%1000000007;
  y=(y*j[19])%1000000007;
  y=(y*j[20])%1000000007;
  y=(y*j[23])%1000000007;
  y=(y*j[24])%1000000007;
  y=(y*j[25])%1000000007;
  y=(y*j[27])%1000000007;
  y=(y*j[28])%1000000007;
  y=(y*j[29])%1000000007;
  
  if(y<0){
    y=1000000007+y;
  }
  return y;
}

long int gcd(long int x,long int y){
  long int g;
  long int X,Y;
  X=x;
  Y=y;
  while(X*Y!=0){
    if(X>Y){
      X=X%Y;
    }else{
      Y=Y%X;
    }
  }
  g=X+Y;
  return g;
}
  

int main(void){
  long int n,i,j;
  long int a[10001];
  scanf("%ld\n",&n);
  for(i=1;i<=n;i++){
    scanf("%ld",&a[i]);
  }
  
  long int sum;
  sum=0;
  for(i=1;i<=n;i++){
    sum=(sum+inv(a[i]))%1000000007;
  }
  
  if(n>100){
    
    long int l=a[1];
    long int L=a[n/2+1];
    
    for(i=2;i<=n/2;i++){
      for(j=1;j<=i-1;j++){
        if(gcd(a[i],a[j])!=1){
          a[i]=a[i]/gcd(a[i],a[j]);
        }
      }
      l=(l*a[i])%1000000007;
    }
    for(i=n/2+2;i<=n;i++){
      for(j=n/2+1;j<=i-1;j++){
        if(gcd(a[i],a[j])!=1){
          a[i]=a[i]/gcd(a[i],a[j]);
        }
      }
      L=(L*a[i])%1000000007;
    }
    long int lcm;
    lcm=(l*L)%1000000007;
  }else{
    long int lcm=a[1];
  
    for(i=2;i<=n;i++){
      for(j=1;j<=i-1;j++){
        if(gcd(a[i],a[j])!=1){
          a[i]=a[i]/gcd(a[i],a[j]);
        }
      }
    lcm=(lcm*a[i])%1000000007;
  }
  
  long int A;
  A=(sum*l)%1000000007;
  printf("%ld",A);
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:97:10: error: 'l' was not declared in this scope
   97 |   A=(sum*l)%1000000007;
      |          ^
a.cc:101:2: error: expected '}' at end of input
  101 | }
      |  ^
a.cc:47:15: note: to match this '{'
   47 | int main(void){
      |               ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

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

map<int, int> prime_factorize(int n) {
    map<int, int> res;
    for (int p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res[p] = num;
    }
    if (n != 1) res[n] = 1;
    return res;
}

void solve() {
    int n; cin >> n;
    vector<map<int, int> > p;
    map<int, int> mp;
    for(int i = 0; i < n; ++i){
        int a; cin >> a;
        p.emplace_back(prime_factorize(a));
     }
     for(auto& pi : p)
        for(auto it : pi){
            if(mp.count(it.first) != 0){
                mp[it.first] = max(mp[it.first], it.second);
            }
            else{
                mp[it.first] = it.second;
            }
        }
    }

    ll ans = 0;
    for(auto& pi : p){
        ll tmp = 1;
        for (auto it : mp) {
            if(pi.count(it.first) != 0){
                tmp *= modpow(it.first, it.second - pi[ it.first ], MOD);
            }
            else{
                tmp *= modpow(it.first, it.second, MOD);
            }
            tmp %= MOD;
        }
        ans += tmp;
        ans %= MOD;
    }
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Compiler output:
a.cc:57:5: error: expected unqualified-id before 'for'
   57 |     for(auto& pi : p){
      |     ^~~
a.cc:71:5: error: 'cout' does not name a type
   71 |     cout << ans << endl;
      |     ^~~~
a.cc:72:1: error: expected declaration before '}' token
   72 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { 
    if (b == 0) return a; 
    return gcd(b, a % b); 
} 
  
int main() { 
	int N, arr[10000];
  	scanf("%d",&N);
  	for (int i = 0; i < N; i++) scanf("%d",&A[i]);
    long long lcm = arr[0]; 
    for (int i = 1; i < N; i++) lcm = (((lcm * arr[i])) / (gcd(arr[i], lcm)));
  	long long sum = 0;
  	for (int i = 0; i < N; i++) sum = (sum + lcm / arr[i]) % 1000000007
    printf("%lld\n",sum);
} 

Compiler output:
a.cc: In function 'int main()':
a.cc:11:49: error: 'A' was not declared in this scope
   11 |         for (int i = 0; i < N; i++) scanf("%d",&A[i]);
      |                                                 ^
a.cc:15:76: error: expected ';' before 'printf'
   15 |         for (int i = 0; i < N; i++) sum = (sum + lcm / arr[i]) % 1000000007
      |                                                                            ^
      |                                                                            ;
   16 |     printf("%lld\n",sum);
      |     ~~~~~~
Language: C++

#include <bits/stdc++.h>

const int MAX_N = 100005;
const long long MOD = 1000000007;

long long n;

long long ans;

long long arr[MAX_N];

long long __gcm(long long a, long long b) {
  return 1LL * a * b / std::_gcd(a, b);
}

int main() {
  long long gcm;
  std::cin >> n >> arr[1];
  gcm = arr[1];
  for (int i = 2; i <= n; ++i) {
    std::cin >> arr[i];
    gcm = __gcm(gcm, arr[i]);
  }
  for (int i = 1; i <= n; ++i) {
    ans = (1LL * ans + gcm / arr[i]) % MOD;
  }
  std::cout << ans << "\n";
  return 0;
}


Compiler output:
a.cc: In function 'long long int __gcm(long long int, long long int)':
a.cc:13:29: error: '_gcd' is not a member of 'std'; did you mean 'gcd'?
   13 |   return 1LL * a * b / std::_gcd(a, b);
      |                             ^~~~
      |                             gcd