malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   char q[15][15], p[15][15], max_s[15], min_s[15], tmp[15], ans[15];   int np[15];   int main() {     int i, j, k, n, carry, t, flag;     while (scanf( %d %d , &n, &k) != EOF) {       for (i = 0; i < n; ++i) scanf( %s , q + i);       for (i = 0; i < k; ++i) {         np[i] = i;         ans[i] =  9 ;       }       ans[i] =   0 ;       do {         for (i = 0; i < k; ++i) {           min_s[i] =  9 ;           max_s[i] =  0 ;         }         min_s[i] =   0 ;         max_s[i] =   0 ;         for (i = 0; i < n; ++i) {           for (j = 0; j < k; ++j) {             p[i][j] = q[i][np[j]];           }           p[i][j] =   0 ;           if (strcmp(p[i], min_s) < 0) strcpy(min_s, p[i]);           if (strcmp(p[i], max_s) > 0) strcpy(max_s, p[i]);         }         carry = 0;         for (i = k - 1; i >= 0; --i) {           t = max_s[i] - min_s[i] - carry;           if (t < 0) {             carry = 1;             t += 10;           } else             carry = 0;           tmp[i] = t +  0 ;         }         tmp[k] =   0 ;         if (strcmp(tmp, ans) < 0) strcpy(ans, tmp);       } while (next_permutation(np, np + k));       flag = 0;       for (i = 0; i < k; ++i) {         if (ans[i] ==  0 ) {           if (flag != 0) printf( %c , ans[i]);         } else {           if (flag == 0) flag = 1;           printf( %c , ans[i]);         }       }       if (flag == 0)         printf( 0 n );       else         printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   const int N = 100001;   int i, n, m, g[N], v[N], b[N], res[N], c[N], a;   int main() {     scanf( %d%d , &n, &m);     for (i = 1; i <= n; i++) scanf( %d , &g[i]);     for (i = 1; i <= m; i++) scanf( %d , &v[i]);     for (i = 1; i <= m; i++) scanf( %d , &b[i]);     for (i = 1; i <= m; i++) {       for (a = (v[i] + res[i - 1] - 1) % n + 1; b[i] > c[a]; a = g[a]) {         if (c[a] == 0) res[i]++;         c[a] = b[i];         b[i]--;       }       printf( %d n , res[i]);     }   }
#include <bits/stdc++.h>   using namespace std;   struct var {     char name[20], type[20];   } v[1010];   int vcnt;   struct func {     char name[20];     char para[50][20];     int paracnt;   } f[1010];   int fcnt;   int n;   char str[110], name[110], para[110][110], cnt;   int main() {     scanf( %d , &fcnt);     gets(str);     for (int i = 1; i <= fcnt; ++i) {       gets(str);       int j = 0, l = 0, len = strlen(str);       while (str[j] !=  d ) ++j;       ++j;       while (!isalpha(str[j]) && !isdigit(str[j])) ++j;       while (isalpha(str[j]) || isdigit(str[j])) f[i].name[l++] = str[j++];       f[i].name[l] =   0 ;       j++;       while (!isalpha(str[j]) && !isdigit(str[j]) && (j < len)) ++j;       while (j < len) {         l = 0;         f[i].paracnt++;         while (isalpha(str[j]) || isdigit(str[j]))           f[i].para[f[i].paracnt][l++] = str[j++];         f[i].para[f[i].paracnt][l] =   0 ;         while (!isalpha(str[j]) && !isdigit(str[j]) && (j < len)) ++j;       }     }     scanf( %d , &vcnt);     gets(str);     for (int i = 1; i <= vcnt; ++i) {       gets(str);       int j = 0, len = strlen(str), l = 0;       while (!isalpha(str[j]) && !isdigit(str[j])) ++j;       while (isdigit(str[j]) || isalpha(str[j])) v[i].type[l++] = str[j++];       v[i].type[l] =   0 ;       while (!isalpha(str[j]) && !isdigit(str[j])) ++j;       l = 0;       while (isdigit(str[j]) || isalpha(str[j])) v[i].name[l++] = str[j++];       v[i].name[l] =   0 ;     }     scanf( %d , &n);     gets(str);     while (n--) {       gets(str);       int j = 0, l = 0, len = strlen(str);       while (!isalpha(str[j]) && !isdigit(str[j])) ++j;       while (isalpha(str[j]) || isdigit(str[j])) name[l++] = str[j++];       name[l] =   0 ;       j++;       cnt = 0;       while (!isalpha(str[j]) && !isdigit(str[j]) && (j < len)) ++j;       while (j < len) {         l = 0;         cnt++;         while (isalpha(str[j]) || isdigit(str[j])) para[cnt][l++] = str[j++];         para[cnt][l] =   0 ;         while (!isalpha(str[j]) && !isdigit(str[j]) && (j < len)) ++j;       }       bool flag = true;       for (int i = 1; i <= cnt; ++i) {         bool find = false;         for (int j = 1; j <= vcnt; ++j)           if (!strcmp(para[i], v[j].name)) {             strcpy(para[i], v[j].type);             find = true;             break;           }         if (!find) {           flag = false;           break;         }       }       if (!flag) {         printf( 0 n );         continue;       }       int res = 0;       for (int i = 1; i <= fcnt; ++i)         if ((strcmp(f[i].name, name) == 0) && (cnt == f[i].paracnt)) {           bool okay = true;           for (int j = 1; j <= cnt; ++j)             if (strcmp(f[i].para[j],  T ) && strcmp(f[i].para[j], para[j])) {               okay = false;               break;             }           res += okay;         }       printf( %d n , res);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int nxt[500005], to[500005], head[500005], fa[500005], f[500005][22],       dep[500005], ru[500005], tot;   bool vis[500005], used[500005];   queue<int> q;   vector<int> ei[500005];   void add(int u, int v) {     nxt[++tot] = head[u];     head[u] = tot;     to[tot] = v;     nxt[++tot] = head[v];     head[v] = tot;     to[tot] = u;   }   void dfs(int u, int p) {     dep[u] = dep[p] + 1;     f[u][0] = p;     for (int i = 1; i <= 20; i++) f[u][i] = f[f[u][i - 1]][i - 1];     for (int e = head[u]; e; e = nxt[e]) {       int v = to[e];       if (v == p) continue;       dfs(v, u);     }   }   int lca(int x, int y) {     if (dep[x] < dep[y]) swap(x, y);     for (int i = 20; i >= 0; i--) {       if (dep[f[x][i]] >= dep[y]) {         x = f[x][i];       }     }     if (x == y) return x;     for (int i = 20; i >= 0; i--) {       if (f[x][i] != f[y][i]) {         x = f[x][i];         y = f[y][i];       }     }     return f[x][0];   }   int find(int x) {     if (x == fa[x]) return x;     return fa[x] = find(fa[x]);   }   struct sad {     int x, y;   } a[500005];   int main() {     int n, x, y, u, v;     cin >> n;     for (int i = 1; i <= n; i++) fa[i] = i;     for (int i = 1; i <= n - 1; i++) {       scanf( %d%d , &x, &y);       add(x, y);     }     for (int i = 1; i <= n - 1; i++) {       scanf( %d%d , &a[i].x, &a[i].y);       ru[a[i].x]++;       ru[a[i].y]++;       ei[a[i].x].push_back(i);       ei[a[i].y].push_back(i);     }     dfs(1, 0);     for (int i = 1; i <= n - 1; i++) {       if (ru[a[i].x] == 1 || ru[a[i].y] == 1) {         used[i] = 1;         q.push(i);       }     }     int ans = 0;     cout << n - 1 << endl;     while (!q.empty()) {       int eg = q.front();       q.pop();       u = a[eg].x;       v = a[eg].y;       if (ru[u] != 1) swap(u, v);       int z = lca(u, v);       int p = find(u);       if (dep[p] > dep[z]) {         ans++;         fa[p] = find(f[p][0]);         printf( %d %d %d %d n , p, f[p][0], a[eg].x, a[eg].y);       } else {         int t = v;         for (int i = 20; i >= 0; i--)           if (dep[f[t][i]] > dep[z] && find(f[t][i]) != p) t = f[t][i];         fa[t] = find(f[t][0]);         printf( %d %d %d %d n , t, f[t][0], a[eg].x, a[eg].y);       }       ru[u]--;       ru[v]--;       if (ru[v] == 1) {         int mm = ei[v].size();         for (int i = 0; i < mm; i++) {           int ey = ei[v][i];           if (used[ey] == 0) q.push(ey), used[ey] = 1;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long inf = 0x3f3f3f3f;   const long long MAXN = 0x7fffffff;   const long long INF = 0x3f3f3f3f3f3f3f3fLL;   void file() {}   void pr(bool num) { cout << (num == 1 ?  YES  :  NO ) <<   n ; }   signed main() {     ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);     ;     long long t, n;     cin >> t;     while (t--) {       long long a, b, c;       cin >> a >> b >> c;       long long ans = min(a, b);       ans = min(ans, c);       a -= ans;       b -= ans;       c -= ans;       long long num = min(a, b);       a -= num;       b -= num;       long long sum = a + b + c;       if (num <= sum)         ans += num;       else {         ans += sum;         num -= sum;         ans += num / 3 * 2;         if (num % 3 == 2) ans++;       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 577, INF = 1e9, mod = 1e9 + 7;   int n, m;   long long h;   int a[N][N], b[N][N];   int ans;   int main() {     cin >> n >> m;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         scanf( %d , &a[i][j]);       }     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         scanf( %d , &b[i][j]);         if (b[i][j] != a[i][j]) {           b[1][1] = !b[1][1];           b[i][1] = !b[i][1];           b[1][j] = !b[1][j];           b[i][j] = !b[i][j];         }       }     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         if (b[i][j] != a[i][j]) {           printf( No n );           return 0;         }       }     }     printf( Yes n );     return 0;   }
#include <iostream>   #define MAX 200010   using namespace std;      long long int t, n, A[MAX], DP[MAX][105], res, a;      int main()   {       cin >> t;       for (int i = 0; i <= MAX - 3; i++)       {           DP[i][0] = 1;           if (i <= 100)               DP[i][i] = 1;       }       for (int i = 1; i <= MAX - 3; i++)       {           for (int j = 1; j <= min(i, 100); j++)           {               DP[i][j] = DP[i - 1][j] + DP[i - 1][j - 1];           }       }       while (t--)       {           cin >> n;           res = 0;           for (int i = 1; i <= n; i++)               A[i] = 0;           for (int i = 1; i <= n; i++)           {               cin >> a;               A[a]++;           }           for (int i = 1; i <= n; i++)           {               res += A[i] * DP[A[i - 1] + A[i - 2]][2];               res += DP[A[i]][2] * DP[A[i - 1] + A[i - 2]][1];               res += DP[A[i]][3];           }           cout << res << endl;       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int mod = 1000000007;   void dispvec(set<long long int> arr) {     set<long long int>::iterator itr = arr.begin();     while (itr != arr.end()) {       cout << *itr <<    ;       itr++;     }     cout << endl;   }   struct CustomCompare {     bool operator()(const pair<long long int, long long int> &i,                     const pair<long long int, long long int> &j) {       if (i.first == j.first) return i.first < j.first;       return i.second < j.second;     }   };   void solve() {     int n;     cin >> n;     vector<long long int> arr(n);     for (int i = 0; i < n; i++) cin >> arr[i];     long long int sum = arr[0] + 1;     int curr = arr[0];     for (int i = 1; i < n; i++) {       if (arr[i] < arr[i - 1]) {         sum += arr[i - 1] - arr[i];       } else if (arr[i] > arr[i - 1]) {         sum += arr[i] - arr[i - 1];       }       sum += 2;     }     cout << sum << endl;   }   int main() {     int t = 1;     int i = 1;     while (i <= t) {       solve();       i++;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int num[300005][2];   int jichu = 100000;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     int n, m, x;     cin >> n >> m;     if (n == 1) {       cout << 0 << endl;       return 0;     }     long long cont = 0, sum = n;     for (int i = 1; i <= n; i++) {       num[jichu + i][0] = 1;       num[jichu + i][1] = 1;     }     for (int i = 1; i <= m; i++) {       cin >> x;       int l = x - i, r = x + i;       if (num[jichu + l][1] > 0) {         cont += 1LL * num[jichu + l][1];         num[jichu + l - 1][1] += num[jichu + l][1];         num[jichu + l][1] = 0;       }       if (num[jichu + r][0] > 0) {         cont += 1LL * num[jichu + r][0];         num[jichu + r + 1][0] += num[jichu + r][0];         num[jichu + r][0] = 0;       }     }     for (int i = jichu + 1 - m; i < jichu + n; i++) {       if (i + m + 1 > jichu + n) {         sum += 1LL * num[i][1] * ((m + 1) - (i + m + 1 - jichu - n));       } else {         sum += 1LL * num[i][1] * (m + 1);       }     }     for (int i = jichu + 2; i <= jichu + n + m; i++) {       if (i <= jichu + m + 1) {         sum += 1LL * num[i][0] * (i - jichu - 1);       } else {         sum += 1LL * num[i][0] * (m + 1);       }     }     sum -= cont;     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long fpow(long long a, int b, int mod) {     long long res = 1;     for (; b > 0; b >>= 1) {       if (b & 1) res = res * a % mod;       a = a * a % mod;     }     return res % mod;   }   const int mod = 1e9 + 7;   const int N = 2e5 + 100;   inline int read() {     static char buf[1000000], *p1 = buf, *p2 = buf;     register int x = false;     register char ch =         p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)             ? EOF             : *p1++;     ;     register bool sgn = false;     while (ch !=  -  && (ch <  0  || ch >  9 ))       ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)                ? EOF                : *p1++;     ;     if (ch ==  - )       sgn = true,       ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)                ? EOF                : *p1++;     ;     while (ch >=  0  && ch <=  9 )       x = (x << 1) + (x << 3) + (ch ^ 48),       ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)                ? EOF                : *p1++;     ;     return sgn ? -x : x;   }   int mon[N];   int d[N];   int main() {     int t;     cin >> t;     while (t--) {       int n, m;       scanf( %d , &n);       for (int i = 1; i <= n; i++) scanf( %d , &mon[i]);       scanf( %d , &m);       for (int i = 1; i <= m; i++) {         int a, b;         scanf( %d%d , &a, &b);         d[b] = max(a, d[b]);       }       for (int i = n; i >= 0; i--) d[i] = max(d[i + 1], d[i]);       int ans = 0;       for (int i = 1; i <= n;) {         if (mon[i] > d[1]) {           cout <<  -1  << endl;           goto brk;         }         int j = 0;         int MX = 0;         for (; j <= n; j++) {           MX = max(MX, mon[i + j]);           if (d[j + 1] < MX) break;         }         ans++;         i += j;       }       cout << ans << endl;     brk:;       for (int i = 0; i <= n; i++) d[i] = 0;     }     return 0;   }
#include <bits/stdc++.h>   const long long iinf = 1e18;   const int inf = 1e9 + 10;   const int MOD = (1e6 + 3);   int dir4[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};   int knight[8][2] = {{2, 1}, {2, -1}, {-2, 1}, {-2, -1},                       {1, 2}, {-1, 2}, {1, -2}, {-1, -2}};   using namespace std;   void solve() {     int n;     cin >> n;     int ans = 1;     for (int i = 2; i * i <= n; i++) {       if (n % i == 0) {         ans = i;         break;       }     }     if (ans == 1) {       cout << 1 <<     << n - 1 <<   n ;       return;     }     int a = n / ans;     cout << a <<     << (ans - 1) * a <<   n ;   }   int main() {     int t = 1;     cin >> t;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   bool a = true;   int main() {     scanf( %d%d , &n, &m);     int arr[m];     if (m % 2 == 0) {       arr[0] = (m) / 2;       for (int i = 1; i < m; i++) {         if (!a) {           arr[i] = arr[i - 1] - i;           a = !a;         } else {           arr[i] = arr[i - 1] + i;           a = !a;         }       }     } else {       arr[0] = (m + 1) / 2;       for (int i = 1; i < m; i++) {         if (!a) {           arr[i] = arr[i - 1] + i;           a = !a;         } else {           arr[i] = arr[i - 1] - i;           a = !a;         }       }     }     for (int i = 0; i < n; i++) {       printf( %d n , arr[i % m]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     map<int, int> mp;     map<int, int> np;     for (int i = 1; i <= n; i++) {       int x, y;       cin >> x >> y;       int p = y - x;       int q = y + x;       mp[p]++;       np[q]++;     }     map<int, int>::iterator it;     int box = 0;     for (it = mp.begin(); it != mp.end(); it++) {       int g = it->second;       box += (g * (g - 1)) / 2;     }     for (it = np.begin(); it != np.end(); it++) {       int g = it->second;       box += (g * (g - 1)) / 2;     }     cout << box << endl;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > vc;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     long long N, M, x, y, z, p, i, X, Y, j, lplp1, lplp2;     cin >> N >> M >> x >> y >> z >> p;     long long opop1 = x % 4;     long long opop2 = y % 2;     long long opop3 = z % 4;     for (i = 1; i <= p; i++) {       cin >> X >> Y;       vc.push_back(make_pair(X, Y));     }     for (i = 1; i <= opop1; i++) {       for (j = 0; j <= (int)vc.size() - 1; j++) {         lplp1 = vc[j].first;         lplp2 = vc[j].second;         vc[j].first = vc[j].second;         vc[j].second = N - lplp1 + 1;       }       swap(N, M);     }     for (i = 1; i <= opop2; i++) {       for (j = 0; j <= (int)vc.size() - 1; j++) {         lplp1 = vc[j].first;         lplp2 = vc[j].second;         vc[j].second = M - lplp2 + 1;       }     }     for (i = 1; i <= opop3; i++) {       for (j = 0; j <= (int)vc.size() - 1; j++) {         lplp1 = vc[j].first;         lplp2 = vc[j].second;         vc[j].first = M - lplp2 + 1;         vc[j].second = lplp1;       }       swap(N, M);     }     for (i = 0; i <= (int)vc.size() - 1; i++) {       cout << vc[i].first <<     << vc[i].second <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   int solve(int m, int n) {     if (m == 1 || n == 1) return m * n;     if (m == 2 || n == 2) {       if (m < n) {         m = n;         n = 2;       }       if (m % 4 == 0)         return m;       else if (m % 4 == 1)         return m + 1;       else if (m % 4 == 2)         return m + 2;       else         return m + 1;     }     if (m % 2 == 1 && n % 2 == 1) return m * n / 2 + 1;     return m * n / 2;   }   int main() {     int m, n;     scanf( %d %d , &m, &n);     printf( %d , solve(m, n));   }
#include <bits/stdc++.h>   using namespace std;   int n, kov = 1;   int t[502][502];   void ert(int a, int b) { t[a][b] = kov, kov++; }   int main() {     cin >> n;     if (n <= 2) {       cout << -1 <<   n ;       return 0;     }     if (n == 3) {       cout << 1 <<     << 3 <<     << 2 <<   n ;       cout << 5 <<     << 4 <<     << 8 <<   n ;       cout << 9 <<     << 6 <<     << 7 <<   n ;       return 0;     }     for (int i = n - 3; i >= 1; i--) ert(i, n);     for (int i = 1; i <= n - 1; i++) {       for (int j = 1; j <= n - 1; j++) {         if (i % 2 == n % 2)           ert(i, n - j);         else           ert(i, j);       }     }     t[n - 2][n] = n * n, t[n][n] = n * n - 1;     ert(n, n - 2), ert(n, n - 1), ert(n - 1, n);     for (int i = 1; i <= n - 3; i++) ert(n, i);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         cout << t[i][j] <<    ;       }       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     long long int len = s.length();     long long int cnt = 0;     for (long long int i = 0; i < len; i++) {       if (s[i] ==  Q ) {         cnt++;       }     }     long long int suffixes = cnt;     long long int prefixes = 0;     long long int ans = 0;     for (long long int j = 0; j < len; j++) {       if (s[j] ==  Q ) {         prefixes++;         suffixes--;       }       if (s[j] ==  A ) {         ans += prefixes * suffixes;       }     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n, m, i, a, b, sum = 0;     cin >> n >> m;     long long arr[n + 1];     for (i = 1; i <= n; i++) {       cin >> arr[i];     }     for (i = 0; i < m; i++) {       cin >> a >> b;       sum += min(arr[a], arr[b]);     }     cout << sum << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   namespace perfectGroups {   const int mx = 5001;   int arr[mx], ans[mx], previous[mx], dp[5001][5001], zero[mx];   int transNumber(int num) {     int temp = abs(num), rt = sqrt(temp), ret = 1;     for (int i = 2; i <= rt; i++) {       int cnt = 0;       while (temp > 1 && temp % i == 0) {         cnt++;         temp = temp / i;       }       if (cnt & 1) ret = ret * i;     }     if (temp > 1 || temp == 0) ret = ret * temp;     return ret * (num > 0 ? 1 : -1);   }   void mapTheArray(int *n) {     for (int i = 1; i <= *n; i++) {       zero[i] = zero[i - 1] + (arr[i] == 0);     }     map<int, int> maping;     for (int i = 1, idx = 0; i <= *n; i++) {       if (maping.find(arr[i]) == maping.end()) {         arr[i] = maping[arr[i]] = ++idx;       } else {         arr[i] = maping[arr[i]];       }     }     for (int i = 1; i <= *n; i++) {       int pre = previous[arr[i]];       previous[arr[i]] = i;       arr[i] = pre;     }   }   void dpTable(int *n) {     for (int i = 1; i <= *n; i++) {       for (int j = 1; j + i - 1 <= *n; j++) {         int l = i, r = i + j - 1;         if (arr[r] < l)           dp[l][r] = dp[l][r - 1] + 1;         else           dp[l][r] = dp[l][r - 1];       }     }     for (int i = 1; i <= *n; i++) {       for (int j = i; j <= *n; j++) {         int id = zero[j] - zero[i - 1];         if (id >= 1 && dp[i][j] > 1) dp[i][j]--;         ans[dp[i][j]]++;       }     }   }   void solve() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       scanf( %d , &arr[i]);       arr[i] = transNumber(arr[i]);     }     mapTheArray(&n);     dpTable(&n);     for (int i = 1; i <= n; i++) {       printf( %d  , ans[i]);       if (i == n) puts(  );     }   }   }  // namespace perfectGroups   int main() {     perfectGroups::solve();     return 0;   }
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:60777216 )   using namespace std;   int d[10];   int c[107][107];   long long dp[107][17];   long long solve(int len, int pos) {     if (pos == 9) {       if (len >= d[9]) {         return 1;       }       return 0;     }     if (dp[len][pos] != -1) {       return dp[len][pos];     }     dp[len][pos] = 0;     if (pos == 0) {       for (int j = d[pos]; j <= len; ++j) {         dp[len][pos] += solve(len - j, pos + 1) * c[len - 1][j] % 1000000007;         if (dp[len][pos] >= 1000000007) dp[len][pos] -= 1000000007;       }     } else {       for (int j = d[pos]; j <= len; ++j) {         dp[len][pos] += solve(len - j, pos + 1) * c[len][j] % 1000000007;         if (dp[len][pos] >= 1000000007) dp[len][pos] -= 1000000007;       }     }     return dp[len][pos];   }   int main() {     c[0][0] = 1;     c[1][1] = 1;     c[1][0] = 1;     for (int i = 2; i <= 100; ++i) {       c[i][i] = 1;       c[i][0] = 1;       for (int j = 1; j < i; ++j) {         c[i][j] = c[i - 1][j] + c[i - 1][j - 1];         if (c[i][j] >= 1000000007) c[i][j] -= 1000000007;       }     }     long long ans = 0;     memset(dp, -1, sizeof(dp));     int len;     scanf( %d , &len);     for (int i = 0; i < 10; ++i) {       scanf( %d , d + i);     }     for (int i = 1; i <= len; ++i) {       ans += solve(i, 0);       if (ans >= 1000000007) ans -= 1000000007;     }     printf( %d n , ans);     return 0;   }