Language: C++

#include<bits/stdc++.h>

#define ll long long int
#define ld long double
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f
#define show(x) cerr<<#x<<" : "<<x<<'\n';
#define yogeshk972() cerr<<"\nTime Taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<"\n";
clock_t time_p=clock();

using namespace std;
const int N= 1e3+10, mod= 1e9+7;
#define int ll

int gcdex(int a,int b,int& x,int &y){
  if(a==0){
    x=0; y=1;
    return b;
  }
  int x1,y1;
  int g= gcdex(b%a,a,x1,y1);
  x=y1- (b/a)*x1;
  y=x1;
  return g;
}

signed main() {
  ios_base::sync_with_stdio(false);cin.tie(NULL);

/* 
  #ifndef ONLINE_JUDGE
  freopen("in.txt","r",stdin);
  freopen("out.txt","w",stdout);
  #endif
*/  
  int n,m;
  cin>>n>>m;
  set<int> st;
  for(int i=0;i<n;i++){
    int  x; cin>>x;
    st.insert(x);
  }

  pair<int,int> p={ *begin(st)/2,*begin(st) }; 
  st.erase(st.begin());

  for(auto a:st){
    int x,y;
    int g=gcdex(p.yy,a,x,y);
    int c=a/2-p.xx;
    if( c%g!=0 ){
      cout<<"0";
      return 0;
    }
    c/=g;
    x*=c; y*=c;
    int temp= p.xx+p.yy*x;
    p.xx=temp; p.yy=(p.yy*a)/g;
  }

  cout<<max(0,(m-p.xx)/p.yy) + (p.xx<=m);

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:64:12: error: no matching function for call to 'max(int, long long int)'
   64 |   cout<<max(0,(m-p.xx)/p.yy) + (p.xx<=m);
      |         ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:64:12: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   64 |   cout<<max(0,(m-p.xx)/p.yy) + (p.xx<=m);
      |         ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:64:12: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   64 |   cout<<max(0,(m-p.xx)/p.yy) + (p.xx<=m);
      |         ~~~^~~~~~~~~~~~~~~~~