Language: C++

#include<iostream>
#include<vector>
#include<utility>
using namespace std;
#define ll long long
 
 long long int factorial[3*10*10*10*10*10+10];
 factorial[0] = 1;
 for(int i = 0; i < 3*10*10*10*10*10+9; i++){
     factorial[i+1] = factorial[i-1]*(i+1)%998244353;
 }

ll power(ll a, ll b, ll mod){
	ll x = 1, y = a;
	while (b > 0){
		if (b%2){
			x = (x*y)%mod;
		}
		y = (y*y)%mod;
		b /= 2;
	}
	return x%mod;
}	
 
ll modular_inverse(ll n, ll mod){
	return power(n, mod-2, mod);
}
 
ll nCr(ll n, ll k, ll mod){
	return (factorial[n]*((modular_inverse(factorial[k]*modular_inverse(factorial[n-k]))%mod))%mod;
}
 
int main(){
    long long int n, a, b;
    long long int k;
    long long int sum = 0;
    vector<pair<long long int, long long int>> v;
    pair<long long int, long long int> p;
    if((k-sum)%b == 0 && (k-sum)/b <= n){
        p = make_pair(0, (k-sum)/b);
        v.push_back(p);
    }
    cin >> n >> a >> b >> k;
    for(long long int i = 0; i < n; i++){
        sum += a;
        if((k-sum)%b == 0 && (k-sum)/b <= n){
            p = make_pair(i+1, (k-sum)/b);
            v.push_back(p);
        }
    }
    if(v.size() == 0){
        cout << 0 << endl;
        return 0;
    }
    long long int si = v.size();
    long long int sum = 0;
    else{
        for(long long int i = 0; i < si; i++){
            long long int a1, b1;
            pair<long long int, long long int> p1;
            p1 = v[v.size()-1];
            a1 = p1.first;
            b1 = p1.second;
            long long int s1 = nCr(n, a1, 998244353)%998244353;
            long long int s2 = nCr(n, b1, 998244353)%998244353;
            sum = (sum + s1*s2%998244353)%998244353;
            v.pop_back();
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Compiler output:
a.cc:8:2: error: 'factorial' does not name a type
    8 |  factorial[0] = 1;
      |  ^~~~~~~~~
a.cc:9:2: error: expected unqualified-id before 'for'
    9 |  for(int i = 0; i < 3*10*10*10*10*10+9; i++){
      |  ^~~
a.cc:9:17: error: 'i' does not name a type
    9 |  for(int i = 0; i < 3*10*10*10*10*10+9; i++){
      |                 ^
a.cc:9:41: error: 'i' does not name a type
    9 |  for(int i = 0; i < 3*10*10*10*10*10+9; i++){
      |                                         ^
a.cc: In function 'long long int nCr(long long int, long long int, long long int)':
a.cc:30:76: error: too few arguments to function 'long long int modular_inverse(long long int, long long int)'
   30 |         return (factorial[n]*((modular_inverse(factorial[k]*modular_inverse(factorial[n-k]))%mod))%mod;
      |                                                             ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
a.cc:25:4: note: declared here
   25 | ll modular_inverse(ll n, ll mod){
      |    ^~~~~~~~~~~~~~~
a.cc:30:103: error: expected ')' before ';' token
   30 |         return (factorial[n]*((modular_inverse(factorial[k]*modular_inverse(factorial[n-k]))%mod))%mod;
      |                ~                                                                                      ^
      |                                                                                                       )
a.cc: In function 'int main()':
a.cc:56:19: error: redeclaration of 'long long int sum'
   56 |     long long int sum = 0;
      |                   ^~~
a.cc:36:19: note: 'long long int sum' previously declared here
   36 |     long long int sum = 0;
      |                   ^~~
a.cc:57:5: error: 'else' without a previous 'if'
   57 |     else{
      |     ^~~~
a.cc: At global scope:
a.cc:71:5: error: 'cout' does not name a type
   71 |     cout << sum << endl;
      |     ^~~~
a.cc:72:5: error: expected unqualified-id before 'return'
   72 |     return 0;
      |     ^~~~~~
a.cc:73:1: error: expected declaration before '}' token
   73 | }
      | ^