malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline bool chkmin(T &a, const T &b) {     return b < a ? a = b, 1 : 0;   }   template <typename T>   inline bool chkmax(T &a, const T &b) {     return a < b ? a = b, 1 : 0;   }   const int oo = 0x3f3f3f3f;   const int maxn = 1000100;   int n;   char a[maxn + 5];   inline bool check(int first) {     vector<int> man, aster;     for (int i = (0), i_end_ = (n); i < i_end_; ++i) {       if (a[i] ==  P )         man.push_back(i);       else if (a[i] ==  * )         aster.push_back(i);     }     int nman = (int((man).size())), naster = (int((aster).size()));     static bool dp[maxn + 5][2];     memset(dp, 0, sizeof dp);     int j = nman - 1;     dp[naster][0] = dp[naster][1] = 1;     for (int i = naster - 1; i >= 0; --i) {       j = min((int((man).size())) - 1, j + 1);       while (j >= 0 && man[j] > aster[i]) {         bool ok = 0;         if (man[j] - first <= aster[i]) {           int tmp = man[j];           if (j && man[j - 1] > aster[i]) chkmax(tmp, man[j - 1] + first);           int fir =               upper_bound((aster).begin(), (aster).end(), tmp) - aster.begin();           if (fir == naster ||               (j + 1 < (int((man).size())) && aster[fir] > man[j + 1]))             ok = dp[fir][1];           else             ok = dp[fir][0];         }         if (ok) {           dp[i][0] = 1;           break;         }         --j;       }       if (dp[i][0])         dp[i][1] = 1;       else {         if (j >= 0) {           int tmp = man[j] + first;           int fir =               upper_bound((aster).begin(), (aster).end(), tmp) - aster.begin();           if (fir == naster ||               (j + 1 < (int((man).size())) && aster[fir] > man[j + 1])) {             dp[i][1] = dp[fir][1];           } else             dp[i][1] = dp[fir][0];         }       }     }     return dp[0][1];   }   int main() {     scanf( %d , &n);     scanf( %s , a);     bool unique = 1;     int p = -1;     int Max = 0, Min = oo;     int tot = 0, left = 0;     for (int i = (0), i_end_ = (n); i < i_end_; ++i)       if (a[i] ==  P ) {         if (~p) {           unique = 0;         } else {           left = tot;           p = i;         }       } else if (a[i] ==  * ) {         ++tot;         chkmin(Min, i), chkmax(Max, i);       }     if (unique) {       int right = tot - left;       int left_dis = p - Min;       int right_dis = Max - p;       auto tmp = max(make_pair(left, -left_dis), make_pair(right, -right_dis));       tmp.second = -tmp.second;       printf( %d %d n , tmp.first, tmp.second);     } else {       int l = 0, r = n;       while (l < r) {         int mid = (l + r) >> 1;         if (check(mid))           r = mid;         else           l = mid + 1;       }       printf( %d %d n , tot, l);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 1000005;   int N, M, dp[MAXN], res = 0;   vector<pair<int, int>> adj[MAXN];   int check(int v) {     if (dp[v]) return dp[v];     dp[v] = 1;     for (auto p : adj[v]) {       int n = p.first;       if (check(n) + 1 > dp[v]) {         dp[v] = dp[n] + 1;         res = max(res, p.second);       }     }     return dp[v];   }   int main() {     scanf( %d%d , &N, &M);     for (int i = 0; i < M; i++) {       int a, b;       scanf( %d%d , &a, &b);       a -= 1, b -= 1;       adj[a].push_back({b, i + 1});     }     for (int i = 0; i < N; i++) {       if (check(i) == N) {         printf( %d , res);         return 0;       }     }     printf( -1 );   }
#include <bits/stdc++.h>   using namespace std;   const int INF = 1000000000;   template <typename T>   using V = std::vector<T>;   struct debugger {     template <typename T>     debugger& operator,(const T& v) {       cerr << v <<    ;       return *this;     }   } dbg;   int gcd(int a, int b) { return a ? gcd(b % a, a) : b; }   int main() {     int n, m, k;     scanf( %d , &n), scanf( %d , &m), scanf( %d , &k);     int d = gcd(n, k);     int n1 = n / d;     k /= d;     d = gcd(m, k);     int m1 = m / d;     k /= d;     if (k > 2) {       puts( NO );       return 0;     }     puts( YES );     if (k == 1) {       if (n1 * 2 <= n)         n1 *= 2;       else         m1 *= 2;     }     printf( 0 0 n0 %d n%d 0 n , m1, n1);   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     pair<string, string> arr[n];     for (int i = 0; i < n; i++) cin >> arr[i].first >> arr[i].second;     for (int i = 0; i < n; i++)       if (arr[i].second ==  rat ) cout << arr[i].first << endl;     for (int i = 0; i < n; i++)       if (arr[i].second ==  woman  || arr[i].second ==  child )         cout << arr[i].first << endl;     for (int i = 0; i < n; i++)       if (arr[i].second ==  man ) cout << arr[i].first << endl;     for (int i = 0; i < n; i++)       if (arr[i].second ==  captain ) cout << arr[i].first << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   std::map<long long, long long> factors;   void primeFactors(long long n) {     while (n % 2 == 0) {       factors[2]++;       n = n / 2;     }     for (long long i = 3; i <= sqrt(n); i = i + 2) {       while (n % i == 0) {         factors[i]++;         n = n / i;       }     }     if (n > 2) factors[n]++;   }   long long i, j;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long n;     cin >> n;     long long ans = 0;     for (i = 2; i <= n; i++) {       long long x = n / (i);       ans += (i) * (x - 1);     }     cout << ans * 4 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long powmod(long long a, long long b) {     if (b == 0) return 1;     long long x = powmod(a, b / 2);     long long y = (x * x) % 1000000007;     if (b % 2) return (a * y) % 1000000007;     return y % 1000000007;   }   long long mulmod(long long a, long long b, long long c) {     long long x = 0, y = a % c;     while (b > 0) {       if (b % 2 == 1) {         x = (x + y) % c;       }       y = (y * 2) % c;       b /= 2;     }     return x % c;   }   int main() {     long long a, b, x, n;     cin >> a >> b >> n >> x;     long long nm1, nm2, nm3, nm4, nm5;     if (a > 1) {       nm1 = powmod(a, n);       nm2 = (nm1 - 1 + 1000000007) % 1000000007;       nm3 = (x * nm1) % 1000000007;       nm4 = (a - 1 + 1000000007) % 1000000007;       nm5 = (nm2 * powmod(nm4, 1000000007 - 2)) % 1000000007;       long long nm6 = (nm3 + (nm5 * b) % 1000000007) % 1000000007;       cout << nm6 << endl;     } else       cout << (x + mulmod(b, n, 1000000007)) % 1000000007 << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char buf[1 << 21], *p1 = buf, *p2 = buf;   inline long long qread() {     register char c =         (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)              ? EOF              : *p1++);     register long long x = 0, f = 1;     while (c <  0  || c >  9 ) {       if (c ==  - ) f = -1;       c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)                ? EOF                : *p1++);     }     while (c >=  0  && c <=  9 ) {       x = (x << 3) + (x << 1) + c - 48;       c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)                ? EOF                : *p1++);     }     return x * f;   }   inline long long Abs(const long long& x) { return (x > 0 ? x : -x); }   inline long long Max(const long long& x, const long long& y) {     return (x > y ? x : y);   }   inline long long Min(const long long& x, const long long& y) {     return (x < y ? x : y);   }   long long n, l, wmax;   vector<long long> ml, mr;   inline long long Div(long long x, long long y) {     if (!y) {       if (x > 0)         return 2147483647;       else         return -2147483647;     }     if (x % y < 0) x -= (y + x % y);     return x / y;   }   inline void Read() {     n = qread();     l = qread();     wmax = qread();     for (register long long i = 1; i <= n; i++) {       register long long x = qread(), v = qread();       if (v == 1)         mr.push_back(x);       else         ml.push_back(x);     }   }   inline void Solve() {     register long long siz = ml.size();     register long long ans = 0;     for (register long long i = 0; i < siz; i++) {       auto lmost = lower_bound(mr.begin(), mr.end(), -ml[i] - l);       ans += upper_bound(                  mr.begin(), lmost,                  Min(Div((ml[i] + l) * (wmax + 1) - 1, wmax - 1), -ml[i] - l)) -              mr.begin();       ans +=           upper_bound(lmost, mr.end(),                       Min(Div((ml[i] + l) * (wmax - 1) - 1, wmax + 1), ml[i])) -           lmost;     }     printf( %lld , ans);   }   signed main() {     Read();     sort(ml.begin(), ml.end());     sort(mr.begin(), mr.end());     Solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long n, d, k, l, m, i, j, a[105], b[2];   int main() {     cin >> n >> d >> l;     b[0] = n / 2;     b[1] = n - b[0];     k = 0;     if (d > l * b[1] - b[0] || d < b[1] - l * b[0]) {       cout <<  -1  << endl;       return 0;     } else {       for (i = 1; i <= n; i += 2) {         a[i] = 1;         k++;       }       for (i = 2; i <= n; i += 2) {         a[i] = l;         k -= l;       }     }     i = 1;     while (d != k && i <= n) {       if (k + l - 1 <= d) {         a[i] = l;         k = k - 1 + l;       } else {         a[i] += d - k;         k = d;       }       i += 2;     }     i = 2;     while (d != k && i <= n) {       if (k + l - 1 <= d) {         a[i] = 1;         k = k - 1 + l;       } else {         a[i] -= d - k;         k = d;       }       i += 2;     }     cout << a[1];     for (i = 2; i <= n; i++) cout <<     << a[i];     cout << endl;   }
#include <bits/stdc++.h>   using namespace std;   const long long mod = 998244353;   struct Node {     long long val[4], len;     Node() {       memset(val, 0, sizeof(val));       len = 0;     }   };   vector<Node> tree;   long long n, m;   string s;   long long ch[100];   long long choice(long long i, long long j = -1) {     long long res = s[i] -  0 ;     if (~j) res = res * 10 + s[j] -  0 ;     return ch[res];   }   Node join(Node &left, Node &right, long long l, long long r) {     Node res;     long long na = left.len == 1 ? 0 : 1;     long long nb = right.len == 1 ? 0 : 2;     res.len = left.len + right.len;     res.val[0] = left.val[na] * right.val[nb] % mod;     res.val[1] = left.val[na] * right.val[3] % mod;     res.val[2] = left.val[3] * right.val[nb] % mod;     res.val[3] = left.val[3] * right.val[3] % mod;     if (s[l] ==  1 ) {       na = left.len == 1 ? 2 : 0;       nb = right.len == 1 ? 1 : 0;       res.val[na + nb] += left.val[0] * right.val[0] % mod * choice(l, r) % mod;       res.val[na + 1] += left.val[0] * right.val[1] % mod * choice(l, r) % mod;       res.val[2 + nb] += left.val[2] * right.val[0] % mod * choice(l, r) % mod;       res.val[3] += left.val[2] * right.val[1] % mod * choice(l, r) % mod;     }     for (long long i = 0; i < 4; ++i) res.val[i] %= mod;     return res;   }   void build(long long node = 1, long long start = 0, long long end = n - 1) {     tree[node].len = end - start + 1;     if (start == end) {       tree[node].val[0] = 1;       tree[node].val[3] = s[start] -  0  + 1;       return;     }     long long mid = start + end >> 1;     build(node << 1, start, mid);     build(node << 1 | 1, mid + 1, end);     tree[node] = join(tree[node << 1], tree[node << 1 | 1], mid, mid + 1);   }   void update(long long id, long long val, long long node = 1,               long long start = 0, long long end = n - 1) {     if (start == end) {       s[id] = char(val +  0 );       tree[node].val[3] = val + 1;       return;     }     long long mid = start + end >> 1;     if (id <= mid)       update(id, val, node << 1, start, mid);     else       update(id, val, node << 1 | 1, mid + 1, end);     tree[node] = join(tree[node << 1], tree[node << 1 | 1], mid, mid + 1);   }   signed main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     for (long long i = 0; i <= 9; ++i) {       for (long long j = 0; j <= 9; ++j) ch[i + j]++;     }     cin >> n >> m;     cin >> s;     tree.resize((n + 10) << 2);     build();     while (m--) {       long long id, x;       cin >> id >> x;       id--;       update(id, x);       cout << tree[1].val[3] <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n;     cin >> n;     map<int, vector<int> > pos;     map<int, int> result;     for (int i = 0; i < n; i++) {       int t;       cin >> t;       if (pos.find(t) == pos.end()) {         vector<int> temp;         temp.push_back(i + 1);         pos.insert(pair<int, vector<int> >(t, temp));       } else {         pos[t].push_back(i + 1);       }     }     for (map<int, vector<int> >::iterator iter = pos.begin(); iter != pos.end();          iter++) {       int len = iter->second.size();       if (len == 1) {         result.insert(pair<int, int>(iter->first, 0));         continue;       }       int count = 2;       int diff = iter->second[1] - iter->second[0];       for (int i = 1; i < len - 1; i++) {         if (diff != iter->second[i + 1] - iter->second[i]) break;         count++;       }       if (count == len) result.insert(pair<int, int>(iter->first, diff));     }     cout << result.size() << endl;     for (map<int, int>::iterator iter = result.begin(); iter != result.end();          iter++)       cout << iter->first <<     << iter->second << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int trees(vector<vector<int> >& v, int a, int b, int y, int x) {     int trees = 0;     for (int i = y; i < (y + a); ++i) {       for (int j = x; j < (x + b); ++j) {         trees += v[i][j];       }     }     return trees;   }   int main() {     int n, m;     cin >> n >> m;     vector<vector<int> > v(n);     int totTree = 0;     for (int i = 0; i < n; ++i) {       for (int j = 0; j < m; ++j) {         int tmp;         cin >> tmp;         v[i].push_back(tmp);         totTree += tmp;       }     }     int a, b;     cin >> a >> b;     int minTree = totTree;     for (int i = 0; i + a - 1 < n; ++i) {       for (int j = 0; j + b - 1 < m; ++j) {         const int tr = trees(v, a, b, i, j);         if (tr < minTree) {           minTree = tr;         }       }     }     for (int i = 0; i + b - 1 < n; ++i) {       for (int j = 0; j + a - 1 < m; ++j) {         const int tr = trees(v, b, a, i, j);         if (tr < minTree) {           minTree = tr;         }       }     }     cout << minTree << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     int n, m, len;     cin >> n >> m;     if (n >= 1 && n <= 100 && m >= 1 && m <= 100) {       cin >> s;       len = s.size();       if (len == n) {         int l, r, z;         char c1, c2;         while (m--) {           cin >> l >> r >> c1 >> c2;           if (l >= 1 && l <= r && r <= n && c1 >=  a  && c1 <=  z  && c2 >=  a  &&               c2 <=  z )             for (z = l - 1; z <= r - 1; z++) {               if (s[z] == c1) {                 s[z] = c2;               }             }         }         cout << s << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 998244353, inv2 = mod + 1 >> 1;   inline void add(int &a, int b) { (a += b) >= mod && (a -= mod); }   inline int Add(int a, int b) { return add(a, b), a; }   inline void sub(int &a, int b) { (a -= b) < 0 && (a += mod); }   inline int Sub(int a, int b) { return sub(a, b), a; }   inline void mul(int &a, int b) { a = 1ll * a * b % mod; }   inline int Mul(int a, int b) { return 1ll * a * b % mod; }   const int N = 40, M = 1 << 20;   int m, n, S, f[N][M], g[M], siz[M], x[M], y[M], res[M], ans[N];   long long b[M];   inline void XOR(int *a, int n, bool rev) {     for (int k = 2, m = 1; k <= n; k <<= 1, m <<= 1) {       for (int j = 0; j < n; j += k)         for (int i = 0; i < m; ++i) {           int x = a[j + i], y = a[j + i + m];           if (!rev) {             a[j + i] = Add(x, y);             a[j + i + m] = Sub(x, y);           } else {             a[j + i] = Mul(Add(x, y), inv2);             a[j + i + m] = Mul(Sub(x, y), inv2);           }         }     }   }   inline void FWT(int *a, int *b, int n) {     memcpy(x, a, sizeof(x)), memcpy(y, b, sizeof(y));     XOR(x, n, 0), XOR(y, n, 0);     for (int i = 0; i < n; ++i) res[i] = Mul(x[i], y[i]);     XOR(res, n, 1);   }   void dfs1(long long x, int y) {     if (y == m) return ++g[x], void();     dfs1(x, y + 1);     if (b[y]) dfs1(x ^ b[y], y + 1);   }   void dfs2(long long x, int y) {     if (y == n) return ++f[siz[x >> m]][x & (S - 1)], void();     dfs2(x, y + 1);     if (b[y]) dfs2(x ^ b[y], y + 1);   }   int main() {     scanf( %d%d , &m, &n);     int tot = 1;     for (int i = 1; i <= m; ++i) {       long long x;       scanf( %lld , &x), mul(tot, 2);       for (int k = n - 1; ~k; --k)         if (x >> k & 1) {           if (!b[k]) {             b[k] = x;             mul(tot, inv2);             break;           }           x ^= b[k];         }     }     m = n + 1 >> 1, S = 1 << m;     for (int i = 0; i < S; ++i) siz[i] = siz[i >> 1] + (i & 1);     dfs1(0, 0), dfs2(0, m);     for (int i = 0; i <= n - m; ++i) {       FWT(f[i], g, S);       for (int s = 0; s < S; ++s) add(ans[i + siz[s]], res[s]);     }     for (int i = 0; i <= n; ++i) printf( %d  , Mul(ans[i], tot));     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int v[1005];   int a[1005], b[1005];   char s[1005];   vector<int> c, d;   int main() {     cin >> s + 1;     int len = strlen(s + 1);     int num = 0;     for (int i = 1; i <= len; i++) {       if (s[i] ==  ( ) {         a[i]++;         c.push_back(i);       }       a[i] += a[i - 1];     }     for (int i = len; i; i--) {       if (s[i] ==  ) ) {         d.push_back(i);         b[i]++;       }       b[i] += b[i - 1];     }     sort((d).begin(), (d).end());     int l = 0, r = d.size() - 1;     while (l < c.size() && r >= 0 && c[l] < d[r]) {       l++;       r--;       num++;     }     if (!num)       puts( 0 );     else {       puts( 1 );       cout << l + d.size() - r - 1 << endl;       for (int i = 0; i < l; i++) cout << c[i] <<    ;       for (int i = r + 1; i < d.size(); i++) cout << d[i] <<    ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     long long t;     cin >> t;     while (t--) {       long long a, b, n, m;       cin >> a >> b >> n >> m;       if (a + b < n + m) {         cout <<  no               <<   n ;       } else {         long long v1 = min(a, b);         long long v2 = max(a, b);         if (v1 >= m) {           cout <<  yes                 <<   n ;         } else {           cout <<  no                 <<   n ;         }       }     }     return 0;   }
#include <bits/stdc++.h>   int n;   char str[250000];   int main() {     while (~scanf( %d , &n)) {       scanf( %s , str);       int len = strlen(str);       int sum1 = 0, sum2 = 0;       for (int i = 0; i < len; i++) {         if (str[i] ==  < ) {           sum1++;         } else {           break;         }       }       for (int i = len - 1; i >= 0; i--) {         if (str[i] ==  > ) {           sum2++;         } else {           break;         }       }       printf( %d n , sum1 + sum2);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int MaxN = 100009;   unsigned long long a[MaxN], b[MaxN], c[MaxN];   int main() {     unsigned long long n, ans = 0, p, sum = 0, sum2 = 0;     cin >> n >> p;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) {       sum += a[i];       b[i] = sum % p;     }     for (int i = n - 1; i >= 0; i--) {       sum2 += a[i];       c[i] = sum2 % p;     }     for (int i = 0; i < n; i++) ans = max(ans, (b[i] + c[i + 1]));     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   #pragma GCC optimize( O3 )   const long long MOD = 1e9 + 7;   long long n_bits(long long n) {     long long x = __builtin_popcount(n);     return x;   }   int pow(int a, int b, int m) {     int ans = 1;     while (b) {       if (b & 1) ans = (ans * a) % m;       b /= 2;       a = (a * a) % m;     }     return ans;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long t = 1;     while (t--) {       int n, p;       cin >> n >> p;       long long sum = 0;       int a[n];       long long left = 0;       for (int i = 0; i < n; i++) {         cin >> a[i];         sum += a[i];       }       long long final = (sum - a[n - 1]) % p + a[n - 1] % p;       sum -= a[n - 1];       left = a[n - 1];       for (int i = n - 2; i > 0; i--) {         left += a[i];         sum -= a[i];         final = max(final, left % p + sum % p);       }       cout << final;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string s;   int x, y, len, a, b;   int main() {     cin >> s;     len = s.length();     for (int i = 0; i < len; ++i) {       if (s[i] ==  ( )         ++x;       else if (s[i] ==  ) )         --x;       else if (s[i] ==  # )         --x, ++y;       if (x < 0) {         puts( -1 );         exit(0);       }     }     for (int i = 0; i < len; ++i) {       if (s[i] ==  # ) {         ++a;         if (a == y) b -= x;         --b;       }       if (s[i] ==  ( )         ++b;       else if (s[i] ==  ) )         --b;       if (b < 0) {         puts( -1 );         exit(0);       }     }     for (int i = 1; i < y; ++i) puts( 1 );     printf( %d , x + 1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a[105][105];   int sum[2][105];   bool inv[2][105];   int main() {     while (scanf( %d%d , &n, &m) == 2) {       memset(inv, false, sizeof(inv));       memset(sum, 0, sizeof(sum));       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) {           scanf( %d , a[i] + j);           sum[0][i] += a[i][j];           sum[1][j] += a[i][j];         }       }       while (1) {         int idx = -1;         for (int i = 0; i < n; i++) {           if (sum[0][i] < 0) {             idx = i;             break;           }         }         if (idx != -1) {           inv[0][idx] ^= 1;           sum[0][idx] = -sum[0][idx];           for (int i = 0; i < m; i++) {             sum[1][i] -= a[idx][i];             a[idx][i] = -a[idx][i];             sum[1][i] += a[idx][i];           }           continue;         }         for (int i = 0; i < m; i++) {           if (sum[1][i] < 0) {             idx = i;             break;           }         }         if (idx != -1) {           inv[1][idx] ^= 1;           sum[1][idx] = -sum[1][idx];           for (int i = 0; i < n; i++) {             sum[0][i] -= a[i][idx];             a[i][idx] = -a[i][idx];             sum[0][i] += a[i][idx];           }           continue;         }         break;       }       int cnt = 0;       for (int i = 0; i < n; i++)         if (inv[0][i]) cnt++;       printf( %d , cnt);       for (int i = 0; i < n; i++)         if (inv[0][i]) printf(  %d , i + 1);       printf(  n );       cnt = 0;       for (int i = 0; i < m; i++)         if (inv[1][i]) cnt++;       printf( %d , cnt);       for (int i = 0; i < m; i++)         if (inv[1][i]) printf(  %d , i + 1);       printf(  n );     }     return 0;   }