Language: C++

#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#include <cmath>
#include <queue>
#include <tuple>
#include <set>
#include <assert.h>
#include <sstream>
#include <string>
//#include <bits/stdc++.h>
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define FORR(i,i0,n) for(int (i)=(n)-1; (i)>=(i0);(i)--)
#define SORT(x) sort(x.begin(),x.end())
#define SORTR(x) sort(x.begin(),x.end(),greater <>())
#define rn return
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
using namespace std;
using ll = long long;
typedef std::pair<ll,ll> P;





// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    
    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;
    }
};
// combination mod prime
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};





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




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

    vector<mint> a(n);
    vector<int> b(n);
    rep(i,n){
        int in;
        scanf("%d",&in);
        a[i] = in;
        b[i] = in;
    }

    SORT(b);
    
    rep(i,n-1){
        FOR(j,i+1,n){
            b[i]/=gcd(b[i],b[j]);
        }
    }
    
    mint lcm = 1;
    3
    2 3 4        lcm *= b[i];
    }
    mint ans = 0;
    rep(i,n){
        ans = ans + lcm/a[i];
    }
    
    cout << ans.x;
    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:144:6: error: expected ';' before numeric constant
  144 |     3
      |      ^
      |      ;
  145 |     2 3 4        lcm *= b[i];
      |     ~ 
a.cc: At global scope:
a.cc:17:18: error: expected unqualified-id before 'for'
   17 | #define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
      |                  ^~~
a.cc:148:5: note: in expansion of macro 'rep'
  148 |     rep(i,n){
      |     ^~~
a.cc:17:35: error: expected constructor, destructor, or type conversion before '<' token
   17 | #define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
      |                                   ^
a.cc:148:5: note: in expansion of macro 'rep'
  148 |     rep(i,n){
      |     ^~~
a.cc:17:43: error: expected constructor, destructor, or type conversion before '++' token
   17 | #define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
      |                                           ^~
a.cc:148:5: note: in expansion of macro 'rep'
  148 |     rep(i,n){
      |     ^~~
a.cc:152:5: error: 'cout' does not name a type
  152 |     cout << ans.x;
      |     ^~~~
a.cc:154:1: error: expected declaration before '}' token
  154 | }
      | ^