malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   long long t, n;   int main() {     cin >> t;     while (t--) {       cin >> n;       long long ls, mi = 0;       bool pd = false;       cin >> ls;       for (int i = 2; i <= n; i++) {         long long x, lg;         cin >> x;         if (x < ls) {           lg = int(floor(log2(ls - x)));           mi = max(mi, lg);           pd = true;         }         ls = max(ls, x);       }       if (!pd)         cout << 0 << endl;       else         cout << mi + 1 << endl;     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   int p[100000];   int c[100000];   int main() {     ios_base::sync_with_stdio(0);     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> p[i];       --p[i];     }     vector<long long int> loops;     for (int i = 0; i < n; ++i) {       if (c[i]) continue;       int j = i;       int q = 0;       while (c[j] == 0) {         c[j] = 1;         j = p[j];         ++q;       }       loops.push_back(q);     }     sort(loops.begin(), loops.end());     if (loops.size() > 1) {       loops[loops.size() - 2] += loops[loops.size() - 1];       loops.pop_back();     }     long long int ans = 0;     for (int i = 0; i < loops.size(); ++i) {       ans += loops[i] * loops[i];     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char ss[100010];   string s;   string s1;   pair<int, int> b[2000000];   int m[100100];   unsigned long long h[100100];   unsigned long long p[100100];   int main() {     scanf( %s , &ss);     s = (string)ss;     h[0] = 0;     p[0] = 1;     for (int i = (1); i < (100100); ++i) p[i] = p[i - 1] * 257;     for (int i = (0); i < (s.size()); ++i)       h[i + 1] = h[i] + (unsigned int)s[i] * p[i];     int n;     cin >> n;     int sz = 0;     for (int it = (0); it < (n); ++it) {       cin >> s1;       unsigned long long h1 = 0;       for (int i = (0); i < (s1.size()); ++i) h1 += (unsigned int)s1[i] * p[i];       int pp = (int)(s.size()) - (int)s1.size();       for (int i = (0); i < (pp + 1); ++i) {         if (h1 * p[i] == h[i + s1.size()] - h[i]) {           b[sz] = make_pair(i, i + s1.size() - 1);           sz++;         }       }     }     for (int i = (0); i < (s.size()); ++i) m[i] = (int)s.size();     for (int i = (0); i < (sz); ++i)       m[b[i].first] =           ((m[b[i].first] < b[i].second) ? (m[b[i].first]) : (b[i].second));     for (int i = (int)s.size() - 2; i >= 0; --i)       m[i] = ((m[i] < m[i + 1]) ? (m[i]) : (m[i + 1]));     int res = 0;     int res1 = 0;     for (int i = (0); i < (s.size()); ++i) {       int len = m[i] - i;       if (len > res) {         res = len;         res1 = i;       }     }     printf( %d %d n , res, res1);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   long long dp[2005][2005], m, d, ans, bit[2005], len;   char l[2005], r[2005];   long long dfs(int pos, long long sum, bool flag) {     if (pos == -1) return sum == 0;     if (!flag && dp[pos][sum] != -1) return dp[pos][sum];     long long res = 0;     for (int i = 0, up = flag ? bit[pos] : 9; i <= up; ++i) {       if ((len - pos) & 1) {         if (i == d) continue;       } else {         if (i != d) continue;       }       (res += dfs(pos - 1, (sum * 10 + i) % m, flag && (i == up))) %= MOD;     }     return flag ? res : dp[pos][sum] = res;   }   long long calc(char *x) {     len = strlen(x);     for (int i = 0; i < len; ++i) bit[len - i - 1] = x[i] -  0 ;     return dfs(len - 1, 0, 1);   }   int check() {     long long sum = 0;     len = strlen(l);     for (int i = 0; i < len; ++i) {       int x = l[i] -  0 ;       if ((i + 1) & 1) {         if (x == d) return 0;       } else {         if (x != d) return 0;       }       (sum = sum * 10 + x) %= m;     }     return sum == 0;   }   int main() {     memset(dp, -1, sizeof(dp));     scanf( %lld%lld , &m, &d);     scanf( %s , l);     scanf( %s , r);     ans = calc(r) - calc(l);     ans += check();     printf( %lld n , (ans + MOD) % MOD);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) {       long long int m, a[1000], b, sum = 0;       cin >> m >> b;       for (int j = 0; j < m; j++) {         cin >> a[j];       }       for (int j = 0; j < m; j++) {         sum = sum + a[j];       }       if (sum == b) {         cout <<  YES  << endl;       } else {         cout <<  NO  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, m, i, x, ans;   int main() {     cin >> n >> m;     x = 1;     for (i = 1; i <= m; i++) x = x * 2 % 1000000009;     ans = 1;     for (i = 1; i <= n; i++) ans = ans * (x - i) % 1000000009;     cout << ans;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double PI = 3.141592653589793238463;   void printVec(vector<int> v1) {     for (int i = 0; i < v1.size(); i++) cout << v1[i] <<    ;     cout << endl;   }   int main() {     ios::sync_with_stdio(false);     cout.tie(NULL);     cin.tie(NULL);     priority_queue<long long, vector<long long>, greater<long long>> pQ;     long long n;     cin >> n;     string s;     long long opr;     vector<string> vec;     vector<long long> operations;     for (long long i = 0; i < n; i++) {       cin >> s;       vec.push_back(s);       if (s ==  removeMin ) {         operations.push_back(-1);         continue;       }       cin >> opr;       operations.push_back(opr);     }     vector<string> vec_Out;     vector<long long> operations_Out;     for (long long i = 0; i < n; i++) {       if (vec[i] ==  removeMin ) {         if (pQ.empty()) {           pQ.push(0);           vec_Out.push_back( insert  );           operations_Out.push_back(0);         }         pQ.pop();         vec_Out.push_back( removeMin );         operations_Out.push_back(-1);       } else if (vec[i][0] ==  i ) {         vec_Out.push_back( insert  );         operations_Out.push_back(operations[i]);         pQ.push(operations[i]);       } else {         opr = operations[i];         long long MIN = -2;         if (!pQ.empty()) {           MIN = pQ.top();         }         while (opr != MIN && !pQ.empty() && opr > MIN) {           pQ.pop();           if (!pQ.empty()) {             MIN = pQ.top();           }           vec_Out.push_back( removeMin );           operations_Out.push_back(-1);         }         if (pQ.empty() || opr < MIN) {           pQ.push(opr);           vec_Out.push_back( insert  );           operations_Out.push_back(opr);         }         vec_Out.push_back( getMin  );         operations_Out.push_back(opr);       }     }     cout << vec_Out.size() << endl;     for (long long i = 0; i < vec_Out.size(); i++) {       if (vec_Out[i] ==  removeMin ) {         cout << vec_Out[i] << endl;         continue;       }       cout << vec_Out[i] << operations_Out[i] << endl;     }     vec_Out.clear();     vec.clear();     operations.clear();     operations_Out.clear();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int t;   int n, m;   string A, B;   int f[405][405];   int main() {     int i, j, k;     cin >> t;     while (t--) {       cin >> A >> B;       n = A.length(), m = B.length();       A =  0  + A;       B =  0  + B;       i = 1, j = 1;       for (i = 1; i <= n; i++) {         if (A[i] == B[j]) {           j++;           if (j == m + 1) break;         }       }       if (j == m + 1) {         cout <<  YES  << endl;         continue;       }       bool flag = false;       for (k = 1; k < n; k++) {         memset(f, 0, sizeof(f));         f[0][0] = k;         for (i = 0; i < n; i++) {           for (j = 0; j <= k; j++) {             if (f[i][j] == 0) continue;             f[i + 1][j] = max(f[i + 1][j], f[i][j]);             if (j < k and A[i + 1] == B[j + 1]) {               f[i + 1][j + 1] = max(f[i + 1][j + 1], f[i][j]);             }             if (f[i][j] < m and A[i + 1] == B[f[i][j] + 1]) {               f[i + 1][j] = max(f[i + 1][j], f[i][j] + 1);             }           }         }         if (f[n][k] == m) {           flag = true;           break;         }       }       if (flag) {         cout <<  YES  << endl;       } else {         cout <<  NO  << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int nmax = 1005;   const int inf = 1 << 28;   int n, m, A[nmax][nmax], B[nmax][nmax], C[nmax][nmax];   char a[nmax][nmax];   int dx[] = {-1, 0, 0, 1};   int dy[] = {0, -1, 1, 0};   deque<pair<int, int> > q;   bitset<nmax> inq[nmax];   void go(int x, int y, int d[nmax][nmax]) {     for (int i = 1; i <= n; i++) inq[i] = 0;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) d[i][j] = inf;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (a[i][j] == a[x][y]) {           d[i][j] = 0;           q.push_back(make_pair(i, j));           inq[i][j] = 1;         }     while (!q.empty()) {       x = q.front().first;       y = q.front().second;       q.pop_front();       inq[x][y] = 0;       for (int k = 0; k < 4; k++) {         int newx = x + dx[k];         int newy = y + dy[k];         int cost;         if (a[newx][newy] >=  1  && a[newx][newy] <=  3 )           cost = 0;         else if (a[newx][newy] ==  . )           cost = 1;         else           cost = inf;         if (d[x][y] + cost < d[newx][newy]) {           d[newx][newy] = d[x][y] + cost;           if (!inq[newx][newy]) {             q.push_back(make_pair(newx, newy));             inq[newx][newy] = 1;           }         }       }     }   }   int main() {     cin.sync_with_stdio(false);     cin >> n >> m;     for (int i = 1; i <= n; i++) cin >> (a[i] + 1);     bool foundA = 0;     bool foundB = 0;     bool foundC = 0;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++)         if (a[i][j] ==  1  && !foundA) {           go(i, j, A);           foundA = 1;         } else if (a[i][j] ==  2  && !foundB) {           go(i, j, B);           foundB = 1;         } else if (a[i][j] ==  3  && !foundC) {           go(i, j, C);           foundC = 1;         }     }     int sol = inf;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) {         int cost;         if (a[i][j] ==  1  || a[i][j] ==  2  || a[i][j] ==  3 )           cost = 0;         else if (a[i][j] ==  . )           cost = 2;         sol = min(sol, A[i][j] + B[i][j] + C[i][j] - cost);       }     if (sol >= inf)       cout << -1;     else       cout << sol;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   string solve1(string n) {     string res(n.length(),  9 );     for (char c =  8 ; c >=  0 ; c--) {       string t(n.length(), c);       if (t >= n) res = t;     }     return res;   }   string solve2(string n) {     string res = solve1(n);     for (char a =  0 ; a <=  9 ; a++)       for (char b = a + 1; b <=  9 ; b++) {         bool n_ok = true;         for (int i = 0; i < n.length(); i++) {           if (n[i] < b) {             string t = n;             if (t[i] < a)               t[i] = a;             else               t[i] = b;             for (int j = i + 1; j < n.length(); j++) t[j] = a;             if (res > t) res = t;           }           if (n[i] != a && n[i] != b) {             n_ok = false;             break;           }         }         if (n_ok) return n;       }     return res;   }   string solve() {     string n;     int k;     cin >> n >> k;     if (k == 1)       return solve1(n);     else       return solve2(n);   }   int main() {     int t;     cin >> t;     while (t--) cout << solve() <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   typedef long long ll;   int main() {     ll t;     cin >> t;     while (t--) {       ll cnt3, cnt2;       cnt2 = cnt3 = 0;       ll n;       cin >> n;       while (n % 2 == 0) {         n = n / 2;         cnt2++;       }       while (n % 3 == 0) {         n = n / 3;         cnt3++;       }       if (n != 1 || cnt2 > cnt3)         cout << -1 <<   n ;       else {         ll ans = cnt2 + (cnt3 - cnt2) * 2;         cout << ans <<   n ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b;     scanf( %d%d , &a, &b);     if (a < b) {       for (int i = b + 1; i <= (a + b + 1); i++) printf( %d  , i);       for (int j = b; j >= 1; j--) printf( %d  , j);     } else {       for (int i = 1; i <= a; i++) printf( %d  , i);       for (int j = (a + b + 1); j > a; j--) printf( %d  , j);     }   }
#include <bits/stdc++.h>   #pragma GCC optimize(2)   using namespace std;   void qread(int &x) {     int neg = 1;     x = 0;     char c = getchar();     while (c <  0  || c >  9 ) {       if (c ==  - ) neg = -1;       c = getchar();     }     while (c >=  0  && c <=  9 ) x = 10 * x + c -  0 , c = getchar();     x *= neg;   }   const int maxn = 100005;   int n;   char c[maxn];   int dp[maxn][2][3];   int main() {     scanf( %d%s , &n, c);     memset(dp, -1, sizeof(dp));     dp[0][0][0] = dp[0][1][0] = 0;     for (int(i) = 0; (i) < n; i++)       for (int(j) = 0; (j) < 2; j++)         for (int(k) = 0; (k) < 3; k++) {           int cur = dp[i][j][k];           if (cur < 0) continue;           dp[i + 1][j][k] = max(dp[i + 1][j][k], cur);           if (c[i] -  0  != j)             dp[i + 1][c[i] -  0 ][k] = max(dp[i + 1][c[i] -  0 ][k], cur + 1);           else if (k < 2)             dp[i + 1][c[i] -  0 ][k + 1] =                 max(dp[i + 1][c[i] -  0 ][k + 1], cur + 1);         }     int ans = 0;     for (int(j) = 0; (j) < 2; j++)       for (int(k) = 0; (k) < 3; k++) ans = max(ans, dp[n][j][k]);     printf( %d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 200;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     while (ch <  0  || ch >  9 ) {       if (ch ==  - ) f = -1;       ch = getchar();     }     while (ch >=  0  && ch <=  9 ) {       x = x * 10 + ch -  0 ;       ch = getchar();     }     return x * f;   }   int n, cnt, flag = 1;   int a[N], b[N], c[N];   int main() {     cnt = n = read();     a[0] = -1, b[0] = 0;     while (cnt--) {       for (int i = 0; i < N - 1; i++) c[i + 1] = a[i];       c[0] = 0;       for (int i = 0; i < N; i++) c[i] += b[i];       for (int i = 0; i < N; i++)         if (abs(c[i]) > 1) {           for (int i = 0; i < N - 1; i++) c[i + 1] = a[i] * (-1);           c[0] = 0;           for (int i = 0; i < N; i++) c[i] += b[i];           break;         }       for (int i = 0; i < N; i++) b[i] = a[i], a[i] = c[i];     }     cout << n << endl;     if (a[n] < 0)       flag = -1;     else       flag = 1;     for (int i = 0; i <= n; i++) cout << a[i] * flag <<    ;     cout << endl << n - 1 << endl;     if (b[n - 1] < 0)       flag = -1;     else       flag = 1;     for (int i = 0; i <= n - 1; i++) cout << b[i] * flag <<    ;   }
#include <bits/stdc++.h>   #pragma GCC optimize( -O3 )   using namespace std;   const long long N = 1e6 + 5;   void pairsort(long long a[], long long b[], long long n) {     pair<long long, long long> pairt[n];     for (long long i = 0; i < n; i++) {       pairt[i].first = a[i];       pairt[i].second = b[i];     }     sort(pairt, pairt + n);     for (long long i = 0; i < n; i++) {       a[i] = pairt[i].first;       b[i] = pairt[i].second;     }   }   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long isPrime(long long n) {     if (n < 2) return 0;     if (n < 4) return 1;     if (n % 2 == 0 or n % 3 == 0) return 0;     for (long long i = 5; i * i <= n; i += 6)       if (n % i == 0 or n % (i + 2) == 0) return 0;     return 1;   }   long long C(long long n, long long r) {     if (r > n - r) r = n - r;     long long ans = 1;     for (long long i = 1; i <= r; i++) {       ans *= n - r + i;       ans /= i;     }     return ans;   }   long long mod = 1e9 + 7;   long long modexpo(long long x, long long p) {     long long res = 1;     x = x % mod;     while (p) {       if (p % 2) res = res * x;       p >>= 1;       x = x * x % mod;       res %= mod;     }     return res;   }   long long n, t, a[N], b[N], c[N], d[N], x[N];   int32_t main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     cin >> n >> t;     a[n + 1] = 3000000000000000000 - t + 1;     for (long long i = 1; i <= n; i++) cin >> a[i];     for (long long i = 1; i <= n; i++) cin >> x[i];     for (long long i = 1; i <= n; i++)       if (x[i] < x[i - 1] or x[i] < i) return cout <<  No , 0;     for (long long i = 1; i <= n; i++) b[i] = a[x[i] + 1] + t - 1;     for (long long i = n; i > 1; i--)       if (b[i - 1] >= b[i]) b[i - 1] = b[i] - 1;     for (long long i = 1; i <= n; i++) c[i + 1]++, c[x[i] + 1]--, d[x[i] + 1]++;     for (long long i = 1; i <= n; i++) c[i] += c[i - 1];     for (long long i = 1; i <= n; i++)       if (c[i] and a[i] + t > b[i - 1]) return cout <<  No , 0;     for (long long i = 1; i <= n; i++)       if (b[i] < a[i] + t) return cout <<  No , 0;     for (long long i = 1; i <= n; i++)       if (c[i] and d[i]) return cout <<  No , 0;     cout <<  Yes           <<   n ;     for (long long i = 1; i <= n; i++) cout << b[i] <<    ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename Arg1>   void __f(const char* name, Arg1&& arg1) {     cerr << name <<   :   << arg1 <<   n ;   }   template <typename Arg1, typename... Args>   void __f(const char* names, Arg1&& arg1, Args&&... args) {     const char* comma = strchr(names + 1,  , );     cerr.write(names, comma - names) <<   :   << arg1 <<   |  ;     __f(comma + 1, args...);   }   const long long maxn = (long long)1e6 + 6;   const long double EPS = 1e-9;   const long long INF = (long long)1e18 + 18;   const long long mod = (long long)1e9 + 9;   long long n, m, k;   inline long long add(long long x, long long y) {     x += y;     if (x >= mod) x -= mod;     return x;   }   inline long long sub(long long x, long long y) {     x -= y;     if (x < 0) x += mod;     return x;   }   inline long long mul(long long x, long long y) { return (x * 1LL * y) % mod; }   inline long long binpow(long long a, long long b) {     long long x = 1 % mod;     while (b) {       if (b & 1) x = mul(x, a);       a = mul(a, a);       b >>= 1;     }     return x;   }   inline long long inv(long long a) { return binpow(a, mod - 2); }   bool works(long long x) {     long long t = x * k + ((n - x * k) / k) * (k - 1) + (n - x * k) % k;     return t >= m;   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cin >> n >> m >> k;     long long left = 0, right = (n + k - 1) / k;     while (left < right) {       long long mid = (left + right) >> 1;       if (works(mid)) {         right = mid;       } else {         left = mid + 1;       }     }     long long ans = binpow(2, left + 1);     ans = sub(ans, 2);     ans = mul(ans, k);     ans = add(ans, sub(m, left * k));     cout << ans <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long n, u, r;   long long a[40], b[40], k[40], p[40];   long long maxx = (long long)1 << 63;   long long eval() {     long long val = 0;     for (int i = 0; i < n; i++) {       val += a[i] * k[i];     }     return val;   }   void gen(int now, int last) {     if (now % 2 == u % 2) maxx = max(maxx, eval());     if (now < u) {       long long temp[40];       memcpy(temp, a, sizeof(a));       if (last == 1) {         for (int i = 0; i < n; i++) {           a[i] = temp[i] ^ b[i];         }         gen(now + 1, 0);       }       for (int i = 0; i < n; i++) {         a[i] = temp[p[i]] + r;       }       gen(now + 1, 1);     }   }   int main() {     cin >> n >> u >> r;     for (int i = 0; i < n; i++) {       cin >> a[i];     }     for (int i = 0; i < n; i++) {       cin >> b[i];     }     for (int i = 0; i < n; i++) {       cin >> k[i];     }     for (int i = 0; i < n; i++) {       cin >> p[i];       p[i]--;     }     gen(0, 1);     cout << maxx << endl;     return 0;   }
#include <bits/stdc++.h>   const int N = 1e7 + 5;   int n, pos[N], ans1, ans2;   long long ans = 1e14;   int main() {     scanf( %d , &n);     for (int i = 1, x; i <= n; ++i) {       scanf( %d , &x);       if (pos[x]) {         if (x < ans) ans1 = pos[x], ans2 = i, ans = x;       } else         pos[x] = i;     }     for (int i = 1, tmp1, tmp2; i < N; ++i) {       if (i >= ans) break;       tmp1 = tmp2 = 0;       for (int j = i; j < N; j += i) {         if (!pos[j]) continue;         if (!tmp1)           tmp1 = j, tmp2 = pos[j];         else {           if (1LL * j / i * tmp1 < ans) {             ans = 1LL * j / i * tmp1, ans1 = pos[j], ans2 = tmp2;             break;           }         }       }     }     if (ans1 > ans2) ans1 ^= ans2 ^= ans1 ^= ans2;     printf( %d %d n , ans1, ans2);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n;   long long arr[200010], tot = 0;   int main(void) {     cin >> n;     for (int i = 0; i < n; i++) {       cin >> arr[i];       if (i > 0)         tot += abs(arr[i] - arr[i - 1]);       else         tot += abs(arr[i]);     }     cout << tot;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void swap(long long int &x, long long int &y) {     x = x ^ y;     y = x ^ y;     x = x ^ y;   }   template <typename T>   void print(T a) {     for (auto i = a.begin(); i != a.end(); i++) cout << *i <<    ;     cout << endl;   }   bool isVowel(char c) {     if (c ==  a  || c ==  e  || c ==  i  || c ==  o  || c ==  u ) return true;     return false;   }   void sync() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);   }   int main() {     sync();     long long int n;     cin >> n;     map<long long int, long long int> ck1, ck2;     map<pair<long long int, long long int>, long long int> ck3;     while (n--) {       long long int x, y;       cin >> x >> y;       ck1[x]++;       ck2[y]++;       ck3[{x, y}]++;     }     long long int ans = 0;     for (auto i = ck1.begin(); i != ck1.end(); i++) {       long long int x = i->second;       ans += ((x) * (x - 1) / 2);     }     for (auto i = ck2.begin(); i != ck2.end(); i++) {       long long int x = i->second;       ans += ((x) * (x - 1) / 2);     }     for (auto i = ck3.begin(); i != ck3.end(); i++) {       long long int x = i->second;       ans -= ((x) * (x - 1) / 2);     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     int k = 0;     int cnt = 0;     int ans = 0;     for (int i = 0; i < n; i++) {       int p;       cin >> p;       if (p > k)         cnt++;       else         cnt = 1;       k = p;       ans = max(cnt, ans);     }     cout << ans;   }
#include <bits/stdc++.h>   namespace solution {}   namespace solution {   class ISolution {    public:     virtual void init(){};     virtual bool input() { return false; };     virtual void output(){};     virtual int run() = 0;   };   }  // namespace solution   namespace solution {   using namespace std;   const long long MOD = 1000000000LL;   const int SIZE = 2 * 100000 + 11;   const int QUERY_SIZE = 2 * 100000 + 11;   int n, m;   long long A[SIZE];   long long F[SIZE];   void query_1() {     int x, v;     cin >> x >> v;     A[x] = v;   }   void query_2() {     int l, r;     cin >> l >> r;     int len = r - l + 1;     long long sum = 0;     for (int i = 0; i < len; ++i) sum = (sum + F[i] * A[l + i]) % MOD;     cout << sum << endl;   }   void solve() {     F[0] = F[1] = 1;     for (int i = 2; i < SIZE; ++i) F[i] = (F[i - 1] + F[i - 2]) % MOD;     for (int i = 0; i < m; ++i) {       int t;       cin >> t;       if (t == 1) {         query_1();       } else if (t == 2) {         query_2();       }     }   }   class Solution : public ISolution {    public:     bool input() {       if (!(cin >> n >> m)) return false;       for (int i = 0; i < n; ++i) cin >> A[i + 1];       return true;     }     int run() {       while (init(), input()) {         solve();         output();       }       return 0;     }   };   }  // namespace solution   int main() { return solution::Solution().run(); }