malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   struct que {     int l, r, id;     long long ans;   } q[N];   int block, s[N], tong[N * 20], k;   bool cmp1(que i, que j) {     if (i.l / block != j.l / block) return i.l / block < j.l / block;     return i.r < j.r;   }   bool cmp2(que i, que j) { return i.id < j.id; }   int read() {     int x = 0;     char ch = getchar();     while (!isdigit(ch)) ch = getchar();     while (isdigit(ch)) x = x * 10 + ch -  0 , ch = getchar();     return x;   }   inline void print(long long x) {     if (x > 9) print(x / 10);     putchar(x % 10 +  0 );   }   long long ans = 0;   void add(int x) {     ans += (long long)tong[s[x] ^ k];     tong[s[x]]++;   }   void del(int x) {     tong[s[x]]--;     ans -= (long long)tong[s[x] ^ k];   }   int main() {     int n, m, x;     scanf( %d%d%d , &n, &m, &k);     block = sqrt(n);     for (int i = 1; i <= n; ++i) scanf( %d , &x), s[i] = s[i - 1] ^ x;     for (int i = 1; i <= m; ++i)       scanf( %d%d , &q[i].l, &q[i].r), q[i].l--, q[i].id = i;     sort(q + 1, q + m + 1, cmp1);     int l = 0, r = 0;     tong[0] = 1;     for (int i = 1; i <= m; i++) {       for (; l < q[i].l; l++) del(l);       for (; l > q[i].l; l--) add(l - 1);       for (; r < q[i].r; r++) add(r + 1);       for (; r > q[i].r; r--) del(r);       q[i].ans = ans;     }     sort(q + 1, q + m + 1, cmp2);     for (int i = 1; i <= m; ++i) cout << q[i].ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const double eps = 1e-10;   const int oo = ~0u >> 2, mo = (int)1e9 + 7;   const int mn = 110000, mm = 110000 * 2, ml = 18;   struct Edge {     int y, l;   } E[mm];   int g[mn], d[mn], s[mn], blg[mn];   int fa[mn][ml], f[mn];   bool o[mn];   int n, m, tt(1);   void add(int x, int y) {     E[++tt].y = y, E[tt].l = g[x], g[x] = tt;     E[++tt].y = x, E[tt].l = g[y], g[y] = tt;   }   int LOG2(int x) {     int t = (int)log2(x);     while ((1 << t) > x) --t;     while ((1 << (t + 1)) <= x) ++t;     return t;   }   int find(int x) {     int i = x, t;     while (f[i] != i) i = f[i];     while (x != i) t = f[x], f[x] = i, x = t;     return x;   }   struct Stack {     int x, i;     Stack() {}     Stack(int _x) { x = _x, i = -1; }     void init(int _x) { x = _x, i = -1; }   } Q[mn];   void init() {     for (int i = 1; i <= n; ++i)       if (!d[i]) {         int r = 0;         d[i] = 1, fa[i][0] = i, blg[i] = i, f[i] = i;         Q[++r].init(i);         while (r) {           int x = Q[r].x, &i = Q[r].i, y;           (d[0] = max(d[0], d[x]));           if (i == -1)             f[x] = x, i = g[x];           else {             y = E[i].y;             if (find(x) == find(y)) o[x] |= o[y];             i = E[i].l;           }           y = E[i].y;           if (!i) {             --r;             continue;           }           if (!d[y]) {             d[y] = d[x] + 1, fa[y][0] = x, blg[y] = blg[x], f[y] = y;             Q[++r].init(y);           } else if (d[x] > d[y] + 1) {             int z = find(x);             while (d[z] > d[y] + 1) f[z] = fa[z][0], z = find(z);             o[x] |= !((d[x] - d[y]) % 2);           }         }         Q[r = 1].init(i);         while (r) {           int x = Q[r].x, &i = Q[r].i, y;           if (i == -1)             s[x] += o[find(x)], i = g[x];           else             i = E[i].l;           y = E[i].y;           if (!i) {             --r;             continue;           }           if (d[y] == d[x] + 1) {             if (find(x) == find(y)) o[y] |= o[x];             s[y] = s[x], Q[++r].init(y);           }         }       }     int t = LOG2(d[0]);     for (int j = 1; j <= t; ++j)       for (int i = 1; i <= n; ++i) fa[i][j] = fa[fa[i][j - 1]][j - 1];   }   int lca(int x, int y) {     if (d[x] < d[y]) swap(x, y);     while (d[x] > d[y]) x = fa[x][LOG2(d[x] - d[y])];     if (x == y) return x;     for (int i = LOG2(d[x]); i >= 0; --i)       if (fa[x][i] != fa[y][i]) x = fa[x][i], y = fa[y][i];     return fa[x][0];   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= m; ++i) {       int x, y;       scanf( %d%d , &x, &y);       add(x, y);     }     init();     scanf( %d , &tt);     while (tt--) {       int x, y, z;       scanf( %d%d , &x, &y);       if (blg[x] != blg[y]) {         printf( No n );         continue;       }       z = lca(x, y);       if (((d[x] + d[y]) & 1) || s[x] + s[y] - 2 * s[z])         printf( Yes n );       else         printf( No n );     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios::sync_with_stdio(false);     int n, a;     cin >> n >> a;     double angd = 180 * 1.0 / n;     cout <<  2 1  ;     int x = floor(a / angd);     if (x == 0)       cout << 3 << endl;     else if (a - x * angd < (1 + x) * angd - a)       cout << min(x + 2, n) << endl;     else       cout << min(x + 3, n) << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   template <typename T>   using V = vector<T>;   int gcdex(int a, int b, int &x, int &y) {     if (a == 0) {       x = 0;       y = 1;       return b;     }     int x1, y1;     int g = gcdex(b % a, a, x1, y1);     x = y1 - (b / a) * x1;     y = x1;     return g;   }   inline int ADD_MOD(int a, int b) { return (a + b) % 1000000007; }   inline int MUL_MOD(int a, int b) { return (int64_t(a) * b) % 1000000007; }   inline int SUB_MOD(int a, int b) { return a >= b ? a - b : a + 1000000007 - b; }   int DIV_MOD(int a, int b) {     int x, y;     gcdex(b, 1000000007, x, y);     int b1 = (x % 1000000007 + 1000000007) % 1000000007;     return MUL_MOD(a, b1);   }   const long double EPS = 1. / 1e9;   inline bool EPS_EQUAL(long double a, long double b) {     return abs(a - b) <= EPS;   }   inline bool EPS_LESS(long double a, long double b) { return b - a > EPS; }   inline bool EPS_GREATER(long double a, long double b) { return a - b > EPS; }   const int INF = 1e9;   const int64_t INF64 = 2e18;   void get_cycle(V<int> &a, V<uint8_t> &visited, int start, V<int> &c) {     int i = start;     while (a[i] != start) {       c.push_back(a[i]);       visited[a[i]] = 1;       i = a[i];     }     c.push_back(start);     visited[start] = 1;   }   void add_out_cycle(V<int> &b, V<int> &c) {     for (int i = 0; i < c.size(); ++i) {       int prev = i > 0 ? c[i - 1] : c.back();       b[prev] = c[i];     }   }   void add_odd_cycle(V<int> &b, V<int> &c) {     int len = c.size();     V<int> outC(len);     for (int i = 0; i < len; ++i) {       if (i % 2 == 0) {         outC[i] = c[(len + i) / 2];       } else {         outC[i] = c[i / 2];       }     }     add_out_cycle(b, outC);   }   void add_even_cycle(V<int> &b, V<int> &c1, V<int> &c2) {     int len = c1.size();     V<int> outC(len * 2);     for (int i = 0; i < len; ++i) {       outC[i * 2] = c1[i];       outC[i * 2 + 1] = c2[i];     }     add_out_cycle(b, outC);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.precision(15);     int n;     cin >> n;     V<int> a(n);     for (auto &i : a) {       cin >> i;       --i;     }     V<int> b(n);     V<uint8_t> visited(n);     V<V<int> > evenCycles(n + 1);     int evenCyclesCount = 0;     for (int i = 0; i < n; ++i) {       if (!visited[i]) {         V<int> c;         get_cycle(a, visited, i, c);         int len = c.size();         if (len % 2 == 1) {           add_odd_cycle(b, c);         } else {           if (!evenCycles[len].empty()) {             add_even_cycle(b, evenCycles[len], c);             evenCycles[len].clear();             evenCyclesCount--;           } else {             swap(evenCycles[len], c);             evenCyclesCount++;           }         }       }     }     if (evenCyclesCount > 0) {       cout << -1 << endl;       return 0;     }     for (auto &i : b) {       cout << i + 1 <<    ;     }     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 1005;   int n, a[N][N];   deque<int> p[N];   int ptr[N], mat[N];   bool vis[N][N];   void upd(int x) {     while (!p[x].empty() && vis[x][p[x].front()]) p[x].pop_front();     while (!p[x].empty() && vis[x][p[x].back()]) p[x].pop_back();     if (p[x].empty()) {       cout << -1 << endl;       exit(0);     }   }   inline void del(int x, int y) { vis[x][y] = vis[y][x] = 1; }   void add(int x, int y) {     mat[y] = x;     while (1) {       upd(y);       if (p[y].back() != x)         del(p[y].back(), y);       else         break;     }   }   int nxt(int x) {     upd(x);     int y = p[x].front();     p[x].pop_front();     upd(x);     p[x].push_front(y);     return mat[p[x][1]];   }   int main() {     ios::sync_with_stdio(false);     cin >> n;     if (n & 1) {       cout << -1 << endl;       return 0;     }     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= n; j++) {         if (i != j) cin >> a[i][j], p[i].push_back(j);       }       sort(p[i].begin(), p[i].end(),            [&](int x, int y) { return a[i][x] < a[i][y]; });     }     queue<int> q;     for (int i = 1; i <= n; i++) q.push(i);     while (!q.empty()) {       int x = q.front();       q.pop();       while (1) {         upd(x);         int y = p[x].front(), z = mat[y];         if (z && a[y][z] < a[y][x]) assert(0);         if (z) {           mat[y] = 0;           q.push(z);         }         add(x, y);         break;       }     }     int cur = 1;     while (1) {       while (cur <= n) {         upd(cur);         if (p[cur].size() > 1)           break;         else           ++cur;       }       if (cur > n) {         for (int i = 1; i <= n; i++) cout << p[i].front() << endl;         return 0;       }       vector<int> c1, c2;       int x = cur, y = cur;       do x = nxt(x), y = nxt(nxt(y));       while (x != y);       do c1.push_back(y), y = nxt(y);       while (x != y);       for (auto &i : c1) {         int y = p[i][0];         c2.push_back(y);         mat[y] = 0;         del(i, y);       }       for (int i = 0; i < int(c1.size()); i++)         add(c1[i], c2[(i + 1) % c1.size()]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       long long int n, flag = 0;       cin >> n;       long long int a[n];       for (int i = 0; i < n; i++) {         cin >> a[i];       }       for (int i = 0; i < (n - 1); i++) {         if (a[i] > a[i + 1]) {           flag = 0;         } else {           flag = 1;           break;         }       }       if (flag == 0) {         cout <<  NO  << endl;       } else {         cout <<  YES  << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     long long int n;     cin >> n;     string s;     cin >> s;     for (int i = 0; i < n; i++) {       long long int ml = 0, mr = 0, j;       j = i;       while (j < n - 1 && s[j] !=  R ) {         s[j] ==  L  ? mr++ : mr += 0;         j++;       }       j = i - 1;       while (j > -1 && s[j] !=  L ) {         s[j] ==  R  ? ml++ : ml += 0;         j--;       }       cout << 1 + max(ml, mr) <<    ;     }     cout <<   n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     long long n;     cin >> n;     pair<long long, long long> a[n];     for (long long i = 0; i < n; i++) {       cin >> a[i].first;       a[i].second = i + 1;     }     sort(a, a + n);     long long mx = 0, mx_start = 0, mx_end = 0;     long long j;     long long mn = n;     for (long long i = 0; i < n; i++) {       long long c = a[i].second;       long long d, ck = 0;       for (j = i; j < n; j++) {         if (a[i].first != a[j].first) {           d = a[j - 1].second;           break;         } else           ck++;       }       if (j == n) {         d = a[j - 1].second;         i = n - 1;       } else         i = j - 1;       if (ck > mx) {         mx = ck;         mx_start = c;         mx_end = d;         mn = d - c + 1;       } else if (ck == mx && (d - c + 1) < mn) {         mx = ck;         mx_start = c;         mx_end = d;         mn = d - c + 1;       }     }     cout << mx_start <<     << mx_end << endl;     return 0;   }
#include <bits/stdc++.h>   char abc[1000001];   int main() {     char ab[1000001];     scanf( %s , ab);     int abcc = strlen(ab);     int i, x = 0, y = 0;     for (i = 0; i < abcc; i++) {       x += ab[i] ==  x  ? 1 : 0;       y += ab[i] ==  y  ? 1 : 0;     }     if (x > y)       for (i = 0; i < x - y; i++) abc[i] =  x ;     else       for (i = 0; i < y - x; i++) abc[i] =  y ;     printf( %s , abc);   }
#include <bits/stdc++.h>   using namespace std;   void solve(int test) {     int x;     cin >> x;     int no = x % 10;     int cnt = 0;     while (x) {       cnt++;       x /= 10;     }     int ans = (no - 1) * 10;     while (cnt) {       ans += cnt;       cnt--;     }     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     cout << setprecision(20);     long long int t = 1, k;     cin >> t;     k = t;     while (t--) {       solve(k - t);     }     cerr <<  Timpe elapsed :  << clock() * 1000.0 / CLOCKS_PER_SEC <<   mps n ;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int a[19][19];   int n;   int main() {     cin >> n;     for (int i = 1; i <= n; i++) {       a[i][1] = 1;       a[1][i] = 1;     }     for (int i = 2; i <= n; i++) {       for (int j = 2; j <= n; j++) {         a[i][j] = a[i - 1][j] + a[i][j - 1];       }     }     cout << a[n][n];     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, p, q, i = 1, j, k, temp = 0, flag = 0;     string s;     cin >> n >> p >> q;     cin >> s;     if (n % p == 0 && n != p + q || n % q == 0 && n != p + q) {       if (n % p == 0) {         cout << n / p << endl;         for (i = 0; i < n; i++) {           cout << s[i];           if ((i + 1) % p == 0) cout << endl;         }       } else {         cout << n / q << endl;         for (i = 0; i < n; i++) {           cout << s[i];           if ((i + 1) % q == 0) cout << endl;         }       }     } else {       while (1) {         j = n - (p * i);         k = n - (q * i);         if (j < 0 || k < 0) break;         if (j % q == 0) {           temp = 1;           break;         }         if (k % p == 0) {           flag = 1;           break;         }         if (j < 0 && k < 0) break;         i++;       }       if (temp == 1) {         cout << i + (j / q) << endl;         for (int x = 0; x < i * p; x++) {           cout << s[x];           if ((x + 1) % p == 0) cout << endl;         }         j = 1;         for (int x = i * p; x < n; x++) {           cout << s[x];           if ((j) % q == 0) cout << endl;           j++;         }       } else if (flag == 1) {         cout << i + (k / p) << endl;         for (int x = 0; x < i * q; x++) {           cout << s[x];           if ((x + 1) % q == 0) cout << endl;         }         j = 1;         for (int x = i * q; x < n; x++) {           cout << s[x];           if ((j) % p == 0) cout << endl;           j++;         }       } else {         cout <<  -1  << endl;       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int a, b, c;     cin >> a >> b >> c;     for (int i = 0; i <= (c / b); i++) {       int tmp = c - (i * b);       if (tmp % a == 0) {         cout <<  Yes  << endl;         return 0;       }     }     cout <<  No  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, k, a[105], nr = 0, poz = 0;     cin >> n >> k;     for (int i = 0; i < n; i++) cin >> a[i];     for (int i = 0; i < n; i++) {       if (a[i] <= k)         nr++;       else {         poz = i;         break;       }     }     if (poz || nr == 0)       for (int i = n - 1; i > poz; i--)         if (a[i] <= k)           nr++;         else           break;     cout << nr;   }
#include <bits/stdc++.h>   using namespace std;   int p[2010];   int main(void) {     int N, ans = 0, i, j;     cin >> N;     for ((i) = 0; (i) < (int)(N); (i)++) cin >> p[i];     for ((i) = 0; (i) < (int)(N); (i)++)       if (p[i] < 0) p[i] = -p[i];     for ((i) = 0; (i) < (int)(N); (i)++) {       int a = 0, b = 0;       for ((j) = 0; (j) < (int)(N); (j)++)         if (p[j] < p[i]) {           if (j < i) a++;           if (j > i) b++;         }       ans += min(a, b);     }     cout << ans << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int Max_L = 100000 + 100, inf = ~0U >> 2;   pair<int, int> Ret[1000];   int main() {     int L, b, f;     cin >> L >> f >> b;     int n;     cin >> n;     set<pair<int, int> > S;     S.insert(pair<int, int>(-inf, -inf));     S.insert(pair<int, int>(inf, inf));     for (int i = 0; i < n; i++) {       int t, len;       cin >> t >> len;       if (t == 1) {         bool ok = false;         for (typeof(S.begin()) it = S.begin(); it != S.end(); it++) {           if (it == --S.end()) continue;           int l = max(it->second + f, 0);           ++it;           int r = min(it->first - b, L);           --it;           if (r - l >= len) {             ok = true;             cout << l << endl;             Ret[i] = pair<int, int>(l, l + len);             S.insert(Ret[i]);             break;           }         }         if (!ok) cout << -1 << endl;       } else {         len--;         S.erase(Ret[len]);       }     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     long long n, k;     cin >> n >> k;     string s;     cin >> s;     string ans;     for (long long i = 0; i < k; i++) {       ans.push_back(s[i]);     }     for (long long i = k; i < n; i++) {       ans.push_back(ans[i - k]);     }     cout << n << endl;     if (ans >= s) {       cout << ans << endl;     } else {       long long i = k - 1;       while (i >= 0 && ans[i] ==  9 ) {         ans[i] =  0 ;         for (long long j = i; j < n; j += k) {           ans[j] =  0 ;         }         i--;       }       for (; i < n; i += k) {         ans[i]++;       }       cout << ans << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   int main() {     vector<int> seq;     int n;     long e;     cin >> n;     int first = 0;     long long s = 0;     int f = 0;     for (int i = 0; i < n; i++) {       cin >> e;       if (e != 1) {         s += e;         f++;       } else {         first++;       }       if (s > f && (s - f + 1) % 2 == 0) {         cout << 1 << endl;       } else {         cout << 2 << endl;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   vector<pair<long long int, long long int> > points, hull;   bool comp(pair<long long int, long long int> a,             pair<long long int, long long int> b) {     if (a.first != b.first) return a.first < b.first;     return a.second < b.second;   }   int cross(pair<long long int, long long int> a,             pair<long long int, long long int> b,             pair<long long int, long long int> c) {     return a.first * (b.second - c.second) + b.first * (c.second - a.second) +                c.first * (a.second - b.second) >=            0;   }   int main() {     int n;     cin >> n;     for (int i = 0; i < n; i++) {       long long int x, y;       cin >> x >> y;       y = y - x * x;       points.push_back({x, y});     }     sort(points.begin(), points.end(), comp);     int sz = 1;     hull.push_back(points[0]);     for (int i = 1; i < points.size(); i++) {       while (sz >= 2 && cross(hull[sz - 2], hull[sz - 1], points[i]))         hull.pop_back(), sz--;       hull.push_back(points[i]);       sz++;     }     int ans = 0;     for (int i = 0; i < sz - 1; i++) {       if (hull[i].first != hull[i + 1].first) ans++;     }     cout << ans << endl;   }
#include <bits/stdc++.h>   using namespace std;   long long n, x, sum = 0, sumtotal;   int main() {     cin >> n;     for (int i = 0; i < n - 1; i++) {       cin >> x;       sum += x;     }     sumtotal = n * (n + 1) / 2;     cout << sumtotal - sum << endl;   }
#include <bits/stdc++.h>   using namespace std;   #pragma comment(linker,  /STACK:167177216 )   int main() {     double y1, y2, yw, xa, ya, r;     cin >> y1 >> y2 >> yw >> xa >> ya >> r;     double ll = 0, rr = xa;     yw -= r;     double yt = y1 + r + 1e-9;     for (int i = 0; i < 300; ++i) {       double xm = (ll + rr) / 2;       double dx1 = -xm, dy1 = yt - yw;       double a1 = acos(-dy1 / sqrt(dx1 * dx1 + dy1 * dy1));       dx1 = xa - xm, dy1 = ya - yw;       double a2 = acos(-dy1 / sqrt(dx1 * dx1 + dy1 * dy1));       if (a1 > a2)         rr = xm;       else         ll = xm;     }     double xm = (ll + rr) / 2;     double a = yw - yt, b = -xm, c = -b * yt;     double d = fabs(b * y2 + c) / sqrt(a * a + b * b);     if (d + 1e-9 < r) {       cout << -1 << endl;       return 0;     }     cout.precision(20);     cout << xm << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int n, d[100000];     string ch;     long long res = 0;     bool b = 0;     cin >> n >> ch;     for (int i = 0; i < n; i++) cin >> d[i];     for (int i = 0; i < n; i++) {       if (ch[res] ==  < )         res -= d[res];       else         res += d[res];       if (res < 0 || res >= n) {         b = 1;         break;       }     }     if (b)       cout <<  FINITE  << endl;     else       cout <<  INFINITE  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1000000;   int centroid[maxn];   int parent[maxn];   int subtree[maxn];   int heaviest[maxn];   vector<int> graph[maxn];   void dfs(int u, int p = 0) {     parent[u] = p;     subtree[u] = 1;     heaviest[u] = 0;     int vert = 0;     for (auto v : graph[u]) {       if (v == p) continue;       dfs(v, u);       subtree[u] += subtree[v];       if (subtree[v] > heaviest[u]) {         heaviest[u] = subtree[v];         vert = v;       }     }     if ((int)graph[u].size() == 0 or (2 * heaviest[u] <= subtree[u]))       centroid[u] = u;     else {       int curr = centroid[vert];       centroid[u] = curr;       while (curr != u) {         int P = parent[curr];         int rem = subtree[u] - subtree[P];         if (2 * heaviest[P] > subtree[u]) break;         if (2 * rem <= subtree[u]) centroid[u] = P;         curr = parent[curr];       }     }   }   int main() {     int n;     scanf( %d , &n);     int q;     scanf( %d , &q);     for (int i = 2; i <= n; i++) {       int p;       scanf( %d , &p);       graph[p].push_back(i);     }     dfs(1);     while (q--) {       int v;       scanf( %d , &v);       printf( %d n , centroid[v]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k, r1, r2;   string ans;   bool pytaj(int x, int y) {     cout << 1 <<     << x <<     << y <<   n ;     fflush(stdout);     cin >> ans;     return ans[0] ==  T ;   }   int znajdz(int l, int r) {     if (r < l) return -1;     while (l < r) {       int d = (r - l + 1 - 2 + 2) / 4;       int a = l + d;       int b = r - d;       if (pytaj(a, b))         r = (l + r) / 2;       else         l = (l + r + 1) / 2;     }     return l;   }   bool sprawdz(int x) {     if (x - 1 >= 1 && !pytaj(x, x - 1)) return 0;     if (x + 1 <= n && !pytaj(x, x + 1)) return 0;     return 1;   }   int32_t main() {     cin >> n >> k;     r1 = znajdz(1, n);     r2 = znajdz(1, r1 - 1);     if (r2 == -1 || !sprawdz(r2)) r2 = znajdz(r1 + 1, n);     cout << 2 <<     << r1 <<     << r2 <<   n ;     fflush(stdout);   }