malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   template <typename Abel>   struct BIT2D {     vector<vector<Abel>> dat[4];     BIT2D(int h, int w) {       for (int which = 0; which < 4; which++)         dat[which].assign(h + 1, vector<Abel>(w + 1));     }     inline void sub_add(int which, int a, int b, Abel x) {       int h = dat[which].size(), w = dat[which][0].size();       for (int i = a; i < h; i += i & -i)         for (int j = b; j < w; j += j & -j) dat[which][i][j] += x;     }     inline void add(int si, int sj, Abel x) {       sub_add(0b00, si, sj, x * (si - 1) * (sj - 1));       sub_add(0b10, si, sj, -x * (si - 1));       sub_add(0b01, si, sj, -x * (sj - 1));       sub_add(0b11, si, sj, x);     }     inline void add(int si, int ti, int sj, int tj, Abel x) {       add(si, sj, x), add(si, tj, -x), add(ti, sj, -x), add(ti, tj, x);     }     inline Abel sub_sum(int which, int a, int b) {       Abel res = Abel(0);       for (int i = a; i > 0; i -= i & -i)         for (int j = b; j > 0; j -= j & -j) res += dat[which][i][j];       return res;     }     inline Abel sum(int si, int sj) {       Abel res = Abel(0);       res += sub_sum(0b00, si - 1, sj - 1);       res += sub_sum(0b10, si - 1, sj - 1) * (sj - 1);       res += sub_sum(0b01, si - 1, sj - 1) * (si - 1);       res += sub_sum(0b11, si - 1, sj - 1) * (si - 1) * (sj - 1);       return res;     }     inline Abel sum(int si, int ti, int sj, int tj) {       return sum(ti, tj) - sum(si, tj) - sum(ti, sj) + sum(si, sj);     }   };   struct Xor {     long long val;     Xor(long long val_ = 0) : val(val_) {}     Xor operator=(long long val_) {       this->val = val_;       return *this;     }     Xor operator-() { return val; }     const Xor &operator+=(const Xor &x);     const Xor &operator-=(const Xor &x);     friend ostream &operator<<(ostream &os, const Xor &a) { return os << a.val; }   };   Xor operator+(Xor x, Xor y) { return x.val ^ y.val; }   Xor operator-(Xor x, Xor y) { return x.val ^ y.val; }   Xor operator*(Xor x, int p) { return p & 1 ? x : 0; }   const Xor &Xor::operator+=(const Xor &x) { return *this = *this + x; }   const Xor &Xor::operator-=(const Xor &x) { return *this = *this - x; }   int main() {     cin.tie(nullptr);     ios::sync_with_stdio(false);     int n, m;     cin >> n >> m;     BIT2D<Xor> bit(n, n);     while (m--) {       int op;       cin >> op;       int si, sj, ti, tj;       cin >> si >> sj >> ti >> tj;       if (op == 1) {         cout << bit.sum(si, ti + 1, sj, tj + 1) << endl;       }       if (op == 2) {         long long v;         cin >> v;         bit.add(si, ti + 1, sj, tj + 1, v);       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   void solve() {     long long n;     cin >> n;     long long x = n * (n * n + 1) / 2;     vector<long long> a[101];     for (long long j = 0; j < n / 2; j++)       for (long long i = 1; i < n + 1; i++) {         long long x = n * j + i;         a[i].push_back(x);         a[i].push_back(n * n - x + 1);       }     for (long long i = 1; i < n + 1; i++) {       for (auto x : a[i]) cout << x <<    ;       cout <<   n ;     }   }   signed main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long TESTS = 1;     while (TESTS--) {       solve();     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <class T>   T power(T a, T b) {     T x;     if (b == 0)       x = 1;     else       x = a;     for (size_t i = 1; i < b; i++) x *= a;     return x;   }   long long int gcd(long long int a, long long int b) {     return b == 0 ? a : gcd(b, a % b);   }   long long int n, m, a, b, c, ab, ba, x, y, z, avg, total, ans, sum;   long long int arr2[300001], arr3[100001], arr4[100001], arr5[100001];   char c1, c2;   vector<pair<string, long long int> > vec;   vector<long long int> v;   bool f, f1, f2, found;   string str, s1, s2, s3, s4;   map<long long int, long long int> mp, mp1;   set<int> seto;   double d, d1;   long long int x1, x2, y11, y2;   long long int mini = 10000000000, maxi = 0;   set<string> sets;   void rec(int n, string s) {     if (n == 11) return;     sets.insert(s);     rec(n + 1, s +  4 );     rec(n + 1, s +  7 );   }   int main() {     rec(0,   );     for (set<string>::iterator i = sets.begin(); i != sets.end(); i++) {       string s = *i;       if (!s.empty()) arr2[x++] = stoll(s);     }     sort(arr2, arr2 + x);     cin >> n >> m;     y = n;     for (long long int i = 0; i < x; i++) {       if (y <= arr2[i]) {         sum += (min(arr2[i] - y, m - y) + 1) * arr2[i];         y = arr2[i] + 1;       }       if (y > m) break;     }     cout << sum;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k;     scanf( %i%i , &n, &k);     if (k * 2 >= n)       printf( -1 n );     else {       printf( %i n , n * k);       for (int i = 0; i < n; i++)         for (int j = 0; j < k; j++) printf( %i %i n , i + 1, (i + j + 1) % n + 1);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<long long> lucky;   void backtrack(long long num) {     if (num > 10000000000) return;     lucky.push_back(num);     backtrack(num * 10 + 4);     backtrack(num * 10 + 7);   }   int main() {     backtrack(0);     sort(lucky.begin(), lucky.end());     pair<long long, long long> P, V;     int k;     cin >> P.first >> P.second;     cin >> V.first >> V.second;     cin >> k;     long long denominator =         1LL * (P.second - P.first + 1) * (V.second - V.first + 1);     long long numerator = 0;     for (int i = k; i + 1 < (int)lucky.size(); i++) {       long long pLo = max(lucky[i - k] + 1, P.first);       long long pHi = min(lucky[i - k + 1], P.second);       long long vLo = max(lucky[i], V.first);       long long vHi = min(lucky[i + 1] - 1, V.second);       vLo = max(vLo, max(pLo, pHi));       long long yo = 1LL * max(0LL, pHi - pLo + 1) * max(0LL, vHi - vLo + 1);       numerator += yo;       pLo = max(lucky[i], P.first);       pHi = min(lucky[i + 1] - 1, P.second);       vLo = max(lucky[i - k] + 1, V.first);       vHi = min(lucky[i - k + 1], V.second);       pLo = max(pLo, max(vLo, vHi));       yo = 1LL * max(0LL, pHi - pLo + 1) * max(0LL, vHi - vLo + 1);       numerator += yo;     }     if (k == 1)       for (int i = 0; i < (int)lucky.size(); i++)         if (lucky[i] >= max(P.first, V.first) &&             lucky[i] <= min(P.second, V.second))           numerator -= 1;     printf( %.9lf n , (1.0 * numerator) / denominator);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<int> Neighbors[2000000];   bool Visited[2000000];   bool Leaf[2000000];   char Color[500001];   queue<int> Queue;   void bfs(int i) {     Visited[i] = true;     Queue.push(i);     while (Queue.empty() == false) {       int u = Queue.front();       Queue.pop();       Leaf[u] = true;       for (int v = 0; v < Neighbors[u].size(); v++)         if (Visited[Neighbors[u][v]] == false) {           Visited[Neighbors[u][v]] = true;           Queue.push(Neighbors[u][v]);           Leaf[u] = false;         }     }   }   int main() {     int T;     scanf( %d , &T);     for (int t = 1; t <= T; t++) {       int n;       scanf( %d , &n);       for (int i = 1; i <= n; i++) Neighbors[i].clear();       int u, v;       for (int i = 0; i + 1 < n; i++) {         scanf( %d %d , &u, &v);         Neighbors[u].push_back(v);         Neighbors[v].push_back(u);       }       scanf( %s , Color);       if (n < 3) {         printf( Draw n );         continue;       }       int n_ = n;       for (int i = 1; i <= n; i++)         if (Color[i - 1] ==  W ) {           Neighbors[n_ + 1].clear();           Neighbors[n_ + 2].clear();           Neighbors[n_ + 3].clear();           Neighbors[i].push_back(n_ + 1);           Neighbors[n_ + 1].push_back(i);           Neighbors[n_ + 1].push_back(n_ + 2);           Neighbors[n_ + 1].push_back(n_ + 3);           Neighbors[n_ + 2].push_back(n_ + 1);           Neighbors[n_ + 3].push_back(n_ + 1);           n_ += 3;         }       n = n_;       int won = 0;       for (int i = 1; i <= n; i++)         if (Neighbors[i].size() >= 4) {           printf( White n );           won = 1;           break;         }       if (won) continue;       for (int i = 1; i <= n; i++) Visited[i] = 0;       bfs(1);       if (Neighbors[1].size() == 1) Leaf[1] = true;       for (int i = 1; i <= n; i++)         if (Neighbors[i].size() >= 3) {           int leaves = 0;           for (int j = 0; j < Neighbors[i].size(); j++)             if (Leaf[Neighbors[i][j]]) leaves++;           if (Neighbors[i].size() - leaves >= 2) {             printf( White n );             won = 1;             break;           }         }       if (won) continue;       int left = 1;       while (left <= n && Neighbors[left].size() < 3) left++;       int right = n;       while (right > 0 && Neighbors[right].size() < 3) right--;       if (left <= n && right > 0 && left < right) {         int curr, prev = left;         int len = 2;         for (int i = 0; i < Neighbors[prev].size(); i++)           if (Leaf[Neighbors[prev][i]] == 0) curr = Neighbors[prev][i];         while (curr != right) {           if (Neighbors[curr][0] != prev) {             prev = curr;             curr = Neighbors[curr][0];           } else {             prev = curr;             curr = Neighbors[curr][1];           }           len++;         }         if (len % 2 == 1) {           printf( White n );           continue;         }       }       printf( Draw n );     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int M = 500;   int R, n, m, d[M][M];   pair<int, int> hd[M], tl[M], par[M][M];   bool wins = 0, draw = 0;   int mark[M][M];   void dfs(int x, int y) {     if (x < 0 || y < 0) return;     if (x + y > R) {       mark[x][y] = 2;       return;     }     mark[x][y] = 1;     if (x + y == 0) {       wins = 1;       return;     }     for (int i = 1; i <= min(n, x); i++) {       int nx = x - i + hd[i].first, ny = y + hd[i].second;       if (mark[nx][ny] == 1)         draw = 1;       else if (mark[nx][ny] == 0)         dfs(nx, ny);     }     for (int i = 1; i <= min(m, y); i++) {       int nx = x + tl[i].first, ny = y - i + tl[i].second;       if (mark[nx][ny] == 1)         draw = 1;       else if (mark[nx][ny] == 0)         dfs(nx, ny);     }     mark[x][y] = 2;   }   int dp[M][M], dis;   void dfs2(int x, int y) {     if (x + y > R) {       dis = max(dis, dp[x][y]);       return;     }     for (int i = 1; i <= min(n, x); i++) {       int nx = x - i + hd[i].first, ny = y + hd[i].second;       if (nx >= 0 && ny >= 0 && (dp[nx][ny] == 0 || (dp[nx][ny] < dp[x][y] + 1)))         dp[nx][ny] = dp[x][y] + 1, dfs2(nx, ny);     }     for (int i = 1; i <= min(m, y); i++) {       int nx = x + tl[i].first, ny = y - i + tl[i].second;       if (nx >= 0 && ny >= 0 && (dp[nx][ny] == 0 || (dp[nx][ny] < dp[x][y] + 1)))         dp[nx][ny] = dp[x][y] + 1, dfs2(nx, ny);     }   }   int main() {     int h, t;     scanf( %d %d %d , &h, &t, &R);     scanf( %d , &n);     for (int i = 1; i <= n; i++) scanf( %d %d , &hd[i].first, &hd[i].second);     scanf( %d , &m);     for (int i = 1; i <= m; i++) scanf( %d %d , &tl[i].first, &tl[i].second);     dfs(h, t);     if (!wins && draw) return printf( Draw n ), 0;     memset(mark, 0, sizeof mark);     if (wins) {       printf( Ivan n );       queue<pair<int, int> > q;       d[h][t] = 0;       mark[h][t] = 1;       q.push({h, t});       while (q.size()) {         int x = q.front().first, y = q.front().second;         q.pop();         for (int i = 1; i <= min(x, n); i++) {           int nx = x - i + hd[i].first, ny = y + hd[i].second;           if (nx >= 0 && ny >= 0 && nx + ny <= R) {             if (!mark[nx][ny] or (mark[nx][ny] && d[nx][ny] > d[x][y] + 1))               mark[nx][ny] = 1, d[nx][ny] = d[x][y] + 1, q.push({nx, ny});           }         }         for (int i = 1; i <= min(m, y); i++) {           int nx = x + tl[i].first, ny = y - i + tl[i].second;           if (nx >= 0 && ny >= 0 && nx + ny <= R) {             if (!mark[nx][ny] or (mark[nx][ny] && d[nx][ny] > d[x][y] + 1))               mark[nx][ny] = 1, d[nx][ny] = d[x][y] + 1, q.push({nx, ny});           }         }       }       printf( %d , d[0][0]);     } else {       printf( Zmey n );       dfs2(h, t);       printf( %d , dis);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     bool sorted = 0;     int a, b, c;     c = count(s.begin(), s.end(),  c );     a = count(s.begin(), s.end(),  a );     b = count(s.begin(), s.end(),  b );     string ss = s;     sort(ss.begin(), ss.end());     for (int i = 0; i < s.size(); i++) {       if (ss[i] == s[i]) {         sorted = 1;       } else {         cout <<  NO ;         return 0;       }     }     s.erase(unique(s.begin(), s.end()), s.end());     if (s[0] ==  a  && s[1] ==  b  && s[2] ==  c ) sorted = 1;     if (a >= 1 && b >= 1 && (c == a || c == b) && sorted) {       cout <<  YES ;       return 0;     }     cout <<  NO ;     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize(2)   using namespace std;   const long long mod = 1e9 + 7;   int mp[510][510];   struct mon {     int x, y, t;   } t[510 * 510];   int n, m, k, q;   int cmp(mon a, mon b) { return a.t < b.t; }   int sum[510][510];   int check(int tim) {     int i, j;     memset(mp, 0, sizeof(mp));     for (i = 1; i <= tim; i++) mp[t[i].x][t[i].y] = 1;     for (i = 1; i <= n; i++)       for (j = 1; j <= m; j++) {         sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + mp[i][j];       }     for (i = 1; i <= n - k + 1; i++) {       for (j = 1; j <= m - k + 1; j++) {         int temp = sum[i + k - 1][j + k - 1] - sum[i + k - 1][j - 1] -                    sum[i - 1][j + k - 1] + sum[i - 1][j - 1];         if (temp == k * k) return 1;       }     }     return 0;   }   int main() {     ios::sync_with_stdio(false);     cin.tie(0);     cin >> n >> m >> k >> q;     int i;     for (i = 1; i <= q; i++) {       cin >> t[i].x >> t[i].y >> t[i].t;     }     sort(t + 1, t + q + 1, cmp);     int l = 1;     int r = q + 1;     while (l < r) {       int mid = (l + r) >> 1;       if (check(mid))         r = mid;       else         l = mid + 1;     }     if (l == q + 1)       cout << -1;     else       cout << t[l].t;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     cin >> n;     string s;     cin >> s;     int c = 0;     int i;     for (i = 0; i < n - 1; i++) {       if (s[i] > s[i + 1]) {         c = 1;         break;       }     }     if (c == 1)       cout <<  YES n  << i + 1 <<     << i + 2 <<   n ;     else       cout <<  NO n ;   }
#include <bits/stdc++.h>   using namespace std;   const long long MOD = (long long)1e9 + 7;   const int SIZE = 2e5 + 5;   const long long INF = 1LL << 60;   const double eps = 1e-4;   const double PI = 3.1415926535897932;   int last[26];   int main() {     string s;     cin >> s;     int n = ((int)(s).size());     for (int i = 0; i < (26); ++i) last[i] = -1;     for (int i = 0; i < (n); ++i) last[s[i] -  a ] = i;     int cl = 0;     stack<int> st;     string ans =   ;     for (int i = 0; i < (n); ++i) {       while (cl < 26 && last[cl] < i) {         while (((int)(st).size()) && (st.top() <= cl)) {           ans +=  a  + st.top();           st.pop();         }         cl++;       }       if (cl >= 26) break;       while (((int)(st).size()) && (st.top() <= cl)) {         ans +=  a  + st.top();         st.pop();       }       if (last[cl] > i) {         if (s[i] ==  a  + cl) {           ans += s[i];         } else {           st.push(s[i] -  a );         }       } else if (last[cl] == i) {         ans += s[i];         cl++;       }     }     while (((int)(st).size())) {       int i = st.top();       st.pop();       ans +=  a  + i;     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long l1, r1, l2, r2, k;     scanf( %I64d %I64d %I64d %I64d %I64d , &l1, &r1, &l2, &r2, &k);     long long l, r;     l = max(l1, l2);     r = min(r1, r2);     long long ans = (r - l) + 1;     if (k <= r && k >= l) ans--;     ans = max(0LL, ans);     printf( %I64d , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   bool comp(int x, int y) { return x > y; }   int dx[] = {0, 0, 1, -1};   int dy[] = {1, -1, 0, 0};   long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }   int main() {     int n;     cin >> n;     vector<pair<int, int> > a(n);     for (int i = 0; i < n; i++) {       int x, y;       cin >> x >> y;       a[i] = make_pair(x, y);     }     int res = 0;     for (int i = 0; i < n; i++) {       int x1 = a[i].first;       int y1 = a[i].second;       int upper = 0, lower = 0, right = 0, left = 0;       for (int j = 0; j < n; j++) {         if (i != j) {           int x2 = a[j].first;           int y2 = a[j].second;           if (x2 > x1 && y1 == y2) right++;           if (x2 < x1 && y1 == y2) left++;           if (x1 == x2 && y2 > y1) upper++;           if (x1 == x2 && y2 < y1) lower++;         }       }       if (upper >= 1 && lower >= 1 && right >= 1 && left >= 1) res++;     }     cout << res << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   char kata[1005];   int panjang, total[30], batas;   int main() {     scanf( %s , kata);     panjang = strlen(kata);     for (int i = 0; i < panjang; ++i) ++total[kata[i] -  a ];     scanf( %d , &batas);     int cek = 0;     for (int i = 0; i < 26; ++i)       if (total[i]) ++cek;     if (cek > batas) {       printf( -1 n );       return 0;     }     int kiri = 0;     int kanan = panjang;     while (kanan - kiri > 1) {       int tengah = (kanan + kiri) / 2;       int pakai = 0;       for (int i = 0; i < 26; ++i) {         pakai += (total[i] + tengah - 1) / tengah;       }       if (pakai > batas)         kiri = tengah;       else         kanan = tengah;     }     printf( %d n , kanan);     for (int i = 0; i < 26; ++i) {       int temp = (total[i] + kanan - 1) / kanan;       for (int j = 0; j < temp; ++j) printf( %c , i +  a );       batas -= temp;     }     for (int i = 0; i < batas; ++i) printf( a );     printf(  n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int cnt[1000000 + 10];   int a[1000000 + 10];   int main() {     int n, m;     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> a[i];       if (a[i] <= m) {         cnt[a[i]]++;       }     }     for (int i = m; i >= 1; i--) {       for (int j = i; (j += i) <= m;) {         cnt[j] += cnt[i];       }     }     int i, j;     for (i = j = 1; i <= m; i++) {       if (cnt[i] > cnt[j]) {         j = i;       }     }     cout << j <<     << cnt[j] << endl;     for (i = 0; i < n; i++) {       if (j % a[i] == 0) {         cout << i + 1 <<    ;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 160;   const int maxM = (int)1e6 + 100;   const int mod = (int)1e9 + 7;   const int maxlog = (int)20;   const int P = mod;   int n, q, l[maxn], r[maxn], mx[maxn], mn[maxn], t[maxn], v[maxn], b[maxn],       cnt[maxn], ans = INT_MAX, tot = 5000000, was[maxn], a[maxn];   int get() {     for (int i = 1; i <= n; i++) cnt[a[i]]++;     int res = 0;     for (int i = 1; i <= n; i++) {       res += cnt[i] * cnt[i];     }     return res;   }   int randint(int l, int r) {     int v = (rand() << 15) ^ rand();     v %= r - l + 1;     return v + l;   }   int main() {     srand(time(0));     cin >> n >> q;     if (q == 0) {       cout << n;       return 0;     }     for (int i = 1; i <= n; i++) {       mn[i] = 1;       mx[i] = n;     }     for (int i = 1; i <= q; i++) {       cin >> t[i] >> l[i] >> r[i] >> v[i];       for (int j = l[i]; j <= r[i]; j++) {         if (t[i] == 2)           mx[j] = min(mx[j], v[i]);         else           mn[j] = max(mn[j], v[i]);       }     }     for (int i = 1; i <= n; i++) {       if (mx[i] < mn[i]) {         cout << -1;         return 0;       }       a[i] = mn[i];     }     ans = get();     int timer = 0;     while (clock() / (double)CLOCKS_PER_SEC < 2.95) {       memset(cnt, 0, sizeof(cnt));       timer++;       for (int i = 1; i <= n; i++) b[i] = a[i];       int x = min(n, randint(1, max(1, n / 3)) + 1);       for (int i = 1; i <= x; i++) {         int pos = randint(1, n);         while (was[pos] == timer) pos = randint(1, n);         was[pos] = timer;         a[pos] = randint(mn[pos], mx[pos]);       }       for (int i = 1; i <= n; i++) cnt[a[i]]++;       int cur = 0;       for (int i = 1; i <= n; i++) cur += cnt[i] * cnt[i];       if (ans >= cur)         ans = cur;       else {         for (int i = 1; i <= n; i++) a[i] = b[i];       }     }     cout << ans;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   inline T sqr(T t) {     return t * t;   }   inline void files() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);   }   int n1, m1, n2, m2;   int a[150][150], b[150][150];   int mx, ansx, ansy;   int main() {     files();     cin >> n1 >> m1;     for (int i = 1; i <= n1; i++)       for (int j = 1; j <= m1; j++) {         char c;         cin >> c;         a[i][j] = c -  0 ;       }     cin >> n2 >> m2;     for (int i = 1; i <= n2; i++)       for (int j = 1; j <= m2; j++) {         char c;         cin >> c;         b[i][j] = c -  0 ;       }     for (int x = -50; x <= 50; x++) {       for (int y = -50; y <= 50; y++) {         int cur = 0;         for (int i = 1; i <= n1; i++)           for (int j = 1; j <= m1; j++)             if (i + x <= n2 && j + y <= m2 && i + x >= 1 && j + y >= 1)               cur += (a[i][j] * b[i + x][j + y]);         if (mx < cur) {           mx = cur;           ansx = x;           ansy = y;         }       }     }     cout << ansx <<     << ansy;   }
#include <bits/stdc++.h>   int main() {     char a[10], e[10];     int b[10], d[10], i, j, c = 0, t;     scanf( %s , a);     scanf( %s , e);     for (i = 0; i < strlen(a); i++) {       b[i] = a[i] -   0 ;       b[i] = b[i] - 48;       d[i] = e[i] -   0 ;       d[i] = d[i] - 48;     }     for (i = 0; i < strlen(a); i++) {       for (j = i + 1; j < strlen(a); j++) {         if (b[i] > b[j]) {           t = b[i];           b[i] = b[j];           b[j] = t;         }       }     }     for (i = 0; i < strlen(a); i++) {       if (b[i] == 0)         c++;       else         break;     }     if (c != strlen(a)) {       t = b[c];       b[c] = b[0];       b[0] = t;     }     c = 0;     for (i = 0; i < strlen(a); i++) {       if (b[i] == d[i]) c++;     }     if (c == strlen(a) && c == strlen(e))       printf( OK );     else       printf( WRONG_ANSWER );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T, typename S>   ostream &operator<<(ostream &os, const pair<T, S> &p) {     return os <<  (  << p.first <<  ,   << p.second <<  ) ;   }   template <typename C, typename T = decay<decltype(*begin(declval<C>()))>,             typename enable_if<!is_same<C, string>::value>::type * = nullptr>   ostream &operator<<(ostream &os, const C &c) {     bool f = true;     os <<  [ ;     for (const auto &x : c) {       if (!f) os <<  ,  ;       f = false;       os << x;     }     return os <<  ] ;   }   template <typename T>   void debug(string s, T x) {     cerr << s <<   =   << x <<   n ;   }   template <typename T, typename... Args>   void debug(string s, T x, Args... args) {     cerr << s.substr(0, s.find( , )) <<   =   << x <<   |  ;     debug(s.substr(s.find( , ) + 2), args...);   }   int a[200000];   bool isMountain[200000];   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int t;     cin >> t;     while (t--) {       int n, k;       cin >> n >> k;       for (int i = 0; i < n; i++) cin >> a[i];       int ret = 0, cnt = 0;       for (int i = 0; i < n; i++)         isMountain[i] =             (i > 0 && i < n - 1 && a[i] > a[i - 1] && a[i] > a[i + 1]);       for (int i = 1; i < k - 1; i++) cnt += isMountain[i];       ret = cnt;       int l = 0;       for (int i = k; i < n; i++) {         cnt -= isMountain[i - (k - 1)];         cnt += isMountain[i - 1];         if (cnt > ret) {           ret = cnt;           l = i - k + 1;         }       }       cout << ret + 1 <<     << l + 1 <<   n ;     }     return 0;   }