Language: C++

//In the name of God
//SMani24
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N = 1e5 + 10;

ll n, m, a[N];
ll lcm, ans;

int gcd(int a, int b) {
	if (a == 0)
		return b;
	return gcd(b % a, a);
}
void read_input() {
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i] /= 2;
	}
}
void solve() {
	lcm = a[0];
	for (int i = 1; i < n; i++)
		lcm = (lcm * a[i]) / gcd(lcm, a[i]);
	ans = max(0, (m - lcm) / (2 * lcm));
}
void write_output() {
	cout << ans << endl;
}
int main() {
	read_input(), solve(), write_output();
	return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:25:9: error: reference to 'lcm' is ambiguous
   25 |         lcm = a[0];
      |         ^~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:58,
                 from a.cc:3:
/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:10:4: note:                 'll lcm'
   10 | ll lcm, ans;
      |    ^~~
a.cc:27:17: error: reference to 'lcm' is ambiguous
   27 |                 lcm = (lcm * a[i]) / gcd(lcm, a[i]);
      |                 ^~~
/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:10:4: note:                 'll lcm'
   10 | ll lcm, ans;
      |    ^~~
a.cc:27:24: error: reference to 'lcm' is ambiguous
   27 |                 lcm = (lcm * a[i]) / gcd(lcm, a[i]);
      |                        ^~~
/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:10:4: note:                 'll lcm'
   10 | ll lcm, ans;
      |    ^~~
a.cc:27:42: error: reference to 'lcm' is ambiguous
   27 |                 lcm = (lcm * a[i]) / gcd(lcm, a[i]);
      |                                          ^~~
/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:10:4: note:                 'll lcm'
   10 | ll lcm, ans;
      |    ^~~
a.cc:28:27: error: reference to 'lcm' is ambiguous
   28 |         ans = max(0, (m - lcm) / (2 * 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:10:4: note:                 'll lcm'
   10 | ll lcm, ans;
      |    ^~~
a.cc:28:39: error: reference to 'lcm' is ambiguous
   28 |         ans = max(0, (m - lcm) / (2 * 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:10:4: note:                 'll lcm'
   10 | ll lcm, ans;
      |    ^~~