Buggy python submission (verdict: Time Limit Exceeded):
##through permutations and combinations we can reduce ans to
##  Summation N-1CK(m-1)^(N-1-K)


import sys
sys.setrecursionlimit(100000000)
DP={}
mod=998244353
def getproduct(M,n):
    #product=(M-1)^n
    global mod
    fact=1000
    if n<fact:
        return (M**n)%mod
    else:
        Q=int(n/fact)
        R=n%fact
        prev=1
        for q in range(Q):
            prev=(prev*((M**fact)%mod))%mod
        prev=prev*((M**R)%mod)
        return prev%mod
def ncr(n, r, p): 
    # initialize numerator 
    # and denominator 
    num = den = 1 
    for i in range(r): 
        num = (num * (n - i)) % p 
        den = (den * (i + 1)) % p 
    return (num * pow(den,  
            p - 2, p)) % p 
  
def G(N,M,K):
    global mod
    res=0
    for k in range(K+1):
        res=(res+((ncr(N-1,k,mod))%mod *(M*getproduct(M-1,N-k-1))%mod)%mod)%mod
    return res%mod

def F(curr,N,M,K):
    global DP
    if(curr,K) in DP:
        return DP[(curr,K)]
    if curr==N:
        return 1
    if curr==0:
        return M*F(curr+1,N,M,K)
    else:
        a=0
        if K>0:
            a=F(curr+1,N,M,K-1)
        b=(M-1)*F(curr+1,N,M,K)
        DP[(curr,K)]=a+b
        return a+b
N,M,K=map(int,input().strip().split())
#print(F(0,N,M,K)%mod)
print(G(N,M,K))

Fixed submission:
##through permutations and combinations we can reduce ans to
##  Summation N-1CK(m-1)^(N-1-K)


import sys
sys.setrecursionlimit(100000000)
DP={}
mod=998244353
product={}
N = 1000001
  
# array to store inverse of 1 to N 
factorialNumInverse = [None] * (N + 1) 
  
# array to precompute inverse of 1! to N! 
naturalNumInverse = [None] * (N + 1) 
  
# array to store factorial of  
# first N numbers 
fact = [None] * (N + 1) 
  
# Function to precompute inverse of numbers 
def InverseofNumber(p): 
    naturalNumInverse[0] = naturalNumInverse[1] = 1
    for i in range(2, N + 1, 1): 
        naturalNumInverse[i] = (naturalNumInverse[p % i] * 
                                   (p - int(p / i)) % p) 
  
# Function to precompute inverse  
# of factorials 
def InverseofFactorial(p): 
    factorialNumInverse[0] = factorialNumInverse[1] = 1
  
    # precompute inverse of natural numbers 
    for i in range(2, N + 1, 1): 
        factorialNumInverse[i] = (naturalNumInverse[i] * 
                                  factorialNumInverse[i - 1]) % p 
  
# Function to calculate factorial of 1 to N 
def factorial(p): 
    fact[0] = 1
  
    # precompute factorials 
    for i in range(1, N + 1): 
        fact[i] = (fact[i - 1] * i) % p 
  
# Function to return nCr % p in O(1) time 
def Binomial(N, R, p): 
      
    # n C r = n!*inverse(r!)*inverse((n-r)!) 
    ans = ((fact[N] * factorialNumInverse[R])% p * 
                      factorialNumInverse[N - R])% p 
    return ans 
def getproduct(M,n):
    #product=(M-1)^n
    global mod,product
    fact=1000
    if n-1 in product:
        product[n]=(M*product[n-1])%mod
        return (M*product[n-1])%mod
    if n<fact:
        return (M**n)%mod
    else:
        Q=int(n/fact)
        R=n%fact
        prev=1
        for q in range(Q):
            prev=(prev*((M**fact)%mod))%mod
        prev=prev*((M**R)%mod)
        product[n]=prev%mod
        return prev%mod
def ncr(n, r, p): 
    # initialize numerator 
    # and denominator 
    num = den = 1 
    for i in range(r): 
        num = (num * (n - i)) % p 
        den = (den * (i + 1)) % p 
    return (num * pow(den,  
            p - 2, p)) % p 
  
def G(N,M,K):
    global mod
    res=0
    for k in range(K,-1,-1):
        res=(res+((Binomial(N-1,k,mod))%mod *(M*getproduct(M-1,N-k-1))%mod)%mod)%mod
    return res%mod

def F(curr,N,M,K):
    global DP
    if(curr,K) in DP:
        return DP[(curr,K)]
    if curr==N:
        return 1
    if curr==0:
        return M*F(curr+1,N,M,K)
    else:
        a=0
        if K>0:
            a=F(curr+1,N,M,K-1)
        b=(M-1)*F(curr+1,N,M,K)
        DP[(curr,K)]=a+b
        return a+b
N,M,K=map(int,input().strip().split())
InverseofNumber(mod) 
InverseofFactorial(mod) 
factorial(mod) 
#print(F(0,N,M,K)%mod)
print(G(N,M,K))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(100000000)
mod=0
def F(curr,N,M,K):
    global mod
    if curr==N:
        return 1
    if curr==0:
        return (M*F(curr+1,N,M,K))%mod
    else:
        a=0
        if K>0:
            a=F(curr+1,N,M,K-1)%mod
        b=(M-1)*F(curr+1,N,M,K)%mod
        return (a+b)%mod
N,M,K=map(int,input().strip().split())
mod=998244353
print(F(0,N ,M, K)%mod)

Fixed submission:
##through permutations and combinations we can reduce ans to
##  Summation N-1CK(m-1)^(N-1-K)


import sys
sys.setrecursionlimit(100000000)
DP={}
mod=998244353
product={}
N = 1000001
  
# array to store inverse of 1 to N 
factorialNumInverse = [None] * (N + 1) 
  
# array to precompute inverse of 1! to N! 
naturalNumInverse = [None] * (N + 1) 
  
# array to store factorial of  
# first N numbers 
fact = [None] * (N + 1) 
  
# Function to precompute inverse of numbers 
def InverseofNumber(p): 
    naturalNumInverse[0] = naturalNumInverse[1] = 1
    for i in range(2, N + 1, 1): 
        naturalNumInverse[i] = (naturalNumInverse[p % i] * 
                                   (p - int(p / i)) % p) 
  
# Function to precompute inverse  
# of factorials 
def InverseofFactorial(p): 
    factorialNumInverse[0] = factorialNumInverse[1] = 1
  
    # precompute inverse of natural numbers 
    for i in range(2, N + 1, 1): 
        factorialNumInverse[i] = (naturalNumInverse[i] * 
                                  factorialNumInverse[i - 1]) % p 
  
# Function to calculate factorial of 1 to N 
def factorial(p): 
    fact[0] = 1
  
    # precompute factorials 
    for i in range(1, N + 1): 
        fact[i] = (fact[i - 1] * i) % p 
  
# Function to return nCr % p in O(1) time 
def Binomial(N, R, p): 
      
    # n C r = n!*inverse(r!)*inverse((n-r)!) 
    ans = ((fact[N] * factorialNumInverse[R])% p * 
                      factorialNumInverse[N - R])% p 
    return ans 
def getproduct(M,n):
    #product=(M-1)^n
    global mod,product
    fact=1000
    if n-1 in product:
        product[n]=(M*product[n-1])%mod
        return (M*product[n-1])%mod
    if n<fact:
        return (M**n)%mod
    else:
        Q=int(n/fact)
        R=n%fact
        prev=1
        for q in range(Q):
            prev=(prev*((M**fact)%mod))%mod
        prev=prev*((M**R)%mod)
        product[n]=prev%mod
        return prev%mod
def ncr(n, r, p): 
    # initialize numerator 
    # and denominator 
    num = den = 1 
    for i in range(r): 
        num = (num * (n - i)) % p 
        den = (den * (i + 1)) % p 
    return (num * pow(den,  
            p - 2, p)) % p 
  
def G(N,M,K):
    global mod
    res=0
    for k in range(K,-1,-1):
        res=(res+((Binomial(N-1,k,mod))%mod *(M*getproduct(M-1,N-k-1))%mod)%mod)%mod
    return res%mod

def F(curr,N,M,K):
    global DP
    if(curr,K) in DP:
        return DP[(curr,K)]
    if curr==N:
        return 1
    if curr==0:
        return M*F(curr+1,N,M,K)
    else:
        a=0
        if K>0:
            a=F(curr+1,N,M,K-1)
        b=(M-1)*F(curr+1,N,M,K)
        DP[(curr,K)]=a+b
        return a+b
N,M,K=map(int,input().strip().split())
InverseofNumber(mod) 
InverseofFactorial(mod) 
factorial(mod) 
#print(F(0,N,M,K)%mod)
print(G(N,M,K))