fork download
  1. // |******In the name of ALLAH,the Beneficent,the Merciful******|
  2. // coded by Rafi
  3.  
  4. #include <bits/stdc++.h>
  5. // #include <ext/pb_ds/assoc_container.hpp> // Common file
  6. // #include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
  7. // #pragma comment(linxer, "/STACx:2000000") // use to increase stacx size
  8. // using namespace __gnu_pbds; // use to maxe ordered_set
  9.  
  10. // template <typename T>
  11. // using o_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // ordered set
  12.  
  13. // #include &lt;bits/stdc++.h&gt;
  14.  
  15. using namespace std;
  16. using ll = long long;
  17. using ull = unsigned long long;
  18. using lll = __int128_t;
  19.  
  20. #define Taratari ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  21. #define yes printf("YES\n")
  22. #define no printf("NO\n")
  23. #define pi 2 * acos(0.0)
  24. #define all(v) v.begin(), v.end()
  25. #define endl "\n"
  26.  
  27. const int N = 2e6, inf = INT_MAX, mod = 1e9 + 7;
  28. std::ostream &
  29. operator<<(std::ostream &dest, __int128_t value);
  30.  
  31. int cnt[N+9];
  32. bool vis[N+9];
  33. vector<pair<int, int>> v;
  34. void sieve()
  35. {
  36. cnt[1] = 0;
  37. v.push_back({0, 0});
  38. v.push_back({0, 1});
  39. for (int i = 2; i <= N; i++)
  40. {
  41.  
  42. if (!vis[i])
  43. for (int j = i; j <= N; j += i)
  44. {
  45. int temp = j;
  46. while (temp % i == 0)
  47. {
  48. cnt[j]++;
  49. temp /= i;
  50. }
  51. vis[j] = true;
  52. }
  53. v.push_back(make_pair(cnt[i], i));
  54. }
  55. sort(v.begin(), v.end());
  56. }
  57. template <typename T>
  58. void solve(T case_number)
  59. {
  60. // for (int i = 0; i < 100; i++)
  61. // cout << v[i].first << " " << v[i].second << endl;
  62. int n;
  63. cin >> n;
  64. cout << v[n].second << endl;
  65. }
  66.  
  67. int main()
  68. {
  69. Taratari;
  70. sieve();
  71. int Testcase = 1, index = 1;
  72. cin >> Testcase;
  73.  
  74. while (Testcase--)
  75. {
  76. // cout << "Case " << index << ": ";
  77. solve(index);
  78. index++;
  79. }
  80.  
  81. return 0;
  82. }
  83.  
  84. std::ostream &
  85. operator<<(std::ostream &dest, __int128_t value)
  86. {
  87. std::ostream::sentry s(dest);
  88. if (s)
  89. {
  90. __uint128_t tmp = value < 0 ? -value : value;
  91. char buffer[128];
  92. char *d = std::end(buffer);
  93. do
  94. {
  95. --d;
  96. *d = "0123456789"[tmp % 10];
  97. tmp /= 10;
  98. } while (tmp != 0);
  99. if (value < 0)
  100. {
  101. --d;
  102. *d = '-';
  103. }
  104. int len = std::end(buffer) - d;
  105. if (dest.rdbuf()->sputn(d, len) != len)
  106. {
  107. dest.setstate(std::ios_base::badbit);
  108. }
  109. }
  110. return dest;
  111. }
  112. /*
  113. data:
  114. 1)equal_range(.begin(),.end(),value);
  115. :: return iterator of lower_bound(value) & upper_bound(value);{pair maybe}
  116. 2)binary_search()
  117. :: return true or false
  118. 3)next_permutation()
  119. :: return next permutation of a string
  120. 4)unique()
  121. ::return iterator where single unique value are placed
  122. 1 2 2 2 3 3 2 1 1 4 => 1 2 3 2 1 4 2 1 1 4
  123.  
  124. ::we can use resize to get only unique value in vector
  125. => variable_name.resize(unique(v.begin(),v.end())-v.begin());
  126. 5)maxing structure:
  127. ::struct info
  128. {
  129. ll maximum;
  130. ll minimum;
  131. } tree[400009];
  132.  
  133. ::accessing by tree[index].maximum,tree[index].minimum
  134. 6)priority queue:
  135. ::typedef data_type(pair<ll, pair<ll, ll>>) pi;
  136. ::priority_queue<pi, vector<pi>> p; -> "increasing order"
  137. ::priority_queue<pi, vector<pi>, greater<pi>> p; -> "decreasing order"
  138. 7)__builtin_popcountll(number)
  139. ::count number of 1 in a number
  140.  
  141. 8)o_set<data_type> variable; -> xind of a set but can find the value in index
  142. ::variable.find_by_order(index) -> find the value in index return iterator
  143. ::variable.order_of_xey(value) -> find number of value less then value
  144.  
  145. */
  146.  
  147. // First greedy
  148. // Use sorting
  149. // Use dp [dynamic programming]
  150. // Use recursive
  151. // Use dfs
  152. // Use math
  153. // Use bit masxing
  154. // Maxe equation sorter[a.u - b.u < a.v - b.vqe]
  155.  
  156. /*
  157. .
  158. `;|$&@&$%%%|||%%$&@&%' .
  159. '$$%|!!!;;;!!!||%$@@&%;' .:%&&%!:::::::::::::::::::::|!..
  160.   .||:::::::::::::::::::::::;|$@$!` `|&$!::::::::::::::::::::::::::::!|'.
  161.   ;%:::::::::::::::::::::::::::::::;|&&!` `|&$!:::::::::::::::::::::::::::::::::!%:.
  162.   `||:::::::::::::::::::::::::::::::::::::!$&|' '%&|::::::::::::::::::::::::::::::::::::::;%;.
  163.   :%;:::::::::::::::::::::::::::::::::::::::::!$@&;. '%@%;::::::::::::::::::::::::::::::::::::::::::%!`
  164.   !%:::::::::::::::::::::::::::::::::::::::::::::!%&@&!. .!&@$|:::::::::::::::::::::::::::::::::::::::::::::%!`
  165.  .||:::::::::::::::::::::::::::::::::::::::::::::::;|$$&@&;.'%@@@@$!``%@&$%!:::::::::::::::::::::::::::::::::::::::::::::::|!'
  166.  `|!:::::::::::::::::::::::::::::::::::::::::::::::;!|%$$&@$;:::::;|&@&$%!:::::::::::::::::::::::::::::::::::::::::::::::::||'
  167.  :|;::::::::::::::::::::::::::::::::::::::::::;%&@@@@$%|!!;:::::;!|%&@##@&$$%!:::::::::::::::::::::::::::::::::::::::::::::||:
  168.  :%;:::::::::::::::::::::::::::::::::::!%&@$|;'````.```..```...```..``..```:|&@@|;:::::::::::::::::::::::::::::::::::::::::||:
  169.  :%;::::::::::::::::::::::::::::::!$&|:`.`..................................`````;$&|;:::::::::::::::::::::::::::::::::::::||'
  170.  :%;::::::::::::::::::::::::::|&$:`.........``.................................`.````;$$!::::::::::::::::::::::::::::::::::||'
  171.  '|!::::::::::::::::::::::;%$!`.`````.................................................``:%$!:::::::::::::::::::::::::::::::%!`
  172.  `||:::::::::::::::::::;|$!`..```.......................................................```;$%;::::::::::::::::::::::::::::%!`
  173.   !|:::::::::::::::::!$%'`.............................................................``..``'%&|;::::::::::::::::::::::::;%;.
  174.   ;%;::::::::::::::!$!```..............................................................`...````'%@$|;:::::::::::::::::::::!%:.
  175.   '|!::::::::::::!$!`.`....................................................................``````'%&$$|:::::::::::::::::::||`.
  176.   .!|::::::::::;%! ..........................................................................````;&&$$%;::::::::::::::::%! .
  177.   :%;::::::::%%` ...````````.........`.............................................```.``.'%&$%$%!:::::::::::::;%; .
  178.   .!|::::::!%; . .....```..```````````.``........................................``!&$$%%%!:::::::::::!|' .
  179. :|;::::|%' .. ....``..........................................:$&$$$$%;:::::::::%! .
  180. !%::;%|'``..... .....```..................................................````:$&$$%$$|;::::::!%' .
  181. '|!;%|`.......`.`.........````````..`.......```...........`````.................................````:%&$$$$$%!:::::%! .
  182. ;$$|`...`':'..`.`````....`````|!`````...................```.````.................`....````..........:$&$%%%%$|:::!|' .
  183. .||``.``'|!```...........``.`:|;````;!'.``..............```.::```...................`'!:.`.......`..`;$&%%%$$$|;;%; .
  184. ;|'...``!|'``.`````..........;|:``.:$|`...................``;|:......................'|!```.......``.`!&$%%$%$$%$! .
  185. :|:.``..'|!.``..``````......``!%:.`:%&|```...............```'!%|:````.`....```.......`'|!..............'%&$%$$$$@|. .
  186. `|;..````:|:..``;|'.```.......`;%;`:%&#!```..................:|$%:``'|!``````.......```'|!``..........```;$&$%$$@|. .
  187. !|``...``;|:`..'%%'..```..```:%&&!'!&&$!`.```.``..........```;%&%```|&;``:%!```....```.'|;.``...`.``..`.``|&$$$@| .
  188.   :|:.``````;|:``;$@%:````````'|$;:%%;%&!||`....`''........``..:|$&!``!&&&;``|#$'``....``.:|;`````..`!|'``..`:$&&&; .
  189.   !!````||``:|;`!$@#$:`....``:%|:::;$$$%`;|'....`:'...........`;%&%:`!$;:!&%'!$$&!`...```.;|'`..```..;$;....``|#&$; .
  190.   :|:..`:%;```||;%&@@&;``````;$!:'` .;&@; `|;````.::`........``:|%&!`|$;:` `|$$|;%@@|'....`||`````..``;$|'..```;%!||. .
  191.   |!.```!|'```;$%$&$&&|'`'|$$&|:'. `'. !|`..`.';'.........'!%&%;|%:'. '%@#&: `|&%:```:|;`````````;$%:```..'||!%: .
  192.  '|:```'%!`..``!&&&%$&%:`.`:%%|$@&!` `|!```.'!;`....``.`;|$&%%%:;|&$:. :&@%;`!|`.`````..`;$$;::`.``!%;%! .
  193.  !|`..`!$;..`..:&@$|%&&!'`'%%:` .;$@$:. :|:...`;|;`.`.`..:|%&@&&%:. .|&$&@$;.....`````;$$!!!'..`;%;!|` .
  194. .|!`..:$%'```.`;||||%&@$;`!%;` '!!|%:.``;|!'```..'!%&#&;'. !&;````.......```;$$||!'..`:%!;%; .
  195. `|;..`!&|````.:!||||%&&&%|%!'. :%;``;||;````'!|$@%:` `:|$@#####%` :$!``..``........;$%|||:`.`'||:%! .
  196. '|:..:|&|`''``:|||||%&%'%@!.;@@@#####@&$|!'. `|!';|%!'```;%$&||&&@@@@@&&&&&@#| :$|'``.......``.`!$%|||;```'||:||` .
  197. :|'.`;%&!.:;``;|||||%&%` `|@&&&&&&&&&&@&' ;&$%|!'.`;|$&;.!@&&&&&&&&&&&@#|. '%|'``.......````!&%||%!`.`'||:;%: .
  198. :|'.`;%$!`;!'`;|||||%&|. '%|;%&&&&&&&&@$` !&$|:`;%&%` !%`.!&&&&&$$$$@%` '%|'``.```...````|&%|||!'.`'||:;%; .
  199. :|'.'!%$!`;|:`;|||||%&|. :; `|%|%%|||$|. ;$|;$&; :: `!%%|%||||&%` '%%'``.```.''```'%$%|||!'.`'||::%! .
  200. '|:`:|%$!`;|;`;|||||%&! ;$||||%|%%|||&; .'` '%|||||%%%||||&%. '%|'``...`.':`.`:%$|||||:..:|!::||. .
  201. `!;.:|%&!`;||:;||||%$&; ;$||||||||||$%' .|$|||%%%%|||%@| '$|'.`..`.`:!:``!$%|||||:``;$!::!|` .
  202. .||`:|%&|`;||;;||||%&%` '%%||%%%||%%&! :%|||%|||%||$$' :$!`..`````;|:``|&||||||:.`|&!::!|' .
  203. `$%''!|&%';||||||||%&! !$|'.```:|&%. ;$%' :$&: ;$!`......:||:`:%$||||||:.:$$;::!%: .
  204. '$&;'!|$$::|||||||%&%` .|&: .!@|. .|&|`.`;&$' !&;`....``;||;`!$%||||||:`!&%;::!%: .
  205. :%$|';|%&!'!||||||%&%' ......`!@##@!. '|&&|'.`.... .|$:...```:|||;'%$|||||%$;:$&|;::!%: .
  206. ;%;%|;||&$::||||||%$$:..``````````. ;; ...````````..`|%'....`'!|||:;$%||||%$$!|&$|;::!%: .
  207. ;%;|$|!|%&|`;%|||||%&!..`````````... .|#################@@$;. ..``````````.:$|'```.`;||||;%$||%%%%&$%&$%|:::!|' .
  208. :|;;%&$||%$;:$$||||%&%'..````````.. '$##&;``````````````:$&' ..```````.. ;$!`````:||||!%$%|$&$|$#@&$%%!:::||` .
  209. '|!:|$@&%%$$;;&$||||%&|. ........ :@$:`````````````````|$: ...... !$:.```'!%%||%$%|%&@$$##@$%$%;:::|!. .
  210.  !%:!%$@&%%@@!%@%||||%&%` '$!``````````````````|%` `%%'``.'!%&&%$@$%%&#&@##@$%%$|;:::%! .
  211.  `%&&@$|!$&&$$#&&$%|||%&#%` .|$:````````````````:%: :$!````;|$&%%@&%$&%&@; `|@@&%;:::;|: .
  212. '&&';!:%&%|||$&$$@$: .|&;``````````````;%: .;&@@$:`.`;|$@$$@&$&|'%%. .:|$&@|. .
  213. `' ;&$||%&&%||%&@|` `%&!``````````:%!. `!&@$%%%&|`.`:|$@&&#@&$: .
  214. !&$%%&#@%|||%$&@%' .';;'`...''. `!&#&%|||||%$$;`.:%&#@@#@@!. .
  215. .;%&&$$&! :&&$&%|@$%%&@$%%$@#@|:. .`;%&@&@$:``:%&$%%%&@%``:%@#@||#|!$!'';|$@! .
  216. ;&%:```'|$: :$#%.`|@@@%!&#&;```':;|&#@@@@@@@&$%|!;:::|&!. '$%``|;`;&|. .;!|$;``'!%&@; .
  217. .%&$$$%|;;$%` `%$!':%%` `|&|::::::::::;$%` ;&$!|%|&|. `%@$$&&&&@#%` .
  218. `;;;;;;;;;;` || '$; :$|:::::'!&! `%|. !|` !|. .::. .
  219.  
  220. */
Success #stdin #stdout 0.26s 30216KB
stdin
Standard input is empty
stdout
249107