malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1000000007;   const long long INF = 1000000000;   template <class T>   T read(T &x) {     char c;     int flag = 1;     while ((c = getchar()) <  0  || c >  9 )       if (c ==  - ) flag *= -1;     x = c -  0 ;     while ((c = getchar()) >=  0  && c <=  9 ) x = x * 10 + c -  0 ;     x *= flag;     return x;   }   int dep[100005];   int fa[100005];   vector<int> adj[100005];   void dfs(int x, int f) {     for (int i : adj[x]) {       if (i == f) continue;       fa[i] = x;       dep[i] = dep[x] + 1;       dfs(i, x);     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     int n, k;     cin >> n >> k;     for (int i = 1; i < n; ++i) {       int u, v;       cin >> u >> v;       adj[u].push_back(v);       adj[v].push_back(u);     }     dfs(1, -1);     int root = 1;     for (int i = 1; i <= n; ++i)       if (dep[root] < dep[i]) root = i;     memset(dep, 0, sizeof dep);     ;     dfs(root, -1);     int tar = root;     for (int i = 1; i <= n; ++i)       if (dep[tar] < dep[i]) tar = i;     vector<int> v;     while (tar != root) {       v.push_back(tar);       tar = fa[tar];     }     v.push_back(root);     if (v.size() != (k << 1) + 1) return cout <<  No  << endl, 0;     memset(dep, 0, sizeof dep);     ;     root = v[k];     dfs(root, -1);     for (int i = 1; i <= n; ++i) {       if (dep[i] == k) continue;       int sz = adj[i].size() - 1 + (root == i);       if (sz < 3) return cout <<  No  << endl, 0;     }     cout <<  Yes  << endl;   }
#include <bits/stdc++.h>   using namespace std;   int dp[1003][1003], a[1003];   pair<pair<int, int>, int> from[1003][1003];   vector<pair<int, int> > sol;   int main() {     int N;     cin >> N;     for (int i = 1; i <= N; i++) cin >> a[i];     if (N % 2 == 0) {       N++;       a[N] = 0;     }     memset(dp, 0x3f3f3f3f, sizeof(dp));     dp[1][1] = 0;     for (int i = 3; i <= N; i += 2) {       for (int j = 1; j <= i - 2; j++) {         if (dp[i - 2][j] + max(a[j], a[i - 1]) < dp[i][i]) {           dp[i][i] = dp[i - 2][j] + max(a[j], a[i - 1]);           from[i][i] = make_pair(make_pair(j, i - 1), j);         }         if (dp[i - 2][j] + max(a[j], a[i]) < dp[i][i - 1]) {           dp[i][i - 1] = dp[i - 2][j] + max(a[j], a[i]);           from[i][i - 1] = make_pair(make_pair(j, i), j);         }         if (dp[i - 2][j] + max(a[i], a[i - 1]) < dp[i][j])           ;         {           dp[i][j] = dp[i - 2][j] + max(a[i], a[i - 1]);           from[i][j] = make_pair(make_pair(i, i - 1), j);         }       }     }     int best = 0x3f3f3f3f, missing;     for (int i = 1; i <= N; i++)       if (dp[N][i] + a[i] < best) {         best = dp[N][i] + a[i];         missing = i;       }     printf( %d n , best);     if (a[missing]) sol.push_back(make_pair(missing, 0));     int start = N;     while (start != 1) {       int x2 = from[start][missing].first.first;       int x3 = from[start][missing].first.second;       sol.push_back(make_pair(x2, x3));       missing = from[start][missing].second;       start -= 2;     }     for (int i = sol.size() - 1; i >= 0; i--) {       if (sol[i].second)         printf( %d %d n , sol[i].first, sol[i].second);       else         printf( %d n , sol[i].first);     }   }
#include <bits/stdc++.h>   using namespace std;   const int MAXN = 2e5 + 10;   int bit[MAXN + 100], ans[MAXN], _pos[MAXN];   vector<pair<int, int> > _query[MAXN];   vector<int> d[MAXN];   void upd(int id) {     for (; id <= MAXN; id += id & (-id)) bit[id]++;     return;   }   int get(int id) {     int now = 0;     for (; id > 0; id = id & (id - 1)) now += bit[id];     return now;   }   int main() {     ios::sync_with_stdio(0);     int n, q;     cin >> n >> q;     for (int i = 0; i < n; i++) {       int x;       cin >> x;       _pos[x] = i + 1;     }     for (int i = 0; i < q; i++) {       int x, y;       cin >> x >> y;       _query[y].push_back({i, x});     }     for (int i = 1; i <= n; i++)       for (int j = i; j <= n; j += i)         d[max(_pos[i], _pos[j])].push_back(min(_pos[i], _pos[j]));     for (int i = 1; i <= n; i++) {       for (auto j : d[i]) upd(j);       for (auto j : _query[i]) ans[j.first] = get(i) - get(j.second - 1);     }     for (int i = 0; i < q; i++) cout << ans[i] <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(0);     int q, n;     cin >> q;     while (q--) {       cin >> n;       vector<int> a(1 + n), answer(1 + n, 0);       map<int, unordered_set<int> > m;       vector<bool> vis(n + 1, false);       for (int i = 1; i <= n; ++i) {         cin >> a[i];       }       for (int i = 1; i <= n; ++i) {         if (!vis[i]) {           int j = i;           vis[i] = true;           while (a[j] != i) {             m[i].insert(j);             j = a[j];             vis[j] = true;           }           m[i].insert(j);         }       }       for (auto p : m) {         int temp = p.second.size();         answer[p.first] = temp;         for (auto r : p.second) {           answer[r] = temp;         }       }       for (int i = 1; i <= n; ++i) cout << answer[i] <<    ;       cout <<   n ;     }     return 0;   }
#include <bits/stdc++.h>   #include<unordered_set>   using namespace std;   #define ll long long int   #define f1(i,n) for(i=0;i<n;i++)   #define f2(i,a,n) for(i=n-1;i>=a;i--)   #define f3(i,a,n) for(i=a;i<n;i++)   #define vl vector<long long int>   #define um unordered_map<ll,ll>   #define us unordered_set<ll>   #define pb push_back   #define mp make_pair   #define sv(v) sort(v.begin(),v.end())   #define rv(v) reverse(v.begin(),v.end())   #define sa(v,n) sort(v,v+n)   #define ra(v,n) sort(v,v+n,greater<int>())   #define mod 1000000007         void solution(){    ll k{},kg{},l{},h{},r{},u{},n=0,m{},p{},x=0,y{},o=0,sum=0,sum1{},pos{},ch=0,c1=0,c2=0,i=0,j=0,ans=0,a{},b=0,c=0,i1,i2,p1,q,d=0,w,result{},avg{};    string s,s1,s2;    cin>>n;    vl v,v1;    //map<ll,ll> mp;    f1(i,n){     cin>>x;     if(x%2==0) v.pb(x);     else v1.pb(x);         }    f1(i,v.size()) cout<<v[i]<<   ;    f1(i,v1.size()) cout<<v1[i]<<   ;    cout<<endl;       }   //nobody read comments!   int main() {    ios_base::sync_with_stdio(false);       cin.tie(NULL);    ll t=1;       cin>>t;       while(t--)       solution();       return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main(int argc, char const *argv[]) {     long long n, m, k, l;     scanf( %lld%lld%lld%lld , &n, &m, &k, &l);     n /= m;     m = (m + k + l - 1) / m;     printf( %lld n , (n >= m) ? m : -1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> even_bag, odd_bag;     int n, all, x;     cin >> n;     for (int i = 0; i < n; i++) {       cin >> x;       all += x;       if (x & 1)         odd_bag.push_back(x);       else         even_bag.push_back(x);     }     cout << ((all & 1) ? odd_bag.size() : even_bag.size()) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int NMAX = 1e5 + 7;   long long n, a[NMAX], b[NMAX];   long long dp[NMAX];   struct linija {     long long a, b;   };   linija c[NMAX];   int sz, cur;   double prijesek_x(int i, int j) {     return (double)(c[i].b - c[j].b) / (c[j].a - c[i].a);   }   void dodaj(linija L) {     c[sz].a = L.a;     c[sz].b = L.b;     while (sz >= 2 && prijesek_x(sz, sz - 1) <= prijesek_x(sz - 1, sz - 2)) {       c[sz - 1].a = c[sz].a;       c[sz - 1].b = c[sz].b;       sz--;     }     sz++;   }   long long dobij(int ide) {     while (cur + 1 < sz && (double)ide > prijesek_x(cur, cur + 1)) cur++;     return 1LL * c[cur].a * ide + 1LL * c[cur].b;   }   int main() {     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]);     for (int i = 1; i <= n; i++) scanf( %I64d , &b[i]);     linija L = {b[1], 0};     dodaj(L);     for (int i = 2; i <= n; i++) {       dp[i] = dobij(a[i]);       linija L = {b[i], dp[i]};       dodaj(L);     }     printf( %I64d n , dp[n]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long power(long long x, long long y, long long m);   long long modInverse(long long n, long long m);   long long nCr(long long n, long long r, long long m);   long long ceiling(long long x, long long y);   bool sortbyth(const tuple<long long, int, int>& a,                 const tuple<long long, int, int>& b) {     if (get<0>(a) != get<0>(b))       return get<0>(a) > get<0>(b);     else       return get<1>(a) < get<1>(b);   }   int dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};   int dy[] = {-1, 0, 1, 1, 1, 0, -1, -1};   void aksayushx() {     string s;     cin >> s;     int n = s.length();     stack<pair<int, int>> st;     for (int i = 0; i < n; i++) {       if (s[i] ==  0  && (!st.empty() && st.top().first ==  1 ))         st.pop();       else         st.push({s[i], i});     }     while (!st.empty()) {       s[st.top().second] =  0 ;       st.pop();     }     cout << s <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     int t = 1;     while (t--) aksayushx();     return 0;   }   long long power(long long x, long long y, long long m) {     long long res = 1;     x = x % m;     if (x == 0) return 0;     while (y > 0) {       if (y & 1) res = (res * x) % m;       y = y >> 1;       x = (x * x) % m;     }     return res;   }   long long modInverse(long long n, long long m) { return power(n, m - 2, m); }   long long ceiling(long long x, long long y) { return (x + y - 1) / y; }
#include <bits/stdc++.h>   using namespace std;   long long n, m;   const long long inf = 0x3f3f3f3f;   const long long size = 100000;   struct data {     long long id, step;     long long x, y, z;     data(){};     data(long long u, long long v) : id(u), step(v){};     data(long long a, long long b, long long c) : x(a), y(b), z(c){};     bool operator<(const data& p) const { return step > p.step; }   };   priority_queue<data> q;   vector<pair<long long, long long> > ve[size + 10];   vector<data> edge;   vector<data> res;   long long dist[size + 10];   long long path[size + 10];   long long TT[size + 10];   bool vis[size + 10];   void init() {     memset(dist, inf, sizeof(dist));     memset(vis, false, sizeof(vis));     memset(path, -1, sizeof(path));     memset(TT, -1, sizeof(TT));     for (int i = 0; i <= n; i++) {       ve[i].clear();     }     edge.clear();     res.clear();     while (!q.empty()) q.pop();   }   void dij() {     dist[1] = 0;     q.push(data(1, dist[1]));     while (!q.empty()) {       data temp = q.top();       q.pop();       if (vis[temp.id])         continue;       else         vis[temp.id] = true;       if (temp.id == n) return;       for (auto u : ve[temp.id]) {         long long v = u.first;         long long color = u.second;         if (!vis[v] && dist[temp.id] + color < dist[v]) {           dist[v] = dist[temp.id] + color;           TT[v] = temp.id;           q.push(data(v, dist[v]));         }       }     }   }   int main() {     long long x, y, z;     init();     cin >> n >> m;     for (int i = 0; i < m; i++) {       cin >> x >> y >> z;       ve[x].push_back(make_pair(y, !z + size));       ve[y].push_back(make_pair(x, !z + size));       edge.push_back(data(x, y, !z + size));     }     dij();     long long pre = n;     while (pre != 1) {       path[pre] = TT[pre];       pre = TT[pre];     }     for (int i = 0; i < m; i++) {       x = edge[i].x;       y = edge[i].y;       z = edge[i].z;       if (path[x] == y || path[y] == x) {         if (z == size + 1) {           res.push_back(data(x, y, 1LL));         }       } else {         if (z == size) {           res.push_back(data(x, y, 0LL));         }       }     }     cout << res.size() << endl;     for (auto i : res) {       cout << i.x <<     << i.y <<     << i.z << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<int, int> > v;   int main(void) {     int n, m, a, b;     scanf( %d%d , &n, &m);     for (int i = 0; i < m; i++) {       scanf( %d%d , &a, &b);       v.push_back(make_pair(b, a));     }     sort(v.rbegin(), v.rend());     long long ans = 0;     int i = 0;     while (n) {       int del = min(n, v[i].second);       ans += (long long)del * v[i].first;       n -= del;       i++;       if (i == v.size()) break;     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   using namespace std;   long long read() {     long long x = 0, F = 1;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) F = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) {       x = (x << 3) + (x << 1) + c -  0 ;       c = getchar();     }     return x * F;   }   int add(int a, int b) { return (a + b >= 51123987) ? a + b - 51123987 : a + b; }   int dec(int a, int b) { return (a - b < 0) ? a - b + 51123987 : a - b; }   int mul(long long a, int b) { return 1LL * a * b % 51123987; }   int ans, Tk, n, L[2000000 + 5], R[2000000 + 5], ecnt, head[2000000 + 5];   char s[2000000 + 5];   struct edge {     int to, nxt, c;   } e[2000000 + 5];   void add(int u, int v, int c) {     e[++ecnt] = (edge){v, head[u], c};     head[u] = ecnt;   }   struct Palindromic_Tree {     int dep[2000000 + 5], fa[2000000 + 5], len[2000000 + 5];     int lst, tot;     void init() {       memset(head, 0, sizeof(head));       ecnt = 0;       memset(fa, 0, sizeof(fa)), memset(len, 0, sizeof(len)),           memset(dep, 0, sizeof(dep));       tot = 0, lst = 0;       len[++tot] = -1;       fa[0] = fa[1] = 1;     }     int get_id(int x, int c) {       for (int i = head[x]; i; i = e[i].nxt)         if (e[i].c == c) return e[i].to;       return 0;     }     void Insert(int c, int L) {       int p = lst;       while (s[L - len[p] - 1] != s[L]) p = fa[p];       if (!get_id(p, c)) {         int np = ++tot, k = fa[p];         len[np] = len[p] + 2;         while (s[L - len[k] - 1] != s[L]) k = fa[k];         fa[np] = get_id(k, c);         dep[np] = dep[fa[np]] + 1;         add(p, np, c);       }       lst = get_id(p, c);     }   } T;   int main() {     n = read();     scanf( %s , s + 1);     T.init();     for (int i = 1; i <= n; i++) {       T.Insert(s[i] -  a , i);       L[i] = T.dep[T.lst];       ans = add(ans, L[i]);     }     ans = mul(1LL * ans * (ans - 1) / 2, 1);     T.init();     reverse(s + 1, s + n + 1);     for (int i = n; i >= 1; i--) {       T.Insert(s[n - i + 1] -  a , n - i + 1);       R[i] = T.dep[T.lst];       R[i] = add(R[i], R[i + 1]);     }     for (int i = 1; i < n; i++) ans = dec(ans, mul(L[i], R[i + 1]));     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline void read(T &x) {     char ch;     bool flag = false;     while (!isdigit(ch = getchar())) flag |= ch ==  - ;     for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48))       ;     if (flag) x = -x;   }   inline int input() {     int x;     char ch;     bool flag = false;     while (!isdigit(ch = getchar())) flag |= ch ==  - ;     for (x = ch ^ 48; isdigit(ch = getchar()); x = x * 10 + (ch ^ 48))       ;     return flag ? -x : x;   }   const int mod = 1e9 + 7;   inline int add(int x, int y) {     x += y;     return x >= mod ? x - mod : x;   }   inline void inc(int &x, int y) {     x += y;     x -= x >= mod ? mod : 0;   }   inline int Power(int x, int y) {     int res = 1;     while (y) {       if (y & 1) res = (long long)res * x % mod;       x = (long long)x * x % mod, y >>= 1;     }     return res;   }   template <class T>   void chkmax(T &x, T y) {     x = x > y ? x : y;   }   template <class T>   void chkmin(T &x, T y) {     x = x < y ? x : y;   }   template <class T>   T gcd(T x, T y) {     return !y ? x : gcd(x % y, y);   }   int n, a[300005];   int cnt[300005 << 1];   int lmax[300005], lmin[300005], rmax[300005], rmin[300005];   long long ans;   void divide(int l, int r) {     if (l == r) return void();     int mid = l + r >> 1;     divide(l, mid), divide(mid + 1, r);     rmin[mid] = INT_MAX, rmax[mid] = 0;     lmin[mid + 1] = INT_MAX, lmax[mid + 1] = 0;     for (int i = mid; i >= l; --i) {       lmin[i] = min(lmin[i + 1], a[i]);       lmax[i] = max(lmax[i + 1], a[i]);     }     for (int i = mid + 1; i <= r; ++i) {       rmin[i] = min(rmin[i - 1], a[i]);       rmax[i] = max(rmax[i - 1], a[i]);     }     for (int i = mid, lp = mid + 1, rp = mid + 1; i >= l; --i) {       int pos = lmax[i] - lmin[i] + i;       if (pos > mid && pos <= r && rmin[pos] > lmin[i] && rmax[pos] < lmax[i])         ++ans;       while (lp <= r && rmax[lp] < lmax[i]) --cnt[300005 + rmax[lp] - lp], ++lp;       while (rp <= r && rmin[rp] > lmin[i]) ++cnt[300005 + rmax[rp] - rp], ++rp;       if (lp < rp) ans += cnt[300005 + lmin[i] - i];     }     for (int i = mid + 1; i <= r; ++i) cnt[300005 + rmax[i] - i] = 0;     for (int i = mid + 1, lp = mid, rp = mid; i <= r; ++i) {       int pos = rmin[i] - rmax[i] + i;       if (pos >= l && pos <= mid && lmin[pos] > rmin[i] && lmax[pos] < rmax[i])         ++ans;       while (lp >= l && lmin[lp] > rmin[i]) ++cnt[lmax[lp] + lp], --lp;       while (rp >= l && lmax[rp] < rmax[i]) --cnt[lmax[rp] + rp], --rp;       if (lp < rp) ans += cnt[rmin[i] + i];     }     for (int i = l; i <= mid; ++i) cnt[lmax[i] + i] = 0;   }   int main() {     ios::sync_with_stdio(false);     cin >> n, ans = n;     for (int i = 1; i <= n; ++i) {       int x, y;       cin >> x >> y;       a[x] = y;     }     divide(1, n);     printf( %lld n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve(long long cno) {     long long n, i, j, k;     cin >> n;     long long arr[n];     for (i = 0; i < n; i++) {       cin >> arr[i];     }     if (n < 3) {       cout << 0 << endl;       for (auto x : arr) {         cout << x <<    ;       }       return;     }     sort(arr, arr + n);     long long ans[n];     long long ptr = 0;     for (i = 1; i < n; i += 2) {       ans[i] = arr[ptr++];     }     for (i = 0; i < n; i += 2) {       ans[i] = arr[ptr++];     }     cout << (n - 1) / 2 << endl;     for (auto x : ans) {       cout << x <<    ;     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long TESTS = 1;     long long i = 1;     while (TESTS--) {       solve(i);       i++;     }     return 0;   }
#include <bits/stdc++.h>   double A[200000], B[200000];   int i, j, n, m;   double p;   int main() {     scanf( %d , &n);     for (i = 1; i <= n; i++) {       scanf( %lf , &p);       B[i] = p * (B[i - 1] + 1);       A[i] = (A[i - 1] + 2 * B[i - 1] + 1) * p + (1 - p) * A[i - 1];     }     printf( %.9lf n , A[n]);   }
//#include<ext/pb_ds/assoc_container.hpp>   //#include<ext/pb_ds/hash_policy.hpp>   #include<bits/stdc++.h>   #define closeSync ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)   #define multiCase int T;cin>>T;for(int t=1;t<=T;t++)   #define rep(i,a,b) for(int i=(a);i<=(b);i++)   #define repp(i,a,b) for(int i=(a);i<(b);i++)   #define per(i,a,b) for(int i=(a);i>=(b);i--)   #define perr(i,a,b) for(int i=(a);i>(b);i--)   #define pb push_back   #define eb emplace_back   #define mst(a,b) memset(a,b,sizeof(a))   using namespace std;   //using namespace __gnu_pbds;   typedef long long ll;   typedef unsigned long long ull;   typedef pair<int,int> P;   const int INF=0x3f3f3f3f;   const ll LINF=0x3f3f3f3f3f3f3f3f;   const double eps=1e-12;   const double PI=acos(-1.0);   const double angcst=PI/180.0;   const ll mod=998244353;   ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}   ll qmul(ll a,ll b){ll r=0;while(b){if(b&1)r=(r+a)%mod;b>>=1;a=(a+a)%mod;}return r;}   ll qpow(ll a,ll n){ll r=1;while(n){if(n&1)r=(r*a)%mod;n>>=1;a=(a*a)%mod;}return r;}   ll qpow(ll a,ll n,ll p){ll r=1;while(n){if(n&1)r=(r*a)%p;n>>=1;a=(a*a)%p;}return r;}      map<int,char> mp;      void solve()   {       int n;       cin>>n;       while(n--)       {           int r=0;           rep(i,1,5)           {               int d;cin>>d;               r=r*10+d;           }           cout<<mp[r];       }   }   int main()   {       closeSync;       mp[10010]= a ;    mp[11020]= b ;    mp[20011]= c ;    mp[21012]= d ;    mp[11011]= e ;    mp[21021]= f ;    mp[22022]= g ;    mp[12021]= h ;    //mp[11011]= i ;    mp[12012]= j ;    mp[10120]= k ;    mp[11130]= l ;    mp[20121]= m ;    mp[21122]= n ;    mp[11121]= o ;    mp[21131]= p ;    mp[22132]= q ;    mp[12131]= r ;    //mp[11121]= s ;    mp[12122]= t ;    mp[10221]= u ;    mp[11231]= v ;    mp[12113]= w ;    mp[20222]= x ;    mp[21223]= y ;    mp[11222]= z ;       //multiCase       {           solve();       }       return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline T read(register T& t) {     register T f = 1;     register char ch = getchar();     t = 0;     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -f;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) t = t * 10 + ch -  0 , ch = getchar();     t *= f;     return t;   }   template <typename T, typename... Args>   inline void read(T& t, Args&... args) {     read(t);     read(args...);   }   const long long p = 998244353;   inline long long power(register long long x, register long long k = p - 2) {     register long long re = 1;     for (; k; k >>= 1, x = x * x % p)       if (k & 1) re = re * x % p;     return re;   }   int n;   int a[300005];   struct ST {     int lg[300005];     int val[300005];     int st[300005][20];     inline int Max(int x, int y) {       if (val[x] < val[y]) return y;       return x;     }     ST() {       lg[1] = 0;       for (int i = 2; i <= 300000; i++) lg[i] = lg[i >> 1] + 1;     }     void build(int* x, int n, int type) {       for (int i = 1; i <= n; i++) val[i] = x[i] * type;       for (int i = 1; i <= n; i++) st[i][0] = i;       for (int i = 1; i < 20; i++)         for (int j = 1; j + (1 << i) - 1 <= n; j++)           st[j][i] = Max(st[j][i - 1], st[j + (1 << i - 1)][i - 1]);     }     inline int ask(int l, int r) {       int len = lg[r - l + 1];       return Max(st[l][len], st[r - (1 << len) + 1][len]);     }   } L0, R0;   int l_lim[300005], r_lim[300005];   int l[300005][20], r[300005][20];   int main() {     read(n);     if (n == 1) return printf( 0 ), 0;     for (int i = 1; i <= n; i++) read(a[i]), a[n + i] = a[n + n + i] = a[i];     for (int i = 1; i <= n * 3; i++)       l_lim[i] = max(1, i - a[i]), r_lim[i] = min(n * 3, i + a[i]);     L0.build(l_lim, n * 3, -1);     R0.build(r_lim, n * 3, 1);     for (int i = 1; i <= n * 3; i++) l[i][0] = l_lim[i], r[i][0] = r_lim[i];     for (int i = 1; i < 20; i++)       for (int j = 1; j <= n * 3; j++) {         int L = L0.ask(l[j][i - 1], r[j][i - 1]);         int R = R0.ask(l[j][i - 1], r[j][i - 1]);         l[j][i] = min(l[L][i - 1], l[R][i - 1]);         r[j][i] = max(r[L][i - 1], r[R][i - 1]);       }     for (int i = n + 1; i <= n + n; i++) {       int ans = 0;       int x = i, y = i;       for (int j = 20 - 1; j >= 0; j--) {         if (max(r[x][j], r[y][j]) - min(l[x][j], l[y][j]) + 1 >= n) continue;         int tx = x, ty = y;         x = L0.ask(l[tx][j], r[ty][j]);         y = R0.ask(l[tx][j], r[ty][j]);         ans += (1 << j);       }       printf( %d  , ans + 1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int array[n];     for (int i = 0; i < n; i++) {       cin >> array[i];     }     if (n == 1) {       cout << 1 << endl;       return 0;     }     int Count = 1;     vector<int> vec;     for (int i = 0; i < n - 1; i++) {       if (array[i] < array[i + 1]) {         Count++;       } else if (array[i] >= array[i + 1]) {         vec.push_back(Count);         Count = 1;       }       if (i == n - 2) {         vec.push_back(Count);       }     }     cout << *max_element(vec.begin(), vec.end());     return 0;   }