func_code_string: #include <bits/stdc++.h>   using namespace std;   int tu(int val) { return (1 << val); }   bool iset(int mask, int id) {     if ((mask & tu(id)) != 0) return true;     return false;   }   void doset(int &mask, int id) { mask |= tu(id); }   void dounset(int &mask, int id) { mask = mask & (~tu(id)); }   template <typename T>   string tos(T a) {     stringstream ss;     string ret;     ss << a;     ss >> ret;     return ret;   }   const long long LM = 1e18;   long long N, K;   vector<long long> pms, PA, push_back, temp;   void proc(vector<long long> &ans, const vector<long long> &now) {     ans.clear();     ans.push_back(1);     int l = now.size();     for (int(x) = (0); (x) < (l); (x)++) {       long double p = now[x];       int la = ans.size();       temp.clear();       for (int(i) = (0); (i) < (la); (i)++) {         long double v = p * ans[i];         while (v <= LM) {           temp.push_back(v);           v *= p;         }       }       la = temp.size();       for (int(i) = (0); (i) < (la); (i)++) ans.push_back(temp[i]);     }     sort(ans.begin(), ans.end());     int la = ans.size();     for (int(i) = (1); (i) < (la); (i)++) assert(ans[i] != ans[i - 1]);   }   long long count(long long val) {     int la = PA.size();     int lb = push_back.size();     int ia = 0;     int ib = lb - 1;     long long ret = 0;     while (ia < la && ib >= 0) {       unsigned long long va = PA[ia] * push_back[ib];       if (va > val)         ib--;       else {         ret += ib + 1;         ia++;       }     }     return ret;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     while (cin >> N) {       vector<long long> pa, pb;       pms.clear();       pms.resize(N);       for (int(i) = (0); (i) < (N); (i)++) cin >> pms[i];       sort(pms.begin(), pms.end());       cin >> K;       for (int(i) = (0); (i) < (N); (i)++) {         if ((i % 2) == 0)           pa.push_back(pms[i]);         else           pb.push_back(pms[i]);       }       proc(PA, pa);       proc(push_back, pb);       long long ans = -1;       long long lo = 1;       long long hi = LM;       while (true) {         if (hi - lo < 5) {           for (long long x = lo; x <= hi; x++) {             long long k = count(x);             if (k == K) {               ans = x;               break;             }           }           break;         }         long long m = (lo + hi) / 2;         long long k = count(m);         if (k >= K)           hi = m;         else           lo = m;       }       cout << ans << endl;     }     return 0;   }   