malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 2e6 + 5;   int n, m;   namespace BCC {   const int N = 202020;   vector<int> bcc[N];   vector<int> k;   int cnt, dfn[N], low[N], id[N], st[N], _st, _, to[N];   void dfs(int c, int dep, vector<int> g[]) {     int cc = 0;     st[_st++] = c;     dfn[c] = low[c] = dep;     for (auto t : g[c]) {       if (!dfn[t]) {         dfs(t, dep + 1, g);         low[c] = min(low[c], low[t]);       } else if (dfn[t] != dfn[c] - 1 || cc++)         low[c] = min(low[c], dfn[t]);     }     if (low[c] == dfn[c]) {       to[_] = st[_st - 1];       do {         id[st[--_st]] = _;       } while (st[_st] != c);       _++;     }   }   int solve(int n, vector<int> g[]) {     cnt = 0;     fill_n(dfn, n, _ = 0);     fill_n(low, n, _st = 0);     fill_n(bcc, n, vector<int>());     for (int i = (0); i < (n); i++)       if (!dfn[i]) dfs(i, 1, g), cnt++;     for (int i = (0); i < (n); i++)       for (auto j : g[i])         if (id[i] != id[j]) bcc[id[i]].push_back(id[j]);     return cnt;   }   }  // namespace BCC   vector<int> g[N];   int main() {     cin >> n >> m;     if (n == 2) {       cout << -1;       return 0;     }     for (int i = (1); i < (m + 1); i++) {       int u, v;       cin >> u >> v;       u--, v--;       g[u].push_back(v);       g[v].push_back(u);     }     BCC::solve(n, g);     int leaf = 0;     vector<int> s;     for (int i = (0); i < (BCC::_); i++) {       if ((int)BCC::bcc[i].size() == 1) leaf++, s.push_back(BCC::to[i] + 1);     }     int ans = (leaf + 1) / 2;     cout << ans <<   n ;     if (leaf & 1) ans--;     for (int i = ans; i <= leaf - 1; ++i)       cout << s[i] <<     << s[i - ans] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2548;   bool g[N][N], c[N][N], v[N][N];   int ng[N][N], sg[N][N], sc[N][N];   int c_square, c_circle, n;   template <class T>   inline T sqr(T x) {     return x * x;   }   int qx[N * N], qy[N * N], tcnt;   inline void solve(int x, int y) {     const int dx[4] = {0, 0, 1, -1}, dy[4] = {-1, 1, 0, 0};     int l(0), r(0);     pair<int, int> aux(x, y);     ++r;     qx[r] = x;     qy[r] = y;     v[x][y] = true;     while (l < r) {       ++l;       int cx(qx[l]), cy(qy[l]);       for (int i = 0; i < 4; ++i) {         int nx = cx + dx[i], ny = cy + dy[i];         if (!v[nx][ny] && g[nx][ny]) {           ++r;           qx[r] = nx;           qy[r] = ny;           v[nx][ny] = true;         }       }     }     int sqdmax(0), s(r);     if (s < 120) {       ++tcnt;       return;     }     for (int i = 1; i <= r; ++i) aux = min(aux, pair<int, int>(qx[i], qy[i]));     for (int i = 1; i <= r; ++i)       sqdmax = max(sqdmax, sqr(qx[i] - aux.first) + sqr(qy[i] - aux.second));     if (s < (double)sqdmax * 0.4 || s > (double)sqdmax * 0.86) return;     if (s > (double)sqdmax * 0.73)       ++c_circle;     else       ++c_square;   }   double calcRatio(int xl, int yl, int xr, int yr) {     return double(sg[xr][yr] - sg[xl - 1][yr] - sg[xr][yl - 1] +                   sg[xl - 1][yl - 1]) /            double(sc[xr][yr] - sc[xl - 1][yr] - sc[xr][yl - 1] +                   sc[xl - 1][yl - 1]);   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j) {         int t;         scanf( %d , &t);         g[i][j] = t;         c[i][j] = 1;         sg[i][j] = sg[i - 1][j] + sg[i][j - 1] - sg[i - 1][j - 1] + g[i][j];         sc[i][j] = sc[i - 1][j] + sc[i][j - 1] - sc[i - 1][j - 1] + c[i][j];       }     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j) {         ng[i][j] |= calcRatio(i - 2, j - 2, i + 2, j + 2) > 0.9;         ng[i][j] |= calcRatio(i, j, i + 4, j + 4) > 0.6;         ng[i][j] |= calcRatio(i - 4, j - 4, i, j) > 0.6;         ng[i][j] |= calcRatio(i - 4, j, i, j + 4) > 0.6;         ng[i][j] |= calcRatio(i, j - 4, i + 4, j) > 0.6;       }     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j) g[i][j] = ng[i][j];     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j)         if (!v[i][j] && g[i][j]) solve(i, j);     printf( %d %d n , c_circle, c_square);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 1e5 + 4;   int main() {     int n;     cin >> n;     int sum[101] = {0};     for (int i = 0, num; i < n; ++i) {       cin >> num;       sum[i + 1] = sum[i] + num;     }     if (sum[n] != 0) {       cout <<  YES n1 n ;       cout <<  1   << n << endl;       return 0;     }     int i;     for (i = 1; i < n; ++i) {       if (sum[i] != 0 && sum[n] - sum[i] != 0) break;     }     if (i == n)       cout <<  NO n ;     else {       cout <<  YES n2 n ;       cout <<  1   << i << endl;       cout << i + 1 <<     << n << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long int n, s;       cin >> n >> s;       long long int a[n + 1];       for (int i = 1; i <= n; i++) cin >> a[i];       long long int x = 1;       int i = 1;       while (i <= n) {         if (a[i] > a[x]) x = i;         s -= a[i];         if (s < 0) break;         i++;       }       if (s >= 0)         cout << 0 << endl;       else         cout << x << endl;     }   }
#include <bits/stdc++.h>   int main() {     int l, i, flag = 0;     char s[50];     scanf( %s , s);     l = strlen(s);     for (i = 0; i < l; i++) {       if (s[0] == s[i]) flag = flag + 1;     }     if (flag == l) {       printf( %d , 0);       return 0;     }     flag = 0;     for (i = 0; i < (l / 2); i++) {       if (s[i] != s[l - i - 1]) {         flag = flag + 1;         break;       }     }     if (flag == 0)       printf( %d , l - 1);     else       printf( %d , l);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int flag = 0, i, k;     string str, s;     cin >> str;     if (str.at(0) ==  - ) {       flag = 1;       str.erase(0, 1);     }     if (flag == 1) cout <<  ( ;     cout <<  $ ;     if ((int)str.find( . ) != -1)       s = str.substr(0, str.find( . ));     else       s = str.substr(0);     k = s.length() % 3;     for (i = 0; i < s.length(); i++) {       if (i % 3 == k && i != 0) cout <<  , ;       cout << str.at(i);     }     cout <<  . ;     if (str.find( . ) == -1) {       cout <<  00 ;       goto jump;     }     s = str.substr(str.find( . ) + 1);     s +=  0 ;     s = s.substr(0, 2);     cout << s;   jump:     if (flag == 1) cout <<  ) ;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char str[100400];   int len;   long long k;   int r, ret;   long long calc(int x) { return len - x; }   int Q[100400];   char res[100400];   void solve(int x) {     int i, j;     for (j = 0; j < 26; j++) {       long long sum = 0;       queue<int> q;       for (i = 0; i < r; i++) {         if (Q[i] + 1 < len && str[Q[i] + 1] ==  a  + j) {           sum += calc(Q[i] + 1);           q.push(Q[i] + 1);         }       }       if (sum >= k) {         r = 0;         while (!q.empty()) {           Q[r++] = q.front();           q.pop();         }         break;       } else {         k -= sum;       }     }     res[ret++] =  a  + j;     k -= r;     if (k > 0) solve(j);   }   int main() {     int i, j;     while (scanf( %s , str) != EOF) {       scanf( %d , &k);       len = strlen(str);       ret = 0;       if (k > (1LL * (len + 1) * len) / 2) {         cout <<  No such line.  << endl;         continue;       }       for (j = 0; j < 26; j++) {         long long sum = 0;         r = 0;         for (i = 0; i < len; i++) {           if (str[i] ==  a  + j) {             sum += calc(i);             Q[r++] = i;           }         }         if (sum >= k) {           break;         } else {           k -= sum;         }       }       res[ret++] =  a  + j;       k -= r;       if (k > 0) solve(j);       res[ret] =   0 ;       cout << res << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void readn(int &x) {     char c;     x = 0;     do {       c = getchar();     } while (c <  0  || c >  9 );     do {       x = x * 10 + c -  0 ;       c = getchar();     } while (c <=  9  && c >=  0 );   }   const int MAXN = 101 * 1000;   int k, n, maxb, t, out = 0;   int a[MAXN], fen[MAXN], v[MAXN];   inline void add(int pos, int val) {     if (val > out) out = val;     v[pos] = val;     while (pos <= maxb) {       if (fen[pos] < val) fen[pos] = val;       pos += pos & -pos;     }   }   inline int rmax(int pos) {     int tot = 0;     while (pos) {       if (tot < fen[pos]) tot = fen[pos];       pos -= pos & -pos;     }     return tot;   }   int solve() {     memset(fen, 0, sizeof fen);     memset(v, 0, sizeof v);     out = 0;     for (register int rep = (0); rep < (int)(t); ++rep)       for (register int i = (0); i < (int)(n); ++i)         if (a[i]) {           add(a[i], rmax(a[i] - 1) + 1);           if (rep + 1 >= a[i] || v[a[i]] == a[i]) a[i] = 0;           if (out == n || out == maxb) break;         }     return out;   }   int main() {     scanf( %d %d %d %d , &k, &n, &maxb, &t);     t = min(n, min(t, maxb));     while (k--) {       for (register int i = (0); i < (int)(n); ++i) readn(a[i]);       printf( %d n , solve());     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 1e9 + 7;   long long n, k, m, f[100005][15][20];   long long count(long long x) {     long long sum = 0;     while (x) sum++, x -= (x & -x);     return sum;   }   signed main() {     scanf( %lld%lld%lld , &n, &k, &m);     f[0][0][0] = 1;     for (long long i = 0; i < n; i++) {       for (long long j = 0; j <= k; j++) {         for (long long s = 0; s < (1 << m); s++) {           f[i + 1][j][s >> 1] = (f[i + 1][j][s >> 1] + f[i][j][s]) % mod;           f[i + 1][j + 1][(s >> 1) | (1 << (m - 1))] =               (f[i + 1][j + 1][(s >> 1) | (1 << (m - 1))] +                (1ll + count(s)) * f[i][j][s]) %               mod;         }       }     }     long long ans = 0;     for (long long i = 0; i < (1 << m); i++) ans = (ans + f[n][k][i]) % mod;     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 700000;   int n, g, r;   int l[MAXN];   long long sum[MAXN];   long long d[MAXN];   long long cycle;   int m;   long long q[MAXN], code[MAXN];   int minv[MAXN];   void build(int l, int r, int v) {     minv[v] = n + 1;     if (l != r)       build(l, (l + r) >> 1, v << 1), build(((l + r) >> 1) + 1, r, (v << 1) + 1);   }   void change(int p, int l, int r, int v, int x) {     if (l > p || r < p) return;     minv[v] = x;     if (l != r)       change(p, l, (l + r) >> 1, v << 1, x),           change(p, ((l + r) >> 1) + 1, r, (v << 1) + 1, x);   }   int getmin(int L, int R, int l, int r, int v) {     if (L > r || l > R) return n + 1;     if (L <= l && r <= R) return minv[v];     return min(getmin(L, R, l, (l + r) >> 1, v << 1),                getmin(L, R, ((l + r) >> 1) + 1, r, (v << 1) + 1));   }   int process(int u, int curt) {     assert(curt < g);     int l, r;     l = g - curt;     r = cycle - 1 - curt;     l = (1LL * l + code[u]) % cycle;     r = (1LL * r + code[u]) % cycle;     int p1, p2;     p1 = lower_bound(q, q + m, l) - q;     p2 = lower_bound(q, q + m, r + 1) - q - 1;     if (l <= r) {       if (p1 > p2) return n + 1;       return getmin(p1, p2, 0, m - 1, 1);     }     int ret = n + 1;     if (p1 < m) ret = min(ret, getmin(p1, m - 1, 0, m - 1, 1));     assert(p2 >= 0);     ret = min(ret, getmin(0, p2, 0, m - 1, 1));     return ret;   }   int main() {     scanf( %d%d%d , &n, &g, &r);     cycle = g + r;     for (int i = 0; i <= n; i++) scanf( %d , l + i);     for (int i = 1; i <= n + 1; i++) sum[i] = sum[i - 1] + l[i - 1];     for (int i = 1; i <= n + 1; i++) code[i] = sum[i] % cycle;     for (int i = 0; i <= n + 1; i++) q[m++] = code[i];     sort(q, q + m);     m = unique(q, q + m) - q;     build(0, m - 1, 1);     for (int i = n, pos; i > 1; i--) {       pos = process(i, 0);       assert(pos == n + 1 || (sum[pos] - sum[i]) % cycle >= g);       assert(pos > i);       d[i] = d[pos] + sum[pos] - sum[i];       if (pos != n + 1) d[i] += cycle - (sum[pos] - sum[i]) % cycle;       change(lower_bound(q, q + m, code[i]) - q, 0, m - 1, 1, i);     }     int test_num;     scanf( %d , &test_num);     for (int pos; test_num--;) {       long long tim;       scanf( %I64d , &tim);       tim += sum[1];       if (tim % cycle >= g) tim += cycle - tim % cycle;       pos = process(1, tim % cycle);       assert(pos);       assert((sum[pos] - sum[1] + tim) % cycle >= g || pos == n + 1);       long long res = d[pos] + sum[pos] - sum[1] + tim;       if (pos != n + 1) res += cycle - (sum[pos] - sum[1] + tim) % cycle;       printf( %I64d n , res);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   class Solver {    public:     void input() {       cin >> n;       a.resize(n);       for (int i = 0; i < n; i++) {         cin >> a[i];       }     }     void print() { cout << solve() << endl; }       private:     vector<int> a;     int n;     long long f(int x) {       long long ans = 0;       for (int i = 0; i < n; i++) {         int j = lower_bound(a.begin(), a.end(), x - a[i]) - a.begin();         if (i < j) {           ans += j - i - 1;         } else {           break;         }       }       return ans;     }     int solve() {       int ans = 0;       for (int i = 30; i >= 0; i--) {         for (int j = 0; j < n; j++) {           a[j] = (a[j] & ((1 << (i + 1)) - 1));         }         sort(a.begin(), a.end());         long long cur = f(1 << (i + 1)) - f(1 << i);         cur += f(1 << (i + 2)) - f((1 << i) + (1 << (i + 1)));         if (cur & 1) {           ans = (ans | (1 << i));         }       }       return ans;     }   };   int main() {     ios::sync_with_stdio(false);     Solver solver;     solver.input();     solver.print();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-6;   const double PI = 3.14159265358979323846264338f;   const double pi = acos(-1.0);   const int inf = 0x3f3f3f3f;   const long long mod = 1e9 + 7;   const int MAXN = 1005;   inline int read() {     int c = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       c = c * 10 + ch -  0 ;       ch = getchar();     }     return c * f;   }   struct node {     int w, h;   } e[MAXN];   int n;   int ans = inf;   bool vis[MAXN];   int main() {     n = read();     for (int i = 1; i <= n; i++) {       e[i].w = read();       e[i].h = read();     }     auto solve = [](int x) -> void {       memset(vis, false, sizeof(vis));       priority_queue<int> q;       int tot = 0;       int w = 0;       for (int i = 1; i <= n; i++) {         if (e[i].h > x) {           vis[i] = true;           tot++;           w += e[i].h;           if (e[i].w > x) return;         }       }       for (int i = 1; i <= n; i++) {         if (!vis[i]) {           if (e[i].w <= x) q.push(e[i].w - e[i].h);           w += e[i].w;         }       }       while (tot < n / 2 && !q.empty()) {         int ww = q.top();         q.pop();         if (ww > 0) {           w -= ww;           tot++;         } else           break;       }       if (tot <= n / 2) ans = min(ans, w * x);     };     for (int i = 1; i <= 1000; i++) {       solve(i);     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int l = 0, r = 0;     string s, t;     cin >> s >> t;     int i = 0;     for (int j = 0; j < t.length(); j++) {       if (s[i] == t[j]) {         if (i == s.length() - 1) {           i = s.length() - 1;           l = j + 1;           break;         } else           i++;       }     }     for (int j = t.length() - 1; j > l - 1; j--) {       if (s[i] == t[j]) {         if (i == 0) {           i = 0;           r = t.length() - j;           break;         } else           i--;       }     }     if (l == 0 || r == 0) {       cout << 0;       return 0;     }     int ans;     ans = t.length() - l - r + 1;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool isLeaf[100001] = {0};   bool isCorrect[100001] = {0};   bool nowCorrect[100001] = {0};   bool allVisited[100001] = {0};   bool visited = false;   vector<int> solution;   vector<vector<int> > old_pony_ville, pony_ville;   bool dfs(int nodo) {     if (!isLeaf[nodo]) {       solution.push_back(nodo);       nowCorrect[nodo] = !nowCorrect[nodo];       for (int i = 0; i < pony_ville[nodo].size(); i++) {         do {           visited = dfs(pony_ville[nodo][i]);         } while (!isLeaf[pony_ville[nodo][i]]);         if (visited) {           solution.push_back(nodo);           nowCorrect[nodo] = !nowCorrect[nodo];           if (!allVisited[pony_ville[nodo][i]]) {             visited = dfs(pony_ville[nodo][i]);             if (visited) {               solution.push_back(nodo);               nowCorrect[nodo] = !nowCorrect[nodo];             }           }         }       }       isLeaf[nodo] = true;       return true;     } else {       allVisited[nodo] = true;       if (nowCorrect[nodo] == isCorrect[nodo])         return false;       else {         nowCorrect[nodo] = !nowCorrect[nodo];         solution.push_back(nodo);         return true;       }     }   }   void MST(int start) {     bool isVisited[100001] = {0};     vector<int> visits;     visits.push_back(start);     while (!visits.empty()) {       start = visits.back();       isVisited[start] = true;       visits.pop_back();       for (int i = 0; i < old_pony_ville[start].size(); i++) {         if (!isVisited[old_pony_ville[start][i]]) {           pony_ville[start].push_back(old_pony_ville[start][i]);           visits.push_back(old_pony_ville[start][i]);           isVisited[old_pony_ville[start][i]] = true;         }       }     }   }   int main() {     int n, m, a, b, start = 0;     bool x;     cin >> n >> m;     n++;     old_pony_ville.resize(n);     pony_ville.resize(n);     for (int i = 0; i < m; i++) {       cin >> a >> b;       old_pony_ville[a].push_back(b);       old_pony_ville[b].push_back(a);     }     for (int i = 1; i < n; i++) {       cin >> x;       if (x) start = i;       isCorrect[i] = x;     }     MST(start);     for (int i = 1; i < n; i++) {       if (pony_ville[i].size() == 0) isLeaf[i] = true;     }     dfs(start);     allVisited[start] = true;     if (nowCorrect[start] != isCorrect[start]) solution.pop_back();     for (int i = 1; i < n; i++) {       if (!allVisited[i] && isCorrect[i]) {         cout << -1;         return 0;       }     }     cout << solution.size() << endl;     for (int i = 0; i < solution.size(); i++) {       cout << solution[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INFLL = 2 * (long long)1e18 + 100;   const long long INFINT = 2 * (long long)1e9 + 100;   const double PI = atan(1) * 4;   const double EPS = 1e-6;   const long long SEED = (long long)1e3 + 7;   const long long MOD = 998244353;   const long long NMAX = (long long)1e5 + 5;   vector<long long> v;   long long sum[NMAX];   long long solve(long long n) {     vector<long long> temp;     for (long long i = 1; i <= n; i++) temp.push_back(i);     do {       for (auto i : temp) v.push_back(i);     } while (next_permutation(temp.begin(), temp.end()));     long long sol = 0;     for (long long i = 1; i <= v.size(); i++) {       sum[i] = sum[i - 1] + v[i - 1];       if (i >= n) {         long long here = sum[i] - sum[i - n];         if (here == n * (n + 1) / 2) sol++;       }     }     return sol;   }   long long fact(long long x) {     if (x == 1) return 1;     return x * fact(x - 1) % MOD;   }   int32_t main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     long long sol = n * fact(n) % MOD;     long long prev = 1;     for (long long i = n; i >= 2; i--) {       prev = prev * i % MOD;       sol = sol - prev;       if (sol < 0) sol += MOD;     }     cout << sol;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void positionInFraction();   int main() {     positionInFraction();     return 0;   }   void positionInFraction() {     int b, c, rpta, division;     long long a, posicion;     cin >> a >> b >> c;     bool hayRpta = false;     posicion = 1;     while (posicion < 100000 and !hayRpta) {       a = a * 10;       division = a / b;       if (division % 10 == c) {         cout << posicion;         hayRpta = true;         break;       }       a = a % b;       posicion++;     }     if (hayRpta) {     } else {       cout << -1;     }   }
#include <bits/stdc++.h>   using namespace std;   const int M = 1600;   int dr[] = {-1, 0, 1, 0}, dc[] = {0, 1, 0, -1};   int n, m, pr[M][M], pc[M][M];   char g[M][M], f[M][M];   bool dfs(int r, int c) {     int u = (r % n + n) % n, v = (c % m + m) % m;     if ( #  == g[u][v]) return 0;     if (f[u][v]) return r != pr[u][v] || c != pc[u][v];     f[u][v] = 1, pr[u][v] = r, pc[u][v] = c;     for (int d = 0; d < 4; ++d)       if (dfs(r + dr[d], c + dc[d])) return 1;     return 0;   }   int main(void) {     cin >> n >> m;     for (int i = 0; i < n; ++i) cin >> g[i];     for (int i = 0; i < n; ++i)       for (int j = 0; j < m; ++j)         if ( S  == g[i][j])           cout << (dfs(i + n * 2, j + m * 2) ?  Yes  :  No ) << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int k;     cin >> k;     if (k % 2 != 0) {       cout <<  -1 ;       return 0;     }     for (int i = 0; i < k; i++) {       for (int j = 0; j < k; j++) {         for (int t = 0; t < k; t++) {           if (i % 2 == 0) {             if ((j % 4 <= 1 && t % 4 <= 1) || (j % 4 >= 2 && t % 4 >= 2)) {               cout <<  w ;             } else {               cout <<  b ;             }           } else {             if ((j % 4 <= 1 && t % 4 <= 1) || (j % 4 >= 2 && t % 4 >= 2)) {               cout <<  b ;             } else {               cout <<  w ;             }           }         }         cout << endl;       }       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string i2s(int x) {     stringstream ss;     ss << x;     return ss.str();   }   int s2i(string str) {     istringstream ss(str);     int nro;     ss >> nro;     return nro;   }   int n;   int NRO5(int nro) {     int cnt = 0;     while (nro % 5 == 0) {       cnt++;       nro /= 5;     }     return cnt;   }   int main() {     int A[500005];     map<int, vector<int> > mapa;     map<int, vector<int> >::iterator it;     for (int i = 1; i < 500005; i++) {       A[i] = A[i - 1] + NRO5(i);       mapa[A[i]].push_back(i);     }     scanf( %d n , &n);     if (mapa[n].size() == 0) {       putchar( 0 );       putchar(  n );     } else {       printf( %d n , (int)mapa[n].size());       for (int i = 0; i < mapa[n].size(); i++) {         printf( %d%c , mapa[n][i], i == mapa[n].size() - 1 ? 10 : 32);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5;   long long int n;   long long int t[2 * N];   int main() {     long long int n, k;     cin >> n >> k;     long long int a[k], ans = 1e18, g = 0;     for (int i = 0; i < k; i++) {       cin >> a[i];       if (n % a[i] < ans) {         ans = n % a[i];         g = i;       }     }     cout << g + 1 <<     << n / a[g] <<   n ;     return 0;   }