malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   #pragma comment(linker,  /STACK:500000000 )   using namespace std;   bool isq[22 * 22 * 22 * 22];   bool isSquare(int n) { return isq[n]; }   int main() {     int n, m;     cin >> n >> m;     for (int i = 1; i <= 22 * 22; i++) isq[i * i] = true;     for (int columnLine = 0; columnLine <= m; columnLine++) {       for (int rowLine = 0; rowLine <= n; rowLine++) {         for (int aValue = 1; aValue <= 22; aValue++)           for (int bValue = 1; bValue <= 22; bValue++)             for (int cValue = 1; cValue <= 22; cValue++)               for (int dValue = 1; dValue <= 22; dValue++) {                 int sqA = aValue * aValue;                 int sqB = bValue * bValue;                 int sqC = cValue * cValue;                 int sqD = dValue * dValue;                 if (isSquare(columnLine * sqA + (m - columnLine) * sqB) &&                     isSquare(columnLine * sqC + (m - columnLine) * sqD) &&                     isSquare(rowLine * sqA + (n - rowLine) * sqC) &&                     isSquare(rowLine * sqB + (n - rowLine) * sqD)) {                   for (int i = 0; i < n; i++) {                     for (int j = 0; j < m; j++) {                       if (i < rowLine && j < columnLine)                         printf( %d  , aValue);                       else if (i < rowLine && j >= columnLine)                         printf( %d  , bValue);                       else if (i >= rowLine && j < columnLine)                         printf( %d  , cValue);                       else                         printf( %d  , dValue);                     }                     puts(  );                   }                   return 0;                 }               }       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long int t;     cin >> t;     while (t--) {       long long int n;       string s;       cin >> n >> s;       map<long long int, vector<long long int>> mp;       for (long long int i = 0; i < s.size(); i++) {         mp[s[i] -  0 ].push_back(i);       }       vector<long long int> ans(n + 1, 0);       long long int las = -1;       for (auto x : mp) {         vector<long long int> v = x.second;         long long int cnt = 0;         for (long long int i = 0; i < v.size(); i++) {           if (v[i] > las) {             ans[v[i]] = 1;             cnt++;             las = v[i];           }         }         if (cnt != v.size()) {           break;         }       }       vector<long long int> ck;       for (long long int i = 0; i < n; i++) {         if (ans[i] == 1) {           ck.push_back(s[i] -  0 );         }       }       for (long long int i = 0; i < n; i++) {         if (ans[i] != 1) {           ck.push_back(s[i] -  0 );         }       }       long long int f = 0;       for (long long int i = 1; i < n; i++) {         if (ck[i] < ck[i - 1]) {           f = 1;           break;         }       }       if (f == 1) {         cout <<  -  << endl;       } else {         string str;         for (long long int i = 0; i < n; i++) {           if (ans[i] == 0) {             str +=  2 ;           } else {             str +=  1 ;           }         }         cout << str << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   int min(int a, int b) { return a < b ? a : b; }   int n, m, t1, t2, val[1024];   long long ans;   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) {       scanf( %d , &val[i]);     }     for (int i = 1; i <= m; i++) {       scanf( %d%d , &t1, &t2);       ans += min(val[t1], val[t2]);     }     printf( %lld , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n;     cin >> n;     vector<long long> arr(n);     for (int i = 0; i < n; i++) {       cin >> arr[i];     }     long long c = 0;     for (int i = 0; i < n; i++) {       c += arr[i] - 1;       if (c % 2 == 0)         cout << 2 <<   n ;       else         cout << 1 <<   n ;     }   }   int main() {     ios_base::sync_with_stdio(false), cin.tie(nullptr);     long long T;     T = 1;     for (int t = 0; t < T; t++) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char cross[101][101];   int main() {     int n;     while (cin >> n) {       for (int i = 0; i < n; i++)         for (int j = 0; j < n; j++) cin >> cross[i][j];       int ok = 0;       for (int i = 1; i < n - 1; i++) {         for (int j = 1; j < n - 1; j++) {           if (cross[i][j] ==  # ) {             if (cross[i][j] ==  #  && cross[i - 1][j] ==  #  &&                 cross[i][j - 1] ==  #  && cross[i][j + 1] ==  #  &&                 cross[i + 1][j] ==  # ) {               cross[i][j] =  a ;               cross[i - 1][j] =  a ;               cross[i][j - 1] =  a ;               cross[i][j + 1] =  a ;               cross[i + 1][j] =  a ;             }           }         }       }       for (int i = 0; i < n; i++)         for (int j = 0; j < n; j++)           if (cross[i][j] ==  # ) {             ok = 1;             break;             break;           }       if (ok == 0)         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct no {     int r;     int l;     int p;   };   int main() {     int n;     double v;     double a[110];     double b[110];     cin >> n >> v;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     for (int i = 0; i < n; i++) {       cin >> b[i];       if (b[i] == 0) {         cout << 0.0 << endl;         return 0;       }     }     double cu = a[0], ni = b[0];     double aa = 0;     for (int i = 1; i < n; i++) {       if (b[i] / a[i] < ni / cu) {         cu = a[i];         ni = b[i];       }     }     aa = ni / cu;     double ans = 0;     for (int i = 0; i < n; i++) ans += aa * a[i];     if (ans > v) ans = v;     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   typedef long long ll;   #define f(i,a,b) for(i=a;i<b;i++)      using namespace std;      int main()   {       ll n,i,sum=0, count=0;       cin>>n;       vector<ll> a(n);       f(i,0,n) cin>>a[i];       priority_queue <int, vector<int>, greater<int>> p;       f(i,0,n){           if(a[i]>=0) sum+=a[i], count++;           else{                              if(sum+a[i]>=0){                 sum+=a[i], count++;                  p.push(a[i]);               }                else{                   if(!p.empty()&&p.top()<a[i]){                     sum-=p.top();                     p.pop();                     sum+=a[i];                     p.push(a[i]);                   }                }           }       }       cout<<count<<endl;          return 0;   }
#include <bits/stdc++.h>   using namespace std;   int ml, mr, wl, wr;   int main() {     cin >> ml >> mr >> wl >> wr;     if ((ml * 2 + 3 > wr && wr >= ml - 1) || (mr * 2 + 3 > wl && wl >= mr - 1)) {       cout <<  YES ;       return 0;     } else {       cout <<  NO ;       return 0;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   struct que {     int l, r, y, val;     bool operator<(const que &v) const { return y < v.y; }   };   int n, k, x[100010], y[100010], cnt[100010 * 2], pre[100010 * 2];   long long ans[100010];   vector<que> q;   vector<int> h;   int main() {     scanf( %d%d , &n, &k);     for (int i = 1; i <= n; i++) scanf( %d%d , &x[i], &y[i]);     for (int i = 1; i <= 2 * n; i++) pre[i] = -0x3f3f3f3f;     h.push_back(-0x3f3f3f3f);     for (int i = 1; i <= n; i++) {       h.push_back(x[i]);       h.push_back(x[i] + k);     }     sort(h.begin(), h.end());     h.resize(unique(h.begin(), h.end()) - h.begin());     for (int i = 1, l, r; i <= n; i++) {       l = upper_bound(h.begin(), h.end(), x[i]) - h.begin();       r = lower_bound(h.begin(), h.end(), x[i] + k) - h.begin();       q.push_back({l, r, y[i], 1});       q.push_back({l, r, y[i] + k, -1});     }     sort(q.begin(), q.end());     for (auto i : q)       for (int j = i.l; j <= i.r; j++) {         ans[cnt[j]] += 1ll * (h[j] - h[j - 1]) * (i.y - pre[j]);         cnt[j] += i.val;         pre[j] = i.y;       }     for (int i = 1; i <= n; i++) printf( %lld  , ans[i]);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ii = pair<int, int>;   using vi = vector<int>;   using vll = vector<ll>;   using vii = vector<ii>;   const ll MOD = 998244353;   const ll INF = 1e15 + 9;   const int MAXN = 1000006;   int n, m, a[MAXN], p[MAXN], b[MAXN];   int ind[MAXN], seen[MAXN];   ll dp[MAXN], sum[MAXN], negsum[MAXN];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> n;     ++n;     for (int i = 1; i < n; ++i) cin >> a[i];     for (int i = 1; i < n; ++i) cin >> p[i];     cin >> m;     ++m;     for (int i = 1; i < m; ++i) cin >> b[i];     a[n] = n;     b[m] = n;     ++n, ++m;     for (int i = 0, j = 0; i < m; ++i) {       while (j < b[i]) ind[j++] = 2 * i - 1;       ind[j++] = 2 * i;     }     for (int i = 0; i < n; ++i) {       a[i] = ind[a[i]];       sum[i] = sum[seen[a[i]]] + max(p[i], 0);       negsum[i + 1] = negsum[i] + min(p[i], 0);       seen[a[i]] = i;     }     memset(seen, -1, sizeof seen);     seen[0] = 0;     for (int i = 1; i < n; ++i) {       dp[i] = INF;       if ((a[i] & 1) == 0) {         if (seen[a[i] - 2] != -1) {           dp[i] = dp[seen[a[i] - 2]] + sum[seen[a[i] - 1]] + sum[seen[a[i]]] +                   negsum[i] - negsum[seen[a[i] - 2] + 1];           if (seen[a[i]] != -1)             dp[i] = min(dp[i],                         dp[seen[a[i]]] + negsum[i + 1] - negsum[seen[a[i]] + 1]);         }       }       seen[a[i]] = i;     }     if (dp[n - 1] >= INF / 2)       cout <<  NO n ;     else       cout <<  YES n  << dp[n - 1] <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   inline T checkmin(T &a, T b) {     return (a < b) ? a : a = b;   }   template <class T>   inline T checkmax(T &a, T b) {     return (a > b) ? a : a = b;   }   template <class T>   T GCD(T a, T b) {     if (a < 0) return GCD(-a, b);     if (b < 0) return GCD(a, -b);     return (a == 0) ? b : GCD(b % a, a);   }   template <class T>   T LCM(T a, T b) {     if (a < 0) return LCM(-a, b);     if (b < 0) return LCM(a, -b);     return (a == 0 || b == 0) ? 0 : a / GCD(a, b) * b;   }   template <class T>   T ExtGCD(T a, T b, T &x, T &y) {     if (a < 0) {       T c = ExtGCD(-a, b, x, y);       x = -x;       return c;     }     if (b < 0) {       T c = ExtGCD(a, -b, x, y);       y = -y;       return c;     }     if (a == 0) {       x = 0, y = 1;       return b;     } else {       T c = ExtGCD(b % a, a, y, x);       x -= b / a * y;       return c;     }   }   template <class T>   inline T sqr(T X) {     return X * X;   }   class TUFSet {    private:     vector<int> S;       public:     TUFSet() {}     TUFSet(int N) { S = vector<int>(N, -1); }     int Find(int X) { return S[X] < 0 ? X : (S[X] = Find(S[X])); }     void Union(int X, int Y) {       X = Find(X);       Y = Find(Y);       if (X == Y) return;       if (S[X] < S[Y])         S[Y] = X;       else {         if (S[X] == S[Y]) --S[Y];         S[X] = Y;       }     }   };   namespace Poor {   int N, M, K;   TUFSet UFS;   vector<int> D;   void Run() {     scanf( %d%d%d , &N, &M, &K);     UFS = TUFSet(N);     for (int i = 0; i < M; ++i) {       int U, V;       scanf( %d%d , &U, &V);       --U, --V;       UFS.Union(U, V);     }     int Ans = 1 % K;     int C = 0;     D = vector<int>(N, 0);     for (int i = 0; i < N; ++i) {       ++D[UFS.Find(i)];       if (UFS.Find(i) == i) ++C;     }     if (C > 1) {       for (int i = 0; i < C - 2; ++i) Ans = ((long long)Ans * N) % K;       for (int i = 0; i < N; ++i)         if (D[i] > 0) Ans = ((long long)Ans * D[i]) % K;     }     printf( %d n , Ans);   }   }  // namespace Poor   int main() {     Poor::Run();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   int a[1000005];   map<int, int> ht;   map<int, int>::reverse_iterator its;   long long mul(long long a, long long b) {     long long res = 1;     while (b) {       if (b % 2 == 1) res = (res * a) % mod;       a = (a * a) % mod;       b /= 2;     }     return res;   }   int main() {     int n;     scanf( %d , &n);     long long nf = 1;     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       ht[a[i]]++;       nf = (nf * i) % mod;     }     int add = 0;     long long ans = 0;     for (its = ht.rbegin(); its != ht.rend(); its++) {       if (add != 0)         ans = (ans + nf * its->second % mod *                          mul((its->second + add) % mod, mod - 2) % mod *                          its->first % mod) %               mod;       add += its->second;     }     printf( %lld n , ans);   }
#include <bits/stdc++.h>   #pragma GCC optimize( unroll-loops )   using namespace std;   const long long N = 2e5 + 36;   const long long M = 1e3 + 36;   const long long INF = 2e9 + 7;   const long long MOD = 987654323;   const int X[8] = {1, 1, -1, -1, 2, 2, -2, -2};   const int Y[8] = {2, -2, 2, -2, 1, -1, 1, -1};   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     int n, ans = 0;     cin >> n;     string s, t;     cin >> s >> t;     for (int i(0); i < (n >> 1); ++i) {       if (t[i] == t[n - i - 1]) {         if (s[i] == s[n - i - 1]) {           continue;         } else {           ans += 1;           continue;         }       } else {         if (s[i] == s[n - i - 1]) {           if (t[i] == s[i] || t[n - i - 1] == s[i]) {             ans += 1;             continue;           } else {             ans += 2;             continue;           }         } else {           if (s[i] != t[i] && s[i] != t[n - i - 1] && s[n - i - 1] != t[i] &&               s[n - i - 1] != t[n - i - 1]) {             ans += 2;             continue;           }           if (min(t[i], t[n - i - 1]) == min(s[i], s[n - i - 1]) &&               max(t[i], t[n - i - 1]) == max(s[i], s[n - i - 1])) {             continue;           } else {             ans += 1;             continue;           }         }       }     }     if (n % 2 == 1) {       if (s[(n >> 1)] != t[(n >> 1)]) ans++;     }     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());   long long rand(long long l, long long r) {     return uniform_int_distribution<long long>(l, r)(rd);   }   const int N = 49;   int n, m, d[N][N];   int b[N];   signed main() {     ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);     cin >> n >> m;     for (int(i) = (1); (i) <= (m); ++(i)) {       int a, b;       cin >> a >> b;       if (max(a, b) > 48) continue;       d[a][b] = d[b][a] = 1;     }     n = min(n, 48);     for (int(i) = (1); (i) <= (n); ++(i)) b[i] = i;     shuffle(b + 1, b + 1 + n, rd);     for (int(i) = (1); (i) <= (n); ++(i))       for (int(j) = (i + 1); (j) <= (n); ++(j))         for (int(z) = (j + 1); (z) <= (n); ++(z))           for (int(k) = (z + 1); (k) <= (n); ++(k))             for (int(x) = (k + 1); (x) <= (n); ++(x)) {               int CNT = 0;               vector<int> a;               a.push_back(b[i]), a.push_back(b[j]), a.push_back(b[z]),                   a.push_back(b[k]), a.push_back(b[x]);               for (int(i) = (0); (i) <= ((int)(a).size() - 1); ++(i))                 for (int(j) = (0); (j) <= (i - 1); ++(j))                   if (d[a[i]][a[j]]) ++CNT;               if (CNT == 0 || CNT == 10) {                 cout << b[i] <<     << b[j] <<     << b[z] <<     << b[k] <<                          << b[x] <<   n ;                 return 0;               }             }     cout << -1;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   const int N = 1e6, M = 1e6;   pair<int, int> adj[M + 7];   long long val[N + 7];   long long sum[N + 7];   long long res = 0;   mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());   void addRes(int numb) { res += 1LL * numb * (numb - 1) / 2; }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 1, r1, r2; i <= m; i++) {       cin >> r1 >> r2;       adj[i] = {r1, r2};     }     for (int i = 1; i <= n; i++) {       val[i] = rng();       sum[i] = 0;     }     for (int i = 1; i <= m; i++) {       sum[adj[i].first] += val[adj[i].second];       sum[adj[i].second] += val[adj[i].first];     }     int u, v;     for (int i = 1; i <= m; i++) {       u = adj[i].first;       v = adj[i].second;       if (sum[u] - val[v] == sum[v] - val[u]) res++;     }     int start = 1, finish = 1;     sort(sum + 1, sum + n + 1);     for (int i = 2; i <= n; i++)       if (sum[i] == sum[i - 1]) {         finish = i;         if (i == n) addRes(finish - start + 1);       } else {         addRes(finish - start + 1);         start = finish = i;       }     cout << res;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {     return (a.second < b.second);   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }   long long pow2(long long n) {     long long x = 1;     for (long long i = 1; i <= n; i++) {       x *= 2;     }     return x;   }   int main() {     cin.tie(0);     cout.tie(0);     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long n;     cin >> n;     cout << 2 * (n - 1) + 1 <<   2  << endl;     cout <<  1 2  << endl;   }
#include <bits/stdc++.h>   #define ll long long   using namespace std;      int main() {            int t;       cin>>t;              int arra[10] = { 0,                       3,                       17,                       151,                       1117,                       11941,                       117653,                       1219837,                       12176537,                       132176537       };              int arrb[10] = {0,                       7,                       23,                       191,                       1181,                       12071,                       129837,                       1329837,                       13298373,                       143298373       };                     while(t--)       {           int a, b, c, x=0, y=0, z = 0;           cin>>a>>b>>c;                          if(a==c || b == c)               {                   x = pow(10, a- 1);                   y = pow(10, b- 1);               }               else               {                   z = arra[c];                   x = z * arra[a- c+ 1];                   y = z * arrb[b- c+ 1];               }                                             cout<<x<<   <<y<<endl;       }                             return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long oo = 1000000000000000000LL;   const int N = 100005;   vector<pair<int, int>> ds;   long long data[2][100005];   int x[N], p[N], c[N], st[N];   long long val[N];   int main() {     int n, m;     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) {       scanf( %d , x + i);       ds.push_back({x[i], i});     }     for (int i = 1; i <= m; i++) {       scanf( %d%d , p + i, c + i);       ds.push_back({p[i], -i});     }     sort(ds.begin(), ds.end());     long long* f[2] = {data[0] + 10005, data[1] + 10005};     int flag = 0;     for (int i = -n; i <= n; i++) f[flag][i] = oo;     f[flag][0] = 0;     long long last = ds[0].first;     for (int i = 0; i < ds.size(); i++) {       int old = flag;       flag ^= 1;       if (ds[i].second > 0) {         f[flag][n] = oo;         for (int j = -n; j < n; j++) {           f[flag][j] = oo;           if (f[old][j + 1] < oo)             f[flag][j] = f[old][j + 1] + (ds[i].first - last) * abs(j + 1);         }       } else {         int head = 0, tail = -1, cc = c[-ds[i].second];         for (int j = -n; j <= n; j++) {           if (f[old][j] < oo) {             long long tmp = f[old][j] + abs(j) * (ds[i].first - last);             while (head <= tail && val[tail] > tmp) tail--;             st[++tail] = j;             val[tail] = tmp;           }           while (head <= tail && st[head] + cc < j) head++;           f[flag][j] = oo;           if (head <= tail) f[flag][j] = val[head];         }       }       last = ds[i].first;     }     if (f[flag][0] == oo)       printf( -1 );     else       printf( %lld , f[flag][0]);   }
#include <bits/stdc++.h>   using namespace std;   int n;   double sv[500050];   struct info {     int x, v;   } A[500050];   int main() {     scanf( %d , &n);     int l = 0;     for (int i = 0; i < n; i++) scanf( %d %d , &A[i].x, &A[i].v);     int st = n, nd = -1;     for (int i = 0; i < n; i++)       if (A[i].v > 0) {         st = i;         break;       }     for (int i = n - 1; i >= 0; i--)       if (A[i].v < 0) {         nd = i;         break;       }     if (st > nd)       puts( -1.000000000000 );     else {       int it = 100;       double low = 0, high = 1e20, mid;       while (it--) {         mid = (low + high) / 2;         double mx = -1e20, mn = 1e20;         int i;         for (i = 0; i < n; i++)           if (A[i].v > 0) sv[i] = mx = max(mx, A[i].v * mid + A[i].x);         for (i = n - 1; i >= 0; i--) {           if (A[i].v < 0)             mn = min(mn, A[i].v * mid + A[i].x);           else if (sv[i] > mn)             break;         }         if (i >= 0)           high = mid;         else           low = mid;       }       printf( %.12lf n , mid);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long ex(long long a, long long b) {     long long tmp = 1;     for (int i = 0; i < b; i++) {       tmp = tmp * a;     }     return tmp;   }   int main() {     long long r, l, tmp, ans = -1;     bool good = 1;     cin >> l >> r;     for (long long i = l; i <= r; i++) {       for (long long k = 0; k <= 5; k++) {         for (long long j = 0; j <= 5; j++) {           if (i / (ex(10, j)) % 10 == (i / (ex(10, k))) % 10 && ex(10, k) <= i &&               ex(10, j) <= i && j != k) {             good = 0;           }         }       }       if (good) {         ans = i;       }       good = 1;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m;   long long ar[1000001], dp[1001][1001];   long long calc(long long idx, long long rem) {     if (rem == 0 && idx != 0) return 1;     if (idx >= n) return 0;     long long &b = dp[idx][rem];     if (b != -1)       return b;     else       b = 0;     b |= calc(idx + 1, (rem + ar[idx]) % m);     b |= calc(idx + 1, rem);     return b;   }   void solve() {     cin >> n >> m;     for (long long i = 0; i < (n); ++i) {       cin >> ar[i];       ar[i] %= m;       if (ar[i] == 0) {         cout <<  YES n ;         return;       }     }     if (n >= m) {       cout <<  YES n ;       return;     } else {       for (long long i = 0; i < (1001); ++i)         for (long long j = 0; j < (1001); ++j) dp[i][j] = -1;       if (calc(0, m)) {         cout <<  YES n ;       } else         cout <<  NO n ;     }   }   int32_t main() {     ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);     long long t = 1;     while (t--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long pow(long long a, long long b, long long MOD) {     long long x = 1, y = a;     while (b > 0) {       if (b % 2 == 1) {         x = (x * y);         if (x > MOD) x %= MOD;       }       y = (y * y);       if (y > MOD) y %= MOD;       b /= 2;     }     return x;   }   long long modInverse(long long a, long long m) { return pow(a, m - 2, m); }   long long arr[(int)1e5 + 1 + 1], val[(int)1e5 + 1];   int main() {     long long n;     while (cin >> n) {       for (int i = 0; i < n; i++) {         cin >> arr[i];         val[i] = 1;       }       long long ans = 1;       for (int i = 1; i < n; i++) {         if (arr[i] >= arr[i - 1]) {           val[i] = max(val[i], val[i - 1] + 1);         }         ans = max(ans, val[i]);       }       cout << ans << endl;     }   }