malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n = 0, a, tc;   int p[100005];   vector<int> cho[6][100005];   int sum[6];   int ret = 0;   void doit(int x, int cur) {     if (x == n - 1) {       ret += cho[x + 5 - n][cur].size();       return;     }     for (int i = 0; i < cho[x + 5 - n][cur].size(); i++) {       int ti = cho[x + 5 - n][cur][i];       for (int j = 0; j < n - x - 1; j++) {         sum[n - 1 - j] = sum[n - 1 - j] * 10 + ti % 10;         ti /= 10;       }       doit(x + 1, sum[x + 1]);       for (int j = 0; j < n - x - 1; j++) {         sum[n - 1 - j] /= 10;       }     }   }   int main() {     scanf( %d , &tc);     for (int i = 0; i <= 100000; i++) p[i] = 1;     p[0] = p[1] = 0;     for (int i = 2; i <= 100000; i++)       if (p[i] == 1) {         int ti = i;         for (int j = 0; j < 5; j++) {           cho[5 - j][ti].push_back(i);           ti /= 10;         }         for (int j = i + i; j <= 100000; j += i) p[j] = 0;       }     while (tc--) {       scanf( %d , &a);       int ti = a;       ret = 0;       n = 0;       while (ti > 0) {         sum[n] = ti % 10;         ti /= 10;         n++;       }       for (int i = 0; i < n / 2; i++) swap(sum[i], sum[n - 1 - i]);       doit(1, sum[1]);       printf( %d n , ret);     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 5e5 + 10;   int n, q, k;   vector<pair<int, int> > tree[N << 2];   int ask[N], ans[N];   struct que {     int x, y, times, l;   };   queue<que> Q;   int fa[N], h[N], siz[N];   int find(int o) {     if (o != fa[o]) {       return find(fa[o]);     }     return o;   }   struct gu {     int first, second, val;   };   gu merge(int x, int y) {     x = find(x);     y = find(y);     gu re;     re.val = -1;     if (x == y) return re;     if (h[x] > h[y]) swap(x, y);     fa[x] = y;     siz[y] += siz[x];     re.val = h[x] == h[y];     h[y] += h[x] == h[y];     re.first = x;     re.second = y;     return re;   }   void del(int x, int y, int val) {     h[y] -= val;     siz[y] -= siz[x];     fa[x] = x;   }   void add(int o, int l, int r, int L, int R, pair<int, int> x) {     if (l >= L && r <= R) {       tree[o].push_back(x);       return;     }     int mid = (l + r) >> 1;     if (mid >= L) add(o << 1, l, mid, L, R, x);     if (mid < R) add(o << 1 | 1, mid + 1, r, L, R, x);   }   int tp;   gu s[1000100];   void qu(int o, int l, int r) {     int now = tp, sf = 0;     for (int i = 0; i < tree[o].size(); ++i) {       pair<int, int> now = tree[o][i];       s[++tp] = merge(now.first, now.second);     }     if (l == r) {       ans[l] = siz[find(ask[l])];     } else {       int mid = (l + r) >> 1;       qu(o << 1, l, mid);       qu(o << 1 | 1, mid + 1, r);     }     while (tp != now) {       if (s[tp].val != -1) del(s[tp].first, s[tp].second, s[tp].val);       --tp;     }   }   int main() {     scanf( %d%d%d , &n, &q, &k);     for (int i = 1; i <= n; ++i) fa[i] = i, siz[i] = 1, h[i] = 1;     int days = 1;     for (int i = 1; i <= q; ++i) {       int op;       scanf( %d , &op);       if (op == 1) {         int x, y;         scanf( %d%d , &x, &y);         Q.push((que){x, y, days, i});       }       if (op == 2) {         int o;         scanf( %d , &o);         ask[i] = o;       }       if (op == 3) {         ++days;         while (!Q.empty() && Q.front().times <= days - k) {           add(1, 1, q, Q.front().l, i - 1, make_pair(Q.front().x, Q.front().y));           Q.pop();         }       }     }     while (!Q.empty()) {       add(1, 1, q, Q.front().l, q, make_pair(Q.front().x, Q.front().y));       Q.pop();     }     qu(1, 1, q);     for (int i = 1; i <= q; ++i) {       if (ask[i]) printf( %d n , ans[i]);     }   }
#include <bits/stdc++.h>   using namespace std;   const int s_size = 1e5 + 5;   const int mod = 1e9 + 7;   int f[(s_size + 1) >> 1] = {1}, t[(s_size + 1) >> 1], g[(s_size + 1) >> 1];   int fac[s_size] = {1}, inv[s_size], ans[s_size];   int num(char c);   void fac_inv(void);   int qpow(int a, int b);   int main(void) {     int q, x, y, cnt[55] = {0}, plan[55][55];     string s;     cin >> s >> q;     s =  0  + s;     int length = s.size() - 1, upper = (length >> 1);     for (int i = 1; i <= length; i++) cnt[num(s[i])]++;     fac_inv();     int coe = (static_cast<long long>(fac[upper]) * fac[upper]) % mod;     for (int i = 1; i <= 52; i++)       if (cnt[i] > 0) {         coe = (static_cast<long long>(coe) * inv[cnt[i]]) % mod;         for (int j = upper; j >= cnt[i]; j--) f[j] = (f[j] + f[j - cnt[i]]) % mod;       }     for (int i = 1; i <= 52; i++)       if (cnt[i] > 0) {         plan[i][i] = f[upper];         for (int j = 0; j <= upper; j++)           if (j >= cnt[i])             t[j] = (static_cast<long long>(f[j]) - t[j - cnt[i]] + mod) % mod;           else             t[j] = f[j];         for (int j = i + 1; j <= 52; j++)           if (cnt[j] > 0) {             for (int k = 0; k <= upper; k++) {               if (k >= cnt[j])                 g[k] = (static_cast<long long>(t[k]) - g[k - cnt[j]] + mod) % mod;               else                 g[k] = t[k];               plan[i][j] = (static_cast<long long>(2) * g[upper]) % mod;               plan[j][i] = plan[i][j];             }           }       }     for (int i = 1; i <= q; i++) {       cin >> x >> y;       ans[i] = (static_cast<long long>(coe) * plan[num(s[x])][num(s[y])]) % mod;     }     for (int i = 1; i <= q; i++) cout << ans[i] << endl;     return 0;   }   inline int num(char c) { return islower(c) ? c -  a  + 1 : c -  A  + 27; }   void fac_inv(void) {     for (int i = 1; i <= s_size - 5; i++)       fac[i] = (static_cast<long long>(fac[i - 1]) * i) % mod;     inv[s_size - 5] = qpow(fac[s_size - 5], mod - 2);     for (int i = s_size - 6; i >= 0; i--)       inv[i] = (static_cast<long long>(inv[i + 1]) * (i + 1)) % mod;   }   int qpow(int a, int b) {     int ret = 1;     while (b > 0) {       if ((b & 1) == 1) ret = (static_cast<long long>(ret) * a) % mod;       a = (static_cast<long long>(a) * a) % mod;       b >>= 1;     }     return ret;   }
#include <bits/stdc++.h>   using namespace std;   long long int INF = (long long int)1e16;   int n, m, r;   vector<int> s, b;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     s.clear();     b.clear();     cin >> n >> m >> r;     int x, y;     int bax = INT_MAX;     int bay = INT_MIN;     for (int i = 0; i < n; i++) {       cin >> x;       bax = min(bax, x);     }     for (int i = 0; i < m; i++) {       cin >> y;       bay = max(bay, y);     }     int bht = r / bax;     int cost = bht * bay + r % bax;     cout << max(cost, r) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int cont[1003], sum[1003];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int ans = 0;     string s1, s2;     cin >> s1 >> s2;     int n = s1.size();     int m = s2.size();     for (int i = 0; i < n; i++) cont[s1[i] -  a ]++;     for (int i = 0; i < m; i++) sum[s2[i] -  a ]++;     for (int i = 0; i < 26; i++) {       if (sum[i] > 0 && cont[i] == 0) {         cout << -1 <<   n ;         return 0;       }       if (sum[i] > cont[i])         ans += cont[i];       else         ans += sum[i];     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   long long m;   int soln[51];   long long mr = 0;   int main() {     cin >> n >> m;     --m;     for (int k = 1; k < n; ++k) {       mr = mr * 2 + (m & 1);       m >>= 1;     }     int i = 1, j = n;     for (int k = 1; k <= n; ++k) {       if (mr & 1)         soln[j--] = k;       else         soln[i++] = k;       mr >>= 1;     }     for (int k = 1; k <= n; ++k) cout << soln[k] <<    ;     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long n, k, x;   long long m[200010];   long long answer;   struct node {     long long pre;     long long next;   } p[200010];   int main() {     long long a;     while (~scanf( %I64d %I64d %I64d , &n, &k, &x)) {       answer = p[1].pre = p[n].next = 0;       a = x;       for (long long i = k - 1; i > 0; i--) a *= x;       for (long long i = 1; i <= n; i++) {         scanf( %d , &m[i]);         p[i].pre = (m[i - 1] | p[i - 1].pre);       }       for (long long i = n; i >= 1; i--) {         if (i < n) p[i].next = (p[i + 1].next | m[i + 1]);         answer = max(answer, (p[i].pre | p[i].next | m[i] * a));       }       printf( %I64d n , answer);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int x, y, z;     cin >> x >> y >> z;     if (z == 0) {       if (x > y)         cout <<  + ;       else if (x < y)         cout <<  - ;       else         cout <<  0 ;     } else {       if (x > y + z)         cout <<  + ;       else if (y > x + z)         cout <<  - ;       else         cout <<  ? ;     }     return 0;   }
#include <bits/stdc++.h>   int main() {     char name[100], winner[100];     int sh, uh, a, b, v, c, d, e;     int n, i;     int sum;     int total = sum;     scanf( %d , &n);     scanf( %s %d %d %d %d %d %d %d , name, &sh, &uh, &a, &b, &c, &d, &e);     sum = sh * 100 - uh * 50 + a + b + c + d + e;     total = sum;     strcpy(winner, name);     for (i = 0; i < n - 1; i++) {       scanf( %s %d %d %d %d %d %d %d , name, &sh, &uh, &a, &b, &c, &d, &e);       sum = sh * 100 - uh * 50 + a + b + c + d + e;       if (sum > total) {         total = sum;         strcpy(winner, name);       }     }     printf( %s , winner);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, j = 0;     char d;     cin >> n;     string s;     cin >> s;     char a[n][n + 1];     for (i = 0; i < n; i++) {       s.copy(a[i], n - i, i), s.copy(a[i] + (n - i), i), a[i][n] = 0;       d = ( 9  - a[i][0] + 1) % 10;       for (j = 0; j < n; j++)         a[i][j] = (((a[i][j] + d) >  9 ) ? (a[i][j] - 10) : a[i][j]) + d;     }     for (i = 1, j = 0; i < n; i++) j = ((strcmp(a[i], a[j]) < 0) ? i : j);     puts(a[j]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T1>   void deb(T1 e) {     cout << e << endl;   }   template <class T1, class T2>   void deb(T1 e1, T2 e2) {     cout << e1 <<     << e2 << endl;   }   template <class T1, class T2, class T3>   void deb(T1 e1, T2 e2, T3 e3) {     cout << e1 <<     << e2 <<     << e3 << endl;   }   template <class T1, class T2, class T3, class T4>   void deb(T1 e1, T2 e2, T3 e3, T4 e4) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 << endl;   }   template <class T1, class T2, class T3, class T4, class T5>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 << endl;   }   template <class T1, class T2, class T3, class T4, class T5, class T6>   void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {     cout << e1 <<     << e2 <<     << e3 <<     << e4 <<     << e5 <<     << e6          << endl;   }   template <class T>   T Abs(T x) {     return x > 0 ? x : -x;   }   template <class T>   inline T sqr(T x) {     return x * x;   }   long long Pow(long long B, long long P) {     long long R = 1;     while (P > 0) {       if (P % 2 == 1) R = (R * B);       P /= 2;       B = (B * B);     }     return R;   }   int BigMod(long long B, long long P, long long M) {     long long R = 1;     while (P > 0) {       if (P % 2 == 1) {         R = (R * B) % M;       }       P /= 2;       B = (B * B) % M;     }     return (int)R;   }   int n, l, k;   vector<int> prize;   vector<double> prb;   double dp[202][202][202];   double rec(int pos, int need_2_win, int bags) {     if (pos >= n) {       if (need_2_win >= l && bags + k >= need_2_win)         return 1.00;       else         return 0.0;     }     double &ret = dp[pos][need_2_win][bags];     if (ret > -.5) return ret;     ret = 0.0;     ret += (prb[pos] / 100.0) *            rec(pos + 1, need_2_win + 1, min(200, bags + prize[pos]));     ret += (max(100.0 - prb[pos], 0.0) / 100.0) * rec(pos + 1, need_2_win, bags);     return ret;   }   int main(void) {     double val;     int a;     scanf( %d %d %d , &n, &l, &k);     for (int i = 0; i < n; i++) {       scanf( %lf , &val);       prb.push_back(val);     }     for (int i = 0; i < n; i++) {       scanf( %d , &a);       prize.push_back(a + 1);     }     memset(dp, -1, sizeof dp);     double ans = rec(0, 0, 0);     printf( %.12lf n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 2000000000;   static inline int Rint() {     struct X {       int dig[256];       X() {         for (int i =  0 ; i <=  9 ; ++i) dig[i] = 1;         dig[ - ] = 1;       }     };     static X fuck;     int s = 1, v = 0, c;     for (; !fuck.dig[c = getchar()];)       ;     if (c ==  - )       s = 0;     else if (fuck.dig[c])       v = c ^ 48;     for (; fuck.dig[c = getchar()]; v = v * 10 + (c ^ 48))       ;     return s ? v : -v;   }   template <typename T>   static inline void cmax(T& a, const T& b) {     if (b > a) a = b;   }   template <typename T>   static inline void cmin(T& a, const T& b) {     if (b < a) a = b;   }   char buff[1024][1024];   char temp[1024][1024];   int n, m;   int sol_row(int u, int v, int a, int b) {     for (int j = 0; j < m; ++j) {       int match1 = 1, match2 = 1;       int p[2];       if (j % 2 == 0)         p[0] = u, p[1] = v;       else         p[0] = a, p[1] = b;       for (int i = 0; i < n; ++i)         if (buff[i][j] !=  0 ) {           if (buff[i][j] != p[i % 2]) match1 = 0;           if (buff[i][j] != p[1 - i % 2]) match2 = 0;         }       if (!match1 && !match2) return 0;       for (int i = 0; i < n; ++i) {         if (match1)           temp[i][j] = p[i % 2];         else           temp[i][j] = p[1 - i % 2];       }     }     return 1;   }   int sol_col(int u, int v, int a, int b) {     for (int i = 0; i < n; ++i) {       int match1 = 1, match2 = 1;       int p[2];       if (i % 2 == 0)         p[0] = u, p[1] = v;       else         p[0] = a, p[1] = b;       for (int j = 0; j < m; ++j)         if (buff[i][j] !=  0 ) {           if (buff[i][j] != p[j % 2]) match1 = 0;           if (buff[i][j] != p[1 - j % 2]) match2 = 0;         }       if (!match1 && !match2) return 0;       for (int j = 0; j < m; ++j) {         if (match1)           temp[i][j] = p[j % 2];         else           temp[i][j] = p[1 - j % 2];       }     }     return 1;   }   int main() {     n = Rint(), m = Rint();     for (int i = (0); i < (n); ++i) scanf( %s , buff[i]);     int pattern[4] = { 1 ,  2 ,  3 ,  4 };     int solved = 0;     do {       if (sol_row(pattern[0], pattern[1], pattern[2], pattern[3])) {         solved = 1;         break;       }       if (sol_col(pattern[0], pattern[1], pattern[2], pattern[3])) {         solved = 1;         break;       }     } while (next_permutation(pattern, pattern + 4));     if (solved)       for (int i = 0; i < n; ++i) puts(temp[i]);     else       puts( 0 );     return 0;   }
#include <bits/stdc++.h>   int main() {     int n, p, q, i, j;     int cnt = 0;     char s[1000];     scanf( %d %d %d n , &n, &p, &q);     gets(s);     while (n % q != 0 && n >= p) {       ++cnt;       n -= p;     }     if (n % q != 0)       puts( -1 );     else {       printf( %d n , cnt + n / q);       for (i = 0; i < cnt; i++) {         for (j = 0; j < p; j++) putchar(s[i * p + j]);         printf(  n );       }       for (i = 0; i < n / q; i++) {         for (j = 0; j < q; j++) putchar(s[cnt * p + i * q + j]);         printf(  n );       }     }   }
#include <bits/stdc++.h>   using namespace std;   char a[4][100][100];   int c[6];   int check(int le, int s, char st) {     int ct = 0;     for (int i = 0; i < s; i++) {       for (int j = 0; j < s; j++) {         if ((i - (s - 1) / 2 + j - (s - 1) / 2) % 2 == 0 && a[le][i][j] != st) {           ct++;         } else if ((i - (s - 1) / 2 + j - (s - 1) / 2) % 2 != 0 &&                    a[le][i][j] == st) {           ct++;         }       }     }     return ct;   }   int main() {     int si;     scanf( %d , &si);     getchar();     for (int k = 0; k < 4; k++) {       for (int i = 0; i < si; i++) {         char s[101];         scanf( %s , &s);         for (int r = 0; r < si; r++) a[k][i][r] = s[r];         getchar();       }       if (k != 3) getchar();     }     c[0] = check(0, si,  1 ) + check(1, si,  1 ) + check(2, si,  0 ) +            check(3, si,  0 );     c[1] = check(0, si,  1 ) + check(1, si,  0 ) + check(2, si,  1 ) +            check(3, si,  0 );     c[2] = check(0, si,  1 ) + check(1, si,  0 ) + check(2, si,  0 ) +            check(3, si,  1 );     c[3] = check(0, si,  0 ) + check(1, si,  1 ) + check(2, si,  1 ) +            check(3, si,  0 );     c[4] = check(0, si,  0 ) + check(1, si,  1 ) + check(2, si,  0 ) +            check(3, si,  1 );     c[5] = check(0, si,  0 ) + check(1, si,  0 ) + check(2, si,  1 ) +            check(3, si,  1 );     int ans = 40000;     for (int i = 0; i < 6; i++) {       ans = min(c[i], ans);     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, M, cnt, maxi;   char c;   int star[105][105];   int lefted[105][105];   int righted[105][105];   int up[105][105];   int down[105][105];   int chk[105][105];   struct ryunha {     int x, y, r;   } ans;   vector<ryunha> res;   int main(void) {     cin >> N >> M;     for (int i = 1; i <= N; i++) {       for (int j = 1; j <= M; j++) {         cin >> c;         while (c !=  .  && c !=  * ) cin >> c;         star[i][j] = (c ==  .  ? 0 : 1);         if (c ==  * ) chk[i][j] = 1;       }     }     for (int i = 1; i <= N; i++) {       cnt = 0;       for (int j = 1; j <= M; j++) {         if (star[i][j])           cnt++;         else           cnt = 0;         lefted[i][j] = cnt;       }     }     for (int i = 1; i <= N; i++) {       cnt = 0;       for (int j = M; j >= 1; j--) {         if (star[i][j])           cnt++;         else           cnt = 0;         righted[i][j] = cnt;       }     }     for (int j = 1; j <= M; j++) {       cnt = 0;       for (int i = 1; i <= N; i++) {         if (star[i][j])           cnt++;         else           cnt = 0;         up[i][j] = cnt;       }     }     for (int j = 1; j <= M; j++) {       cnt = 0;       for (int i = N; i >= 1; i--) {         if (star[i][j])           cnt++;         else           cnt = 0;         down[i][j] = cnt;       }     }     for (int i = 1; i <= N; i++) {       for (int j = 1; j <= M; j++) {         if (star[i][j]) {           maxi = min({lefted[i][j], righted[i][j], up[i][j], down[i][j]});           int change = 0;           if (maxi >= 2) {             if (chk[i][j]) chk[i][j] = 0, change = 1;             for (int k = 1; k <= maxi - 1; k++) {               if (chk[i + k][j]) chk[i + k][j] = 0, change = 1;               if (chk[i - k][j]) chk[i - k][j] = 0, change = 1;               if (chk[i][j - k]) chk[i][j - k] = 0, change = 1;               if (chk[i][j + k]) chk[i][j + k] = 0, change = 1;             }           }           if (change) {             ans.x = i;             ans.y = j;             ans.r = maxi - 1;             res.push_back(ans);           }         }       }     }     for (int i = 1; i <= N; i++) {       for (int j = 1; j <= M; j++) {         if (chk[i][j]) return !printf( -1 );       }     }     printf( %d n , res.size());     for (int i = 0; i < res.size(); i++)       printf( %d %d %d n , res[i].x, res[i].y, res[i].r);   }
#include <bits/stdc++.h>   using namespace std;   const int inf = 1000000007;   const long long linf = 1LL << 62;   const unsigned long long ulinf = 1ULL << 63;   const double eps = 0.000001;   const double pi = 3.14159265358979323846;   template <class T>   T abs(T a) {     return a >= 0 ? a : -a;   }   template <class T>   T sqr(T a) {     return a * a;   }   template <class T>   T gcd(T a, T b) {     return b ? gcd(b, a % b) : a;   }   template <class T>   T mod(T a, T b) {     return (a % b + b) % b;   }   template <class T>   T addmod(T a, T b, T c) {     return (T)mod((long long)a + b, (long long)c);   }   template <class T>   T mulmod(T a, T b, T c) {     return (T)mod((long long)a * b, (long long)c);   }   template <class T>   T powmod(T a, T b, T c) {     return (T)mod(         b ? mulmod(mod(sqr((long long)powmod(a, b >> 1, c)), (long long)c),                    (b & 1LL) ? a : 1LL, (long long)c)           : 1LL,         (long long)c);   }   template <class T>   void maxe(T &a, T b) {     a = max(a, b);   }   template <class T>   void mine(T &a, T b) {     a = min(a, b);   }   template <class T>   void mode(T &a, T b) {     a = mod(a, b);   }   template <class T>   void addmode(T &a, T b, T c) {     a = addmod(a, b, c);   }   template <class T>   void mulmode(T &a, T b, T c) {     a = mulmod(a, b, c);   }   template <class T>   void powmode(T &a, T b, T c) {     a = powmod(a, b, c);   }   int iszero(double a) { return abs(a) <= eps; }   template <class T>   void geti(T &a) {     a = 0;     long long b = 1;     char c = getchar();     if (c ==  - )       b = -1;     else       a = c - 48;     while ((c = getchar()) !=     && c !=   n ) a = a * 10 + c - 48;     a *= b;   }   void fileio_in_out() {     freopen( .in ,  r , stdin);     freopen( .out ,  w , stdout);   }   void fileio_txt() {     freopen( input.txt ,  r , stdin);     freopen( output.txt ,  w , stdout);   }   const int N = 1111111;   const int M = 1111111;   int test;   long long n, m, k, ans;   long long dp[N];   long long s[N], sinv[N];   const long long md = inf;   long long c(long long a, long long b) {     return s[a] * (sinv[b] * sinv[a - b] % md) % md;   }   long long inv(long long a, long long p) { return powmod(a, p - 2, p); }   long long getans() {     if (n == 0) return k ^ (m > 1);     if (m == 0) return k ^ (n & 1);     s[0] = sinv[0] = 1;     for (long long i = 1; i <= n + m; i++) {       s[i] = s[i - 1] * i % md;       sinv[i] = sinv[i - 1] * inv(i, md) % md;     }     if (k) n--;     dp[0] = (m > 1);     for (long long i = 1; i <= n; i++)       dp[i] = (c(i + m, i) - dp[i - 1] + md) % md;     return dp[n];   }   int main() {     scanf( %I64d%I64d%I64d , &n, &m, &k);     ans = getans();     printf( %I64d n , ans);     return 0;   }