malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int n, tot, d[105];   int read() {     int _ = 0, ___ = 1;     char __ = getchar();     while (__ >  9  || __ <  0 ) {       if (__ ==  - ) ___ = -1;       __ = getchar();     }     while (__ >=  0  && __ <=  9 ) {       _ = _ * 10 + __ -  0 ;       __ = getchar();     }     return _ * ___;   }   int get(int x) {     int sum = 0;     while (x) {       sum += x % 10;       x /= 10;     }     return sum;   }   int main() {     n = read();     for (int i = max(n - 81, 0); i <= n; i++) {       int x = get(i);       if (x + i == n) d[++tot] = i;     }     printf( %d n , tot);     for (int i = 1; i <= tot; i++) printf( %d  , d[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int prime(int n) {     if (n == 1) {       return 0;     }     for (int i = 2; i * i <= n; i++) {       if (n % i == 0) {         return 0;       }     }     return 1;   }   int main() {     int n;     cin >> n;     int cnt = n;     while (!prime(cnt)) {       cnt++;     }     cout << cnt << endl;     for (int i = 1; i <= n; i++) {       cout << i <<     << i % n + 1 << endl;     }     int now = 1;     while (cnt != n) {       cout << now <<     << n - now << endl;       now++;       cnt--;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   long double PI = acosl(-1);   const long long inf = 3e18;   const int nmax = 1e5 + 5;   const int MAXLG = log2(nmax) + 1;   vector<int> g[nmax];   long long val[nmax], chein[nmax], path[nmax];   long long dfs(int u, int p = 0) {     chein[u] = path[u] = val[u];     vector<long long> mxcheins;     for (int v : g[u])       if (v != p) {         mxcheins.push_back(dfs(v, u));         chein[u] = max(chein[u], chein[v] + val[u]);         path[u] = max(path[u], path[v]);       }     path[u] = max(path[u], chein[u]);     sort(mxcheins.rbegin(), mxcheins.rend());     if (mxcheins.size() > 1)       path[u] = max(path[u], val[u] + mxcheins[0] + mxcheins[1]);     else if (mxcheins.size() > 0)       path[u] = max(path[u], val[u] + mxcheins[0]);     return chein[u];   }   long long dfs2(int u, long long mxpath, long long mxchein, int p = 0) {     multiset<long long> alpath;     multiset<long long> alchein;     for (int v : g[u])       if (v != p) alpath.insert(path[v]), alchein.insert(chein[v]);     alchein.insert(mxchein), alpath.insert(mxpath);     long long ret = mxpath + path[u];     for (int v : g[u])       if (v != p) {         alpath.erase(alpath.find(path[v]));         alchein.erase(alchein.find(chein[v]));         long long mxp2 = *alpath.rbegin(), mxc2 = *alchein.rbegin() + val[u];         if (alchein.size() > 1) {           long long tmp = *alchein.rbegin();           alchein.erase(alchein.find(tmp));           long long tmp2 = *alchein.rbegin();           mxp2 = max(mxp2, val[u] + tmp + tmp2);           alchein.insert(tmp);         } else if (alchein.size() > 0) {           mxp2 = max(mxp2, val[u] + *alchein.rbegin());         }         mxp2 = max(mxp2, mxc2);         ret = max(ret, dfs2(v, mxp2, mxc2, u));         alpath.insert(path[v]), alchein.insert(chein[v]);       }     return ret;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     for (int i = 1; i <= n; i++) cin >> val[i];     for (int i = 1; i < n; i++) {       int u, v;       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     dfs(1);     cout << dfs2(1, 0, 0);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n, x, k;     cin >> n >> k;     vector<long long> v;     set<long long> s;     map<long long, long long> m;     for (long long i = 0; i < n; i++) {       cin >> x;       if (m[x] == 0) {         m[x]++;         v.insert(v.begin(), x);       }       if (v.size() > k) {         m[v.back()] = 0;         v.pop_back();       }     }     long long a = v.size();     cout << min((a), k) << endl;     for (long long i = 0; i < v.size(); i++) {       cout << v[i] <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   int md = 1e9 + 7;   int __gcd(int a, int b) {     if (b == 0) return a;     return __gcd(b, a % b);   }   int poww(int a, int b) {     int res = 1;     while (b) {       if (b & 1) {         res *= a;         res %= md;       }       a *= a;       a %= md;       b >>= 1;     }     return res;   }   void ainp(int arr[], int n) {     for (int i = 1; i <= n; i++) cin >> arr[i];   }   const int N = 1e5 + 5;   void fun() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);   }   int n;   int a[N], cache[N][10];   int dp(int idx, int cur) {     if (idx == n) return 1;     int &ans = cache[idx][cur];     if (ans != -1) return ans;     ans = 0;     if (a[idx + 1] > a[idx]) {       for (int i = cur + 1; i <= 5; i++) ans |= dp(idx + 1, i);     } else if (a[idx + 1] == a[idx]) {       for (int i = 1; i <= 5; i++) {         if (i == cur) continue;         ans |= dp(idx + 1, i);       }     } else {       for (int i = 1; i < cur; i++) ans |= dp(idx + 1, i);     }     return ans;   }   void path(int idx, int cur) {     cout << cur <<    ;     if (idx == n) return;     if (a[idx + 1] > a[idx]) {       for (int i = cur + 1; i <= 5; i++)         if (dp(idx + 1, i)) return path(idx + 1, i);     } else if (a[idx + 1] == a[idx]) {       for (int i = 1; i <= 5; i++) {         if (i == cur) continue;         if (dp(idx + 1, i)) return path(idx + 1, i);       }     } else {       for (int i = 1; i < cur; i++)         if (dp(idx + 1, i)) return path(idx + 1, i);     }   }   signed main() {     fun();     memset(cache, -1, sizeof(cache));     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= 5; i++) {       if (dp(1, i)) {         path(1, i);         return 0;       }     }     cout <<  -1 ;     return 0;   }
#include <bits/stdc++.h>      using namespace std;      #define ar array   #define ll long long      const int MAX_N = 1e5 + 1;   const int m = 1e9 + 7;   const int INF = 1e9;   const ll LINF = 1e18;      int main()   {    int t=1;    cin>>t;    int n;    while(t--)    {     cin>>n;     int A[n];     for(int i=0;i<n;i++)cin>>A[i];     int x=0,y=n-1;     while(x<=y){      cout<<A[x]<<   ;      if(x!=y)cout<<A[y--]<<   ;      x++;     }     cout<<endl;    }      return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long dp[2000010], v[2000010];   int main() {     for (int i = 3; i <= 2000000; i++) {       dp[i] =           (dp[i - 1] + 2 * dp[i - 2] + 4 * (!v[i - 1] && !v[i - 2])) % 1000000007;       v[i] = !v[i - 1] && !v[i - 2];     }     int t;     scanf( %d , &t);     while (t--) {       int n;       scanf(  %d , &n);       printf( %I64d n , dp[n]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 3e3;   int r, c, n, k, tot, bound[maxn + 2], vis[maxn + 2], suc[maxn + 2],       pre[maxn + 2], rest[maxn + 2];   bool exist[maxn + 2][maxn + 2];   long long ans;   struct vertex {     int x, y;   } a[maxn + 1];   vector<int> t[maxn + 1];   int main() {     scanf( %d%d%d%d , &r, &c, &n, &k);     for (int i = 1; i <= n; ++i) {       scanf( %d%d , &a[i].x, &a[i].y);       exist[a[i].x][a[i].y] = true;     }     for (int i = 1; i <= r; ++i) {       memset(vis, 0, sizeof vis);       memset(suc, 0, sizeof suc);       memset(pre, 0, sizeof pre);       memset(rest, 0, sizeof rest);       tot = 0;       suc[c + 1] = c + 1;       for (int j = 1; j <= c + 1; ++j) bound[j] = c + 1;       for (int j = 1; j <= n; ++j)         if (a[j].x >= i) {           ++vis[a[j].y];           t[a[j].x].push_back(a[j].y);         }       for (int j = 1, l = 0, sum = 0; j <= c; ++j) {         while (l <= c && sum < k) sum += vis[++l];         if (l > c) break;         bound[j] = l;         rest[j] = sum;         sum -= vis[j];       }       for (int j = 1, last = 0; j <= c; ++j) {         if (vis[j]) {           suc[last] = j;           pre[j] = last;           last = j;         }         if (j == c) {           suc[last] = c + 1;           pre[c + 1] = last;         }       }       long long sum = 0;       for (int j = c + 1; j; j = pre[j])         sum += (long long)(c - bound[j] + 1) * (j - pre[j]);       for (int j = r; j >= i; --j) {         ans += sum;         for (int l = 0; l < t[j].size(); ++l) {           int lt = t[j][l];           --vis[lt];           for (int cnt = vis[lt], now = lt; now && bound[now] >= lt;                now = pre[now]) {             --rest[now];             if (rest[now] < k) {               sum -= (long long)(c - bound[now] + 1) * (now - pre[now]);               bound[now] = suc[bound[now]];               rest[now] += vis[bound[now]];               sum += (long long)(c - bound[now] + 1) * (now - pre[now]);             }           }           if (!vis[lt]) {             sum += (long long)(c - bound[suc[lt]] + 1) * (suc[lt] - pre[lt]) -                    (long long)(c - bound[lt] + 1) * (lt - pre[lt]) -                    (long long)(c - bound[suc[lt]] + 1) * (suc[lt] - lt);             pre[suc[lt]] = pre[lt];             suc[pre[lt]] = suc[lt];           }         }         t[j].clear();       }     }     printf( %lld , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, a, b;       string s =   ;       cin >> n >> a >> b;       s +=  a ;       for (int i = 1; i < b; i++) {         s += s[i - 1] + 1;       }       string s2 = s;       for (int i = 0; i < n / b - 1; i++) {         s += s2;       }       for (int i = 0; i < n % b; i++) {         s += s[i];       }       cout << s << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   set<int> cn[10000];   int nx[10000];   string xm[10000];   int main() {     int m;     cin >> m;     ;     map<string, int> mx;     int n = 0;     for (int i = (0); i < m; i++) {       string a, b;       cin >> a >> b;       if (!mx.count(a)) mx[a] = n, xm[n++] = a;       if (!mx.count(b)) mx[b] = n, xm[n++] = b;       cn[mx[a]].insert(mx[b]);       cn[mx[b]].insert(mx[a]);     }     cout << n << endl;     for (int i = (0); i < n; i++) {       memset(nx, 0, sizeof(nx));       int my = -1, cmy = 0;       for (auto f : cn[i]) {         for (auto fx : cn[f]) {           if (fx == i || cn[fx].count(i)) continue;           nx[fx]++;           if (nx[fx] > my)             my = nx[fx], cmy = 1;           else if (nx[fx] == my)             cmy++;         }       }       if (cmy == 0) {         cmy = n - 1 - cn[i].size();       }       cout << xm[i] <<     << cmy << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, k, ans, s, e, in[100020], pre[100020], vis[100020], ff[100020];   long long len[100020];   struct node {     int v, f;     long long w;   };   vector<node> adj[100020];   bool operator<(const node &x, const node &y) {     if (x.w > y.w) return true;     return false;   }   int dijk(int s) {     priority_queue<node> q;     node now, newnode;     now.w = 0;     now.v = s;     q.push(now);     int i, u, v;     memset(ff, 0, sizeof(ff));     memset(vis, 0, sizeof(vis));     memset(len, 123, sizeof(len));     len[s] = 0;     int cnt = 0;     while (!q.empty()) {       if (cnt == n) break;       u = q.top().v;       q.pop();       if (vis[u]) continue;       vis[u] = 1;       for (i = 0; i < adj[u].size(); i++) {         now = adj[u][i];         v = now.v;         if (now.w + len[u] < len[v] || (now.w + len[u] == len[v] && !now.f)) {           len[v] = now.w + len[u];           newnode.w = len[v];           newnode.v = v;           if (now.f)             ff[v] = 1;           else             ff[v] = 0;           pre[v] = u;           q.push(newnode);         }       }       cnt++;     }     return 0;   }   void addnode(int u, int v, int w, int f) {     node nn;     nn.v = v;     nn.w = w;     nn.f = f;     adj[u].push_back(nn);   }   int main() {     ans = 0;     int t, i, u, v, w, cnt = 0;     node now, nn;     scanf( %d%d%d , &n, &m, &k);     for (i = 0; i < m; i++) {       scanf( %d%d%d , &u, &v, &w);       addnode(u, v, w, 0);       addnode(v, u, w, 0);     }     for (i = 0; i < k; i++) {       scanf( %d%d , &v, &w);       addnode(1, v, w, 1);       addnode(v, 1, w, 1);     }     dijk(1);     ans = 0;     for (int i = 2; i <= n; i++) {       if (ff[i]) ans++;     }     printf( %d n , k - ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int n;     cin >> n;     long long int mc[6];     mc[0] = mc[5] = 0;     for (long long int i = 0, k = 0; i < n; i++) {       cin >> k;       mc[k] += 1;     }     if (mc[0] < 1)       cout << -1;     else if (mc[5] < 9)       cout << 0;     else {       for (long long int i = 0; i < mc[5] / 9 * 9; i++) cout << 5;       for (long long int i = 0; i < mc[0]; i++) cout << 0;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MOD = 32768, N = 109;   char ch;   string s[N], t;   int ans, v, f[MOD + 9], num, p, pos;   int ex();   int gt() {     int ret = 0;     if (t[pos] ==  n ) return pos++, v;     if (t[pos] ==  f ) return pos += 2, ret = f[ex()], pos++, ret;     while (t[pos] >=  0  && t[pos] <=  9 ) ret = ret * 10 + (t[pos] -  0 ), pos++;     return ret;   }   int nex() {     int ret = gt();     while (t[pos] ==  *  || t[pos] ==  / ) {       char tp = t[pos];       pos++;       int t1 = gt();       if (tp ==  * )         ret = (int)((1ll * ret * t1) % MOD);       else         ret = (ret / t1) % MOD;     }     return ret;   }   int ex() {     int ret = nex();     while (t[pos] ==  +  || t[pos] ==  - ) {       char tp = t[pos];       pos++;       int t1 = nex();       if (tp ==  + )         ret = (ret + t1) % MOD;       else         ret = (ret + MOD - t1) % MOD;     }     return ret;   }   bool iex() {     int p1, p2, tp;     p1 = ex();     if (t[pos] ==  = )       tp = 0, pos += 2;     else if (t[pos] ==  < )       tp = -1, pos++;     else       tp = 1, pos++;     p2 = ex();     if (tp == 0) return p1 == p2;     if (tp == -1) return p1 < p2;     if (tp == 1) return p1 > p2;     return 0;   }   int getans() {     for (int i = 0; i < num; i++) {       t = s[i];       if (t[0] ==  i ) {         pos = 3;         if (iex()) return pos += 7, ex();       } else         return pos = 6, ex();     }     return -1;   }   int main() {     cin >> ans >> ch;     while (ch !=  { ) cin >> ch;     num = 0;     while (true) {       cin >> ch;       if (ch ==  } ) break;       if (ch ==  ; )         num++;       else         s[num] += ch;     }     int anst = -1;     for (int i = 0; i < MOD; i++) {       v = i, f[i] = getans();       if (f[i] == ans) anst = i;     }     cout << anst;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, l;   vector<vector<int>> adj;   int timer;   vector<int> tin, tout;   vector<vector<int>> up;   vector<int> dist;   vector<int> down;   void dfs(int v, int p) {     dist[v] = dist[p] + 1;     down[v] = 1;     tin[v] = ++timer;     up[v][0] = p;     for (int i = 1; i <= l; ++i) up[v][i] = up[up[v][i - 1]][i - 1];     for (int u : adj[v]) {       if (u != p) {         dfs(u, v);         down[v] += down[u];       }     }     tout[v] = ++timer;   }   bool is_ancestor(int u, int v) {     return tin[u] <= tin[v] && tout[u] >= tout[v];   }   int lca(int u, int v) {     if (is_ancestor(u, v)) return u;     if (is_ancestor(v, u)) return v;     for (int i = l; i >= 0; --i) {       if (!is_ancestor(up[u][i], v)) u = up[u][i];     }     return up[u][0];   }   int pre(int u, int v) {     for (int i = l; i >= 0; --i) {       if (!is_ancestor(up[u][i], v)) u = up[u][i];     }     return u;   }   void preprocess(int root) {     tin.resize(n + 1);     tout.resize(n + 1);     timer = 0;     l = ceil(log2(n + 1));     up.assign(n + 1, vector<int>(l + 2));     dfs(root, root);   }   void trav(int x, int d) {     int to = x;     for (int i = l; i >= 0; i--) {       if (dist[x] - dist[up[to][i]] < d) {         to = up[to][i];       }     }     cout << down[up[to][0]] - down[to] <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     adj.resize(n + 1);     dist.resize(n + 1);     down.resize(n + 1);     for (int i = 0; i < n - 1; i++) {       int x, y;       cin >> x >> y;       adj[x].push_back(y);       adj[y].push_back(x);     }     preprocess(1);     cin >> m;     for (int i = 0; i < m; i++) {       int x, y;       cin >> x >> y;       int L = lca(x, y);       if (x == y) {         cout << n <<   n ;         continue;       }       int d = (dist[x] - dist[L] + dist[y] - dist[L] + 1);       if (d % 2 == 0) {         cout << 0 <<   n ;       } else {         if (dist[x] - dist[L] == dist[y] - dist[L]) {           cout << n - down[pre(x, L)] - down[pre(y, L)] <<   n ;         } else {           d = (dist[x] - dist[L] + dist[y] - dist[L]);           if (dist[x] < dist[y]) swap(x, y);           int z = d / 2;           trav(x, z);         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int fp(int abc, int parent[]) {     if (parent[abc] == abc) return abc;     int def = fp(parent[abc], parent);     parent[abc] = def;     return def;   }   void cycledmerge(vector<int> hub[], int n, int parent[]) {     stack<int> urutan;     for (int i = 0; i < n; i++) parent[i] = i;     stack<pair<int, int> > ngurut;     vector<int> sudah(n, 0);     vector<int> adadiurutan(n, 0);     vector<int> dari(n, -1);     for (int i = 0; i < n; i++) {       if (sudah[i]) continue;       urutan.push(i);       ngurut.push(make_pair(i, 0));       adadiurutan[i] = 1;       sudah[i] = 1;       while (!ngurut.empty()) {         int id = ngurut.top().first;         int val = ngurut.top().second;         ngurut.pop();         if (val == (int)hub[id].size()) {           while (!urutan.empty() && urutan.top() == id) urutan.pop();           adadiurutan[id] = 0;           continue;         }         ngurut.push(make_pair(id, val + 1));         int next = hub[id][val];         if (dari[id] == next) continue;         if (sudah[next] && !adadiurutan[fp(next, parent)]) continue;         if (!sudah[next]) {           sudah[next] = 1;           urutan.push(next);           ngurut.push(make_pair(next, 0));           adadiurutan[next] = 1;           dari[next] = id;           continue;         }         if (parent[fp(id, parent)] == fp(next, parent)) continue;         parent[fp(id, parent)] = fp(next, parent);         while (!urutan.empty() && urutan.top() != fp(next, parent)) {           parent[fp(urutan.top(), parent)] = fp(next, parent);           urutan.pop();         }       }     }     return;   }   int main() {     int p[200];     vector<int> hub[200];     int n, m;     cin >> n >> m;     for (int(i) = 0; (i) < (m); ++(i)) {       int a, b;       cin >> a >> b;       --a;       --b;       hub[a].push_back(b);       hub[b].push_back(a);     }     cycledmerge(hub, n, p);     vector<int> ukuran(n, 0);     for (int(i) = 0; (i) < (n); ++(i)) ukuran[p[i]]++;     int numcyc = 0;     for (int(i) = 0; (i) < (n); ++(i))       if (ukuran[i] >= 3) ++numcyc;     if (numcyc != 1) {       cout <<  NO  << endl;       return 0;     }     int besar = 0;     for (int(i) = 0; (i) < (n); ++(i))       if (ukuran[i] >= 3) besar = ukuran[i];     int yesadj = 0;     int noadj = 0;     for (int(i) = 0; (i) < (n); ++(i))       for (int(j) = 0; (j) < (((int)hub[i].size())); ++(j)) {         int k = hub[i][j];         if (k < i) continue;         if (p[i] != p[k])           ++noadj;         else           ++yesadj;       }     if (yesadj != besar || noadj != (n - besar + 1) - 1) {       cout <<  NO  << endl;     } else {       cout <<  FHTAGN!  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, resmax = -round(1e9), resmin = round(1e9);   int main() {     cin >> n;     for (int i = 1; i <= 7; i++) {       int j = i, dem1 = 0;       for (int dem = 1; dem <= n; dem++) {         if ((j % 7 == 0) || (j % 7 == 6)) dem1++;         j++;         if (j > 7) j = 1;       }       resmax = max(resmax, dem1);       resmin = min(resmin, dem1);     }     cout << resmin <<     << resmax;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string st;     cin >> st;     for (int i = 0; i < st.length(); i++) {       if (st[i] ==  H  || st[i] ==  Q  || st[i] ==  9 ) {         cout <<  YES  << endl;         return 0;       }     }     cout <<  NO  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int solve() {     int n;     cin >> n;     if (n == 1) return cout << -1 << endl, 0;     string s =   ;     for (int i = 0; i < n - 1; i++) s +=  3 ;     cout <<  2  + s << endl;     return 0;   }   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int t;     cin >> t;     while (t--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int gi() {     int res = 0, w = 1;     char ch = getchar();     while (ch !=  -  && !isdigit(ch)) ch = getchar();     if (ch ==  - ) w = -1, ch = getchar();     while (isdigit(ch)) res = res * 10 + ch -  0 , ch = getchar();     return res * w;   }   const int Mod = 1e9 + 7, K = 1e9;   int upd(int x) { return x + (x >> 31 & Mod); }   const int MAX_N = 3e5 + 5;   int N, M, a[MAX_N], b[MAX_N], c[MAX_N];   char s[MAX_N];   int d[MAX_N], m;   void Div(int x, int &v) {     long long now = 0;     for (int i = m; i; i--) {       now = now * K + d[i];       d[i] = now / x, now %= x;     }     v = now;     for (; m > 1 && !d[m]; m--)       ;   }   int f[2][MAX_N * 20], mx[2];   void add(int o, int x, int v) {     f[o][x] = upd(f[o][x] + v - Mod);     mx[o] = max(mx[o], x);   }   int main() {     N = gi();     a[1] = 1;     for (int i = 2; i <= N; i++) a[i] = gi();     for (int i = 1; i <= N; i++) b[i] = gi();     scanf( %s , s + 1), M = strlen(s + 1);     reverse(&s[1], &s[M + 1]);     for (int i = 1; i <= M; i += 9) {       ++m;       for (int j = min(M, i + 8); j >= i; j--) d[m] = d[m] * 10 + s[j] -  0 ;     }     a[N + 1] = K;     for (int i = 1; i <= N; i++)       if (a[i + 1] > 1) Div(a[i + 1], c[i]);     if (m != 1 || d[1] != 0) return puts( 0 ) & 0;     f[0][0] = 1, f[0][1] = Mod - 1, mx[0] = 1;     for (int i = 1, o = 0; i <= N; i++, o ^= 1) {       for (int j = 1; j <= mx[o]; j++) f[o][j] = upd(f[o][j] + f[o][j - 1] - Mod);       for (int j = 0; j <= mx[o]; j++)         if (f[o][j]) {           int k = (c[i] - j % a[i + 1] + a[i + 1]) % a[i + 1];           int l = (j + k - c[i]) / a[i + 1],               r = b[i] / a[i + 1] + 1 - (b[i] % a[i + 1] < k);           add(o ^ 1, l, f[o][j]), add(o ^ 1, l + r, Mod - f[o][j]);           f[o][j] = 0;         }       mx[o] = 0;     }     printf( %d n , f[N & 1][0]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   map<int, int> cnt, b;   vector<int> ans;   int a[200010], x;   int n, m, p;   int main() {     cin >> n >> m >> p;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < m; i++) {       cin >> x;       b[x]++;     }     for (int i = 0; i < p; i++) {       if (i + (long long)(m - 1) * p >= n) break;       long long j;       cnt = b;       for (j = i; j <= i + (long long)(m - 1) * p; j += p)         if (--cnt[a[j]] == 0) cnt.erase(a[j]);       if (cnt.size() == 0) ans.push_back(i + 1);       for (long long k = i; j < n; j += p, k += p) {         if (--cnt[a[j]] == 0) cnt.erase(a[j]);         if (++cnt[a[k]] == 0) cnt.erase(a[k]);         if (cnt.size() == 0) ans.push_back(k + p + 1);       }     }     sort(ans.begin(), ans.end());     cout << ans.size() << endl;     for (int i = 0; i < ans.size(); i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int k[5] = {100, 20, 10, 5, 1};   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     while (cin >> n) {       long long ans = 0;       for (int i = 0; i < 5; i++) {         ans += n / k[i];         n %= k[i];       }       cout << ans <<   n ;     }     return 0;   }