Language: C++

#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <float.h>
#include <random>

#define repeat(i,n) for (int i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge] << '\n'
#define debugArrayP(x,n) for(long long hoge = 0; (hoge) < (n); ++ (hoge)) cerr << #x << "[" << hoge << "]: " << x[hoge].first<< " " << x[hoge].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const int INF = INT_MAX;
const ll MOD = 998244353;

ll dp[310][300*300/2+10][300*300/2+10];
ll a[310];
ll sum[310];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;cin>>N;
  repeat(i,N){
    cin>>a[i];
    sum[i+1] =sum[i]+ a[i];
  }
  //debugArray(sum,N+1);
  dp[0][0][0]=1;
  repeat(i,N){
    repeat(j,min(sum[i],sum[N]/2+1)+1){
      repeat(k,min(sum[i],sum[N]/2+1)+1){
        if((j+a[i])*2<sum[N]){
          dp[i+1][j+a[i]][k] = (dp[i+1][j+a[i]][k]+dp[i][j][k])%MOD;
        }
        if((k+a[i])*2<sum[N]){
          dp[i+1][j][k+a[i]] = (dp[i+1][j][k+a[i]]+dp[i][j][k])%MOD;
        }
        dp[i+1][j][k] = (dp[i+1][j][k]+dp[i][j][k])%MOD;
      }
    }
  }
  ll ans=0;
  repeat(j,sum[N]/2+1){
    repeat(k,sum[N]/2+1){
      if((j+k)*2>sum[N]){
        //cerr<<"!!"<<endl;
        ans = (ans+dp[N][j][k])%MOD;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Compiler output:
/tmp/cciNsj8L.o: in function `main':
a.cc:(.text+0x55): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0x7e): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0x96): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0xb6): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0x113): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0x15f): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0x1f3): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0x273): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0x292): relocation truncated to fit: R_X86_64_PC32 against symbol `sum' defined in .bss section in /tmp/cciNsj8L.o
a.cc:(.text+0x2bf): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status