Language: C++

#include <algorithm>
#include <array>
#include <bitset>
#include <chrono>
#include <cmath>
#include <functional>
#include <iostream>
#include <list>
#include <numeric>
#include <random>
#include <set>
#include <unordered_set>
#include <vector>

#define rep(i, n) for (int i = 0; i < (n); i++)


using i64 = int64_t;
using i32 = int32_t;

using u64 = uint64_t;
using u32 = uint32_t;

using namespace std;

#define pv(val) cerr << #val << " = " << (val) << endl
#define pvn(name, val) cerr << name << " = " << (val) << endl
#define pl cerr << '@' << __LINE__ << endl

template <class T>
ostream& operator<<(ostream& os, vector<T> const& vec) {
  if (vec.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < vec.size() - 1; i++) os << vec[i] << ", ";
    os << vec.back() << '}';
  }
  return os;
}

template <class T, size_t S>
ostream& operator<<(ostream& os, array<T, S> const& arr) {
  if (arr.empty()) {
    os << "{}";
  } else {
    os << '{';
    for (size_t i = 0; i < arr.size() - 1; i++) os << arr[i] << ", ";
    os << arr.back() << '}';
  }
  return os;
}

template <class T, class U>
ostream& operator<<(ostream& os, pair<T, U> const& p) {
  os << '(' << p.first << ", " << p.second << ')';
  return os;
}

template <class T, class U>
pair<T, U> operator+(pair<T, U> const& lhs, pair<T, U> const& rhs) {
  return {lhs.first + rhs.first, lhs.second + rhs.second};
}

template <class T, class U>
pair<T, U> operator-(pair<T, U> const& lhs, pair<T, U> const& rhs) {
  return {lhs.first - rhs.first, lhs.second - rhs.second};
}


template <class F, class T, class U>
U hoge(F f, T const& val, U l, U r) {
  while (l < r) {
    auto m = l + (r - l) / 2;
    auto fm = f(m);
    if (fm < val) {
      l = m + 1;
    } else {
      r = m;
    }
  }
  return l;
}

int ketaWa(int a) {
  int ans = 0;
  while (a > 0) {
    ans += a % 10;
    a /= 10;
  }

  return ans;
}

//a^b mod p
template<class T>
T powMod(T a, T b, T p = numeric_limits<T>::max()) {
  T acc = 1;
  while (b > 1) {
    if (b % 2 == 1) {
      acc *= a;
      acc %= p;
    }
    a *= a;
    a %= p;

    b /= 2;
  }

  return (acc * a) % p;
}

template<class T>
T combMod(T n, T r, T p = numeric_limits<T>::max()) {


}


int main(void) {
  i64 const p = 998244353;

  int N, A, B, K;
  cin >> N >> A >> B >> K;

  vector<i64> fact(N + 1);
  fact[0] = 1;
  for (i64 i = 1; i <= N; i++) fact[i] = i * fact[i - 1];

  i64 ans = 0;
  for (int a = 0; a <= N; a++) {
    if ((K - a * A) % B != 0) continue;
    int b = (K - a * A) / B;
    auto x = powMod(fact[N], 1ll, p);
    x = (x * powMod(fact[N - a], p - 2, p)) % p;
    x = (x * powMod(fact[a], p - 2, p)) % p;

    x = (x * powMod(fact[N], 1ll, p)) % p;
    x = (x * powMod(fact[N - b], p - 2, p)) % p;
    x = (x * powMod(fact[b], p - 2, p)) % p;
    ans = (ans + x) % p;
  }
  pv(fact);

  cout << ans << endl;

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:134:20: error: no matching function for call to 'powMod(__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type&, long long int, const i64&)'
  134 |     auto x = powMod(fact[N], 1ll, p);
      |              ~~~~~~^~~~~~~~~~~~~~~~~
a.cc:97:3: note: candidate: 'template<class T> T powMod(T, T, T)'
   97 | T powMod(T a, T b, T p = numeric_limits<T>::max()) {
      |   ^~~~~~
a.cc:97:3: note:   template argument deduction/substitution failed:
a.cc:134:20: note:   deduced conflicting types for parameter 'T' ('long int' and 'long long int')
  134 |     auto x = powMod(fact[N], 1ll, p);
      |              ~~~~~~^~~~~~~~~~~~~~~~~
a.cc:138:20: error: no matching function for call to 'powMod(__gnu_cxx::__alloc_traits<std::allocator<long int>, long int>::value_type&, long long int, const i64&)'
  138 |     x = (x * powMod(fact[N], 1ll, p)) % p;
      |              ~~~~~~^~~~~~~~~~~~~~~~~
a.cc:97:3: note: candidate: 'template<class T> T powMod(T, T, T)'
   97 | T powMod(T a, T b, T p = numeric_limits<T>::max()) {
      |   ^~~~~~
a.cc:97:3: note:   template argument deduction/substitution failed:
a.cc:138:20: note:   deduced conflicting types for parameter 'T' ('long int' and 'long long int')
  138 |     x = (x * powMod(fact[N], 1ll, p)) % p;
      |              ~~~~~~^~~~~~~~~~~~~~~~~