malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, g, t;     cin >> n >> k;     char a[n];     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) {       if (a[i] ==  G ) g = i;       if (a[i] ==  T ) t = i;     }     for (int i = 0; i < n; i++) {       if (g < t) {         while (g < n && a[g] !=  #  && a[g] !=  T ) g = g + k;         if (a[g] ==  T ) {           cout <<  YES  << endl;           return 0;         } else if (a[g] ==  #  || g >= n) {           cout <<  NO  << endl;           return 0;         }       } else if (g > t) {         while (g >= 0 && a[g] !=  #  && a[g] !=  T ) g = g - k;         if (a[g] ==  T ) {           cout <<  YES  << endl;           return 0;         } else if (a[g] ==  #  || g < 0) {           cout <<  NO  << endl;           return 0;         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     string s;     cin >> s;     int n = s.size();     bool dp[n + 1][8];     memset(dp, false, sizeof(dp));     string ans[8];     for (int i = 1; i < n + 1; i++) {       string temp_ans[8];       dp[i][(s[i - 1] -  0 ) % 8] = true;       temp_ans[(s[i - 1] -  0 ) % 8] = s[i - 1];       for (int j = 0; j < 8; j++) {         if (dp[i - 1][j]) {           int temp = (10 * j + (s[i - 1] -  0 )) % 8;           dp[i][temp] = true;           temp_ans[temp] = ans[j] + s[i - 1];           dp[i][j] = true;           temp_ans[j] = ans[j];         }       }       for (int j = 0; j < 8; j++) ans[j] = temp_ans[j];     }     if (dp[n][0]) {       cout <<  YES n ;       cout << ans[0] << endl;     } else       cout <<  NO n ;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long int b, l, d;     cin >> b >> l >> d;     long long int m = b;     if (l > m) {       m = l;     }     if (d > m) {       m = d;     }     long long int miss = 0;     if (m - 1 - b > 0) {       miss += m - 1 - b;     }     if (m - 1 - l > 0) {       miss += m - 1 - l;     }     if (m - 1 - d > 0) {       miss += m - 1 - d;     }     cout << miss;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > a[100500];   int d[100500];   int main() {     int n, m, cap;     scanf( %d%d%d , &n, &m, &cap);     cap--;     for (int i = 0; i < (m); i++) {       int x, y, w;       scanf( %d%d%d , &x, &y, &w);       x--, y--;       a[x].push_back(pair<int, int>(y, w));       a[y].push_back(pair<int, int>(x, w));     }     int l;     scanf( %d , &l);     const int INF = 1100000000;     for (int i = 0; i < (n); i++) d[i] = INF;     d[cap] = 0;     set<pair<int, int> > s;     s.insert(pair<int, int>(d[cap], cap));     while (!s.empty()) {       int v = s.begin()->second;       s.erase(s.begin());       for (typeof((a[v]).begin()) it = (a[v]).begin(); it != (a[v]).end(); ++it) {         int u = it->first;         int w = it->second;         if (d[u] >= INF || d[u] >= d[v] + w) {           if (d[u] < INF) s.erase(s.find(pair<int, int>(d[u], u)));           d[u] = d[v] + w;           s.insert(pair<int, int>(d[u], u));         }       }     }     int ans = 0;     for (int i = 0; i < (n); i++)       for (typeof((a[i]).begin()) it = (a[i]).begin(); it != (a[i]).end(); ++it) {         int u = i;         int v = it->first;         int w = it->second;         int x = d[v] - d[u] + w;         assert(0 <= x && x <= w + w);         if (0 < x && x < w + w) {           if (d[u] < l && l + l <= 2 * d[u] + x) ans++;           if (d[v] < l && l + l <= 2 * d[v] + w + w - x) ans++;           if (l + l == 2 * d[u] + x && l + l == 2 * d[v] + w + w - x) ans--;         } else {           if (min(d[u], d[v]) < l && l < max(d[u], d[v])) ans++;         }       }     ans >>= 1;     for (int i = 0; i < (n); i++) ans += d[i] == l;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using D = double;   using uint = unsigned int;   template <typename T>   using pair2 = pair<T, T>;   const int maxn = 300005;   bool used[maxn];   int n, k;   vector<int> all;   int main() {     cin >> n >> k;     if (k == 6) {       if (n < 6)         printf( No n );       else {         printf( Yes n );         printf( 5 n );         printf( 1 2 4 5 6 n );       }       return 0;     }     int cur = 0;     int mx = 0;     for (int i = 1; i <= n && cur < k; i++) {       mx = i;       used[i] = true;       for (int j = 1; j < i && j * j <= i; j++)         if (i % j == 0) {           cur++;           if (i / j > j && i / j < i) cur++;         }     }     if (cur < k) {       printf( No n );       return 0;     }     for (int IT = 0; IT < 3; IT++) {       for (int i = mx; i >= 1 && cur > k; i--)         if (used[i]) {           int cnt = 0;           for (int j = 1; j < i && j * j <= i; j++)             if (i % j == 0) {               if (used[j]) cnt++;               if (i / j > j && i / j < i && used[i / j]) cnt++;             }           for (int j = 2 * i; j <= mx; j++)             if (used[j]) cnt++;           if (cnt <= cur - k) {             used[i] = false;             cur -= cnt;           }         }     }     assert(cur == k);     for (int i = 0; i <= mx; i++)       if (used[i]) all.push_back(i);     printf( Yes n );     printf( %d n , (int)all.size());     for (auto t : all) printf( %d  , t);     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int sz = 55;   int n, r1, c1, r2, c2, ans = 1000000000;   string s[sz];   bool visited[sz][sz];   vector<pair<int, int> > v;   void dfs(int x, int y, bool flag) {     if (x < 1 || x > n || y < 1 || y > n || s[x][y] ==  1  ||         visited[x][y] == true) {       return;     }     visited[x][y] = true;     if (flag == true) {       v.push_back(make_pair(x, y));     } else {       for (int i = 0; i < v.size(); i++) {         int cost = (v[i].first - x) * (v[i].first - x) +                    (v[i].second - y) * (v[i].second - y);         ans = min(ans, cost);       }     }     dfs(x - 1, y, flag);     dfs(x + 1, y, flag);     dfs(x, y - 1, flag);     dfs(x, y + 1, flag);   }   int main() {     cin >> n;     cin >> r1 >> c1 >> r2 >> c2;     for (int i = 1; i <= n; i++) {       cin >> s[i];       s[i] =     + s[i];     }     memset(visited, false, sizeof(visited));     dfs(r2, c2, true);     memset(visited, false, sizeof(visited));     dfs(r1, c1, false);     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s1, s2, t =   ;     cin >> s1 >> s2;     int n = s1.size(), c = 0, c1 = 0, c2 = 0;     for (int i = 0; i < n; i++) {       if (s1[i] != s2[i]) c++;     }     if (c % 2 != 0)       cout <<  impossible  << endl;     else {       c1 = c2 = c / 2;       for (int i = 0; i < n; i++) {         if (s1[i] == s2[i])           t += s1[i];         else if (s1[i] != s2[i]) {           if (c1 > 0) {             c1--;             t += s1[i];           } else if (c2 > 0) {             c2--;             t += s2[i];           }         }       }       cout << t << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline void checkMin(T &a, T b) {     if (b < a) a = b;   }   template <class T>   inline void checkMax(T &a, T b) {     if (a < b) a = b;   }   template <class T>   inline T Min(T a, T b) {     return a < b ? a : b;   }   template <class T>   inline T Max(T a, T b) {     return a > b ? a : b;   }   template <class T>   inline T Myabs(T a) {     return a > 0 ? a : -a;   }   const int dx[] = {-1, 0, 1, 0};   const int dy[] = {0, 1, 0, -1};   const int inf = 0x3f3f3f3f;   const long long linf = 1LL << 60;   const double pi = acos(-1.0);   const double eps = 1e-9;   const int mod = 100000007;   const int maxn = 10010;   int n, r, c;   char ch[maxn], s[maxn];   void print(int v) {     if (v) {       print((v - 1) / 26);       printf( %c ,  A  + (v - 1) % 26);     }   }   int main() {     scanf( %d , &n);     for (int cas = 1; cas <= n; cas++) {       scanf( %s , ch);       if (sscanf(ch,  R%dC%d , &r, &c) == 2) {         print(c);         printf( %d n , r);       } else {         sscanf(ch,  %[^0-9]%d , s, &r);         int ans = 0;         for (int i = 0; s[i]; i++) ans *= 26, ans += s[i] -  A  + 1;         printf( R%dC%d n , r, ans);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int dp[2][4500005], xl[3005], ans, gd[3005];   void merge(int l, int r) {     if (l == r) return;     int mid = (l + r) >> 1;     merge(l, mid), merge(mid + 1, r);     int i = l, j = mid + 1, dq = l;     while (i <= mid && j <= r) {       if (xl[i] <= xl[j])         gd[dq++] = xl[i++];       else         gd[dq++] = xl[j++], ans += mid - i + 1;     }     for (; i <= mid; ++i) gd[dq++] = xl[i];     for (; j <= r; ++j) gd[dq++] = xl[j];     for (int i = l; i <= r; ++i) xl[i] = gd[i];     return;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 1; i <= n; ++i) scanf( %d , &xl[i]);     merge(1, n);     for (int i = 1; i <= ans; ++i) {       dp[1][i] = dp[0][i - 1] + 1;       dp[0][i] = dp[1][i - 1] + 3;     }     printf( %.6lf , (double)dp[1][ans]);   }
#include <bits/stdc++.h>   using namespace std;   const int N = 203600;   pair<pair<int, int>, int> p[N];   int n;   vector<int> ans;   int main() {     cin >> n;     for (int i = (0); i < (int)(n); i++) {       cin >> p[i].first.first >> p[i].first.second;       p[i].second = i + 1;     }     sort(p, p + n);     for (int i = (0); i < (int)(n); i++) {       int cur = -1e9;       bool ok = 1;       for (int j = (0); j < (int)(n); j++)         if (j != i) {           if (p[j].first.first < cur)             ok = 0;           else             cur = p[j].first.second;         }       if (ok) ans.push_back(p[i].second);     }     sort((ans).begin(), (ans).end());     printf( %d n , (int)ans.size());     for (int i = (0); i < (int)(ans.size()); i++)       printf( %d%s , ans[i], i + 1 == ans.size() ?   n  :    );   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, r1 = -1, p1 = -1, p2 = INT_MAX, x, 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;     long double q = ((long long)(b * p1) / (long double)(a * p2 + b * p1));     q = sqrt(q);     q *= r1;     printf( %.12Lf n , q);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[100005], f[100005], st[100005];   int main() {     int n, top = 0;     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , a + i);     for (int i = n - 1; i >= 0; i--) {       int t = 0;       while (top && a[st[top - 1]] < a[i]) f[i] = t = max(t + 1, f[st[--top]]);       st[top++] = i;     }     printf( %d n , *max_element(f, f + n));   }
#include <bits/stdc++.h>   using namespace std;   map<long long, int> m;   map<long long, int>::iterator it;   int main() {     int n, k, q, a[150001];     cin >> n >> k >> q;     for (int i = 1; i <= n; i++) cin >> a[i];     while (q--) {       int x, y;       cin >> x >> y;       if (x == 1)         m.insert(make_pair(-a[y], y));       else {         int count = 0, p = 1;         if (m.find(-a[y]) == m.end())           p = 0;         else {           for (it = m.begin(); it != m.end(); it++) {             if (it->first == -a[y])               break;             else               count++;             if (count == k) {               p = 0;               break;             }           }         }         if (p)           cout <<  YES n ;         else           cout <<  NO n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   double PI = 3.141592653589793;   vector<complex<double> > duzywek;   vector<complex<double> > duzyret[50][2];   void szykuj() {     for (int j = 0; j < 22; j++) {       for (int i = 1; i <= (1 << (21 - j)); i++) {         duzyret[j][0].push_back(0);         if (j) duzyret[j][1].push_back(0);       }     }   }   int potenga(int v) {     for (int i = 1; 1; i <<= 1) {       if (i >= v) {         return i;       }     }   }   void dft(int nn, int kt, int coile, complex<double> omega, int gdzie, int poz) {     if (nn == 1) {       duzyret[poz][gdzie][0] = duzywek[kt];       return;     }     dft(nn >> 1, kt, coile << 1, omega * omega, 0, poz + 1);     dft(nn >> 1, kt + coile, coile << 1, omega * omega, 1, poz + 1);     complex<double> jeden(1.0, 0.0);     int w = 0;     int an = (nn >> 1) - 1;     for (int i = 0; i < nn; i++) {       duzyret[poz][gdzie][i] =           duzyret[poz + 1][0][i & an] + jeden * duzyret[poz + 1][1][i & an];       jeden *= omega;     }   }   vector<int> fft(vector<int> jed, vector<int> dwa) {     int n1 = potenga(jed.size() + dwa.size());     while (jed.size() < n1) {       jed.push_back(0);     }     while (dwa.size() < n1) {       dwa.push_back(0);     }     complex<double> omega(cos(2.0 * PI / n1), sin(2.0 * PI / n1));     vector<complex<double> > pam;     duzywek.clear();     for (int i = 0; i < n1; i++) {       duzywek.push_back(complex<double>(jed[i], 0.0));     }     dft(n1, 0, 1, omega, 0, 0);     pam = duzyret[0][0];     for (int i = 0; i < n1; i++) {       duzywek[i] = complex<double>(dwa[i], 0.0);     }     dft(n1, 0, 1, omega, 0, 0);     for (int i = 0; i < n1; i++) {       duzywek[i] = pam[i] * duzyret[0][0][i];     }     omega = (complex<double>(1.0, 0.0)) / omega;     dft(n1, 0, 1, omega, 0, 0);     vector<int> retret;     int dowrzucenia;     for (int i = 0; i < n1; i++) {       duzyret[0][0][i] /= n1;       dowrzucenia = round(duzyret[0][0][i].real());       retret.push_back(dowrzucenia);     }     return retret;   }   int n, m;   vector<int> dopo;   vector<int> otrz;   vector<int> wyn;   int x;   int main() {     szykuj();     scanf( %d%d , &n, &m);     while (dopo.size() <= m) {       dopo.push_back(0);     }     dopo[0] = 1;     for (int i = 1; i <= n; i++) {       scanf( %d , &x);       dopo[x] = 1;     }     otrz = fft(dopo, dopo);     while (otrz.size() > m + 1) otrz.pop_back();     for (int i = 1; i < otrz.size(); i++) {       if (otrz[i] && !dopo[i]) {         printf( NO );         return 0;       }       if (otrz[i] == 2) {         wyn.push_back(i);       }     }     printf( YES n );     printf( %d n , (int)wyn.size());     for (int i = 0; i < wyn.size(); i++) {       printf( %d  , wyn[i]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct node {     int x, y;     bool operator<(const node& a) const { return x < a.x || x == a.x && y < a.y; }   };   const int dr[] = {-1, 1, 0, 0, -1, -1, 1, 1};   const int dc[] = {0, 0, -1, 1, -1, 1, -1, 1};   int HH[277];   char s[401000];   int main() {     int n, k;     do {       char _c = getchar(), _v = 1;       for (n = 0; _c < 48 || _c > 57; _c = getchar())         if (_c == 45) _v = -1;       for (; _c >= 48 && _c <= 57;            n = (n << 1) + (n << 3) + _c - 48, _c = getchar())         ;       n *= _v;     } while (0);     do {       char _c = getchar(), _v = 1;       for (k = 0; _c < 48 || _c > 57; _c = getchar())         if (_c == 45) _v = -1;       for (; _c >= 48 && _c <= 57;            k = (k << 1) + (k << 3) + _c - 48, _c = getchar())         ;       k *= _v;     } while (0);     scanf( %s , s);     for (int i = 0; i < n; i++) ++HH[s[i]];     if (n == k) return 0;     char c;     for (c =  a ; c <=  z ; ++c) {       k -= HH[c];       if (k <= 0) {         k += HH[c];         break;       }       HH[c] = 0;     }     int cnt = 0;     for (int i = 0; i < n; i++) {       if (HH[s[i]]) {         if (s[i] != c)           putchar(s[i]);         else {           cnt++;           if (cnt > k) putchar(s[i]);         }       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       int n, m;       cin >> n >> m;       bitset<32> b1(n);       bitset<32> b2(m + 1);       vector<int> a(32), b(32);       for (int i = 0; i < 32; i++) a[i] = b1[31 - i];       for (int i = 0; i < 32; i++) b[i] = b2[31 - i];       long long ans = 0;       for (int i = 0; i < 32; i++) {         if (a[i] == 1 && b[i] == 0)           break;         else           ans += (a[i] ^ b[i]) * pow(2, 31 - i);       }       cout << ans <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1e18;   const int INFi = 2e9;   const int maxN = 1e5 + 5;   const int md = 998244353;   const int md2 = 1e9 + 7;   double getTime() { return clock() / (double)CLOCKS_PER_SEC; };   void solve() {     int m, n;     cin >> m >> n;     vector<pair<int, int>> a(n);     for (int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second;     sort((a).begin(), (a).end());     vector<long long> suf(n + 1);     suf[n] = 0;     suf[n - 1] = a[n - 1].first;     for (int i = n - 2; i >= 0; --i) suf[i] = suf[i + 1] + a[i].first;     long long ans = 0;     for (int i = 0; i < n; ++i) {       long long res = 0;       pair<int, int> kek = {a[i].second, -1};       int l = lower_bound((a).begin(), (a).end(), kek) - a.begin();       l = max(l, n - m);       int cnt = n - l;       res += suf[l];       if (i < l && cnt < m) {         cnt++;         res += a[i].first;       }       res += 1ll * a[i].second * (m - cnt);       ans = max(ans, res);     }     cout << ans <<   n ;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     int tests = 1;     cin >> tests;     for (int _ = 0; _ < tests; ++_) {       solve();     }     return 0;   }
#include <bits/stdc++.h>      const int N = 5010;   const int M = 1 << 20;   const int K = 30;      char s[N];   int vis[K];   bool dp[M];   int cnt[K], l[K], r[K];      int main(){       int n, a, b;       scanf( %d%d%d , &n, &a, &b);       scanf( %s , s);       memset(vis, -1, sizeof(vis));       int id = 0;       for (int i = 0; i < n; ++ i){           if (vis[s[i] -  a ] != -1){               continue;           }           vis[s[i] -  a ] = id;           l[id] = i;           for (int j = i; j < n; ++ j){               if (s[j] == s[i]){                   r[id] = j;                   ++ cnt[id];               }           }           if (1ll * a * (r[id] - l[id] + 1) <= 1ll * cnt[id] * b){               dp[1 << id] = true;           }           ++ id;       }       for (int i = 3; i < (1 << id) - 1; ++ i){           if (__builtin_popcount(i) <= 1){               continue;           }           for (int j = 1; j < id; ++ j){               int x = i & ((1 << j) - 1);               int y = i ^ x;               if (x < i && y < i){                   if (dp[x] && dp[y]){                       dp[i] = true;                       break;                   }               }           }           if (dp[i]){               continue;           }           int left = INT_MAX, right = INT_MIN;           int ccnt = 0;           for (int j = 0; j < id; ++ j){               if (i >> j & 1){                   left = std::min(left, l[j]);                   right = std::max(right, r[j]);                   ccnt += cnt[j];               }           }           if (1ll * a * (right - left + 1) <= 1ll * ccnt * b){               for (int j = 0; j < id; ++ j){                   if (i >> j & 1){                       if (dp[i ^ 1 << j]){                           dp[i] = true;                           break;                       }                   }               }           }       }       dp[0] = true;       std::vector <char> ans;       for (int i = 0; i < 26; ++ i){           if (vis[i] == -1){               continue;           }           if (dp[((1 << id) - 1) ^ (1 << vis[i])]){               ans.emplace_back( a  + i);           }       }       printf( %d , int(ans.size()));       for (auto u : ans){           printf(  %c , u);       }       puts(  );       return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, m;     char a[55][55];     memset(a, 0, sizeof(a));     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         cin >> a[i][j];       }     }     cout << a[1] << endl;     int r[55], c[55], rn = 0, cn = 0;     bool rr[55];     memset(rr, 0, sizeof(rr));     for (int i = 1; i <= n; i++) {       rr[i] = 1;       memset(r, 0, sizeof(r));       memset(c, 0, sizeof(c));       rn = cn = 0;       for (int j = 1; j <= m; j++) {         if (a[i][j] ==  # ) {           c[++cn] = j;           for (int k = i + 1; k <= n; k++) {             if (a[k][j] ==  #  && !rr[k]) {               rr[k] = 1;               r[++rn] = k;             }           }         }       }       for (int j = 1; j <= rn; j++) {         for (int k = 1; k <= cn; k++) {           if (a[r[j]][c[k]] !=  # ) {             cout <<  No n ;             return 0;           }         }         int num = 0;         for (int k = 1; k <= m; k++) {           if (a[r[j]][k] ==  # ) {             num++;           }         }         if (num != cn) {           cout <<  No n ;           return 0;         }       }     }     cout <<  Yes n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 7;   int h;   int a[N];   int sum[N];   int main() {     scanf( %d , &h);     for (int i = 0; i <= h; i++) {       scanf( %d , &a[i]);       sum[i] += sum[i - 1] + a[i];     }     bool check = false;     int pre = 1;     for (int i = 0; i <= h; i++) {       if (a[i] == 1) {         pre = 1;         continue;       } else {         if (pre == 1) {           pre = a[i];           continue;         } else {           check = true;         }       }     }     if (check == false) {       cout <<  perfect ;       return 0;     }     cout <<  ambiguous  << endl;     cout <<  0  ;     for (int i = 1; i <= h; i++) {       for (int j = 1; j <= a[i]; j++) {         cout << sum[i - 2] + 1 <<    ;       }     }     cout << endl;     cout <<  0  ;     for (int i = 1; i <= h; i++) {       for (int j = 1; j <= a[i]; j++) {         if (sum[i - 2] + j <= sum[i - 1])           cout << sum[i - 2] + j <<    ;         else {           cout << sum[i - 2] + 1 <<    ;         }       }     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int a[100010];   int b[100010];   int main() {     cin >> n;     for (int i = 0; i < n; i++) cin >> a[i];     b[0] = 1;     for (int i = 1; i < n; i++)       if (a[i] > a[i - 1])         b[i] = b[i - 1] + 1;       else         b[i] = 1;     int mx = 1;     for (int i = 0; i < n; i++) mx = max(mx, b[i]);     if (mx != n) mx += 1;     int nx = 0;     if (n > 1 && a[0] >= a[1]) {       for (int i = 2; i < n; i++)         if (b[i] == 1) {           mx = max(mx, b[i - 1] + 1);           break;         } else if (i == n - 1)           mx = max(mx, b[n - 1] + 1);     }     for (int i = 1; i < n; i++) {       if (b[i] == 1) {         mx = max(mx, b[i - 1] + nx);         mx = max(mx, b[i - 1] + 1);         if (a[i + 1] - a[i - 1] >= 2)           nx = b[i - 1];         else           nx = 0;       } else if (i == n - 1)         mx = max(mx, b[i] + nx);     }     nx = 0;     for (int i = 0; i < n; i++) {       if (b[i + 1] == 1 && i + 1 < n) {         mx = max(mx, b[i] + nx);         mx = max(mx, b[i] + 1);         if (a[i + 1] - a[i - 1] >= 2)           nx = b[i];         else           nx = 0;       } else if (i + 1 == n)         mx = max(mx, b[i] + nx);     }     cout << mx << endl;     return 0;   }