Language: C++

v#include <bits/stdc++.h>

#if MYDEBUG
#include "lib/cp_debug.hpp"
#else
#define DBG(...) ;
#endif
#if __cplusplus <= 201402L
template <typename T>
T gcd(T a, T b) { return ((a % b == 0) ? b : gcd(b, a % b)); }
template <typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }
#endif
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;

namespace Problem {
using namespace std;
template <long long Mod = MOD>
class Factorial {
 private:
  int n;

 public:
  vector<long long> fac, inv;

 public:
  Factorial(long long n) : n(n), fac(n + 1), inv(n + 1) {
    fac[0] = 1;
    for (int i = 0; i < n; ++i) fac[i + 1] = fac[i] * (i + 1) % Mod;
    inv[n] = modpow(fac[n], Mod - 2);
    for (int i = n - 1; i >= 0; --i) inv[i] = inv[i + 1] * (i + 1) % Mod;
  };
  long long modpow(long long a, long long n, long long mod = Mod) {
    long long i = 1, ret = 1, p = a;
    while (i <= n) {
      if (i & n) {
        ret = (ret * p) % mod;
      }
      i = (i << 1);
      p = (p * p) % mod;
    }
    return ret;
  }
  long long C(int a, int b) {
    return (fac[a] * inv[b] % Mod) * inv[a - b] % Mod;
  }
  long long P(int a, int b) {
    return (fac[a]) * inv[a - b] % Mod;
  }
  long long H(int a, int b) {  //The number of multisets of length b on a symbols
    return C(a + b - 1, b);
  }
};
template <long long Mod = MOD>
class Modint {
 public:
  long long v;

  Modint(const Modint &x) { v = x.v; }
  explicit Modint(int x) {
    if (x < 0 or Mod <= x) x %= Mod;
    if (x < 0) x += Mod;
    v = x;
  }
  explicit Modint(long long x) {
    if (x < 0 or Mod <= x) x %= Mod;
    if (x < 0) x += Mod;
    v = x;
  }
  explicit Modint(unsigned x) {
    if (Mod <= x) x %= Mod;
    v = x;
  }
  explicit Modint(unsigned long long x) {
    if (Mod <= x) x %= Mod;
    v = x;
  }
  template <typename T>
  explicit Modint(T x) {
    if (x < 0 or Mod <= x) x %= Mod;
    v = x;
  }
  Modint() : v(0) {}
  long long get() const { return v; }
  Modint mpow(Modint &n) const { return mpow(n.v); }
  Modint mpow(long long n) const {
    long long i = 1, p = v;
    Modint ret(1);
    while (i <= n) {
      if (i & n) ret *= p;
      i = (i << 1);
      p = (p * p) % Mod;
    }
    return ret;
  }
  Modint operator-() const { return (v ? Modint(Mod - v) : Modint(0)); }
  explicit operator int() const { return v; }
  explicit operator long long() const { return v; }
  Modint &operator+=(const Modint &a) {
    v = (v + a.v);
    if (v >= Mod) v -= Mod;
    return *this;
  }
  Modint &operator-=(const Modint &a) {
    v = (v - a.v);
    if (v < 0) v += Mod;
    return *this;
  }
  Modint &operator*=(const Modint &a) {
    v = (v * a.v) % Mod;
    return *this;
  }
  Modint &operator/=(const Modint &a) {
    v = (v * a.mpow(Mod - 2).v) % Mod;
    return *this;
  }
  template <class T>
  Modint &operator+=(const T &a) {
    v = (v + Modint(a).v);
    if (v >= Mod) v -= Mod;
    return *this;
  }
  template <class T>
  Modint &operator-=(const T &a) {
    v = (v - Modint(a).v);
    if (v < 0) v += Mod;
    return *this;
  }
  template <class T>
  Modint &operator*=(const T &a) {
    v = (v * Modint(a).v) % Mod;
    return *this;
  }
  template <class T>
  Modint &operator/=(const T &a) {
    v = (v * Modint(a).mpow(Mod - 2).v) % Mod;
    return *this;
  }
  friend Modint operator+(const Modint &a, const Modint &b) {
    return Modint(a) += b;
  }
  friend Modint operator-(const Modint &a, const Modint &b) {
    return Modint(a) -= b;
  }
  friend Modint operator*(const Modint &a, const Modint &b) {
    return Modint(a) *= b;
  }
  friend Modint operator/(const Modint &a, const Modint &b) {
    return Modint(a) /= b;
  }
  template <class T, class U>
  friend Modint operator+(const T &a, const U &b) {
    return Modint(a) += Modint(b);
  }
  template <class T, class U>
  friend Modint operator-(const T &a, const U &b) {
    return Modint(a) -= Modint(b);
  }
  template <class T, class U>
  friend Modint operator*(const T &a, const U &b) {
    return Modint(a) *= Modint(b);
  }
  template <class T, class U>
  friend Modint operator/(const T &a, const U &b) {
    return Modint(a) /= Modint(b);
  }
};

template <long long M>
ostream &operator<<(ostream &os, const Modint<M> m) {
  return os << m.v;
}

class Solver {
 public:
  LL h, w, k;
  void solve() {
    cin >> h >> w >> k;
    Factorial<> fac(3e7);
    Modint<> ans(0);
    for (LL i = 1; i <= k; ++i) {
      Modint<> tmp(0);
      tmp += Modint<>(i + 1) * fac.P(w + h, i);
      tmp += Modint<>(i - 1) * i * w * fac.P(w + h - 1, i - 1);
      if (i >= 2) tmp += Modint<>(-1) * i * (i - 1) * w * (w - 1) * fac.P(w + h - 2, i - 2);
      tmp *= fac.P(w + h - i, k - i);
      ans += tmp;
    }
    cout << ans << endl;
  }
};

}  // namespace Problem

int main() {
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(false);
  // std::cout << std::fixed << std::setprecision(12);

  Problem::Solver sol;
  sol.solve();
  return 0;
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | v#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'v' does not name a type
    1 | v#include <bits/stdc++.h>
      | ^
a.cc:15:11: error: 'LL' does not name a type
   15 | constexpr LL LINF = 334ll << 53;
      |           ^~
a.cc:17:11: error: 'LL' does not name a type
   17 | constexpr LL MOD = 1E9 + 7;
      |           ^~
a.cc:21:27: error: 'MOD' was not declared in this scope
   21 | template <long long Mod = MOD>
      |                           ^~~
a.cc:27:3: error: 'vector' does not name a type
   27 |   vector<long long> fac, inv;
      |   ^~~~~~
a.cc: In constructor 'Problem::Factorial<Mod>::Factorial(long long int)':
a.cc:30:34: error: class 'Problem::Factorial<Mod>' does not have any field named 'fac'
   30 |   Factorial(long long n) : n(n), fac(n + 1), inv(n + 1) {
      |                                  ^~~
a.cc:30:46: error: class 'Problem::Factorial<Mod>' does not have any field named 'inv'
   30 |   Factorial(long long n) : n(n), fac(n + 1), inv(n + 1) {
      |                                              ^~~
a.cc:31:5: error: 'fac' was not declared in this scope
   31 |     fac[0] = 1;
      |     ^~~
a.cc:33:5: error: 'inv' was not declared in this scope; did you mean 'int'?
   33 |     inv[n] = modpow(fac[n], Mod - 2);
      |     ^~~
      |     int
a.cc: In member function 'long long int Problem::Factorial<Mod>::C(int, int)':
a.cc:48:13: error: 'fac' was not declared in this scope
   48 |     return (fac[a] * inv[b] % Mod) * inv[a - b] % Mod;
      |             ^~~
a.cc:48:22: error: 'inv' was not declared in this scope; did you mean 'int'?
   48 |     return (fac[a] * inv[b] % Mod) * inv[a - b] % Mod;
      |                      ^~~
      |                      int
a.cc: In member function 'long long int Problem::Factorial<Mod>::P(int, int)':
a.cc:51:13: error: 'fac' was not declared in this scope
   51 |     return (fac[a]) * inv[a - b] % Mod;
      |             ^~~
a.cc:51:23: error: 'inv' was not declared in this scope; did you mean 'int'?
   51 |     return (fac[a]) * inv[a - b] % Mod;
      |                       ^~~
      |                       int
a.cc: At global scope:
a.cc:57:27: error: 'MOD' was not declared in this scope
   57 | template <long long Mod = MOD>
      |                           ^~~
a.cc:173:1: error: 'ostream' does not name a type
  173 | ostream &operator<<(ostream &os, const Modint<M> m) {
      | ^~~~~~~
a.cc:179:3: error: 'LL' does not name a type
  179 |   LL h, w, k;
      |   ^~
a.cc: In member function 'void Problem::Solver::solve()':
a.cc:181:5: error: 'cin' was not declared in this scope
  181 |     cin >> h >> w >> k;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | v#include <bits/stdc++.h>
a.cc:181:12: error: 'h' was not declared in this scope
  181 |     cin >> h >> w >> k;
      |            ^
a.cc:181:17: error: 'w' was not declared in this scope
  181 |     cin >> h >> w >> k;
      |                 ^
a.cc:181:22: error: 'k' was not declared in this scope
  181 |     cin >> h >> w >> k;
      |                      ^
a.cc:182:15: error: template argument 1 is invalid
  182 |     Factorial<> fac(3e7);
      |               ^
a.cc:183:12: error: template argument 1 is invalid
  183 |     Modint<> ans(0);
      |            ^
a.cc:184:10: error: 'LL' was not declared in this scope
  184 |     for (LL i = 1; i <= k; ++i) {
      |          ^~
a.cc:184:20: error: 'i' was not declared in this scope
  184 |     for (LL i = 1; i <= k; ++i) {
      |                    ^
a.cc:185:14: error: template argument 1 is invalid
  185 |       Modint<> tmp(0);
      |              ^
a.cc:186:21: error: template argument 1 is invalid
  186 |       tmp += Modint<>(i + 1) * fac.P(w + h, i);
      |                     ^
a.cc:186:36: error: request for member 'P' in 'fac', which is of non-class type 'int'
  186 |       tmp += Modint<>(i + 1) * fac.P(w + h, i);
      |                                    ^
a.cc:187:21: error: template argument 1 is invalid
  187 |       tmp += Modint<>(i - 1) * i * w * fac.P(w + h - 1, i - 1);
      |                     ^
a.cc:187:44: error: request for member 'P' in 'fac', which is of non-class type 'int'
  187 |       tmp += Modint<>(i - 1) * i * w * fac.P(w + h - 1, i - 1);
      |                                            ^
a.cc:188:33: error: template argument 1 is invalid
  188 |       if (i >= 2) tmp += Modint<>(-1) * i * (i - 1) * w * (w - 1) * fac.P(w + h - 2, i - 2);
      |                                 ^
a.cc:188:73: error: request for member 'P' in 'fac', which is of non-class type 'int'
  188 |       if (i >= 2) tmp += Modint<>(-1) * i * (i - 1) * w * (w - 1) * fac.P(w + h - 2, i - 2);
      |                                                                         ^
a.cc:189:18: error: request for member 'P' in 'fac', which is of non-class type 'int'
  189 |       tmp *= fac.P(w + h - i, k - i);
      |                  ^
a.cc:192:5: error: 'cout' was not declared in this scope
  192 |     cout << ans << endl;
      |     ^~~~
a.cc:192:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:192:20: error: 'endl' was not declared in this scope
  192 |     cout << ans << endl;
      |                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | v#include <bits/stdc++.h>
a.cc: In function 'int main()':
a.cc:199:8: error: 'cin' is not a member of 'std'
  199 |   std::cin.tie(0);
      |        ^~~
a.cc:199:8: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:200:8: error: 'std::ios_base' has not been declared
  200 |   std::ios_base::sync_with_stdio(false);
      |        ^~~~~~~~