#include #include #include using namespace std; long sq(long N,long k) { if(k>=30)return 1; long L=0,R=N+1; while(R-L>1) { long mid=(L+R)/2; long t=1; bool ok=true; for(int i=0;iN/mid) { ok=false; break; } t*=mid; } if(ok)L=mid; else R=mid; } return L; } vectorS; long cnt(long N) { long ans=0; ans+=upper_bound(S.begin(),S.end(),N)-S.begin(); long now=sq(N,2); ans+=now; ans-=sq(now,2)-1; return ans; } main() { const long LIM=1e18; for(long k=3;;k++) { bool ch=false; for(long a=2;;a++) { long b=1; bool ok=true; for(int i=0;iLIM/a) { ok=false; break; } b*=a; } if(!ok)break; S.push_back(b); ch=true; } if(!ch)break; } sort(S.begin(),S.end()); S.erase(unique(S.begin(),S.end()),S.end()); int T; //cout<>T; for(;T--;) { long K;cin>>K; long L=0,R=1e18; while(R-L>1) { long mid=(L+R)/2; if(cnt(mid)