Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <climits>
#include <string>
using namespace std;

// 最大公約数
long gcd(long a, long b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

// 最小公倍数
long lcm(long a, long b)
{
   return a * b / gcd(a, b);
}

long count(long c, long d, long to){
  
  long ret = 0;
  
  long ret += to/c;
  long ret += to/d;
  long ret -= to/lcm(c,d);
  
  return ret;
}
int main() {
  long A, B, C, D;
  cin >> A >> B >> C >> D;
  
  cout << count(B) - count(A-1) << endl;
  return 0;
}



Compiler output:
a.cc: In function 'long int count(long int, long int, long int)':
a.cc:32:12: error: expected initializer before '+=' token
   32 |   long ret += to/c;
      |            ^~
a.cc:33:12: error: expected initializer before '+=' token
   33 |   long ret += to/d;
      |            ^~
a.cc:34:12: error: expected initializer before '-=' token
   34 |   long ret -= to/lcm(c,d);
      |            ^~
a.cc: In function 'int main()':
a.cc:42:16: error: no matching function for call to 'count(long int&)'
   42 |   cout << count(B) - count(A-1) << endl;
      |           ~~~~~^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: candidate: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note:   candidate expects 4 arguments, 1 provided
a.cc:28:6: note: candidate: 'long int count(long int, long int, long int)'
   28 | long count(long c, long d, long to){
      |      ^~~~~
a.cc:28:6: note:   candidate expects 3 arguments, 1 provided
a.cc:42:27: error: no matching function for call to 'count(long int)'
   42 |   cout << count(B) - count(A-1) << endl;
      |                      ~~~~~^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note: candidate: 'template<class _IIter, class _Tp> typename std::iterator_traits< <template-parameter-1-1> >::difference_type std::count(_IIter, _IIter, const _Tp&)'
 4025 |     count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
      |     ^~~~~
/usr/include/c++/14/bits/stl_algo.h:4025:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator, class _Tp> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, typename std::iterator_traits<_II>::difference_type> std::count(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, const _Tp&)'
  101 | count(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, const _Tp& __value);
      | ^~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:101:1: note:   candidate expects 4 arguments, 1 provided
a.cc:28:6: note: candidate: 'long int count(long int, long int, long int)'
   28 | long count(long c, long d, long to){
      |      ^~~~~
a.cc:28:6: note:   candidate expects 3 arguments, 1 provided