이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define ll long long
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define ok puts("ok");
#define whatis(x) cerr << #x << " = " << x << endl;
#define pause system("pause");
#define random rand() ^ (rand() << 5)
const int N = (int)1e6 + 7;
const int inf = (int)1e9 + 7;
int mod = (int)1e9 + 7;
ll fact[N];
ll mult(ll a, ll b) {
  return a * b % mod;
}
ll add(ll a, ll b) {
  a += b;
  if (a > mod) a -= mod;
  return a;
}
ll sub(ll a, ll b) {
  a -= b;
  while (a < 0) a += mod;
  return a;
}
void precalc() {
  fact[0] = 1;
  for (ll i = 1; i < N; i++) {
    fact[i] = mult(fact[i - 1], i);
  }
}
ll binpow(ll a, int n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) {
      res = mult(res, a);
    }
    a = mult(a, a);
    n >>= 1;
  }
  return res;
}
ll cnk(ll n, ll k) {
  if (k > n) return 0;
  return mult(mult(fact[n], binpow(fact[k], mod - 2)), binpow(fact[n - k], mod - 2));
}
int n, m;
main() {
  precalc();
  scanf("%d %d", &n, &m);
  m--;
  ll ans = 0;
  for (int k = 0; k <= m + 1; k++) {
    if (k & 1) {
      ans = sub(ans, mult(cnk(n + 1, k), binpow(m + 1 - k, n)));
    } else {
      ans = add(ans, mult(cnk(n + 1, k), binpow(m + 1 - k, n)));
    }
  }
  cout << ans;
}
컴파일 시 표준 에러 (stderr) 메시지
asceticism.cpp:67:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
asceticism.cpp: In function 'int main()':
asceticism.cpp:69:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &n, &m);
   ~~~~~^~~~~~~~~~~~~~~~~| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |