Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
mod=998244353
Combi=1
SC=0
for i in range(N,N//2,-1):
    SC=(SC+Combi*pow(2,N-i,mod))%mod
    Combi=Combi*(i)*pow(N-i+1,mod-2,mod)%mod
print((pow(3,N,mod)-SC*2)%mod)

Fixed submission:
N=int(input())
mod=998244353

FACT=[1]
for i in range(1,N+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(N,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

POW=[1]
for i in range(N):
    POW.append(POW[-1]*2%mod)

def Combi(a,b):
    return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod

SC=0
for i in range(N//2+1,N+1):
    SC+=Combi(N,i)*POW[N-i]

print((pow(3,N,mod)-SC*2)%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
mod=998244353
Combi=1
for i in range(1,N//2+1):
    Combi=Combi*(N-i+1)*pow(i,mod-2,mod)%mod
SC=0
for i in range(N//2+1,N+1):
    Combi=Combi*(N-i+1)*pow(i,mod-2,mod)%mod
    SC=(SC+Combi*pow(2,N-i,mod))%mod  
print((pow(3,N,mod)-SC*2)%mod)

Fixed submission:
N=int(input())
mod=998244353

FACT=[1]
for i in range(1,N+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(N,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

POW=[1]
for i in range(N):
    POW.append(POW[-1]*2%mod)

def Combi(a,b):
    return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod

SC=0
for i in range(N//2+1,N+1):
    SC+=Combi(N,i)*POW[N-i]

print((pow(3,N,mod)-SC*2)%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
mod=998244353
Combi=[1]
for i in range(1,N+1):
    Combi.append(Combi[-1]*(N-i+1)*pow(i,mod-2,mod)%mod)
SC=0
for i in range(N//2+1,N+1):
    SC=(SC+Combi[i]*pow(2,N-i,mod))%mod
print((pow(3,N,mod)-SC*2)%mod)


Fixed submission:
N=int(input())
mod=998244353

FACT=[1]
for i in range(1,N+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(N,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

POW=[1]
for i in range(N):
    POW.append(POW[-1]*2%mod)

def Combi(a,b):
    return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod

SC=0
for i in range(N//2+1,N+1):
    SC+=Combi(N,i)*POW[N-i]

print((pow(3,N,mod)-SC*2)%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
mod=998244353
Combi=[1]
for i in range(1,N+1):
    Combi.append(Combi[-1]*(N-i+1)*pow(i,mod-2,mod)%mod)
SC=0
for i in range(N//2+1,N+1):
    SC+=Combi[i]*pow(2,N-i,mod)
print((pow(3,N,mod)-SC*2)%mod)

Fixed submission:
N=int(input())
mod=998244353

FACT=[1]
for i in range(1,N+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(N,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

POW=[1]
for i in range(N):
    POW.append(POW[-1]*2%mod)

def Combi(a,b):
    return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod

SC=0
for i in range(N//2+1,N+1):
    SC+=Combi(N,i)*POW[N-i]

print((pow(3,N,mod)-SC*2)%mod)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
mod=998244353

FACT=[1]
for i in range(1,N+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(N,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod

SC=0
for i in range(N//2+1,N+1):
    SC+=Combi(N,i)*pow(2,N-i,mod)

print((pow(3,N,mod)-SC*2)%mod)

Fixed submission:
N=int(input())
mod=998244353

FACT=[1]
for i in range(1,N+1):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(N,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

POW=[1]
for i in range(N):
    POW.append(POW[-1]*2%mod)

def Combi(a,b):
    return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod

SC=0
for i in range(N//2+1,N+1):
    SC+=Combi(N,i)*POW[N-i]

print((pow(3,N,mod)-SC*2)%mod)