Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import factorial
n, m, k = map(int, input().split())
prime_mod = 998244353

def prime_cycle_division(a, b):
  inverted = pow(b, prime_mod-2, prime_mod)
  return (a*inverted)%prime_mod

def mod_comb(places, objects):
  numerator = 1
  denominator = 1
  for i in range(objects):
    numerator = (numerator*(places-i))%prime_mod
    denominator = (denominator*(i+1))%prime_mod
  ans = prime_cycle_division(numerator, denominator)
  return ans

def combos(j):
  ans = (m*mod_comb(n-1, j))%prime_mod
  ans = (ans*pow(m-1, n-1-j, prime_mod))%prime_mod
  return ans

total = 0
for j in range(k+1):
  total = (total + combos(j))%prime_mod
print(total)

Fixed submission:
import sys
n, m, k = map(int, input().split())
prime_mod = 998244353

def prime_cycle_division(a, b):
  inverted = pow(b, prime_mod-2, prime_mod)
  return (a*inverted)%prime_mod

def gen_mod_combs(places):
  k = 0
  x = 1
  while True:
    yield x
    factor = prime_cycle_division(places-k, k+1)
    x = (x*factor)%prime_mod
    k += 1

def combos(j):
  ans = (m*next(gen))%prime_mod
  ans = (ans*pow(m-1, n-1-j, prime_mod))%prime_mod
  return ans

total = 0
gen = gen_mod_combs(n-1)
for j in range(k+1):
  total = (total + combos(j))%prime_mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import factorial
n, m, k = map(int, input().split())
prime_mod = 998244353

def prime_cycle_division(a, b):
  inverted = pow(b, prime_mod-2, prime_mod)
  return (a*inverted)%prime_mod

def prime_factorial(lower, upper):
  total = 1
  for i in range(lower+1, upper+1):
    total = (total*i)%prime_mod
  return total

def mod_comb(places, objects):
  objects = min(objects, places-objects)
  numerator = prime_factorial(places-objects, places)
  denominator = prime_factorial(0, objects)
  ans = prime_cycle_division(numerator, denominator)
  return ans

def combos(j):
  ans = (m*mod_comb(n-1, j))%prime_mod
  ans = (ans*pow(m-1, n-1-j, prime_mod))%prime_mod
  return ans

total = 0
for j in range(k+1):
  total = (total + combos(j))%prime_mod
print(total)

Fixed submission:
import sys
n, m, k = map(int, input().split())
prime_mod = 998244353

def prime_cycle_division(a, b):
  inverted = pow(b, prime_mod-2, prime_mod)
  return (a*inverted)%prime_mod

def gen_mod_combs(places):
  k = 0
  x = 1
  while True:
    yield x
    factor = prime_cycle_division(places-k, k+1)
    x = (x*factor)%prime_mod
    k += 1

def combos(j):
  ans = (m*next(gen))%prime_mod
  ans = (ans*pow(m-1, n-1-j, prime_mod))%prime_mod
  return ans

total = 0
gen = gen_mod_combs(n-1)
for j in range(k+1):
  total = (total + combos(j))%prime_mod
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from math import factorial
n, m, k = map(int, input().split())
prime_mod = 998244353

def prime_cycle_division(a, b):
  inverted = pow(b, prime_mod-2, prime_mod)
  return (a*inverted)%prime_mod

def prime_factorial(lower, upper):
  total = 1
  for i in range(lower+1, upper+1):
    total = (total*i)%prime_mod
  return total

def mod_comb(places, objects):
  numerator = prime_factorial(places-objects, places)
  denominator = prime_factorial(0, objects)
  ans = prime_cycle_division(numerator, denominator)
  return ans

def combos(j):
  ans = (m*mod_comb(n-1, j))%prime_mod
  ans = (ans*pow(m-1, n-1-j, prime_mod))%prime_mod
  return ans

total = 0
for j in range(k+1):
  total = (total + combos(j))%prime_mod
print(total)

Fixed submission:
import sys
n, m, k = map(int, input().split())
prime_mod = 998244353

def prime_cycle_division(a, b):
  inverted = pow(b, prime_mod-2, prime_mod)
  return (a*inverted)%prime_mod

def gen_mod_combs(places):
  k = 0
  x = 1
  while True:
    yield x
    factor = prime_cycle_division(places-k, k+1)
    x = (x*factor)%prime_mod
    k += 1

def combos(j):
  ans = (m*next(gen))%prime_mod
  ans = (ans*pow(m-1, n-1-j, prime_mod))%prime_mod
  return ans

total = 0
gen = gen_mod_combs(n-1)
for j in range(k+1):
  total = (total + combos(j))%prime_mod
print(total)