Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define forx(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)

ll mod=1e9+7;
ll max=1e7;

ll fact[max],inv[max],finv[max];

void setup(){
    fact[0]=fact[1]=finv[0]=finv[1]=inv[1]=1;
    for(int i=2;i<max;i++){
        fact[i]=fact[i-1]*i%mod;
        inv[i]=mod-inv[mod%i]*(mod/i)%mod;
        finv[i]=finv[i-1]*inv[i]%mod;
    }
}
    

ll h(ll n,ll r){
    //n+r-1Cr
    ll x=n+r-1;
    //xCr
    return fact[x]*(finv[r]*finv[x-r]%mod)%mod;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    setup();
    
    ll n,m,x,f=2,ans=1;
    cin>>n>>m;
    x=m;
    
    map<ll,ll>mp;
    
    while(x>1){
        if(x%f==0){
            mp[f]++;
            x/=f;
        }
        else f++;
    }
    
    for(auto i:mp){
        ans*=h(n,i.second);
        ans%=mod;
    }
    
    if(m==1)ans=1;
    
    cout<<ans%mod<<endl;
    
    return 0;
}


Compiler output:
a.cc:10:9: error: reference to 'max' is ambiguous
   10 | ll fact[max],inv[max],finv[max];
      |         ^~~
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
In file included from /usr/include/c++/14/algorithm:60:
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:8:4: note:                 'll max'
    8 | ll max=1e7;
      |    ^~~
a.cc:10:18: error: reference to 'max' is ambiguous
   10 | ll fact[max],inv[max],finv[max];
      |                  ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:8:4: note:                 'll max'
    8 | ll max=1e7;
      |    ^~~
a.cc:10:28: error: reference to 'max' is ambiguous
   10 | ll fact[max],inv[max],finv[max];
      |                            ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:8:4: note:                 'll max'
    8 | ll max=1e7;
      |    ^~~
a.cc: In function 'void setup()':
a.cc:13:5: error: 'fact' was not declared in this scope
   13 |     fact[0]=fact[1]=finv[0]=finv[1]=inv[1]=1;
      |     ^~~~
a.cc:13:21: error: 'finv' was not declared in this scope
   13 |     fact[0]=fact[1]=finv[0]=finv[1]=inv[1]=1;
      |                     ^~~~
a.cc:13:37: error: 'inv' was not declared in this scope; did you mean 'int'?
   13 |     fact[0]=fact[1]=finv[0]=finv[1]=inv[1]=1;
      |                                     ^~~
      |                                     int
a.cc:14:19: error: reference to 'max' is ambiguous
   14 |     for(int i=2;i<max;i++){
      |                   ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidates are: '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:5706:5: note:                 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:                 '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:257:5: note:                 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:8:4: note:                 'll max'
    8 | ll max=1e7;
      |    ^~~
a.cc: In function 'll h(ll, ll)':
a.cc:26:12: error: 'fact' was not declared in this scope
   26 |     return fact[x]*(finv[r]*finv[x-r]%mod)%mod;
      |            ^~~~
a.cc:26:21: error: 'finv' was not declared in this scope
   26 |     return fact[x]*(finv[r]*finv[x-r]%mod)%mod;
      |                     ^~~~