malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   queue<pair<int, int> > q;   int n, s[3][7005], f[3][7005], k[3], dd[3][7005];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 1; i <= 2; i++) {       cin >> k[i];       for (int j = 1; j <= k[i]; j++) cin >> s[i][j];     }     memset(f, 0, sizeof f);     q.push(pair<int, int>(1, 0));     q.push(pair<int, int>(2, 0));     f[1][0] = 1;     f[2][0] = 1;     while (!q.empty()) {       int t = q.front().first;       int u = q.front().second;       q.pop();       if (f[t][u] == 1) {         for (int i = 1; i <= k[3 - t]; i++) {           int v = (u + n - s[3 - t][i]) % n;           if (f[3 - t][v] > 0) continue;           f[3 - t][v] = 2;           q.push(pair<int, int>(3 - t, v));         }       } else {         for (int i = 1; i <= k[3 - t]; i++) {           int v = (u + n - s[3 - t][i]) % n;           if (f[3 - t][v] > 0) continue;           ++dd[3 - t][v];           if (dd[3 - t][v] == k[3 - t]) {             f[3 - t][v] = 1;             q.push(pair<int, int>(3 - t, v));           }         }       }     }     for (int i = 1; i <= 2; i++) {       for (int j = 1; j <= n - 1; j++) {         if (f[i][j] < 1) cout <<  Loop  ;         if (f[i][j] == 1) cout <<  Lose  ;         if (f[i][j] > 1) cout <<  Win  ;       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1e9 + 10;   const double pi = acos(-1.0);   const double eps = 1e-8;   struct node1 {     int y, x1, x2;   } a[5050];   int tp1;   struct node2 {     int x, y1, y2;   } b[5050];   int tp2;   bitset<5050> bs[5050];   int main() {     int n;     tp1 = tp2 = 0;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       int x1, y1, x2, y2;       scanf( %d %d %d %d , &x1, &y1, &x2, &y2);       if (x1 == x2) {         b[++tp2].x = x1;         if (y1 > y2) swap(y1, y2);         b[tp2].y1 = y1;         b[tp2].y2 = y2;       } else {         a[++tp1].y = y1;         if (x1 > x2) swap(x1, x2);         a[tp1].x1 = x1;         a[tp1].x2 = x2;       }     }     if (tp1 > tp2) {       int tp = max(tp1, tp2);       for (int i = 1; i <= tp; i++) {         int tmp = a[i].y;         a[i].y = b[i].x;         b[i].x = tmp;         tmp = a[i].x1;         a[i].x1 = b[i].y1;         b[i].y1 = tmp;         tmp = a[i].x2;         a[i].x2 = b[i].y2;         b[i].y2 = tmp;       }       swap(tp1, tp2);     }     for (int i = 1; i <= tp1; i++) {       for (int j = 1; j <= tp2; j++) {         if (a[i].y >= b[j].y1 && a[i].y <= b[j].y2 && b[j].x >= a[i].x1 &&             b[j].x <= a[i].x2) {           bs[i][j] = 1;         }       }     }     long long ans = 0;     for (int i = 1; i < tp1; i++) {       if (bs[i].count() == 0) continue;       for (int j = i + 1; j <= tp1; j++) {         bitset<5050> bb = bs[i] & bs[j];         int tmp = bb.count();         ans += tmp * (tmp - 1) / 2;       }     }     printf( %I64d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> prime;   int isprime[1000005];   void Find() {     for (int i = 2; i < 1000005; i++) {       if (isprime[i] == 0) {         prime.push_back(i);         for (int j = i * 2; j < 1000005; j += i) isprime[j] = 1;       }     }   }   vector<int> v[1000005];   int dis[1000005];   int from[1000005];   int main() {     int n;     scanf( %d , &n);     vector<int> vv;     for (int i = 2; i <= 1000; i++) {       vv.push_back(i * i);     }     vector<int> ok, ok2;     Find();     for (int i = 1; i <= n; i++) {       int first;       scanf( %d , &first);       for (auto it : vv) {         while (first % it == 0) first /= it;       }       if (first == 1) {         printf( 1 n );         return 0;       }       if (isprime[first] == 0)         ok.push_back(first);       else {         for (int j = 2; j < 1000; j++) {           if (first % j == 0) {             v[first / j].push_back(j);             v[j].push_back(first / j);             break;           }         }         ok2.push_back(first);       }     }     sort(ok.begin(), ok.end());     for (int i = 1; i < ok.size(); i++) {       if (ok[i] == ok[i - 1]) {         printf( 2 n );         return 0;       }     }     sort(ok2.begin(), ok2.end());     for (int i = 1; i < ok.size(); i++) {       if (ok[i] == ok[i - 1]) {         printf( 2 n );         return 0;       }     }     queue<int> q;     memset(dis, -1, sizeof(dis));     for (auto it : ok) {       dis[it] = 0;       q.push(it);     }     int ans = 1e9;     while (!q.empty()) {       int first = q.front();       q.pop();       for (auto it : v[first]) {         if (dis[it] == -1) {           dis[it] = dis[first] + 1;           from[it] = first;           q.push(it);         } else {           if (from[first] == it)             ;           else {             ans = min(ans, dis[it] + dis[first] + 1 + 2);           }         }       }     }     for (auto it : prime) {       if (it > 1000) break;       for (auto it2 : prime) dis[it2] = -1;       dis[it] = 0;       queue<int> q;       q.push(it);       while (!q.empty()) {         int first = q.front();         q.pop();         for (auto it2 : v[first]) {           if (dis[it2] == -1) {             dis[it2] = dis[first] + 1;             from[it2] = first;             q.push(it2);           } else {             if (from[first] == it2)               ;             else {               ans = min(ans, dis[first] + dis[it2] + 1);             }           }         }       }     }     if (ans == 1e9) {       printf( -1 n );     } else {       printf( %d n , ans);     }   }
#include <bits/stdc++.h>   using namespace std;   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     long long ct;     cin >> ct;     while (ct--) {       long long n, k;       cin >> n >> k;       vector<long long> a(n), was(n + 1), s;       long long tmp = 0;       for (long long i = 0; i < (n); ++i) {         cin >> a[i];         if (!was[a[i]]) {           tmp++;           was[a[i]]++;         }       }       if (tmp > k) {         cout <<  -1 n ;       } else {         for (long long i = 1; i < (n + 1); ++i) {           if (tmp < k and !was[i]) {             s.push_back(i);             tmp++;           }           if (was[i]) s.push_back(i);         }         cout << n * s.size() <<   n ;         for (long long i = 0; i < (n); ++i) {           for (long long j = 0; j < (s.size()); ++j) {             cout << s[j] <<    ;           }         }         cout <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, k, ans;     int a[105];     while (cin >> n >> m >> k) {       ans = 1000000;       for (int i = 0; i < n; i++) {         cin >> a[i];       }       m--;       for (int i = 1; m - i >= 0; i++) {         if (a[m - i] <= k && a[m - i]) {           ans = min(ans, i * 10);           break;         }       }       for (int i = 1; m + i < n; i++) {         if (a[m + i] && k >= a[m + i]) {           ans = min(ans, i * 10);           break;         }       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     int x, y, n;     cin >> x >> y >> n;     int k = (n / x) * x + y;     if (k <= n) {       cout << k;     } else {       cout << k - x;     }     cout << endl;   }   int main() {     int test_cases;     cin >> test_cases;     while (test_cases--) {       solve();     }   }
#include <bits/stdc++.h>   using namespace std;   long long pw(long long a, long long b, long long md) {     return (!b ? 1                : (b & 1 ? a * pw(a * a % md, b / 2, md) % md                         : pw(a * a % md, b / 2, md) % md));   }   const long long MOD = 1e9 + 7, MAXN = 1e6 + 10;   bool prime[MAXN];   long long n, ans, p;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     ;     cin >> n;     for (long long i = 0; i < MAXN; i++) prime[i] = true;     for (int p = 2; p * p <= n; p++) {       if (prime[p] == true) {         for (int i = p * 2; i <= n; i += p) prime[i] = false;       }     }     for (long long i = 1; i <= n; i++) {       p = 0;       for (long long j = 2; j <= i; j++) {         if (i % j == 0 && prime[j]) p++;       }       if (p == 2) ans++;     }     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const int MAX = 1000005;   int SetBit(int n, int x) { return n | (1 << x); }   int ClearBit(int n, int x) { return n & ~(1 << x); }   int ToggleBit(int n, int x) { return n ^ (1 << x); }   bool CheckBit(int n, int x) { return (bool)(n & (1 << x)); }   long long gcd(long long a, long long b) {     if (b == 0)       return a;     else       return gcd(b, a % b);   }   int main(void) {     long long l, r, a, b, x, y, G, L, i, j;     while (scanf( %lld %lld %lld %lld , &l, &r, &a, &b) != EOF) {       vector<int> v;       for (i = 1; i * i <= b; i++) {         if (b % i == 0) {           v.push_back(i);           if (i != b / i) v.push_back(b / i);         }       }       sort(v.begin(), v.end());       int len = v.size();       int ans = 0;       for (i = 0; i < len; i++) {         for (j = 0; j < len; j++) {           x = v[i], y = v[j];           G = gcd(x, y);           L = (x * y) / G;           if (G == a && L == b && x >= l && x <= r && y >= l && y <= r) ++ans;         }       }       printf( %d n , ans);       v.clear();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   static inline void canhazfast() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);   }   template <typename T>   T gcd(T a, T b) {     return b == 0 ? a : gcd(b, a % b);   }   template <typename T>   T extgcd(T a, T b, T &x, T &y) {     T x0 = 1, y0 = 0, x1 = 0, y1 = 1;     while (b) {       T q = a / b;       a %= b;       swap(a, b);       x0 -= q * x1;       swap(x0, x1);       y0 -= q * y1;       swap(y0, y1);     }     x = x0;     y = y0;     return a;   }   static inline int ctz(unsigned x) { return __builtin_ctz(x); }   static inline int ctzll(unsigned long long x) { return __builtin_ctzll(x); }   static inline int clz(unsigned x) { return __builtin_clz(x); }   static inline int clzll(unsigned long long x) { return __builtin_clzll(x); }   static inline int popcnt(unsigned x) { return __builtin_popcount(x); }   static inline int popcntll(unsigned long long x) {     return __builtin_popcountll(x);   }   static inline int bsr(unsigned x) { return 31 ^ clz(x); }   static inline int bsrll(unsigned long long x) { return 63 ^ clzll(x); }   int main() {     canhazfast();     static long long a[200016], x[200016], b[200016];     int n;     long long t, lb;     cin >> n >> t;     for (int i = 1; i <= n; ++i) cin >> a[i];     for (int i = 1; i <= n; ++i) cin >> x[i];     if (x[n] != n) return cout <<  No , 0;     lb = a[n];     b[n] = a[n] + n;     for (int i = n - 1; i > 0; --i) {       b[i] = b[i + 1] - 1;       if (x[i] == i)         b[i] = lb - 1;       else if (x[i] != x[i + 1] || b[i] < lb)         return cout <<  No , 0;       lb = a[i];     }     cout <<  Yes n ;     for (int i = 1; i <= n; ++i) cout << b[i] + t <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long gcd(long long a, long long b) {     if (a % b == 0)       return b;     else       return gcd(b, a % b);   }   void palindrome(string s) {     int i = 0;     int j = s.size() - 1;     while (i < j) {       if (s[i] != s[j]) return;       i++;       j--;     }     cout << s;     exit(0);   }   int recursive(int n, int a[]) {     int x = 1;     if (a[n] != 0) return a[n];     if (n < 10) return n;     while (n != 0) {       if (n % 10 != 0) x = x * (n % 10);       n = n / 10;     }     return recursive(x, a);   }   int myXOR(int x, int y) { return (x | y) & (~x | ~y); }   int main() {     string s;     cin >> s;     int a, b;     if (s.size() >= 2) {       a = s[s.size() - 2] -  0 ;       b = s[s.size() - 1] -  0 ;       a = 10 * a + b;       if (a % 4 == 0)         cout << 4;       else         cout << 0;     }     if (s.size() == 1) {       int x = s[0] -  0 ;       if (x % 4 == 0)         cout << 4;       else         cout << 0;     }   }
#include <bits/stdc++.h>   using namespace std;   int sum(int[][3], int, int);   bool valid(int);   int main() {     int A[3][3];     for (int i = 0; i < 3; ++i)       for (int j = 0; j < 3; ++j) cin >> A[i][j];     for (int i = 0; i < 3; ++i) {       for (int j = 0; j < 3; ++j) cout << !(sum(A, i, j) % 2);       cout <<   n ;     }     return 0;   }   bool valid(int x) { return (x > -1 && x < 3); }   int sum(int A[][3], int i, int j) {     int s = 0, k;     for (k = -1; k < 2; ++k) {       int I = i + k;       if (valid(I)) s += A[I][j];       if (k) {         int J = j + k;         if (valid(J)) s += A[i][J];       }     }     return s;   }
#include <bits/stdc++.h>   using namespace std;   int const mod = 1e9 + 7;   inline void SAFE_ADD(int& a, int b) {     a += b;     if (a >= mod) a -= mod;   }   struct Matr {     vector<vector<int> > _data;     Matr(int sz) : _data(sz, vector<int>(sz, 0)) {}     void ones() {       for (int i = 0; i < _data.size(); ++i) _data[i][i] = 1;     }   };   Matr operator*(Matr const& a, Matr const& b) {     int n = a._data.size();     Matr ans(n);     for (int i = 0; i < n; ++i)       for (int j = 0; j < n; ++j)         for (int k = 0; k < n; ++k) {           SAFE_ADD(ans._data[i][k], a._data[i][j] * 1LL * b._data[j][k] % mod);         }     return ans;   }   inline int getnum(char c) {     if (c >=  a  && c <=  z )       return c -  a ;     else       return 26 + c -  A ;   }   Matr pow(Matr const& a, long long b) {     Matr ans(a._data.size());     ans.ones();     Matr tmp(a);     while (b) {       if (b & 1) ans = ans * tmp;       tmp = tmp * tmp;       b >>= 1;     }     return ans;   }   int main() {     ios_base::sync_with_stdio(false);     long long n;     int m, k;     cin >> n >> m >> k;     if (n == 1) {       cout << m <<   n ;       return 0;     };     Matr a(m);     for (int i = 0; i < m; ++i)       for (int j = 0; j < m; ++j) a._data[i][j] = 1;     for (int i = 0; i < k; ++i) {       string tmp;       cin >> tmp;       a._data[getnum(tmp[0])][getnum(tmp[1])] = 0;     }     a = pow(a, n - 1);     int ans = 0;     for (int i = 0; i < m; ++i)       for (int j = 0; j < m; ++j) SAFE_ADD(ans, a._data[i][j]);     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 100 + 10;   int a[MAX_N];   int main() {     int n, count = 0, f = 0, h = 0, b;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> b;       if (b < 0) count++;       if (count == 3) {         f++;         a[f] = i - h;         h += a[f];         count = 1;       }       if (count < 3 && i == n - 1) {         f++;         a[f] = i + 1 - h;         h += a[f];       }     }     cout << f << endl;     for (int i = 1; i <= f; i++) cout << a[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 100005;   const int maxm = 300005;   int n, m, cnt1, cnt2, ans;   int head[maxn], Head[maxn];   int dis1[maxn], vis1[maxn];   int use1[maxn], use2[maxn];   int num[maxn], ok[maxn];   struct nood {     int nex, to, w;     int fr;   };   nood e[maxm], E[maxm];   inline void jia(int u, int v, int c) {     e[++cnt1].nex = head[u];     e[cnt1].fr = u;     head[u] = cnt1;     e[cnt1].to = v;     e[cnt1].w = c;   }   inline void Jia(int u, int v, int c) {     E[++cnt2].nex = Head[u];     Head[u] = cnt2;     E[cnt2].to = v;     E[cnt2].w = c;   }   inline void dfs(int u) {     use1[u] = 1;     for (int i = head[u]; i; i = e[i].nex) {       int v = e[i].to;       if (use1[v]) continue;       dfs(v);     }   }   inline void Dfs(int u) {     use2[u] = 1;     for (int i = Head[u]; i; i = E[i].nex) {       int v = E[i].to;       if (use2[v]) continue;       Dfs(v);     }   }   inline void spfa(int s) {     queue<int> q;     memset(dis1, 127 / 3, sizeof(dis1));     memset(vis1, 0, sizeof(vis1));     q.push(s), dis1[s] = 0;     num[s] = 1, vis1[s] = 1;     while (!q.empty()) {       int u = q.front();       q.pop();       vis1[u] = 0;       for (int i = Head[u]; i; i = E[i].nex) {         int v = E[i].to;         if (dis1[v] > dis1[u] + E[i].w) {           dis1[v] = dis1[u] + E[i].w;           if (!vis1[v]) {             vis1[v] = 1;             q.push(v);             num[v]++;           }           if (num[v] > n) {             printf( No n );             exit(0);           }         }       }     }   }   inline int read() {     int sum = 0;     char ch = getchar();     while (!isdigit(ch)) ch = getchar();     while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();     return sum;   }   int main() {     n = read();     m = read();     for (int i = 1; i <= m; i++) {       int u = read();       int v = read();       jia(u, v, 0);       Jia(v, u, 0);     }     dfs(1);     Dfs(n);     for (int i = 1; i <= n; i++)       if (use1[i] && use2[i]) ok[i] = 1;     if (!use1[n]) return printf( No n ), 0;     memset(E, 0, sizeof(E));     memset(Head, 0, sizeof(Head));     cnt2 = 0;     ok[1] = 1, ok[n] = 1;     for (int i = 1; i <= m; i++) {       int u = e[i].fr;       int v = e[i].to;       if (ok[u] && ok[v]) {         Jia(u, v, -1);         Jia(v, u, 2);       }     }     spfa(1);     printf( Yes n );     for (int i = 1; i <= m; i++) {       int u = e[i].fr;       int v = e[i].to;       if (ok[u] && ok[v])         printf( %d n , abs(dis1[u] - dis1[v]));       else         printf( 1 n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX_N = 2e5;   vector<int> gr[MAX_N];   int indx(int h, int t) { return h * 450 + t; }   int win = 1e9;   int lose = 0;   bool draw = false;   int used[MAX_N] = {0};   void bfs(int st_indx) {     queue<pair<int, int>> q;     q.push({0, st_indx});     used[st_indx] = 1;     while (!q.empty()) {       auto [d, v] = q.front();       q.pop();       if (v == 0) {         win = min(win, d);       }       for (auto e : gr[v]) {         if (!used[e]) {           used[e] = 1;           q.push({d + 1, e});         }       }     }   }   void dfs(int v) {     used[v] = 1;     for (auto e : gr[v]) {       if (used[e] == 1) {         draw = true;       } else if (!used[e]) {         dfs(e);       }     }     used[v] = 2;   }   int d[MAX_N];   void dij(int st) {     fill(d, d + MAX_N, 1e9);     set<pair<int, int>> s;     d[st] = 0;     s.insert({0, st});     while (!s.empty()) {       int v = s.begin()->second;       if (gr[v].empty()) {         lose = max(lose, -d[v]);       }       s.erase(s.begin());       for (auto e : gr[v]) {         if (d[e] > d[v] - 1) {           s.erase({d[e], e});           d[e] = d[v] - 1;           s.insert({d[e], e});         }       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int h, t, r, n;     cin >> h >> t >> r >> n;     vector<pair<int, int>> a(n + 1);     for (int i = 1; i <= n; ++i) {       cin >> a[i].first >> a[i].second;     }     int m;     cin >> m;     vector<pair<int, int>> b(m + 1);     for (int i = 1; i <= m; ++i) {       cin >> b[i].first >> b[i].second;     }     for (int h1 = 0; h1 <= r; ++h1) {       for (int t1 = 0; t1 <= r; ++t1) {         if (h1 + t1 > r || !(h1 + t1)) {           continue;         }         for (int chop_h = 1; chop_h <= min(h1, n); ++chop_h) {           int h2 = h1 - chop_h + a[chop_h].first;           int t2 = t1 + a[chop_h].second;           gr[indx(h1, t1)].push_back(indx(h2, t2));         }         for (int chop_t = 1; chop_t <= min(t1, m); ++chop_t) {           int h2 = h1 + b[chop_t].first;           int t2 = t1 - chop_t + b[chop_t].second;           gr[indx(h1, t1)].push_back(indx(h2, t2));         }       }     }     bfs(indx(h, t));     memset(used, 0, sizeof(used));     dfs(indx(h, t));     if (win != 1e9) {       cout <<  Ivan n  << win;     } else if (draw) {       cout <<  Draw ;     } else {       dij(indx(h, t));       cout <<  Zmey n  << lose;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     cin >> n >> m;     int a[n];     for (int i = 0; i < n; ++i) cin >> a[i];     m--;     int cnt = 0;     for (int i = 0; i < n; ++i)       if (1) {         bool ok = 0;         for (int j = i + m; j >= 0 && j >= i - m; --j)           if (j >= n)             continue;           else if (a[j] == 1) {             cnt++;             i = j + m;             ok = 1;             break;           }         if (!ok) return cout << -1, 0;       }     cout << cnt;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 250;   int a[N + 5], ans;   double fac[20005];   double POI(int P) {     double ans = 0;     double v = log(P);     for (int i = (int)(1); i <= (int)(N); i++)       if (a[i] < 0)         return -1e300;       else         ans += v * a[i] - P - fac[a[i]];     return ans;   }   double UNI(int P) {     double ans = 0;     double v = log(2 * P + 1);     for (int i = (int)(1); i <= (int)(N); i++)       if (a[i] < 0 || a[i] > 2 * P)         return -1e300;       else         ans -= v;     return ans;   }   void solve() {     double pos = -1e300;     for (int i = (int)(1); i <= (int)(N); i++) scanf( %d , &a[i]);     for (int i = (int)(1); i <= (int)(1000); i++) {       for (int j = (int)(1); j <= (int)(N); j++) ++a[j];       double v1 = POI(i), v2 = UNI(i);       if (v1 > pos) pos = v1, ans = 0;       if (v2 > pos) pos = v2, ans = 1;     }     puts(ans ?  uniform  :  poisson );   }   int main() {     for (int i = (int)(1); i <= (int)(10000); i++) fac[i] = fac[i - 1] + log(i);     int T;     scanf( %d , &T);     while (T--) solve();   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   void gi(T &x) {     int f;     char c;     for (f = 1, c = getchar(); c <  0  || c >  9 ; c = getchar())       if (c ==  - ) f = -1;     for (x = 0; c <=  9  && c >=  0 ; c = getchar()) x = x * 10 + (c & 15);     x *= f;   }   const int N = 4e5 + 10, mod = 998244353;   inline int qm(int x, int k) {     int sum = 1;     for (; k; k >>= 1, x = 1ll * x * x % mod)       if (k & 1) sum = 1ll * sum * x % mod;     return sum;   }   int n, a[20][N], R[N], L = 0;   inline int C(int n, int m) {     if (n < m || n < 0 || m < 0) return 0;     int ret = 1, I = 1;     for (int i = 1; i <= m; i++)       ret = 1ll * ret * (n - i + 1) % mod, I = 1ll * I * i % mod;     return 1ll * ret * qm(I, mod - 2) % mod;   }   inline void NTT(int *A) {     for (int i = 0; i < n; i++)       if (i < R[i]) swap(A[i], A[R[i]]);     for (int i = 1; i < n; i <<= 1) {       int t0 = qm(3, (mod - 1) / (i << 1)), x, y;       for (int j = 0; j < n; j += i << 1) {         int t = 1;         for (int k = 0; k < i; k++, t = 1ll * t * t0 % mod) {           x = A[j + k];           y = 1ll * A[j + k + i] * t % mod;           A[j + k] = (x + y) % mod;           A[j + k + i] = (x - y + mod) % mod;         }       }     }   }   inline void mul(int *A, int *B) {     NTT(A);     NTT(B);     for (int i = 0; i < n; i++) A[i] = 1ll * A[i] * B[i] % mod;     NTT(A);     reverse(A + 1, A + n);     for (int i = 0, t = qm(n, mod - 2); i < n; i++) A[i] = 1ll * A[i] * t % mod;   }   inline void solve(int l, int r, int d) {     if (l == r) {       a[d][0] = l;       a[d][1] = 1;       return;     }     int mid = (l + r) >> 1, m = r - l + 1;     solve(l, mid, d + 1);     for (int i = 0; i <= m; i++) a[d][i] = a[d + 1][i];     solve(mid + 1, r, d + 1);     for (n = 1, L = 0; n <= m; n <<= 1) L++;     for (int i = mid - l + 2; i < n; i++) a[d][i] = 0;     for (int i = r - mid + 1; i < n; i++) a[d + 1][i] = 0;     for (int i = 0; i < n; i++) R[i] = (R[i >> 1] >> 1) | ((i & 1) << (L - 1));     mul(a[d], a[d + 1]);   }   int A, B;   int main() {     cin >> n >> A >> B;     if (n == 1) {       if (A + B - 2 >= 0)         puts( 1 );       else         puts( 0 );       exit(0);     }     solve(0, n - 2, 0);     cout << 1ll * a[0][A + B - 2] * C(A + B - 2, A - 1) % mod;     return 0;   }