Language: C++

#include <iostream> 
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <cctype>
#include <climits>

using namespace std;

using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;

using ll = long long int;

#define mp(a,b) make_pair(a,b)

const int MOD = 998244353;

bool res() {
	int n, s;
	cin >> n >> s;
	if (!cin) return false;

	vi v(n);
	for (int i = 0; i < n; ++i) cin >> v[i];

	ll res = 0;

	
	vector<ll> kn(s + 1, 0);
	kn[0] = 1;
	for (int j = n - 1; j >= 0; --j) {
		for (int d = s; d >= 0; --d) {
			if (kn[d] != 0 && d + v[j] <= s) {
				#include <iostream> 
#include <vector>
#include <cmath>
#include <string>
#include <sstream>
#include <algorithm>
#include <queue>
#include <stack>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <map>
#include <iomanip>
#include <cctype>
#include <climits>
 
using namespace std;
 
using ii = pair<int, int>;
using vi = vector<int>;
using vii = vector<ii>;
using vvi = vector<vi>;
 
using ll = long long int;
 
#define mp(a,b) make_pair(a,b)
 
const int MOD = 998244353;
 
bool res() {
	int n, s;
	cin >> n >> s;
	if (!cin) return false;
 
	vi v(n);
	for (int i = 0; i < n; ++i) cin >> v[i];

 
	ll res = 0;
 
	
	vector<ll> kn(s + 1, 0);
	kn[0] = 1;
	for (int j = ini; j < n; ++j) {
		for (int d = s; d >= 0; --d) {
			if (kn[d] != 0 && d + v[j] <= s) {
				kn[d + v[j]] = (kn[d] + kn[d + v[j]]) % MOD;
					
				if (d + v[j] == s) {
					res = (res + (n - j)* j * kn[d]) % MOD;
				}
				
			}
		}
	}
 
	cout << res << '\n';
 
	return true;
}


int main() {
	while (res()) {}
	return 0;
}

Compiler output:
a.cc: In function 'bool res()':
a.cc:75:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   75 | bool res() {
      |         ^~
a.cc:75:9: note: remove parentheses to default-initialize a variable
   75 | bool res() {
      |         ^~
      |         --
a.cc:75:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:75:12: error: a function-definition is not allowed here before '{' token
   75 | bool res() {
      |            ^
a.cc:108:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
  108 | int main() {
      |         ^~
a.cc:108:9: note: remove parentheses to default-initialize a variable
  108 | int main() {
      |         ^~
      |         --
a.cc:108:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:108:12: error: a function-definition is not allowed here before '{' token
  108 | int main() {
      |            ^
a.cc:111:2: error: expected '}' at end of input
  111 | }
      |  ^
a.cc:45:58: note: to match this '{'
   45 |                         if (kn[d] != 0 && d + v[j] <= s) {
      |                                                          ^
a.cc:111:2: error: expected '}' at end of input
  111 | }
      |  ^
a.cc:44:46: note: to match this '{'
   44 |                 for (int d = s; d >= 0; --d) {
      |                                              ^
a.cc:111:2: error: expected '}' at end of input
  111 | }
      |  ^
a.cc:43:42: note: to match this '{'
   43 |         for (int j = n - 1; j >= 0; --j) {
      |                                          ^
a.cc:111:2: error: expected '}' at end of input
  111 | }
      |  ^
a.cc:30:12: note: to match this '{'
   30 | bool res() {
      |            ^
a.cc:111:2: warning: control reaches end of non-void function [-Wreturn-type]
  111 | }
      |  ^