Language: C++

#include <iostream>

using namespace std;



const int MAXN = 1e5 * 3 + 5;
const int mod = 998244353;

long long fakt[MAXN];

int n;
long long a, b, k;
long long sol = 0;


int mul (int a, int b) {
    return ((long long) a * b) % mod;
}
int add (int a, int b) {
    a+=b;
    if (a >= mod) return a-mod;
    return a;
}
int pow(int baza, int potencija) {
    int r = 1, a = baza, x = potencija;
    while (x) {
        if (x % 2 == 1) {
            r = mul(r,a);
        }
        a = mul(a,a);
        x/=2;
    }
    return r;
}
int div (int a, int b) {
    return mul(a, pow(b,mod-2));
}

int main () {
    fakt[0] = 1;
    for (int i = 1 ; i < MAXN ; i++) {
        fakt[i] = mul(fakt[i-1],i);
    }
    cin >> n >> a >> b >> k;
    for (int i = 0  ; i <= n ; i ++) {
        long long A = a * i;
        if ((k - A) % b == 0 ) {
            //cout << "PROV: " <<A << " " << B;
            int j = (k-A) / b;
            sol = add(sol , mul (div (fakt[n] , mul(fakt[i] ,fakt[n-i] ) ) , div (fakt[n] , mul(fakt[j] , fakt[n-j] ) ) ) );
        }
        else {
            continue;
        }
     }
    cout << sol;

    return 0;
}




Compiler output:
a.cc:36:5: error: ambiguating new declaration of 'int div(int, int)'
   36 | int div (int a, int b) {
      |     ^~~
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:992:14: note: old declaration 'div_t div(int, int)'
  992 | extern div_t div (int __numer, int __denom)
      |              ^~~
a.cc: In function 'int main()':
a.cc:51:38: error: call of overloaded 'div(long long int&, int)' is ambiguous
   51 |             sol = add(sol , mul (div (fakt[n] , mul(fakt[i] ,fakt[n-i] ) ) , div (fakt[n] , mul(fakt[j] , fakt[n-j] ) ) ) );
      |                                  ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:992:14: note: candidate: 'div_t div(int, int)'
  992 | extern div_t div (int __numer, int __denom)
      |              ^~~
/usr/include/c++/14/cstdlib:219:3: note: candidate: 'lldiv_t __gnu_cxx::div(long long int, long long int)'
  219 |   div(long long __n, long long __d)
      |   ^~~
/usr/include/c++/14/cstdlib:181:3: note: candidate: 'ldiv_t std::div(long int, long int)'
  181 |   div(long __i, long __j) _GLIBCXX_NOTHROW { return ldiv(__i, __j); }
      |   ^~~
a.cc:51:82: error: call of overloaded 'div(long long int&, int)' is ambiguous
   51 |             sol = add(sol , mul (div (fakt[n] , mul(fakt[i] ,fakt[n-i] ) ) , div (fakt[n] , mul(fakt[j] , fakt[n-j] ) ) ) );
      |                                                                              ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/stdlib.h:992:14: note: candidate: 'div_t div(int, int)'
  992 | extern div_t div (int __numer, int __denom)
      |              ^~~
/usr/include/c++/14/cstdlib:219:3: note: candidate: 'lldiv_t __gnu_cxx::div(long long int, long long int)'
  219 |   div(long long __n, long long __d)
      |   ^~~
/usr/include/c++/14/cstdlib:181:3: note: candidate: 'ldiv_t std::div(long int, long int)'
  181 |   div(long __i, long __j) _GLIBCXX_NOTHROW { return ldiv(__i, __j); }
      |   ^~~