malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n;       cin >> n;       bool impr = false;       bool taken[n + 1];       for (int i = 0; i <= n; i++) {         taken[i] = false;       }       int notTaken = -1;       for (int i = 0; i < n; i++) {         int k;         cin >> k;         bool done = false;         for (int i = 0; i < k; i++) {           int next;           cin >> next;           if (!done && !taken[next]) {             taken[next] = true;             done = true;           }         }         if (!done) {           impr = true;           notTaken = i + 1;         }       }       if (impr) {         cout <<  IMPROVE  << endl;         int good = 0;         for (int i = 1; i <= n; i++) {           if (taken[i] == false) {             good = i;           }         }         cout << notTaken <<     << good << endl;       } else {         cout <<  OPTIMAL  << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   long long int N, T;   void solve() {     cin >> N;     vector<long long int> cnt(N + 1);     long long int x;     for (long long int i = 0; i < N; i++) {       cin >> x;       cnt[x]++;     }     long long int ans = 0;     for (long long int s = 2; s <= 2 * N; s++) {       long long int cur = 0;       for (long long int i = 1; i < (s + 1) / 2; i++) {         if (s - i > N)           continue;         else {           cur += min(cnt[i], cnt[s - i]);         }       }       if (s % 2 == 0) {         cur += cnt[s / 2] / 2;       }       ans = max(ans, cur);     }     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> T;     while (T--) solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char s[200001], out[20];   int len[200001];   int ans1[2000001], ans2[2000001];   vector<int> v[2000001];   int digit[6];   bool solve(int n, int i, int sum) {     if (!i) {       if (ans1[sum] >= 10) return false;       ans2[n] = sum;       return true;     }     for (int j = 1, k = 10; k <= i * 10; j++, k *= 10) {       if (solve(n, i / k, sum + i % k)) {         v[n].push_back(j);         return true;       }     }     return false;   }   int main() {     int n;     for (int i = 1; i <= 2000000; i++) {       int j = 0;       for (; digit[j] == 9; digit[j++] = 0)         ;       digit[j]++;       int sum = 0;       for (int j = 0; j < 6; j++) sum += digit[j];       ans1[i] = sum;     }     for (int i = 1; i <= 2000000; i++) {       v[i].reserve(7);       solve(i, i, 0);     }     scanf( %d%s , &n, s);     int sum;     while (1) {       if (n > 10) {         int t = rand() % min(n / 2, 500);         for (int i = 0; i < t; i++) len[i] = 2;         for (int i = 2 * t; i < n; i++) len[i - t] = 1;         random_shuffle(len, len + n - t);       } else         for (int i = 0; i < n; i++) len[i] = 1;       sum = 0;       for (int i = 0, j = 0; j < n; j += len[i++])         sum += len[i] == 1 ? s[j] -  0  : (s[j] -  0 ) * 10 + s[j + 1] -  0 ;       if (!v[sum].empty()) break;     }     for (int i = 0, j = 0; j < n; j += len[i++]) {       if (i) putchar( + );       putchar(s[j]);       if (len[i] > 1) putchar(s[j + 1]);     }     putchar(  n );     sprintf(out,  %d , sum);     int j = 0;     for (int i : v[sum]) {       if (j) putchar( + );       for (int k = 0; k < i; k++) putchar(out[j + k]);       j += i;     }     putchar(  n );     sum = ans2[sum];     sprintf(out,  %d , sum);     for (int i = 0; out[i]; i++) {       if (i) putchar( + );       putchar(out[i]);     }     putchar(  n );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long a, b, c;     cin >> a >> b >> c;     long long Min = min(a, b);     Min = min(Min, c);     long long day = 0;     while (a + b + c >= 7 && a >= 3 && b >= 2 && c >= 2) {       a -= 3;       b -= 2;       c -= 2;       day += 7;     }     long long ans = 0;     long long _a = a, _b = b, _c = c;     for (long long i = 1; i <= 7; i++) {       long long tmp = 0;       a = _a;       b = _b;       c = _c;       for (long long j = i; j <= i + 7; j++) {         long long _j = j % 7;         if (_j == 1 || _j == 4 || _j == 0) {           if (!a) {             ans = max(ans, tmp);             break;           }           a--;           tmp++;         }         if (_j == 2 || _j == 6) {           if (!b) {             ans = max(ans, tmp);             break;           }           b--;           tmp++;         }         if (_j == 3 || _j == 5) {           if (!c) {             ans = max(ans, tmp);             break;           }           c--;           tmp++;         }       }       ans = max(ans, tmp);     }     cout << day + ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void ZZ(const char* name, Arg1&& arg1) {     std::cerr << name <<   =   << arg1 << endl;   }   template <typename Arg1, typename... Args>   void ZZ(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     std::cerr.write(names, comma - names) <<   =   << arg1;     ZZ(comma, args...);   }   int n, u, v;   int nxt[1000010], ans[1000010], cnt[1000010];   pair<int, int> a[1000000];   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     ;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i].first >> a[i].second;       cnt[a[i].second] = 1;       nxt[a[i].first] = a[i].second;       if (!a[i].first) u = a[i].second;     }     for (int i = 0; i < n; i++) {       if (!cnt[a[i].first]) {         v = a[i].first;         break;       }     }     for (int i = 0; i < n; i += 2) {       ans[i] = v;       v = nxt[v];     }     for (int i = 1; i < n; i += 2) {       ans[i] = u;       u = nxt[u];     }     for (int i = 0; i < n; i++) cout << ans[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize(2)   #pragma GCC optimize(3)   using namespace std;   int a[200011], b[200011];   struct song {     int t;     int id;     bool operator<(song other) const {       if (t != other.t) return t < other.t;       return id < other.id;     }   };   struct oriSet {     int tol = 0;     int len = 0;     set<song> s;     bool empty() { return s.empty(); }     int size() { return s.size(); }     void insert(int id) {       s.insert(song{a[id], id});       tol += b[id];       len += a[id];     }     int extractmin() {       if (!s.empty()) {         return s.begin()->id;       }       return -1;     }     int extractmax() {       if (!s.empty()) {         return s.rbegin()->id;       }       return -1;     }     void del(int id) {       if (s.find(song{a[id], id}) != s.end()) {         s.erase(song{a[id], id});         tol -= b[id];         len -= a[id];       }     }   };   struct lessSet {     int tol = 0;     int len = 0;     set<song> s;     bool empty() { return s.empty(); }     int size() { return s.size(); }     void insert(int id) {       int ti = a[id] - a[id] / 2;       s.insert(song{a[id], id});       tol += b[id];       len += ti;     }     int extractmin() {       if (!s.empty()) {         return s.begin()->id;       }       return -1;     }     int extractmax() {       if (!s.empty()) {         return s.rbegin()->id;       }       return -1;     }     void del(int id) {       if (s.find(song{a[id], id}) != s.end()) {         s.erase(song{a[id], id});         tol -= b[id];         len -= a[id] - a[id] / 2;       }     }   };   oriSet s1;   lessSet s2;   int n, w, k;   void make_balance() {     while (s2.size() < w && !s1.empty()) {       int id = s1.extractmax();       s1.del(id);       s2.insert(id);     }     while (!s1.empty() && s2.size() == w) {       int id1 = s1.extractmax(), id2 = s2.extractmin();       if (a[id1] <= a[id2]) break;       if (a[id1] > a[id2]) {         s1.del(id1);         s2.del(id2);         s1.insert(id2);         s2.insert(id1);       }     }   }   int main() {     scanf( %d%d%d , &n, &w, &k);     int i, j, ans = 0;     for (i = 1; i <= n; i++) {       scanf( %d , &b[i]);     }     for (i = 1; i <= n; i++) {       scanf( %d , &a[i]);     }     for (i = 1, j = 1; i <= n; i++) {       s1.insert(i);       make_balance();       while (j <= i && s1.len + s2.len > k) {         s1.del(j);         s2.del(j);         make_balance();         j++;       }       ans = max(ans, s1.tol + s2.tol);     }     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long n, k, ar[200000];   long long reach[777777];   long long q;   long long ans[777777];   multiset<long long> bst;   multiset<long long>::iterator it;   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> k;     for (int i = 1; i <= n; i++) cin >> ar[i];     reach[0] = 1;     for (int i = 1; i <= 666666; i++) reach[i] = 0;     for (int i = 1; i <= n; i++)       for (int j = 555555; j + 1; --j)         if (reach[j]) reach[j + ar[i]] = 1;     ans[0] = 0;     bst.insert(0);     for (int i = 1; i <= 666666; i++) {       ans[i] = 1e18;       if (i > k && ans[i - k - 1] < 1e18) {         it = bst.find(ans[i - k - 1]);         bst.erase(it);       }       if (reach[i] == 0) continue;       if (bst.size() == 0) continue;       it = bst.begin();       q = (*it);       ans[i] = q + 1;       bst.insert(ans[i]);     }     q = 666666;     while (ans[q] > 1e17) --q;     cout << q <<     << ans[q] << endl;     cin.get();     cin.get();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int N, C;   int A[1001];   vector<int> V;   int main() {     cin >> N;     for (int i = 0; i < N; ++i) cin >> A[i];     for (int i = 0; i < N; ++i) {       C = 1;       for (int j = i; j < N - 1; ++j) {         if (A[j] >= A[j + 1])           ++C;         else           break;       }       for (int j = i; j > 0; --j) {         if (A[j] >= A[j - 1])           ++C;         else           break;       }       V.push_back(C);     }     sort(V.begin(), V.end());     cout << V[V.size() - 1] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int nsz = 5e5;   int n, rt = 1, t, l[nsz + 5], r[nsz + 5];   vector<int> g[nsz + 5];   void dfs(int u = rt, int p = rt) {     for (int i = 0; i < g[u].size(); ++i) {       int v = g[u][i];       if (v == p) continue;       l[v] = ++t;     }     r[u] = ++t;     for (int i = g[u].size() - 1; i >= 0; --i) {       int v = g[u][i];       if (v == p) continue;       dfs(v, u);     }   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n - 1; ++i) {       int u, v;       scanf( %d%d , &u, &v);       g[u].push_back(v);       g[v].push_back(u);     }     l[rt] = ++t;     dfs();     for (int u = 1; u <= n; ++u) {       cout << l[u] <<     << r[u] <<   n ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = int(5e5) + 3;   const int MOD = 998244353;   const double PI = 4 * atan(1);   const double eps = 1e-10;   const long long oo = 1e10;   const int K = 26;   int n, m;   int a[N], b[N], c[N], d[N], k[N];   vector<int> actors[N];   vector<int> pitch[N];   set<int> s;   unordered_map<int, int> maa;   unordered_map<int, set<int> > occ;   vector<int> songs[N];   int anss[N];   void prepAns() {     for (int i = 0; i < m; i++) {       for (auto j : songs[i]) {         anss[j] = i;       }     }   }   bool exists(int c, int j) {     set<int>::iterator it;     bool cond = false;     if (s.count(c - 1) == 0) {       cond = true;       s.insert(c - 1);     }     it = s.find(c - 1);     it++;     if (it == s.end()) {       if (cond) {         s.erase(c - 1);       }       return 0;     }     int x = *it;     int y = *occ[x].begin();     songs[j].push_back(y);     occ[x].erase(occ[x].begin());     if (occ[x].size() == 0) {       s.erase(x);     }     if (cond) {       s.erase(c - 1);     }     return 1;   }   int main() {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> a[i] >> b[i];       s.insert(a[i]);       s.insert(b[i]);     }     cin >> m;     s.insert(0);     for (int i = 0; i < m; i++) {       cin >> c[i] >> d[i] >> k[i];       s.insert(c[i]);       s.insert(d[i]);     }     int ind = 1;     for (auto t : s) {       maa[t] = ind++;     }     for (int i = 0; i < n; i++) {       a[i] = maa[a[i]];       b[i] = maa[b[i]];       pitch[b[i]].push_back(i);     }     for (int i = 0; i < m; i++) {       c[i] = maa[c[i]];       d[i] = maa[d[i]];       actors[d[i]].push_back(i);     }     maa.clear();     s.clear();     int ans = 0;     for (int i = 1; i < ind; i++) {       for (auto j : pitch[i]) {         s.insert(a[j]);         occ[a[j]].insert(j);       }       for (auto j : actors[i]) {         while (k[j] && exists(c[j], j)) {           k[j]--;           ans++;         }       }     }     if (ans == n) {       cout <<  YES n ;       prepAns();       for (int i = 0; i < n; i++) {         cout << anss[i] + 1 <<    ;       }     } else {       cout <<  NO n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int TOUR = 1 << 18, INF = 0x3f3f3f3f;   struct strq {     int r1, r2, s1, s2, ind;     strq() {}   } q[TOUR];   struct event {     int st, red, stup;     strq qq;     event(int st, int red, int stup, strq qq)         : st(st), red(red), stup(stup), qq(qq) {}     event() {}   };   bool operator<(event a, event b) {     if (a.red != b.red) return a.red < b.red;     return a.st > b.st;   }   int t[2 * TOUR];   int red[TOUR], stup[TOUR];   int brred, brstup;   int rje[TOUR];   int indexxR[TOUR];   int n, brq;   vector<event> V;   vector<int> R[TOUR];   void Stavi(int pos, int val) {     for (t[pos + TOUR] = val, pos = (pos + TOUR) / 2; pos; pos /= 2)       t[pos] = max(t[2 * pos], t[2 * pos + 1]);   }   int Vrati(int pos, int lo, int hi, int begin, int end) {     if (lo >= end || hi <= begin) return 0;     if (lo >= begin && hi <= end) return t[pos];     return max(Vrati(2 * pos + 0, lo, (lo + hi) / 2, begin, end),                Vrati(2 * pos + 1, (lo + hi) / 2, hi, begin, end));   }   void Promjena() {     for (int i = 0; i < n; i++) swap(red[i], stup[i]);     for (int i = 0; i < brq; i++) {       swap(q[i].r1, q[i].s1);       swap(q[i].r2, q[i].s2);     }   }   void Init() {     V.clear();     for (int i = 0; i < TOUR; i++) R[i].clear();     for (int i = 0; i < n; i++) {       V.push_back(event(0, red[i], stup[i], strq()));       R[stup[i]].push_back(red[i]);     }     for (int i = 0; i < brq; i++) V.push_back(event(1, q[i].r1, q[i].s1, q[i]));     memset(t, INF, sizeof t);     memset(indexxR, 0, sizeof indexxR);     for (int i = 0; i < TOUR; i++) {       R[i].push_back(INF);       sort(R[i].begin(), R[i].end());       Stavi(i, R[i][0]);     }     sort(V.begin(), V.end());   }   int main() {     scanf( %d%d%d%d , &brred, &brstup, &n, &brq);     for (int i = 0; i < n; i++) scanf( %d%d , &red[i], &stup[i]);     for (int i = 0; i < brq; i++) {       scanf( %d%d%d%d , &q[i].r1, &q[i].s1, &q[i].r2, &q[i].s2);       q[i].ind = i;     }     for (int i = 0; i < 2; i++) {       Init();       for (int j = 0; j < (int)V.size(); j++) {         event tmp = V[j];         if (!tmp.st) {           indexxR[tmp.stup]++;           Stavi(tmp.stup, R[tmp.stup][indexxR[tmp.stup]]);         } else {           if (Vrati(1, 0, TOUR, tmp.qq.s1, tmp.qq.s2 + 1) <= tmp.qq.r2)             rje[tmp.qq.ind] = 1;         }       }       Promjena();     }     for (int i = 0; i < brq; i++) {       if (rje[i])         printf( YES n );       else         printf( NO n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int nextt[200007], c[200007], vis[200007];   long long ans, n;   template <class T>   void read(T &x) {     int f = 0;     x = 0;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       f |= (ch ==  - );       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = (x << 1) + (x << 3) + (ch ^ 48);       ch = getchar();     }     x = f ? -x : x;   }   int MIN(int now) {     int min = c[now];     for (int i = nextt[now];; i = nextt[i]) {       if (i == now)         return min;       else if (c[i] < min)         min = c[i];     }   }   int main() {     read(n);     for (int i = 1; i <= n; i++) read(c[i]);     for (int i = 1; i <= n; i++) {       read(nextt[i]);       if (nextt[i] == i) vis[i] = -1, ans += c[i];     }     for (int now = 1; now <= n; now++) {       if (vis[now]) continue;       for (int i = now;; i = nextt[i]) {         if (vis[i]) {           if (vis[i] == now) ans += MIN(i);           break;         }         vis[i] = now;       }     }     printf( %I64d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, a[200015], i, n1;   bool doit() {     n1 = n - 1;     for (i = 0; n1; ++i) {       if (a[i] == a[i + 1]) {         printf( :( );         return 0;       }       a[i] += n1;       --n1;     }     for (i = 0; i < n; ++i) printf( %d  , a[i]);   }   int main() {     scanf( %d , &n);     i = n;     while (i) {       --i;       scanf( %d , a + i);       a[i] -= i;     }     sort(a, a + n);     doit();   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m, a, b;     while (cin >> n >> m >> a >> b) {       a--;       b--;       int r1 = a / m, r2 = b / m;       int c1 = a % m, c2 = b % m;       if (r1 == r2)         cout << 1 << endl;       else if (c1 == 0 && c2 == m - 1)         cout << 1 << endl;       else if (c1 == 0 && c2 != m - 1) {         if (b == n - 1)           cout << 1 << endl;         else           cout << 2 << endl;       } else if (r1 + 1 == r2)         cout << 2 << endl;       else if (c1 != 0 && c2 == m - 1)         cout << 2 << endl;       else {         if (b == n - 1)           cout << 2 << endl;         else if (c2 + 1 == c1)           cout << 2 << endl;         else           cout << 3 << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct IP {     string nm;     int a, b, c, d;   };   int n, m;   int test(IP a[], IP x) {     for (int i = 0; i < n; i++) {       if (a[i].a == x.a && a[i].b == x.b && a[i].c == x.c && a[i].d == x.d)         return i;     }     return -1;   }   IP a[1000], b[1000];   int main() {     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> a[i].nm >> a[i].a;       getchar();       cin >> a[i].b;       getchar();       cin >> a[i].c;       getchar();       cin >> a[i].d;     }     for (int i = 0; i < m; i++) {       cin >> b[i].nm >> b[i].a;       getchar();       cin >> b[i].b;       getchar();       cin >> b[i].c;       getchar();       cin >> b[i].d;       getchar();     }     for (int i = 0; i < m; i++) {       cout << b[i].nm <<    ;       printf( %d.%d.%d.%d; , b[i].a, b[i].b, b[i].c, b[i].d);       int k = test(a, b[i]);       if (k != -1) cout <<   #  << a[k].nm;       cout << endl;     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( O3 )   #pragma GCC target( sse4 )   using namespace std;   template <class c>   struct rge {     c b, e;   };   template <class c>   rge<c> range(c i, c j) {     return rge<c>{i, j};   }   template <class c>   auto dud(c* x) -> decltype(cerr << *x, 0);   template <class c>   char dud(...);   struct debug {     template <class c>     debug& operator<<(const c&) {       return *this;     }   };   map<string, long long> mp;   const long long N = 8;   long long a[N][N];   long long ans1 = (long long)1e18 + 5, ans2 = 0;   vector<long long> vv(3);   vector<long long> ini = {0, 1, 2, 3, 4, 5, 6};   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long n;     mp[ Anka ] = 0, mp[ Chapay ] = 1, mp[ Cleo ] = 2, mp[ Troll ] = 3,     mp[ Dracul ] = 4, mp[ Snowy ] = 5, mp[ Hexadecimal ] = 6;     cin >> n;     string x, cc1, y;     for (long long i = 0; i < n; i++) {       cin >> x >> cc1 >> y;       a[mp[x]][mp[y]] = 1;     }     cin >> vv[0] >> vv[1] >> vv[2];     do {       for (long long i = 1; i < 5; i++) {         for (long long j = i + 1; j < 6; j++) {           vector<vector<long long> > aa(3);           for (long long k = 0; k < i; k++) aa[0].push_back(ini[k]);           for (long long k = i; k < j; k++) aa[1].push_back(ini[k]);           for (long long k = j; k < 7; k++) aa[2].push_back(ini[k]);           vector<vector<long long> > cur1 = aa;           long long lik = 0;           for (long long ii = 0; ii < 3; ii++) {             for (long long jj = 0; jj < (long long)cur1[ii].size(); jj++) {               for (long long k = jj + 1; k < (long long)cur1[ii].size(); k++) {                 if (a[cur1[ii][jj]][cur1[ii][k]]) {                   lik++;                 }                 if (a[cur1[ii][k]][cur1[ii][jj]]) lik++;               }             }           }           vector<long long> cur = {0, 1, 2};           vector<long long> arr(3, 0);           do {             arr[0] = (vv[cur[0]] / (long long)aa[0].size());             arr[1] = (vv[cur[1]] / (long long)aa[1].size());             arr[2] = (vv[cur[2]] / (long long)aa[2].size());             long long ans = 0;             for (long long ii = 0; ii < 3; ii++) {               for (long long jj = ii + 1; jj < 3; jj++) {                 ans = max(ans, abs(arr[ii] - arr[jj]));               }             }             if (ans <= ans1) {               if (ans == ans1) {                 if (lik > ans2) {                   ans2 = lik;                 }               } else {                 ans1 = ans;                 ans2 = lik;               }             }           } while (next_permutation((cur).begin(), (cur).end()));         }       }     } while (next_permutation((ini).begin(), (ini).end()));     cout << ans1 <<     << ans2 <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     cin >> n >> k;     long long ans = 1;     for (int i = k + 1; i <= n; i++) ans = (ans * (n - k)) % 1000000007;     ans = (ans * (k)) % 1000000007;     if (k - 1 > 0) {       long long prod = 0;       vector<int> v(k + 2);       int loopval = 1;       for (int i = 1; i <= k - 1; i++) loopval *= k;       for (int i = 0; i < loopval; i++) {         int temp = i;         for (int j = 0; j < k - 1; j++) {           v[j + 2] = temp % k + 1;           temp /= k;         }         int j = 0;         for (; j < k - 1; j++) {           int steps = 0;           temp = v[j + 2];           while (steps <= 7 && temp > 1) {             temp = v[temp];             steps++;           }           if (temp > 1) break;         }         if (j == k - 1) prod++;       }       ans = (ans * (prod)) % 1000000007;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int w;     w = 1;     while (w--) {       int n, maxi = -1, b = 0;       vector<int> s, t[10];       bool f1 = true, f = false;       cin >> n;       while (n > 0) {         int x = n % 10;         s.push_back(x);         maxi = max(maxi, x);         n /= 10;       }       reverse(s.begin(), s.end());       while (f1) {         f1 = false;         f = false;         for (int i = 0; i < s.size(); i++) {           int y = s[i];           if (y > 0) {             f1 = true;             f = true;             t[b].push_back(1);             y--;             s[i] = y;           } else {             if (f) t[b].push_back(0);           }         }         b++;       }       string ans[maxi];       cout << maxi << endl;       for (int i = 0; i < maxi; i++) {         for (int j = 0; j < t[i].size(); j++) {           char c = (char)(t[i][j] +  0 );           ans[i].push_back(c);         }       }       for (int i = 0; i < maxi; i++) cout << ans[i] <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int N = 500010;   long long x, y, m;   int main() {     ios_base::sync_with_stdio(false);     cin >> x >> y >> m;     if (x >= m || y >= m) {       cout <<  0 n ;       return 0;     }     if (x <= 0 && y <= 0) {       cout <<  -1 n ;       return 0;     }     if (x > y) swap(x, y);     long long res = 0;     if (x < 0) {       res = ceil(-x * 1.0 / y);       x += res * y;     }     while (x < m && y < m) {       if (x < y)         x = x + y;       else         y = x + y;       res++;     }     cout << res <<   n ;     return 0;   }