malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   pair<long long, long long> ps[300010];   long long x;   int main() {     cin >> x;     if (x == 1) {       puts( 1 n1 1 );       return 0;     }     ps[0].first = 1, ps[0].second = x;     bool f1 = 0;     long long c = 2, f2 = 0;     int t = 1;     while (1) {       long long re = x - 1ll * c * (c - 1) * (2 * c - 1) / 6;       long long p = 1ll * c * (c - 1) / 2;       re += 1ll * c * p;       long long m1 = re % (1ll * c * c - p);       long long m = re / (1ll * c * c - p);       if (c > m) break;       if (!m1) {         if (c == m)           f2 = c;         else           ps[t++] = make_pair(c, m);       }       c++;     }     if (f2)       cout << (2 * t + 1) << endl;     else       cout << (2 * t) << endl;     for (int i = 0; i < t; i++) {       cout << ps[i].first <<     << ps[i].second << endl;     }     if (f2) cout << f2 <<     << f2 << endl;     for (int i = t - 1; i >= 0; i--) {       cout << ps[i].second <<     << ps[i].first << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, l, k, i, p[256], a[256], j, w;   double f[201][512][201], aa;   int main() {     scanf( %d%d%d , &n, &l, &k);     k = min(k, n);     for (i = 0; i < n; ++i) scanf( %d , p + i);     for (i = 0; i < n; ++i) scanf( %d , a + i);     f[0][k + 256][0] = 1;     for (i = 0; i < n; ++i)       for (j = -i; j <= n; ++j)         for (w = 0; w <= i; ++w)           if (f[i][j + 256][w] > 0) {             f[i + 1][256 + min(j + a[i], n)][w + 1] +=                 f[i][j + 256][w] * p[i] / 100;             f[i + 1][j + 256][w] += f[i][j + 256][w] * (100 - p[i]) / 100;           }     for (j = 0; j <= n; ++j)       for (w = l; w <= n; ++w) aa += f[n][j + 256][w];     printf( %.12lf n , aa);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[20];   long long b[20];   int getbit(long long x) {     int ret = 0;     while (x) {       x /= 10;       ++ret;     }     return ret;   }   int main() {     a[1] = 9;     b[1] = 9;     for (int i = 2; i <= 18; ++i) b[i] = b[i - 1] * 10 + 9;     for (int i = 2; i <= 18; ++i) a[i] = a[i - 1] * 10;     long long w, m, k;     while (cin >> w >> m >> k) {       long long num = getbit(m);       long long cnt = b[num] - m + 1;       long long ans = 0;       if (w <= num * k * cnt || (num * k * cnt) <= 0) {         ans = w / (num * k);       } else {         ans = cnt;         w -= cnt * num * k;         for (int i = num + 1; w > 0; ++i) {           if (w <= a[i] * i * k || a[i] * i * k <= 0) {             ans += w / (i * k);             break;           } else {             ans += a[i];             w -= a[i] * k * i;           }         }       }       cout << ans << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAX = 514;   int mat[MAX][MAX];   int aib[MAX][MAX];   int n, m;   int dx[] = {1, 0};   int dy[] = {0, 1};   inline int inside(int x, int y) {     return x <= n and y <= m and x >= 1 and y >= 1;   }   int jos[MAX][MAX];   int dreapta[MAX][MAX];   int main() {     ios ::sync_with_stdio(false);     cin >> n >> m;     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         char c;         cin >> c;         if (c ==  # ) ++mat[i][j];       }     }     for (int i = 1; i <= n; ++i) {       for (int j = 1; j <= m; ++j) {         for (int k = 0; k <= 1; ++k) {           if (inside(i + dx[k], j + dy[k])) {             if (mat[i][j] == 0 and mat[i + dx[k]][j + dy[k]] == 0) {               aib[i][j]++;               if (k == 0) {                 jos[i][j]++;               } else {                 dreapta[i][j]++;               }             }           }         }         aib[i][j] += aib[i - 1][j];         aib[i][j] += aib[i][j - 1];         aib[i][j] -= aib[i - 1][j - 1];         jos[i][j] += jos[i][j - 1];         dreapta[i][j] += dreapta[i - 1][j];       }     }     int q;     cin >> q;     while (q--) {       int a, b, c, d;       cin >> a >> b >> c >> d;       int dr = dreapta[c][d] - dreapta[a - 1][d];       int jj = jos[c][d] - jos[c][b - 1];       cout << aib[c][d] - aib[c][b - 1] - aib[a - 1][d] + aib[a - 1][b - 1] - dr -                   jj            <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> adj[205];   bool vis[205];   long long dp[205];   void dfs(long long v) {     vis[v] = true;     for (long long first : adj[v]) {       if (!vis[first]) {         dfs(first);         dp[v] = max(dp[first] + 1, dp[v]);       }     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     map<string, long long> m;     long long curr = 2;     m[ polycarp ] = 1;     for (long long i = 0; i < n; i++) {       string s1, s2, s3;       cin >> s1 >> s2 >> s3;       for (char &c : s1) c = tolower(c);       for (char &c : s3) c = tolower(c);       if (!m[s1]) m[s1] = curr++;       if (!m[s3]) m[s3] = curr++;       adj[m[s3]].emplace_back(m[s1]);     }     dfs(1);     cout << dp[1] + 1;   }
#include <bits/stdc++.h>   int main() {     long long a, b;     scanf( %I64d %I64d , &a, &b);     printf( %I64d n , (6LL * a - 1LL) * b);     for (long long i = 1; i <= a; i++) {       printf( %I64d %I64d %I64d %I64d n , (6LL * i - 5LL) * b,              (6LL * i - 4LL) * b, (6LL * i - 3LL) * b, (6LL * i - 1LL) * b);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     double x, r1 = 0, p1 = 0, p2 = 999999999999, a, b;     cin >> n;     while (n--) {       cin >> x;       r1 = max(r1, x);     }     cin >> n;     while (n--) {       cin >> x;       p1 = max(p1, x);     }     cin >> n;     while (n--) {       cin >> x;       p2 = min(p2, x);     }     cin >> a >> b;     x = b * p1;     double up = x * r1 * r1, down = a * p2 + x;     cout << setprecision(10) << sqrt(up / down);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; i++) {       printf( %d , i);       for (int j = 1; j < n; j++) {         int tmp = (i + j) % n;         if (tmp == 0) tmp = n;         printf(  %d , j * n + tmp);       }       printf(  n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct caca {     long long a, b;   };   caca v[7005];   bool ok[7005];   bool cmp(caca a, caca b) { return a.a < b.a; }   int main() {     cin.tie(0)->sync_with_stdio(0);     cin.tie(NULL);     cout.tie(NULL);     int n;     cin >> n;     for (int i = 1; i <= n; i++) cin >> v[i].a;     for (int i = 1; i <= n; i++) cin >> v[i].b;     sort(v + 1, v + n + 1, cmp);     v[0].a = -1;     v[n + 1].a = -1;     for (int i = 1; i <= n; i++) {       if (v[i].a == v[i - 1].a || v[i].a == v[i + 1].a) {         ok[i] = 1;         for (int j = 1; j <= n; j++) {           if ((v[i].a & v[j].a) == v[j].a) {             ok[j] = 1;           }         }       }     }     long long sol = 0;     for (int i = 1; i <= n; i++) {       if (ok[i]) {         sol += v[i].b;       }     }     cout << sol;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 100 + 10;   int n, m;   int SG[N << 1];      int main() {       int T;       for(scanf( %d , &T); T--; ) {           scanf( %d%d , &n, &m);           memset(SG, 0, (n + m) << 2);           for(int i = 0; i < n; i++) {               for(int j = 0; j < m; j++) {                   int x;                   scanf( %d , &x);                   SG[i + j] ^= x;               }           }           int flag = 0;           for(int i = 0; i <= n + m - 2; i++) if(SG[i]) flag = 1;           if(flag) printf( Ashish n );           else printf( Jeel n );       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(0);     string s;     cin >> s;     long long int n = s.length(), i;     stack<char> a;     for (i = 0; i < n; i++) {       if (a.empty())         a.push(s[i]);       else {         if (a.top() == s[i])           a.pop();         else           a.push(s[i]);       }     }     if (a.size() != 0)       cout <<  No ;     else       cout <<  Yes ;   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   const int N = 122231;   int n, k;   vector<int> g[N];   int used[N];   int done[150][150][150];   int memo[150][150][150];   vector<int> sons[N];   int max_dep[N];   void dfs(int v) {     used[v] = 1;     max_dep[v] = 0;     for (int i = 0; i < g[v].size(); i++) {       int to = g[v][i];       if (used[to]) continue;       sons[v].push_back(to);       dfs(to);       max_dep[v] = max(max_dep[v], max_dep[to] + 1);     }   }   int solve(int v, int top1, int covered_pref) {     if (done[v][top1][covered_pref]) return memo[v][top1][covered_pref];     done[v][top1][covered_pref] = 1;     if (top1 == 100) {       memo[v][top1][covered_pref] = (covered_pref > max_dep[v]);       return memo[v][top1][covered_pref];     }     if (top1 > k && covered_pref == 0) {       memo[v][top1][covered_pref] = 0;       return 0;     }     long long ways[2], nways[2];     ways[0] = ways[1] = nways[0] = nways[1] = 0;     if (top1 == 0) {       ways[1] = 1;     } else {       ways[0] = 1;     }     for (int i = 0; i < sons[v].size(); i++) {       int to = sons[v][i];       for (int j = 0; j < 2; j++) nways[j] = 0;       int new_pref = max(covered_pref - 1, k - top1);       if (new_pref < 0) new_pref = 0;       for (int dep_there = 0; dep_there <= 100; dep_there++) {         int is_ok_dep = 1;         if (dep_there + 1 < top1) is_ok_dep = 0;         if (dep_there == 100) {           if (new_pref <= max_dep[to]) is_ok_dep = 0;         } else {           int covered2 = dep_there - k;           if (covered2 > new_pref) is_ok_dep = 0;         }         if (is_ok_dep == 0) continue;         if (solve(to, dep_there, new_pref) == 0) continue;         for (int j = 0; j < 2; j++) {           nways[j | ((dep_there + 1) == top1)] =               1ll * nways[j | ((dep_there + 1) == top1)] +               1ll * ways[j] * solve(to, dep_there, new_pref) % 1000000007;           nways[j | ((dep_there + 1) == top1)] %= 1000000007;         }       }       for (int j = 0; j < 2; j++) {         ways[j] = nways[j];       }     }     memo[v][top1][covered_pref] = ways[1];     return memo[v][top1][covered_pref];   }   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> k;     for (int i = 1; i < n; i++) {       int a, b;       cin >> a >> b;       g[a].push_back(b);       g[b].push_back(a);     }     int root = 1;     dfs(root);     int res = 0;     for (int i = 0; i <= k; i++) {       res += solve(root, i, 0);       res %= 1000000007;     }     cout << res << endl;     cin.get();     cin.get();     return 0;   }
#include <bits/stdc++.h>   const int INF = 1 << 29;   using namespace std;   void put(int i) {     cout << (i == 0 ? 0 : i);     exit(0);   }   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(NULL);     ;     int n, x, y;     cin >> n;     vector<int> v(n), sum(n);     for (int i = 0; i < n; ++i) {       cin >> v[i];       if (!i)         sum[i] = v[i];       else         sum[i] = sum[i - 1] + v[i];     }     cin >> x >> y;     for (int i = 1; i < n; ++i) {       int p1 = sum[i - 1];       int p2 = sum[n - 1] - sum[i - 1];       if (p1 >= x && p1 <= y && p2 >= x && p2 <= y) put(i + 1);     }     put(0);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200010, M = 400010, mod = 1e9 + 7;   int n, m, k;   int h[N], e[M], ne[M], idx;   int a[N], b[N], ans[N];   int ind[N], oud[N], cnt;   bool stn[N], stm[M];   struct Edge {     int a, b;   } edge[M];   void add(int a, int b) { e[idx] = b, ne[idx] = h[a], h[a] = idx++; }   queue<int> q;   void delet_node() {     while (!q.empty()) {       int t = q.front();       q.pop();       for (int i = h[t]; ~i; i = ne[i]) {         if (stm[i]) continue;         int j = e[i];         ind[j]--;         if (ind[j] < k && !stn[j]) {           q.push(j), stn[j] = 1, cnt--;         }       }     }   }   void topsort() {     for (int i = 1; i <= n; i++) {       if (ind[i] < k) q.push(i), cnt--, stn[i] = 1;     }     delet_node();     for (int i = m; i >= 1; i--) {       ans[i] = cnt;       int a = edge[i].a, b = edge[i].b;       if (!stn[a] && !stn[b]) ind[a]--, ind[b]--;       stm[--idx] = 1, stm[--idx] = 1;       if (ind[a] < k && !stn[a]) q.push(a), stn[a] = 1, cnt--;       if (ind[b] < k && !stn[b]) q.push(b), stn[b] = 1, cnt--;       delet_node();     }     for (int i = 1; i <= m; i++) cout << ans[i] << endl;   }   int main() {     memset(h, -1, sizeof h);     scanf( %d%d%d , &n, &m, &k);     cnt = n;     for (int i = 1; i <= m; i++) {       int a, b;       scanf( %d%d , &a, &b);       edge[i] = {a, b};       add(a, b), add(b, a);       ind[a]++, ind[b]++;     }     topsort();   }
#include <bits/stdc++.h>   using namespace std;   vector<int> g[200009];   int c[200009];   set<int> col[200009];   int main() {     int n, m;     scanf( %d , &n);     scanf( %d , &m);     int fans = 1e6;     for (int i = 1; i <= n; i++) {       scanf( %d , &c[i]);       fans = min(fans, c[i]);     }     for (int i = 0; i < m; i++) {       int x, y;       scanf( %d , &x);       scanf( %d , &y);       g[x].push_back(y);       g[y].push_back(x);     }     for (int i = 1; i <= n; i++) {       int id = c[i];       for (int j = 0; j < g[i].size(); j++) {         if (c[g[i][j]] != id) {           col[id].insert(c[g[i][j]]);         }       }     }     int maxx = -1, maxid = -1;     for (int i = 1; i <= 100000; i++) {       int sz = col[i].size();       if (maxx < sz) {         maxx = sz;         maxid = i;       }     }     if (maxx == 0) {       maxid = fans;     }     printf( %d n , maxid);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   int main() {     cin >> n >> k;     n = n % 6;     if (n == 0) {       cout << k;       return 0;     }     if (k == 0) {       if ((n == 1) || (n == 2)) {         cout << 1;       }       if ((n == 3) || (n == 4)) {         cout << 2;       }       if ((n == 5) || (n == 6)) {         cout << 0;       }     } else {       if (k == 1) {         if ((n == 1) || (n == 4)) {           cout << 0;         }         if ((n == 2) || (n == 5)) {           cout << 2;         }         if ((n == 3) || (n == 6)) {           cout << 1;         }       } else {         if ((n == 2) || (n == 3)) {           cout << 0;         }         if ((n == 4) || (n == 5)) {           cout << 1;         }         if ((n == 1) || (n == 6)) {           cout << 2;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using lli = long long int;   using pii = pair<int, int>;   using vi = vector<int>;   using vb = vector<bool>;   using vvi = vector<vector<int>>;   using vlli = vector<long long int>;   using vpii = vector<pair<int, int>>;   const int N = 500005;   mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());   lli n, m, k, u, v, x, ans, curr, T;   vlli c(N);   lli fast_exp(lli base, lli exp) {     lli res = 1;     base = base % 1000000007;     while (exp > 0) {       if (exp % 2) res = (res * base) % 1000000007;       base = (base * base) % 1000000007;       exp /= 2;     }     return res % 1000000007;   }   template <class T>   struct DSU {     map<T, T> par;     T comp_sz = n;     T get(T u) {       if (par.find(u) == par.end()) return u;       return par[u] = get(par[u]);     }     void unite(T x, T y) {       T X = get(x), Y = get(y);       if (X == Y) return;       par[X] = Y;       --comp_sz;     }   };   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> k;     map<lli, DSU<lli>> virus;     for (int i = 1; i <= n; i++) cin >> c[i];     for (int i = 1; i <= m; i++) {       cin >> u >> v;       x = c[u] ^ c[v];       virus[x].unite(u, v);     }     ans = ((fast_exp(2, k) - virus.size() + 1000000007) * fast_exp(2, n)) %           1000000007;     for (auto i : virus) {       curr = (i.second).comp_sz;       ans = (ans + fast_exp(2, curr)) % 1000000007;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   const double eps = pi / 180.0;   int main() {     int t;     cin >> t;     while (t--) {       double n;       cin >> n;       double angle = 180.0 / n;       double first = 1.0 / 2.0 / sin(angle / 2.0 * eps);       double a1 = 180.0 / n * round(n / 4.0);       double a2 = 90 - a1;       double ans = first * (sin(a1 * eps) + sin(a2 * eps)) / sin(45.0 * eps);       printf( %.9lf n , ans);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     set<char> c;     int mul = 0;     long long ans = 1;     bool f = false;     string s;     cin >> s;     for (int i = 0; i < s.length(); i++) {       if (s[i] ==  ? )         ans *= 10;       else if (s[i] >= 65 && s[i] <= 74)         c.insert(s[i]);     }     if (s[0] >= 65 && s[0] <= 74 || s[0] ==  ? ) f = true;     for (int i = 0; i < c.size(); i++) ans *= (10 - i);     if (f == true) ans *= 0.9;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool f[1005];   vector<int> x[1005];   vector<int> y[1005];   int dx[4] = {1, 1, -1, -1};   int dy[4] = {1, -1, 1, -1};   int main() {     for (int i = 1; i <= 1000; i++) {       for (int j = 1; j <= 1000; j++) {         int p = i * i + j * j;         int u = (int)(sqrt(p));         if (u * u == p && u <= 1000) {           f[u] = 1;           x[u].push_back(i);           y[u].push_back(j);         }       }     }     int a, b;     scanf( %d%d , &a, &b);     if (f[a] && f[b]) {       for (int r = 0; r < x[a].size(); r++)         for (int s = 0; s < x[b].size(); s++) {           int u = x[a][r], v = y[a][r];           for (int i = 0; i < 4; i++) {             int p = u * dx[i];             int q = v * dy[i];             if (x[b][s] * p + y[b][s] * q == 0 &&                 (x[b][s] != p && y[b][s] != q)) {               printf( YES n );               printf( 0 0 n );               printf( %d %d n , x[b][s], y[b][s]);               printf( %d %d n , p, q);               return 0;             }           }           swap(u, v);           for (int i = 0; i < 4; i++) {             int p = u * dx[i];             int q = v * dy[i];             if (x[b][s] * p + y[b][s] * q == 0 &&                 (x[b][s] != p && y[b][s] != q)) {               printf( YES n );               printf( 0 0 n );               printf( %d %d n , x[b][s], y[b][s]);               printf( %d %d n , p, q);               return 0;             }           }         }       printf( NO n );     } else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int m, k, n, s;     cin >> m >> k >> n >> s;     int len = m - k * (n - 1);     vector<int> a(m);     for (auto& i : a) {       cin >> i;     }     int bad = 0;     vector<int> cnt(5e5 + 1);     for (int i = 0; i < s; ++i) {       int b;       cin >> b;       bad += !cnt[b];       ++cnt[b];     }     bool ok = false;     vector<int> ans;     for (int i = 0; i < m; ++i) {       --cnt[a[i]];       bad -= !cnt[a[i]];       int j = i - len + 1;       if (j >= 0) {         if (!bad && j % k == 0) {           for (int l = j; len - int(ans.size()) > k; ++l) {             if (cnt[a[l]] < 0) {               ans.push_back(l);               ++cnt[a[l]];             }           }           ok = true;           break;         }         bad += !cnt[a[j]];         ++cnt[a[j]];       }     }     if (!ok) {       cout << -1 <<   n ;     } else {       cout << ans.size() <<   n ;       for (auto i : ans) {         cout << i + 1 <<    ;       }     }   }
#include <bits/stdc++.h>   const int maxn = 5e5 + 5;   const int logn = 21;   const int lim = 2e1;   const int maxq = 5e5 + 5;   struct w {     int l, r, id;     friend bool operator<(w now, w oth) { return now.r < oth.r; }   } qu[maxq];   int b[logn], p[logn];   void insert(int gave, int id) {     for (int i = lim; i >= 0; i--) {       if (!(gave >> i & 1)) continue;       if (!b[i]) {         b[i] = gave;         p[i] = id;         return;       }       if (p[i] < id) {         std::swap(p[i], id);         std::swap(b[i], gave);       }       gave ^= b[i];     }     return;   }   int tian(int lef) {     int r = 0;     for (int i = lim; i >= 0; i--)       if (p[i] >= lef) r = std::max(r, r ^ b[i]);     return r;   }   int o[maxq];   int n, q;   int v[maxn];   signed main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d , v + i);     scanf( %d , &q);     for (int i = 1; i <= q; i++) {       scanf( %d%d , &qu[i].l, &qu[i].r);       qu[i].id = i;     }     std::sort(qu + 1, qu + q + 1);     int nr = 0;     for (int i = 1; i <= q; i++) {       while (nr < qu[i].r) {         nr++;         insert(v[nr], nr);       }       o[qu[i].id] = tian(qu[i].l);     }     for (int i = 1; i <= q; i++) printf( %d n , o[i]);     return 0;   }
#include <queue>   #include <vector>   #include <stdio.h>   #include <stdlib.h>      #define DEBUG printf( Passing [%s] in Line %d n  , __FUNCTION__ , __LINE__) ;      const int MAX_N = (1 << 11) + 10 , MAX_M = 10 + 5 , MAX_E = (1 << 22) + 10 , INF = 0x3f3f3f3f ;      struct Link {    int num , cap , cost ;    Link *next , *reg ;   }list[MAX_E] ;      std::queue<int> q ;   std::vector<int> ans ;      char s[MAX_N][MAX_M] ;   Link *head[MAX_N] , *id[MAX_N] ;   bool st[MAX_N] , ud[MAX_M] , vis[MAX_N] ;   int n , m , tot , cur , pt[MAX_N][2] , lt[MAX_N] ;   int S , T , pre[MAX_N] , dis[MAX_N] , flow[MAX_N] ;      void ins(int x , int y , int f , int c) {    list[cur].num = y ;    list[cur].cap = f ;    list[cur].cost = c ;    list[cur].reg = &list[cur + 1] ;    list[cur].next = head[x] ;    head[x] = &list[cur++] ;       list[cur].num = x ;    list[cur].cap = 0 ;    list[cur].cost = -c ;    list[cur].reg = &list[cur - 1] ;    list[cur].next = head[y] ;    head[y] = &list[cur++] ;   }      ///      bool spfa() {    for (int i = 0 ; i <= tot ; ++i) dis[i] = INF , vis[i] = 0 ;    vis[S] = 1 ; dis[S] = 0 ; flow[S] = INF ; q.push(S) ;       while (!q.empty()) {     int x = q.front() ; vis[x] = 0 ; q.pop() ;        for (Link *h = head[x] ; h ; h = h->next) {      int nx = h->num ;      if (dis[nx] <= dis[x] + h->cost || !h->cap) continue ;         flow[nx] = std::min(flow[x] , h->cap) ;      dis[nx] = dis[x] + h->cost ;      pre[nx] = x ; id[nx] = h ;         if (!vis[nx]) {vis[nx] = 1 ; q.push(nx) ;}     }    }       return dis[T] < INF ;   }      void dinic() {    while (spfa()) {     int x = T ;     for (; x != S ; x = pre[x]) {      id[x]->cap -= flow[T] ;      id[x]->reg->cap += flow[T] ;     }    }   }      ///      int main() {    scanf( %d %d  , &m , &n) ;    for (int i = 1 ; i <= n ; ++i) scanf( %s  , s[i]) ;       ///       for (int i = 1 ; i <= n ; ++i) pt[i][0] = ++tot , pt[i][1] = ++tot ;    S = 0 ; T = ++tot ;       for (int i = 1 ; i <= n ; ++i) {     int cnt = 1 ;     for (int j = 0 ; j < m ; ++j) if (s[i][j] ==  1 ) ++cnt ;        for (int j = 1 ; j <= n ; ++j) {      if (i == j) continue ;         bool ok = 1 ;      for (int k = 0 ; k < m ; ++k) if (s[i][k] ==  1  && s[j][k] ==  0 ) ok = 0 ;      if (ok) ins(pt[i][0] , pt[j][1] , 1 , -cnt) ;     }    }       for (int i = 1 ; i <= n ; ++i)     ins(S , pt[i][0] , 1 , 0) , ins(pt[i][1] , T , 1 , 0) ;       ///       dinic() ;    for (int i = 1 ; i <= n ; ++i) {     int x = pt[i][0] ;     for (Link *h = head[x] ; h ; h = h->next) {      int nx = h->num ;      if (h->cap || !nx) continue ;         nx >>= 1 ;      lt[(x + 1) >> 1] = nx ; st[nx] = 1 ;     }    }       ///       for (int i = 1 ; i <= n ; ++i)     if (!st[i]) {      for (int j = 0 ; j < m ; ++j) ud[j] = 0 ;      for (int j = i ; j ; j = lt[j])       for (int k = 0 ; k < m ; ++k)        if (s[j][k] ==  1  && !ud[k]) ans.push_back(k) , ud[k] = 1 ;      ans.push_back(-1) ;     }       int m = ans.size() - 1 ;    printf( %d n  , m) ;    for (int i = 0 ; i < m ; ++i) {     int x = ans[i] ;     if (x == -1) printf( R  ) ;     else printf( %d   , x) ;    }    printf(  n ) ;       return 0 ;   }