Language: C++

#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
/*
//#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
*/

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*
//#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
*/
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#include <numeric>
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
#define M_INF 1000000000
unsigned ll gcd(unsigned ll a,unsigned ll b){
  if(b==0) return a;
  return gcd(b,a%b);
}
unsigned ll lcm(unsigned ll m,unsigned ll n )
{
  return (m*n) /gcd(m,n);
}//lcm

ll n,m,v,i;
void solve(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  // cout<<"ss";
  ll a[n];
  rep(i,n) {
    // cout<<1<<endl;
    // scanf("%d",&a[i]);
    cin>>a[i];
  }
  // cout<<"ss";
  unsigned ll ans = 1;
  rep(i,n) {
    ans = lcm(a[i],ans);
  }
  unsigned ll cnt = 0;
  ans--;
  rep(i,n) cnt += (ans%a[i]);
  cout<<cnt<<endl;
}

int main(){
  solve();
  return 0;
}


Compiler output:
a.cc:112:13: error: expected initializer before 'gcd'
  112 | unsigned ll gcd(unsigned ll a,unsigned ll b){
      |             ^~~
a.cc:116:13: error: expected initializer before 'lcm'
  116 | unsigned ll lcm(unsigned ll m,unsigned ll n )
      |             ^~~
a.cc: In function 'void solve()':
a.cc:134:15: error: expected initializer before 'ans'
  134 |   unsigned ll ans = 1;
      |               ^~~
a.cc:136:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
  136 |     ans = lcm(a[i],ans);
      |     ^~~
      |     abs
a.cc:138:15: error: expected initializer before 'cnt'
  138 |   unsigned ll cnt = 0;
      |               ^~~
a.cc:139:3: error: 'ans' was not declared in this scope; did you mean 'abs'?
  139 |   ans--;
      |   ^~~
      |   abs
a.cc:140:12: error: 'cnt' was not declared in this scope; did you mean 'int'?
  140 |   rep(i,n) cnt += (ans%a[i]);
      |            ^~~
      |            int
a.cc:141:9: error: 'cnt' was not declared in this scope; did you mean 'int'?
  141 |   cout<<cnt<<endl;
      |         ^~~
      |         int