Buggy python submission (verdict: Time Limit Exceeded):
import math
import copy
import numpy as np

MOD = 998244353

n = int(input())
xxs = []
total = 0
for _ in range(n):
    t = int(input())
    xxs.append(t)
    total += t

xs = np.array(xxs)
dp = np.array([[0] * (total+1) for _ in range(n)])

dp[0][0] = 2
dp[0][xs[0]] = 1

curtotal = xs[0]
for i in range(1,n): # length of
    s = xs[i]
    curtotal += s
    dp[i] = (dp[i-1] * 2)
    for j in range (s,curtotal+1):
        if j - s >= 0:
            dp[i][j] = (dp[i][j] + dp[i-1][j-s])
    dp[i] %= MOD

plus = 0
if total % 2 == 0:
    dp2 = np.array([0] * (total // 2 + 1))
    dp2[0] = 1
    curtotal = 0
    for i in range(n):
        s = xs[i]
        curtotal += s
        prev = copy.copy(dp2)
        for j in range(s,min(len(dp2), curtotal+1)):
            if j-s >= 0:
                dp2[j] =  (dp2[j] + prev[j-s]) % MOD
                #print(i,j,s,dp2)
    plus = dp2[total//2]

#print(dp2)
minus = 0
for i in range(math.ceil(total/2), total+1):
    minus = (minus + dp[n-1][i]) % MOD


#print(3**n, minus, plus)
print(((3**n)%MOD - minus*3 + plus*3) % MOD)


Fixed submission:
import math
import copy
import numpy as np

MOD = 998244353

n = int(input())
xxs = []
total = 0
for _ in range(n):
    t = int(input())
    xxs.append(t)
    total += t

xs = np.array(xxs)
dp = np.array([[0] * (total+1) for _ in range(n)])

dp[0][0] = 2
dp[0][xs[0]] = 1

curtotal = xs[0]
for i in range(1,n): # length of
    s = xs[i]
    curtotal += s
    dp[i] = (dp[i-1] * 2)
    dp[i][s:] += dp[i-1][:-s]
    dp[i] %= MOD

#print(dp)

plus = 0
if total % 2 == 0:
    dp2 = np.array([0] * (total // 2 + 1))
    dp2[0] = 1
    curtotal = 0
    for i in range(n):
        s = xs[i]
        curtotal += s
        prev = copy.copy(dp2)
        dp2[s:] += prev[:-s]
        dp2 %= MOD
    plus = dp2[total//2]

#print(dp2)
minus = 0
for i in range(math.ceil(total/2), total+1):
    minus = (minus + dp[n-1][i]) % MOD


#print(3**n, minus, plus)
print(((3**n)%MOD - minus*3 + plus*3) % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import copy

MOD = 998244353

n = int(input())
xs = []
total = 0
for _ in range(n):
    t = int(input())
    xs.append(t)
    total += t

dp = [[0] * (total+1) for _ in range(n)]

dp[0][0] = 2
dp[0][xs[0]] = 1

curtotal = xs[0]
for i in range(1,n): # length of
    s = xs[i]
    curtotal += s
    for j in range (0,curtotal+1):
        dp[i][j] = (dp[i-1][j] * 2) % MOD
        if j - s >= 0:
            dp[i][j] = (dp[i][j] + dp[i-1][j-s]) % MOD


plus = 0
if total % 2 == 0:
    dp2 = [0] * (total // 2 + 1)
    dp2[0] = 1
    curtotal = 0
    for i in range(n):
        s = xs[i]
        curtotal += s
        prev = copy.copy(dp2)
        for j in range(0,min(len(dp2), curtotal+1)):
            if j-s >= 0:
                dp2[j] =  (dp2[j] + prev[j-s]) % MOD
                #print(i,j,s,dp2)
    plus = dp2[total//2]

#print(dp2)
minus = 0
for i in range(math.ceil(total/2), total+1):
    minus = (minus + dp[n-1][i]) % MOD


#print(3**n, minus, plus)
print(((3**n)%MOD - minus*3 + plus*3) % MOD)


Fixed submission:
import math
import copy
import numpy as np

MOD = 998244353

n = int(input())
xxs = []
total = 0
for _ in range(n):
    t = int(input())
    xxs.append(t)
    total += t

xs = np.array(xxs)
dp = np.array([[0] * (total+1) for _ in range(n)])

dp[0][0] = 2
dp[0][xs[0]] = 1

curtotal = xs[0]
for i in range(1,n): # length of
    s = xs[i]
    curtotal += s
    dp[i] = (dp[i-1] * 2)
    dp[i][s:] += dp[i-1][:-s]
    dp[i] %= MOD

#print(dp)

plus = 0
if total % 2 == 0:
    dp2 = np.array([0] * (total // 2 + 1))
    dp2[0] = 1
    curtotal = 0
    for i in range(n):
        s = xs[i]
        curtotal += s
        prev = copy.copy(dp2)
        dp2[s:] += prev[:-s]
        dp2 %= MOD
    plus = dp2[total//2]

#print(dp2)
minus = 0
for i in range(math.ceil(total/2), total+1):
    minus = (minus + dp[n-1][i]) % MOD


#print(3**n, minus, plus)
print(((3**n)%MOD - minus*3 + plus*3) % MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import copy

MOD = 998244353

n = int(input())
xs = []
total = 0
for _ in range(n):
    t = int(input())
    xs.append(t)
    total += t

dp = [[0] * (total+1) for _ in range(n)]

dp[0][0] = 2
dp[0][xs[0]] = 1

for i in range(1,n): # length of
    s = xs[i]
    for j in range (0,total+1):
        dp[i][j] = (dp[i-1][j] * 2) % MOD
        if j - s >= 0:
            dp[i][j] = (dp[i][j] + dp[i-1][j-s]) % MOD

plus = 0
if total % 2 == 0:
    dp2 = [0] * (total // 2 + 1)
    dp2[0] = 1
    intotal = 0
    for i in range(n):
        s = xs[i]
        prev = copy.copy(dp2)
        for j in range(0,len(dp2)):
            if j-s >= 0:
                dp2[j] =  (dp2[j] + prev[j-s]) % MOD
                #print(i,j,s,dp2)
    plus = dp2[total//2]

#print(dp2)
minus = 0
for i in range(math.ceil(total/2), total+1):
    minus = (minus + dp[n-1][i]) % MOD


#print(3**n, minus, plus)
print(((3**n)%MOD - minus*3 + plus*3) % MOD)


Fixed submission:
import math
import copy
import numpy as np

MOD = 998244353

n = int(input())
xxs = []
total = 0
for _ in range(n):
    t = int(input())
    xxs.append(t)
    total += t

xs = np.array(xxs)
dp = np.array([[0] * (total+1) for _ in range(n)])

dp[0][0] = 2
dp[0][xs[0]] = 1

curtotal = xs[0]
for i in range(1,n): # length of
    s = xs[i]
    curtotal += s
    dp[i] = (dp[i-1] * 2)
    dp[i][s:] += dp[i-1][:-s]
    dp[i] %= MOD

#print(dp)

plus = 0
if total % 2 == 0:
    dp2 = np.array([0] * (total // 2 + 1))
    dp2[0] = 1
    curtotal = 0
    for i in range(n):
        s = xs[i]
        curtotal += s
        prev = copy.copy(dp2)
        dp2[s:] += prev[:-s]
        dp2 %= MOD
    plus = dp2[total//2]

#print(dp2)
minus = 0
for i in range(math.ceil(total/2), total+1):
    minus = (minus + dp[n-1][i]) % MOD


#print(3**n, minus, plus)
print(((3**n)%MOD - minus*3 + plus*3) % MOD)