func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 2e5 + 10;   int a[maxn], b[maxn];   int n, k;   bool check(int x, int state) {     if (state == 1) {       int c = 0, right = 0;       for (int i = 1; i <= n; i++) {         if (a[i] <= x) {           right = i;           c++;           i++;         }       }       if (c == k - k / 2 && right == n && k % 2 == 0) return false;       return c >= k - k / 2;     } else {       int c = 0, right = 0;       for (int i = 2; i <= n; i++) {         if (a[i] <= x) {           right = i;           c++;           i++;         }       }       if (c == k / 2 && right == n && k % 2 != 0) return false;       return c >= k / 2;     }   }   int main() {     cin >> n >> k;     for (int i = 1; i <= n; i++) {       cin >> a[i];       b[i] = a[i];     }     sort(b + 1, b + n + 1);     int l = 1, r = n;     while (l < r) {       int mid = r + l >> 1;       if (check(b[mid], 0) || check(b[mid], 1))         r = mid;       else         l = mid + 1;     }     cout << b[l];     return 0;   }   