func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = long long;   using ld = long double;   using str = string;   using pi = pair<int, int>;   using pl = pair<ll, ll>;   using pd = pair<ld, ld>;   using vi = vector<int>;   using vb = vector<bool>;   using vl = vector<ll>;   using vd = vector<ld>;   using vs = vector<str>;   using vpi = vector<pi>;   using vpl = vector<pl>;   using vpd = vector<pd>;   str Tout[2] = { NO ,  YES };   str tout[2] = { No ,  Yes };   int main() {     ll n, k;     cin >> n >> k;     ll a[n + 17];     for (int i = (0); i < (n); i++) cin >> a[i];     if (k == 2) {       cout << max(a[0], a[n - 1]);       return 0;     }     sort(a, a + n);     if (k == 1)       cout << a[0];     else       cout << a[n - 1];     return 0;   }   