malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include<bits/stdc++.h>   using namespace std;   #define ll int long long   #define mp make_pair   //#define for(i,n) for(int i=0;i<n;i++)   #define F first   #define S second   #define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);   #define N 1000000007   #define pq priority queue   #define pb push_back   #define pf push_front   #define mt make_tuple   #define prec(a) fixed<<setprecision(9)<<a   #define endl   n    #define fast_set s.max_load_factor(0.25);s.reserve(500);   #define cy cout<< YES <<endl;   #define cn cout<< NO <<endl;   #define all(v) v.begin(),v.end()   #define allr(v) v.rbegin(),v.rend()   const long double PI = (long double)(3.1415926535897932384626433832795);   bool check(int a,int b,int hh,int mm)   {        int savea=a,saveb=b;    int arr[10];    memset(arr,-1,sizeof(arr));    arr[0]=0;    arr[1]=1;    arr[2]=5;    arr[5]=2;    arr[8]=8;    int h=0,m=0;    h=arr[(b%10)]*10+arr[(b/10)];    m=arr[(a%10)]*10+arr[(a/10)];    if(arr[a%10] == -1 || arr[a/10] == -1 || arr[b%10] == -1 || arr[b/10] == -1){     return 0;    }    return (h<hh&&m<mm);   }   int main()    {    fast;    int test,n,i,j,k;    cin>>test;    while(test--)    {     string str;     cin>>n>>k>>str;     if(n%k!=0)     {      cout<< -1 <<endl;     }     else     {      int hash1[26]={0};      n=str.length();      for(i=0;i<n;i++)      {       hash1[str[i]- a ]++;      }      for(i=0;i<26;i++)      {       if(hash1[i]%k!=0)       {        break;       }      }      if(i==26)      {       cout<<str<<endl;      }      else      {       for(i=n-1;i>=0;i--)       {        hash1[str[i]- a ]--;        for(j=str[i]- a +1;j<26;j++)        {         bool flag=1;         hash1[j]++;         int it=0,cnt=0;         for(it=0;it<26;it++)         {          cnt+=((k-(hash1[it]%k))%k);         }         int avail = n-i-1;         if(cnt>avail||(avail-cnt)%k!=0)         {          flag=0;         }         hash1[j]--;         if(flag)         {          break;         }        }        if(j<26)        {         break;        }       }       if(i<0)       {        cout<<i<<endl;       }       else       {        //cout<<i<<   <<j<<endl;        str[i]= a +j;        hash1[j]++;        int it=0,mini=0;        vector<int>s;        int sum=0;        for(it=0;it<26;it++)        {         if(hash1[it]>0)          mini=min(mini,it);         int a=((k-(hash1[it]%k))%k);         sum+=a;         while(a--)         {          mini=min(mini,it);          s.pb(it);         }        }        //cout<<sum<<endl;        int a=n-i-1-sum;        while(a--)        {         s.pb(mini);        }        int c=0;        //cout<<s.size()<<endl;        sort(all(s));        for(j=i+1;j<n;j++)        {         str[j]= a +s[c];         c++;                 }        cout<<str<<endl;       }      }     }    }    return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t, n, counter, a, b, c;     cin >> t;     while (t--) {       cin >> a >> b >> c;       counter = 0;       while (++counter) {         (a < b) ? a += b : b += a;         if (max(a, b) > c) break;       }       cout << counter << endl;     }   }
#include <bits/stdc++.h>   long long query(long long q) {     std::printf( ? %lld n , q);     std::fflush(stdout);     long long res;     std::scanf( %lld , &res);     return res;   }   long long qpow(long long a, int b) {     long long res = 1;     while (b) {       if (b & 1) res *= a;       b >>= 1, a *= a;     }     return res;   }   long long tmp;   int prime[] = {2,   3,   5,   7,   11,  13,  17,  19,  23,  29,  31,  37,  41,                  43,  47,  53,  59,  61,  67,  71,  73,  79,  83,  89,  97,  101,                  103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,                  173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239,                  241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313,                  317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397,                  401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467,                  479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569,                  571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643,                  647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719};   int get(int val) {     long long now = val;     while (now * val <= int(1e9)) now *= val;     long long t = query(now);     int res = 0;     while (t % val == 0) t /= val, ++res;     return res;   }   int ans = 1, us = 0;   int mian() {     int next = 0;     us = 0, ans = 1;     while (us < 21) {       if (prime[next] == 719) break;       long long p = 1;       int last = next;       while (p * prime[next] < 1e15 && prime[next] != 719) p *= prime[next++];       tmp = query(p);       ++us;       for (int i = last; i < next; ++i)         if (tmp % prime[i] == 0 && us < 22) {           int ga = get(prime[i]);           ++us;           ans *= ga + 1;         }     }     std::printf( ! %d n , std::max(ans + 7, ans * 2));     std::fflush(stdout);     return 0;   }   int main() {     int t;     std::scanf( %d , &t);     while (t--) mian();   }
#include <bits/stdc++.h>   using namespace std;   set<pair<int, int> > ss;   struct Node {     int l, r, ope;     bool operator<(const Node &b) const {       if (l != b.l) return l < b.l;       return ope > b.ope;     }   };   Node a[200010];   int num[100010], ans[100010];   int main() {     int n, m;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d%d , &a[i].l, &a[i].r);       a[i].ope = -1 - i;     }     scanf( %d , &m);     for (int i = 0; i < m; i++) {       scanf( %d%d%d , &a[i + n].l, &a[i + n].r, &num[i]);       a[i + n].ope = i;     }     sort(a, a + n + m);     for (int i = 0; i < n + m; i++) {       if (a[i].ope >= 0) {         ss.insert(make_pair(a[i].r, a[i].ope));       } else {         if (ss.size() == 0) {           puts( NO );           return 0;         }         set<pair<int, int> >::iterator pos =             ss.lower_bound(make_pair(a[i].r, -1));         if (pos == ss.end()) {           puts( NO );           return 0;         }         pair<int, int> x = *pos;         num[x.second]--;         ans[-(a[i].ope + 1)] = x.second + 1;         if (num[x.second] == 0) {           ss.erase(pos);         }       }     }     puts( YES );     for (int i = 0; i < n; i++) {       printf( %d  , ans[i]);     }     puts(  );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = acos(-1.0);   const double eps = 1e-6;   const int MOD = 1e9 + 7;   const int INF = 0x3f3f3f3f;   const long long INFLL = 0x3f3f3f3f3f3f3f3f;   const int MAXN = 5e5 + 5;   int n, k;   struct nodes {     int maxn[12], minn[12], siz;     bool operator<(const nodes& x) const {       int f = 1;       for (int i = 1; i <= k; i++)         if (maxn[i] > x.minn[i]) f = 0;       return f;     }   };   int main() {     cin >> n >> k;     multiset<nodes> s;     for (int i = 1; i <= n; i++) {       nodes now;       for (int j = 1; j <= k; j++) {         scanf( %d , &now.maxn[j]);         now.minn[j] = now.maxn[j];       }       now.siz = 1;       auto p = s.lower_bound(now);       auto p2 = s.upper_bound(now);       nodes nxt = now;       vector<multiset<nodes>::iterator> v;       for (auto sp = p; sp != p2; sp++) {         for (int i = 1; i <= k; i++) {           nxt.maxn[i] = max(nxt.maxn[i], sp->maxn[i]);           nxt.minn[i] = min(nxt.minn[i], sp->minn[i]);         }         nxt.siz += sp->siz;         v.push_back(sp);       }       for (int i = 0; i < v.size(); i++) s.erase(v[i]);       s.insert(nxt);       printf( %d n , s.rbegin()->siz);     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 15;   int a[N], dp[N][2];   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     for (int i = 1; i <= n; i += 1) {       cin >> a[i];     }     int ans = 0;     for (int i = n; i >= 1; i -= 1) {       dp[i][0] = 1;       if (i == n) continue;       if (a[i] < a[i + 1]) dp[i][0] += dp[i + 1][0];     }     for (int i = 1; i <= n; i += 1) {       dp[i][1] = 1;       if (i == 1) continue;       if (a[i] > a[i - 1]) {         dp[i][1] += dp[i - 1][1];       }     }     for (int i = 1; i <= n; i += 1) {       int x = dp[i + 1][0];       int y = dp[i - 1][1];       ans = max(ans, min(n, x + 1));       ans = max(ans, min(n, y + 1));       if (a[i - 1] + 1 < a[i + 1]) ans = max(ans, min(n, x + y + 1));     }     if (n == 1) ans = 1;     cout << min(ans, n) <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long N = 100100;   const long long Mod = 1e9 + 7;   long long Rec(long long i, long long j, long long c);   long long p[N];   long long x[N];   vector<long long> Adj[N];   vector<long long> Dp[N][2];   int main() {     long long n;     cin >> n;     for (long long i = 2; i <= n; i++)       scanf( %I64d , p + i), Adj[++p[i]].push_back(i);     for (long long i = 1; i <= n; i++) scanf( %I64d , x + i);     for (long long i = 0; i < N; i++)       Dp[i][0] = Dp[i][1] = vector<long long>(Adj[i].size(), -1);     cout << Rec(1, 0, 0);   }   long long Rec(long long i, long long j, long long c) {     if (j == 0) c += x[i];     if (c > 1) return 0;     if (j == Adj[i].size()) return c;     if (Dp[i][c][j] + 1) return Dp[i][c][j];     long long Res1 = (Rec(i, j + 1, c) * Rec(Adj[i][j], 0, 0)) % Mod;     long long Res2 = (c ? Rec(i, j + 1, 1) * Rec(Adj[i][j], 0, 1) : 0) % Mod;     long long Res3 = (!c ? (Rec(i, j + 1, 1) * Rec(Adj[i][j], 0, 0)) % Mod +                                (Rec(i, j + 1, 0) * Rec(Adj[i][j], 0, 1)) % Mod                          : 0) %                      Mod;     return Dp[i][c][j] = (Res1 + Res2 + Res3) % Mod;   }
#include <bits/stdc++.h>   using namespace std;   int n;   string s;   map<char, bool> m;   int main() {     cin >> n >> s;     char pl =  a ;     int sum = 0, sum2 = 0;     int len = s.size();     int book = 0;     for (int i = 0; i < len / 2; ++i) {       if (isalpha(s[i])) {         if (!m[s[i]]) {           m[s[i]] = 1;           sum2++;         }         if (s[len - i - 1] ==  ? ) {           s[len - i - 1] = s[i];         } else if (s[i] != s[len - i - 1]) {           puts( IMPOSSIBLE );           return 0;         }       }     }     for (int i = len / 2; i < len; ++i) {       if (isalpha(s[i])) {         if (!m[s[i]]) {           m[s[i]] = 1;           sum2++;         }         if (s[len - i - 1] ==  ? ) {           s[len - i - 1] = s[i];         } else if (s[i] != s[len - i - 1]) {           puts( IMPOSSIBLE );           return 0;         }       } else         sum++;     }     sum2 = n - sum2;     if (sum2 > sum) {       puts( IMPOSSIBLE );       return 0;     }     int tot = sum - sum2;     for (int i = 0; i <= len / 2; ++i) {       if (s[i] ==  ? ) {         if (tot) {           s[i] =  a ;           s[len - i - 1] =  a ;           tot--;         } else {           while (m[pl]) pl++;           s[i] = pl;           s[len - i - 1] = pl;           m[pl] = 1;         }       }     }     cout << s << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool sortcol(const vector<long long int>& v1, const vector<long long int>& v2) {     if (v1[0] == v2[0]) return v1[1] < v2[1];     return v1[0] < v2[0];   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int n, m;     cin >> n >> m;     vector<vector<long long int> > A(m, vector<long long int>(n));     vector<long long int> sum(n);     for (long long int i = 0; i < m; i++)       for (long long int j = 0; j < n; j++) cin >> A[i][j];     for (long long int i = 0; i < m; i++) {       for (long long int j = 0; j < n - 1; j++) A[i][j] = A[i][n - 1] - A[i][j];       A[i][n - 1] = i;     }     long long int max = 0, store = -1;     for (long long int i = 0; i < n - 1; i++) {       vector<vector<long long int> > B(m, vector<long long int>(2));       for (long long int j = 0; j < m; j++) {         B[j][0] = A[j][i];         B[j][1] = A[j][n - 1];       }       sort(B.begin(), B.end(), sortcol);       long long int ans = 0, val = 0, check = 0;       for (long long int j = 0; j < m; j++) {         ans += B[j][0];         if (ans > 0) {           val = j;           if (val > max) {             max = val;             store = i;           }           check = 1;           break;         }       }       if (check == 1) continue;       val = m;       if (val > max) {         max = val;         store = i;       }     }     cout << m - max << endl;     vector<vector<long long int> > B(m, vector<long long int>(2));     for (long long int j = 0; j < m; j++) {       B[j][0] = A[j][store];       B[j][1] = A[j][n - 1];     }     sort(B.begin(), B.end(), sortcol);     for (long long int i = max; i < m; i++) cout << B[i][1] + 1 <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double pi = acos(-1.0);   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t;     t = 1;     while (t--) {       long long int n;       cin >> n;       long long int a[n];       for (int i = 0; i < n; i += 1) cin >> a[i];       long long int pre[n];       pre[0] = a[0];       for (long long int i = 1; i < n; i += 1) {         pre[i] = a[i];         pre[i] += pre[i - 1];       }       long long int q;       cin >> q;       for (long long int i = 0; i < q; i += 1) {         long long int x, y;         cin >> x >> y;         x -= 1, y -= 1;         long long int tmp = pre[y] - pre[x] + a[x];         tmp = tmp / 10;         cout << tmp <<   n ;       }     }   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int n, q, i, j, l, r;     cin >> n >> q;     int auxi[n + 2], sum[n + 2];     memset(auxi, 0, sizeof(auxi));     memset(sum, 0, sizeof(sum));     vector<pair<int, int> > v;     for (i = 0; i < q; i++) {       cin >> l >> r;       v.push_back({l, r});       auxi[r + 1] -= 1;       auxi[l] += 1;     }     int net = 0;     for (i = 0; i <= n + 1; i++) {       net += auxi[i];       sum[i] += net;     }     int ans = 0;     for (i = 0; i < q; i++) {       for (j = 0; j <= n; j++) {         auxi[j] = sum[j];       }       int count = 0;       for (j = v[i].first; j <= v[i].second; j++) {         auxi[j]--;       }       int prefix[n + 1];       prefix[0] = 0;       for (j = 1; j <= n; j++) {         prefix[j] = prefix[j - 1] + (auxi[j] == 1);         if (auxi[j]) count++;       }       for (j = i + 1; j < q; j++) {         ans = max(ans, count - prefix[v[j].second] + prefix[v[j].first - 1]);       }     }     cout << ans <<   n ;   }
#include <bits/stdc++.h>   const int MAXN = 2e5 + 10;   const int mod = 1e9 + 7;   void reduce(int& x) { x += x >> 31 & mod; }   int mul(int a, int b) { return (long long)a * b % mod; }   int pow(int a, int b, int res = 1) {     for (; b; b >>= 1, a = mul(a, a))       if (b & 1) res = mul(res, a);     return res;   }   const int MAXS = 1e6 + 1;   int pri[MAXS], npri[MAXS], tot;   int fac[MAXS], inv[MAXS];   void sieve() {     inv[0] = inv[1] = 1;     fac[1] = 1;     for (int i = 2; i != MAXS; ++i) {       inv[i] = mul(inv[mod % i], mod - mod / i);       if (!npri[i]) fac[pri[++tot] = i] = i;       for (int j = 1, t; j <= tot && (t = i * pri[j]) < MAXS; ++j) {         npri[t] = true;         fac[t] = pri[j];         if (i % pri[j] == 0) break;       }     }   }   int A[MAXN];   int n, m;   int pre[MAXN];   int tr[MAXN];   void add(int x, int v) {     for (; x; x &= x - 1) tr[x] = mul(tr[x], v);   }   int lst[MAXS], ansl[MAXN];   int ls[MAXN];   std::vector<int> qs[MAXN];   int qry(int x) {     int r = 1;     for (; x <= n; x += x & -x) r = mul(r, tr[x]);     return r;   }   int main() {     std::ios_base::sync_with_stdio(false), std::cin.tie(0);     sieve();     std::cin >> n;     pre[0] = 1;     for (int i = 1; i <= n; ++i) {       std::cin >> A[i];       pre[i] = mul(pre[i - 1], A[i]);       tr[i] = 1;     }     std::cin >> m;     for (int i = 1, r; i <= m; ++i) {       std::cin >> ls[i] >> r;       qs[r].push_back(i);     }     for (int i = 1; i <= n; ++i) {       std::set<int> hl;       int x = A[i];       while (x > 1) hl.insert(fac[x]), x /= fac[x];       for (auto t : hl) {         add(lst[t], mul(inv[t - 1], t));         add(lst[t] = i, mul(inv[t], t - 1));       }       for (auto t : qs[i]) {         ansl[t] = pow(pre[ls[t] - 1], mod - 2, pre[i]);         ansl[t] = mul(ansl[t], qry(ls[t]));       }     }     for (int i = 1; i <= m; ++i) std::cout << ansl[i] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[200005], cnt = 0;   bool vis[200005];   void f(int x) {     while (!vis[x]) vis[x] = 1, x = a[x];   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , a + i);     for (int i = 1; i <= n; ++i)       if (!vis[i]) {         ++cnt;         f(i);       }     if (cnt == 1) cnt = 0;     bool f = 0;     for (int j, i = 1; i <= n; ++i) scanf( %d , &j), f ^= (j & 1);     cnt += !f;     printf( %d n , cnt);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int q;     cin >> q;     for (int i = 0; i < q; i++) {       int n;       cin >> n;       int gnum;       while (1) {         gnum = n;         while (gnum > 0) {           if (gnum % 3 == 2) {             break;           }           gnum = gnum / 3;         }         if (gnum == 1 || gnum == 0) {           break;         }         n++;       }       cout << n << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n;   long long arr[100005];   int c5;   int find(long long a, long long b, long long c) {     long long arr[4];     arr[0] = a;     arr[1] = b;     arr[2] = c;     sort(arr, arr + 3);     if (arr[0] < arr[1] && arr[1] < arr[2])       return 6;     else if (arr[0] == arr[1] && arr[1] < arr[2])       return 3;     else if (arr[0] < arr[1] && arr[1] == arr[2])       return 3;     else       return 1;   }   int main() {     cin >> n;     if (n % 6 != 0) {       printf( 0 n );       return 0;     }     n /= 3;     for (long long x = 1; x * x <= n; x++) {       if (n % x == 0) {         arr[c5++] = x;         if (x * x != n) arr[c5++] = n / x;       }     }     sort(arr, arr + c5);     long long x, y, z;     int ans = 0, cnt = 0;     long long a, b, c;     for (int i = 0; i < c5; i++) {       x = arr[i];       for (int j = i; j < c5 && arr[i] * arr[j] * arr[j] <= n; j++) {         if (n % (arr[i] * arr[j]) == 0) {           y = arr[j];           z = n / (arr[i] * arr[j]);           if (x <= y <= z) {             if (x - y + z > 0 && y - x + z > 0 && y - z + x > 0 &&                 (x - y + z) % 2 == 0) {               cnt++;               a = (x - y + z) / 2;               b = (y - x + z) / 2;               c = (y - z + x) / 2;               ans += find(a, b, c);             }           }         }       }     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long mod = 1e9 + 7;   int main() {     map<int, int> m, p;     int n;     cin >> n;     for (int i = (1); i <= (n); i++) {       int u, v;       cin >> u >> v;       m[u]++;       if (v != u) p[v]++;     }     int ans = 1e9;     if (n % 2) n++;     for (auto i : m) {       int cval = i.second;       int poss = p[i.first];       int reqd = n / 2;       int now = reqd - cval;       if (now <= poss) ans = min(ans, max(0, now));     }     for (auto i : p) {       int poss = i.second;       int cval = m[i.first];       int reqd = n / 2;       int now = reqd - cval;       if (now <= poss) ans = min(ans, max(0, now));     }     if (ans == 1e9)       cout <<  -1 n ;     else       cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long prime = 1e9 + 7;   const long long maxN = 1e5 + 5;   const long double pi = 3.1415926536;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n, k, a, rem = 1e18, t = 1, b = 0;     cin >> n >> k;     for (long long i = (long long)(1); i <= (long long)(k); i++) {       cin >> a;       if ((a <= n) && (n % a < rem)) {         rem = n % a;         t = i;         b = n / a;       }     }     cout << t <<     << b;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> v[3000];   long long h[200000], pw[200000];   string st, st1, st2;   long l1, l2, l, ans, fl, g1[20000], g2[20000];   long long gethash(long a, long b) {     return (h[b + 1] - h[a]) * pw[st.size() - b + 1];   }   int main() {     cin >> st;     cin >> st1 >> st2;     pw[0] = 1;     for (int i = 1; i <= 3000; i++) pw[i] = pw[i - 1] * 29;     for (int i = 1; i <= st.size(); i++) h[i] = h[i - 1] + st[i - 1] * pw[i];     l = st.size();     l1 = st1.size();     l2 = st2.size();     for (int i = 0; i <= l - l1; i++) {       fl = 0;       for (int j = 0; j < l1; j++)         if (st1[j] != st[i + j]) {           fl++;           break;         }       if (fl == 0) g1[i] = 1;     }     for (int i = 0; i <= l - l2; i++) {       fl = 0;       for (int j = 0; j < l2; j++)         if (st2[j] != st[i + j]) {           fl++;           break;         }       if (fl == 0) g2[i + l2 - 1] = 1;     }     long lll = max(l1, l2);     for (int i = 0; i < l; i++)       for (int j = i; j < l; j++)         if (g1[i] && g2[j] && (j - i + 1 >= lll)) {           v[j - i + 1].push_back(gethash(i, j));         }     for (int i = 1; i <= l; i++) {       sort(v[i].begin(), v[i].end());       if (v[i].size()) ans++;       for (int j = 1; j < v[i].size(); j++)         if (v[i][j] != v[i][j - 1]) ++ans;     }     cout << ans << endl;     cin.get();     cin.get();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int cnt_9s(long long int num);   long long int power(int num, int exp);   int main() {     long long int num, sale, rem;     cin >> num >> sale;     while (1) {       rem = power(10, cnt_9s(num) + 1);       if (sale >= num % rem + 1)         sale -= (num % rem + 1), num -= (num % rem + 1);       else         break;     }     cout << num << endl;     return 0;   }   long long int power(int num, int exp) {     long long int res = 1;     while (exp != 0) res *= num, exp--;     return res;   }   int cnt_9s(long long int num) {     int cnt = 0;     while (num != 0)       if (num % 10 == 9)         cnt++, num /= 10;       else         break;     return cnt;   }
#include <bits/stdc++.h>   using namespace std;   char a[100100];   int main() {     scanf( %s , a);     int en;     int len = strlen(a);     int r = 0, l = 0;     int ll, rr;     int flag = 0;     int last;     int cnt = 0;     for (int i = 0; a[i] !=   0 ; i++)       if (a[i] ==  # ) en = i;     for (int i = 0; i < len; i++) {       if (a[i] ==  ( )         l++;       else {         r++;         if (a[i] ==  # ) cnt++;       }       if (r > l) {         flag = 1;         break;       }       if (i == en) ll = l, rr = r;     }     last = l - r + 1;     rr += last - 1;     if (ll < rr) flag = 1;     for (int i = en + 1; i < len; i++) {       if (a[i] ==  ( )         ll++;       else         rr++;       if (rr > ll) {         flag = 1;         break;       }     }     if (rr != ll) flag = 1;     if (flag)       puts( -1 );     else {       for (int i = 0; i < cnt - 1; i++) puts( 1 );       printf( %d n , last);     }   }