malteklaes/cpp-code-code_search_net-style huggingface dataset:
#include <bits/stdc++.h>   using namespace std;   char _buf[100000], *_op(_buf), *_ed(_buf);   inline int getint() {     int _s = 0, _f = 1;     char _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),                                _op == _ed)                     ? EOF                     : *_op++);     while (!( 0  <= _ch && _ch <=  9 ))       (_ch ==  - ) && (_f = -1),           _ch =               (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),                               _op == _ed)                    ? EOF                    : *_op++);     while (( 0  <= _ch && _ch <=  9 ))       _s = _s * 10 + _ch - 48,       _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin),                             _op == _ed)                  ? EOF                  : *_op++);     return _s * _f;   }   const int N = 2e5 + 1, mod = 1e9 + 7;   inline void check(int& x) { x -= mod, x += x >> 31 & mod; }   inline void cmax(int& x, int y) {     if (x - y >> 31) x = y;   }   inline void cmin(int& x, int y) {     if (y - x >> 31) x = y;   }   int n, m, ans;   int Sx, Sy, Fx, Fy;   int X[N], Y[N], tag[N];   int idx[N], idy[N], posx[N], posy[N];   inline int dis(int x, int y, int p) {     return min(abs(X[p] - x), abs(Y[p] - y));   }   priority_queue<pair<int, int> > q;   inline void input() {     n = getint(), m = getint();     Sx = getint(), Sy = getint(), Fx = getint(), Fy = getint();     for (int i = 1; i <= m; i++) X[i] = getint(), Y[i] = getint();     ans = abs(Fx - Sx) + abs(Fy - Sy);     for (int i = 1; i <= m; i++) q.push(pair<int, int>(-dis(Sx, Sy, i), i));   }   inline int cmpx(int x, int y) { return X[x] < X[y]; }   inline int cmpy(int x, int y) { return Y[x] < Y[y]; }   inline void init() {     for (int i = 1; i <= m; i++) idx[i] = i;     sort(idx + 1, idx + 1 + m, cmpx);     for (int i = 1; i <= m; i++) posx[idx[i]] = i;     for (int i = 1; i <= m; i++) idy[i] = i;     sort(idy + 1, idy + 1 + m, cmpy);     for (int i = 1; i <= m; i++) posy[idy[i]] = i;   }   inline void work() {     for (int u, w, v; !q.empty();) {       w = -q.top().first, u = q.top().second, q.pop();       if (tag[u]) continue;       tag[u] = 1, ans = min(0ll + ans, 0ll + w + abs(X[u] - Fx) + abs(Y[u] - Fy));       if ((v = idx[posx[u] - 1]) && !tag[v])         q.push(pair<int, int>(-w - X[u] + X[v], v));       if ((v = idx[posx[u] + 1]) && !tag[v])         q.push(pair<int, int>(-w - X[v] + X[u], v));       if ((v = idy[posy[u] - 1]) && !tag[v])         q.push(pair<int, int>(-w - Y[u] + Y[v], v));       if ((v = idy[posy[u] + 1]) && !tag[v])         q.push(pair<int, int>(-w - Y[v] + Y[u], v));     }     cout << ans <<   n ;   }   int main() {     input();     init();     work();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m, K;   char maze[2010][2010];   int up[2010][2010], down[2010][2010];   struct Segtree {     int key[2010 * 4], ans[2010 * 4];     void add(deque<pair<int, int> > &que, int pos, int val) {       while (!que.empty() && val < que.back().second) que.pop_back();       que.push_back(make_pair(pos, val));     }     void remove(deque<pair<int, int> > &que, int pos) {       while (!que.empty() && que.front().first <= pos) que.pop_front();     }     void cal(int l, int r, int step) {       int mid = l + r >> 1;       deque<pair<int, int> > qU, qD;       int i = 0, j = 0;       key[step] = 0;       for (; j < m; j++) {         int a, b;         add(qU, j, mid - max(l - 1, up[mid][j]));         if (mid < r)           add(qD, j, b = (min(r + 1, down[mid + 1][j]) - mid - 1));         else           add(qD, j, b = 0);         key[step] =             max(key[step], min(j - i + 1, qU.front().second + qD.front().second));         while (i < j && j - i + 1 > qU.front().second + qD.front().second) {           remove(qU, i);           remove(qD, i);           i++;           key[step] = max(key[step],                           min(j - i + 1, qU.front().second + qD.front().second));         }       }     }     void build(int l, int r, int step) {       cal(l, r, step);       if (l == r) return;       int mid = l + r >> 1;       build(l, mid, step * 2);       build(mid + 1, r, step * 2 + 1);       ans[step] = max(key[step], max(ans[step * 2], ans[step * 2 + 1]));     }     void update(int l, int r, int pos, int step) {       cal(l, r, step);       if (l == r) return;       int mid = l + r >> 1;       if (pos <= mid)         update(l, mid, pos, step * 2);       else         update(mid + 1, r, pos, step * 2 + 1);       ans[step] = max(key[step], max(ans[step * 2], ans[step * 2 + 1]));     }   } tree;   int main() {     scanf( %d%d%d , &n, &m, &K);     for (int i = 0; i < (n); i++) scanf( %s , maze[i]);     for (int j = 0; j < (m); j++) up[0][j] = maze[0][j] ==  .  ? -1 : 0;     for (int i = 1; i < n; i++)       for (int j = 0; j < (m); j++)         up[i][j] = maze[i][j] ==  .  ? up[i - 1][j] : i;     for (int j = 0; j < (m); j++)       down[n - 1][j] = maze[n - 1][j] ==  .  ? n : n - 1;     for (int i = n - 2; i >= 0; i--)       for (int j = 0; j < (m); j++)         down[i][j] = maze[i][j] ==  .  ? down[i + 1][j] : i;     tree.build(0, n - 1, 1);     while (K--) {       int x, y;       scanf( %d%d , &x, &y);       x--, y--;       maze[x][y] =  # ;       up[0][y] = maze[0][y] ==  .  ? -1 : 0;       for (int i = 1; i < n; i++) up[i][y] = maze[i][y] ==  .  ? up[i - 1][y] : i;       down[n - 1][y] = maze[n - 1][y] ==  .  ? n : n - 1;       for (int i = n - 2; i >= 0; i--)         down[i][y] = maze[i][y] ==  .  ? down[i + 1][y] : i;       tree.update(0, n - 1, x, 1);       printf( %d n , tree.ans[1]);     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   vector<pair<int, int> > v[1000007];   vector<int> rv[1000007];   int comp[1000007];   vector<pair<int, int> > g[1000007];   long long sm[1000007];   int used[1000007];   int stver;   stack<int> s;   vector<int> srt;   bool val[100000002];   long long hval[1000007];   long long dp[1000007];   map<int, int> ZX;   void dfs(int vertex) {     used[vertex] = 1;     int i;     int sz = v[vertex].size();     for (i = 0; i < sz; i++) {       if (used[v[vertex][i].first] == 0) {         dfs(v[vertex][i].first);       }     }     s.push(vertex);   }   void revdfs(int vertex, int id) {     comp[vertex] = id;     int i;     int sz = rv[vertex].size();     for (i = 0; i < sz; i++) {       if (comp[rv[vertex][i]] == 0) {         revdfs(rv[vertex][i], id);       }     }   }   void precalc() {     int i;     long long cur = 0;     int br = 1;     if (val[0] == true) {       hval[0] = 1;     }     for (i = 1; i < 100000002; i++) {       cur = cur + br;       if (i >= (br * (br + 1) / 2)) {         br++;       }       if (val[i] == true) {         hval[ZX[i]] = cur;       }     }   }   void calc_dp(int vertex) {     used[vertex] = 1;     int i;     int sz = g[vertex].size();     for (i = 0; i < sz; i++) {       if (used[g[vertex][i].first] == 0) {         calc_dp(g[vertex][i].first);       }       if (dp[vertex] < dp[g[vertex][i].first] + g[vertex][i].second) {         dp[vertex] = dp[g[vertex][i].first] + g[vertex][i].second;       }     }     dp[vertex] += sm[vertex];   }   void input() {     scanf( %d%d , &n, &m);     int i;     for (i = 1; i <= m; i++) {       int x, y, z;       scanf( %d%d%d , &x, &y, &z);       v[x].push_back(make_pair(y, z));       rv[y].push_back(x);       srt.push_back(z);       val[z] = true;     }     if (srt.size() != 0) {       sort(srt.begin(), srt.end());       ZX[srt[0]] = 1;       for (i = 1; i < m; i++) {         if (srt[i] == srt[i - 1]) {           continue;         }         ZX[srt[i]] = ZX[srt[i - 1]] + 1;       }     }     scanf( %d , &stver);     precalc();   }   void solve() {     int i, j;     for (i = 1; i <= n; i++) {       if (used[i] == 0) {         dfs(i);       }     }     int tp = 1;     while (s.empty() == false) {       int u = s.top();       s.pop();       if (comp[u] != 0) {         continue;       }       revdfs(u, tp);       tp++;     }     for (i = 1; i <= n; i++) {       int sz = v[i].size();       for (j = 0; j < sz; j++) {         if (comp[v[i][j].first] == comp[i]) {           sm[comp[i]] += hval[ZX[v[i][j].second]];         } else {           g[comp[i]].push_back(make_pair(comp[v[i][j].first], v[i][j].second));         }       }     }     for (i = 1; i <= n; i++) {       used[i] = 0;     }     stver = comp[stver];     calc_dp(stver);     printf( %I64d n , dp[stver]);   }   int main() {     ios_base ::sync_with_stdio(false);     cin.tie(NULL);     input();     solve();     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long int INF = 2e18;   bool isPrime(long long int n) {     if (n <= 1) return false;     if (n <= 3) return true;     if (n % 2 == 0 || n % 3 == 0) return false;     for (long long int i = 5; i * i <= n; i = i + 6) {       if (n % i == 0 || n % (i + 2) == 0) return false;     }     return true;   }   long long int exp(long long int x, long long int n) {     long long int res = 1;     while (n > 0) {       if (n % 2 == 1) res = (res * x) % 1000000007;       x = (x * x) % 1000000007;       n = n / 2;     }     return res;   }   void null() {     long long int n, l, r;     cin >> n >> l >> r;     vector<long long int> a, b;     for (long long int i = 0; i < n; i++) {       long long int x;       cin >> x;       a.push_back(x);     }     for (long long int i = 0; i < n; i++) {       long long int x;       cin >> x;       b.push_back(x);     }     for (long long int i = 0; i < l - 1; i++) {       if (a[i] != b[i]) {         cout <<  LIE ;         return;       }     }     for (long long int i = r; i < n; i++) {       if (a[i] != b[i]) {         cout <<  LIE ;         return;       }     }     cout <<  TRUTH ;   }   signed main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     long long int t = 1;     clock_t start, end;     start = clock();     cout << fixed << setprecision(20);     while (t--) {       null();     }     end = clock();     double time_taken = double(end - start) / double(CLOCKS_PER_SEC);   }
#include <bits/stdc++.h>   using namespace std;   int n, m, a[105], rev[105], b[105];   long double ans = 0, cnt = 0, f[2][35][35], g[31][31];   void dfs(int u) {     if (!u) {       for (int i = 1; i <= n; i++)         for (int j = i + 1; j <= n; j++)           if (a[i] > a[j]) ans++;       cnt++;       return;     }     for (int i = 1; i <= n; i++) {       for (int j = i; j <= n; j++) {         for (int k = i; k <= (i + j) / 2; k++) swap(a[k], a[j - (k - i)]);         dfs(u - 1);         for (int k = i; k <= (i + j) / 2; k++) swap(a[k], a[j - (k - i)]);       }     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     long double kk = n * (n + 1) / 2.0;     for (int i = 1; i <= n; i++)       for (int j = i + 1; j <= n; j++)         if (a[i] > a[j]) f[0][i][j] = 1;     for (int o = 1; o <= m; o++) {       int p = o & 1;       memset(f[p], 0, sizeof(f[p]));       for (int i = 1; i <= n; i++) {         for (int j = i; j <= n; j++) {           for (int k = 1; k <= n; k++) b[k] = k;           for (int k = i; k <= (j + i) / 2; k++) swap(b[k], b[j - k + i]);           for (int x = 1; x <= n; x++)             for (int y = x + 1; y <= n; y++)               if (b[x] < b[y])                 f[p][b[x]][b[y]] += f[p ^ 1][x][y] / kk;               else                 f[p][b[y]][b[x]] += (1 - f[p ^ 1][x][y]) / kk;         }       }     }     long double ans = 0;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= n; j++) ans += f[m & 1][i][j];     printf( %.10lf n , (double)ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long int inv[32][2];   void rec(vector<int>& a, int b) {     if (b < 0 || a.size() == 0) return;     int c[2] = {0};     vector<int> v[2];     for (int x : a) {       int val;       if ((x & (1 << b)) > 0)         val = 1;       else         val = 0;       if (val == 0)         inv[b][0] += c[1];       else         inv[b][1] += c[0];       c[val]++;       v[val].push_back(x);     }     rec(v[0], b - 1);     rec(v[1], b - 1);   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     int n;     cin >> n;     vector<int> a(n);     for (int i = 0; i < n; i++) cin >> a[i];     rec(a, 30);     long long int x = 0, ans = 0;     for (int i = 0; i <= 30; i++) {       ans += min(inv[i][0], inv[i][1]);       if (inv[i][0] > inv[i][1]) x += (1 << i);     }     cout << ans <<     << x <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int N = 2e5 + 5;   vector<int> g[N];   void dfs(int u, vector<int>& dep, int par = -1, int h = 0) {     dep[u] = h;     for (int v : g[u]) {       if (v == par) continue;       dfs(v, dep, u, h + 1);     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int n, x;     cin >> n >> x;     for (int i = 0; i < n - 1; i++) {       int u, v;       cin >> u >> v;       g[u].push_back(v);       g[v].push_back(u);     }     vector<int> dep_r(n + 1);     vector<int> dep_x(n + 1);     dfs(1, dep_r);     dfs(x, dep_x);     int mx = -1;     for (int i = 1; i <= n; i++) {       if (dep_x[i] < dep_r[i]) {         mx = max(mx, dep_r[i] << 1);       }     }     cout << mx <<   n ;   }
#include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   const long long inf = 1e18;   const int maxn = 1e5 + 10;   const double eps = 1e-7;   const double pi = 3.14159265359;   int n, m, t[maxn];   int par[maxn];   int main() {     ios::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n >> m;     for (int i = 0; i < n; i++) {       cin >> t[i];     }     par[0] = t[0];     for (int i = 1; i < n; i++) {       par[i] = par[i - 1] + t[i];     }     for (int i = 0; i < n; i++) {       if (i == 0) {         cout << 0 <<    ;         continue;       }       sort(t, t + i);       int res = 0;       int s = par[i];       int id = i - 1;       while (s > m) {         s -= t[id];         id--;         res++;       }       cout << res <<    ;     }   }
#include <bits/stdc++.h>   using namespace std;   const int maxn = 1e5 + 100;   int b[10] = {0, 2, 3, 1}, a[maxn];   int main() {     int t;     scanf( %d , &t);     while (t--) {       long long n, ans = 1;       cin >> n;       int m = n % 3;       n = (n + 2) / 3;       while (n > ans) {         n -= ans;         ans *= 4;       }       int cnt = 0;       long long ans1 = ans + n - 1, ans2 = ans * 2;       n--;       while (n) {         a[++cnt] = n % 4;         n /= 4;       }       long long now = 1;       for (int i = 1; i <= cnt; i++) ans2 += b[a[i]] * now, now *= 4;       if (m == 1)         cout << ans1 << endl;       else if (m == 2)         cout << ans2 << endl;       else if (m == 0)         cout << (ans1 ^ ans2) << endl;     }   }
#include <bits/stdc++.h>   using namespace std;   long long int q;   void solve(long long int x) {     for (long long int i = 2; i * i <= x; i++) {       if (x % i == 0) {         long long int temp = x / i;         for (long long int j = 2; j * j <= temp; j++) {           if (temp % j == 0) {             cout << 1 <<   n ;             cout << i * j;             return;           }         }         cout << 2;         return;       }     }     cout << 1 <<   n ;     cout << 0;     return;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     cin >> q;     if (q == 1) {       cout << 1 <<   n ;       cout << 0;       return 0;     }     solve(q);     return 0;   }
#include <bits/stdc++.h>   int n;   int x[200050];   int f[200050];   int ans = 0;   int main() {     scanf( %d , &n);     for (int i = 0; i < n; i++) scanf( %d , &x[i]);     for (int i = 0; i < n; i++) scanf( %d , &f[i]);     int k = 0, l = 0;     while (l < n) {       if (x[k] == f[l])         k++, l++;       else         ans++, l++;     }     printf( %d n , ans);   }
#include <bits/stdc++.h>   using namespace std;   int n, m;   struct point {     double x, y, z;   } P[5200];   inline double sqr(double x) { return x * x; }   inline double dist(point a, point b) {     return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y) + sqr(a.z - b.z));   }   inline double len(point a, point b, point c) {     return dist(a, b) + dist(a, c) + dist(b, c);   }   int main() {     cin >> n;     double ans = 1e100;     for (int i = 0; i < n; i++) cin >> P[i].x >> P[i].y >> P[i].z;     for (int i = 1; i < n; i++)       for (int j = i + 1; j < n; j++) ans = min(ans, len(P[0], P[i], P[j]));     cout.precision(11);     cout << ans / 2 << endl;   }
#include <bits/stdc++.h>   int main() {     int m, n, i, j, p, q;     scanf( %d %d , &m, &n);     scanf( %d %d , &p, &q);     int ar[m], br[n];     for (i = 0; i < m; i++) {       scanf( %d , &ar[i]);     }     for (i = 0; i < n; i++) {       scanf( %d , &br[i]);     }     if (ar[p - 1] < br[n - q])       printf( YES n );     else       printf( NO n );     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int A[100005];   int F[100005];   int main() {     int n, x;     cin >> n >> x;     for (int i = 1; i <= n; i++) {       scanf( %d , &A[i]);       F[A[i]]++;     }     int idx = (n + 1) / 2;     bool wasPresent = true;     if (!F[x]) {       wasPresent = false;       A[n + 1] = x;       n++;     }     sort(A + 1, A + n + 1);     int ans = 100005;     for (int i = 1; i <= n; i++) {       if (A[i] == x) {         int add = 0;         if ((i - 1) > (n - i)) {           add = (i - 1) - (n - i);         } else if ((i - 1) < (n - i)) {           add = (n - i) - (i - 1) - 1;         }         ans = min(ans, add);       }     }     if (!wasPresent) ans++;     printf( %d n , ans);     return 0;   }
#include <bits/stdc++.h>   using namespace std;   const long long INF = 1000000000000000000;   map<pair<long long, int>, long long> memo;   long long solve(long long n, int x) {     pair<long long, int> p = make_pair(n, x);     if (memo.find(p) != memo.end()) return memo[p];     if (n == 0) return memo[p] = 0;     if (n == 1) return memo[p] = (x == 0) ? 1 : 0;     return memo[p] = solve((n + 1) / 2, x) + (x ? solve(n / 2, x - 1) : 0);   }   int main() {     ios_base::sync_with_stdio(false);     long long n, t;     cin >> n >> t;     for (int i = 0; (1ll << i) <= t; ++i)       if (t == (1ll << i)) {         cout << solve(n + 2, i + 1) - solve(2, i + 1);         return 0;       }     cout << 0;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     string s;     cin >> s;     int n = s.size();     int a = 0, b = 0, c = 0, d = 0;     for (int i = 0; i < n; i++) {       if (s[i] >=  A  && s[i] <=  Z )         a = 1;       else if (s[i] >=  a  && s[i] <=  z )         b = 1;       else if (s[i] >=  0  && s[i] <=  9 )         c = 1;     }     if (n >= 5) {       if (a && b && c)         cout <<  Correct  << endl;       else         cout <<  Too weak  << endl;     } else       cout <<  Too weak  << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   long long a[200010];   int main() {     int n;     while (~scanf( %lld , &n)) {       long long ans = 0;       for (int i = 0; i < n; ++i) scanf( %lld , &a[i]);       for (int i = 0; i < n;) {         ans++;         long long j = i;         while (j < n && a[j] == -1) j++;         if (j == n) break;         long long k = j + 1;         while (k < n && a[k] == -1) k++;         if (k == n) break;         long long d = k - j;         if ((a[k] - a[j]) % d) {           i = k;           continue;         }         long long s = (a[k] - a[j]) / d;         if (s > 0 && a[j] - s * (j - i) <= 0) {           i = k;           continue;         }         long long r = k + 1;         while (r < n) {           long long e = a[k] + s * (r - k);           if (a[r] != -1 && a[r] != e) break;           if (e <= 0) break;           r++;         }         i = r;       }       printf( %lld n , ans);     }     return 0;   }
#include <bits/stdc++.h>   #pragma GCC optimize( -O2 )   using namespace std;   void err(istream_iterator<string> it) {}   template <typename T, typename... Args>   void err(istream_iterator<string> it, T a, Args... args) {     cerr << *it <<   =   << a << endl;     err(++it, args...);   }   const int LIM = 1e5 + 5, MOD = 1e9 + 7;   int t, n, m, k, x, y;   int is_com[LIM];   vector<int> pr;   void sieve() {     for (int i = 2; i < LIM; i++) {       if (!is_com[i]) pr.push_back(i);       for (auto &it : pr) {         if (it * i >= n) break;         is_com[i * it] = 1;         if (i % it == 0) {           break;         }       }     }   }   long long int powm(long long int x, long long int pw, long long int MOD) {     long long int res = 1;     while (pw) {       if (pw & 1LL) res = ((res * x)) % MOD;       pw >>= 1;       x = ((x * x)) % MOD;     }     return res;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     cout.tie(0);     sieve();     long long int x, y;     cin >> x >> y;     long long int ans = 0;     if (y % x == 0) {       map<int, int> fac;       y /= x;       long long int cp = y;       for (auto &it : pr) {         if (cp == 1) break;         while (cp % it == 0) fac[it]++, cp /= it;       }       if (cp > 1) fac[cp]++;       for (long long int i = 1; i < (long long int)1e5; ++i) {         if (i * i > y) break;         if (y % i == 0) {           map<int, int> f;           cp = i;           for (auto &it : fac) {             if (cp == 1) break;             while (cp % it.first == 0) f[it.first]++, cp /= it.first;           }           int mu = 1;           for (auto &it : f) {             if (it.second > 1)               mu = 0;             else               mu *= -1;           }           ans += mu * powm(2, y / i - 1, MOD);           if (y / i != i) {             map<int, int> f;             cp = y / i;             for (auto &it : fac) {               if (cp == 1) break;               while (cp % it.first == 0) f[it.first]++, cp /= it.first;             }             int mu = 1;             for (auto &it : f) {               if (it.second > 1)                 mu = 0;               else                 mu *= -1;             }             ans += mu * powm(2, i - 1, MOD);           }           ans %= MOD;         }       }       cout << (ans + MOD) % MOD <<   n ;     } else       cout << 0 <<   n ;     return 0;   }
#include <bits/stdc++.h>   int main() {     int n, m;     char ch[51];     scanf( %s , &ch);     n = strlen(ch);     if (n == 1)       printf( %c , ch[0]);     else {       if (n % 2 == 0)         m = (n / 2) - 1;       else         m = (n / 2);       printf( %c , ch[m]);       int j = 1;       for (int i = 1; i <= n / 2; i++) {         if (j < n) printf( %c , ch[m + i]);         j++;         if (j < n) printf( %c , ch[m - i]);         j++;       }     }     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int main() {     int i, j, k, m, n, a = 0, b = 0;     cin >> n >> m;     k = n;     k = k / 9;     n = n % 9;     if (n != 0) k++;     for (i = 0; i < k; i++) cout << 54;     cout << endl;     for (i = 0; i < k - 1; i++) cout << 45;     cout << 46;     cout << endl;     return 0;   }
#include <bits/stdc++.h>   using namespace std;   int n, k;   int query(int l, int r) {     if (l < 1 || r > n) return false;     string re;     cout << 1 <<     << l <<     << r << endl;     cin >> re;     return re ==  TAK ;   }   int get(int l, int r) {     if (l > r) return false;     while (l < r) {       int mid = (l + r) >> 1;       if (query(mid, mid + 1))         r = mid;       else         l = mid + 1;     }     return l;   }   int main() {     cin >> n >> k;     int x, y;     x = get(1, n);     y = get(1, x - 1);     if (!query(y, x)) y = get(x + 1, n);     cout << 2 <<     << x <<     << y << endl;     return 0;   }