Language: C++

#include<bits/stdc++.h>
long long flip(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
int main () {
  const long long mo = 998244353;
  int N;
  long long M;
  int K;
  cin >> N >> M >> K;
  vector<long long>mpo(N + 1);
  mpo[0] = 1;
  for (int i = 1; i <= N; i ++) {
    long long kj = mpo[i - 1] * (M - 1);
    mpo[i] = kj % mo;
  }
  long long ans = 0;
  vector<long long>com(N + 1);
  com[0] = 1;
  for (int i = 1; i <= N; i ++) {
    com[i] = com[i - 1] * (N + 1 - i) * flip(i);
    com[i] %= mo;
  }
  for (int i = 0; i <= K; i ++) {
    int j = N - i;
    long long kj = mpo[j - 1] * M * com[i];
    kj %= mo;
    ans += kj;
    ans %= mo;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'long long int flip(long long int, long long int)':
a.cc:7:5: error: 'swap' was not declared in this scope
    7 |     swap(a, b);
      |     ^~~~
a.cc:7:5: note: suggested alternatives:
In file included from /usr/include/c++/14/regex:68,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:181,
                 from a.cc:1:
/usr/include/c++/14/bits/regex.h:2230:5: note:   'std::__cxx11::swap'
 2230 |     swap(match_results<_Bi_iter, _Alloc>& __lhs,
      |     ^~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:61,
                 from /usr/include/c++/14/bits/stl_algobase.h:64,
                 from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51:
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
  226 |     swap(_Tp& __a, _Tp& __b)
      |     ^~~~
/usr/include/c++/14/bits/move.h:226:5: note:   'std::swap'
In file included from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/stdexcept:38,
                 from /usr/include/c++/14/system_error:43,
                 from /usr/include/c++/14/bits/ios_base.h:46,
                 from /usr/include/c++/14/streambuf:43,
                 from /usr/include/c++/14/bits/streambuf_iterator.h:35,
                 from /usr/include/c++/14/iterator:66,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:54:
/usr/include/c++/14/bits/exception_ptr.h:229:5: note:   'std::__exception_ptr::swap'
  229 |     swap(exception_ptr& __lhs, exception_ptr& __rhs)
      |     ^~~~
In file included from /usr/include/c++/14/filesystem:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:200:
/usr/include/c++/14/bits/fs_path.h:736:15: note:   'std::filesystem::__cxx11::swap'
  736 |   inline void swap(path& __lhs, path& __rhs) noexcept { __lhs.swap(__rhs); }
      |               ^~~~
a.cc: In function 'int main()':
a.cc:20:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   20 |   cin >> N >> M >> K;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:21:3: error: 'vector' was not declared in this scope
   21 |   vector<long long>mpo(N + 1);
      |   ^~~~~~
a.cc:21:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:21:10: error: expected primary-expression before 'long'
   21 |   vector<long long>mpo(N + 1);
      |          ^~~~
a.cc:22:3: error: 'mpo' was not declared in this scope; did you mean 'mo'?
   22 |   mpo[0] = 1;
      |   ^~~
      |   mo
a.cc:28:10: error: expected primary-expression before 'long'
   28 |   vector<long long>com(N + 1);
      |          ^~~~
a.cc:29:3: error: 'com' was not declared in this scope; did you mean 'cos'?
   29 |   com[0] = 1;
      |   ^~~
      |   cos
a.cc:31:45: error: too few arguments to function 'long long int flip(long long int, long long int)'
   31 |     com[i] = com[i - 1] * (N + 1 - i) * flip(i);
      |                                         ~~~~^~~
a.cc:2:11: note: declared here
    2 | long long flip(long long a, long long m) {
      |           ^~~~
a.cc:41:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   41 |   cout << ans << endl;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:41:18: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   41 |   cout << ans << endl;
      |                  ^~~~
      |                  std::endl
In file included from /usr/include/c++/14/istream:41,
                 from /usr/include/c++/14/sstream:40,
                 from /usr/include/c++/14/complex:45,
                 from /usr/include/c++/14/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~