fork download
  1. #include <bits/stdc++.h>
  2.  
  3. static struct FASTIO {
  4.  
  5. char READ_CHARACTER; bool REMAINING_CHARACTER = false;
  6.  
  7. inline void ignore(); inline void flush();
  8.  
  9. template <typename T> inline bool READ_INT(T &x); template <typename T> inline bool READ_STRING(T &x);
  10. /* Fast I/O Code Optimizer */
  11. template<size_t N> inline bool READ_CHAR_ARRAY(char (&x)[N]); template<size_t N> inline bool READ_VAR(char (&x)[N]);
  12. /* A tool to optimize execution time of C++ codes by replacing methods of reading and writing variables */
  13. template <typename T> inline bool READ_CHAR(T &x); inline bool READ_CHAR_ARRAY(char*& x); inline bool READ_GETLINE(std::string &x);
  14. /* Use it on fastio.pythonanywhere.com */
  15. template <typename T> inline bool READ_FLOAT(T &x); template <typename T> inline bool READ_DOUBLE(T &x);
  16. /* Github Project: github.com/bfs07/Fast-IO-Code-Optimizer */
  17. template<std::size_t N> inline bool READ_BITSET(std::bitset<N> &bit); template<std::size_t N> inline bool READ_VAR(std::bitset<N> &bit);
  18. inline bool READ_VAR(bool &x); inline bool READ_VAR(short int &x); inline bool READ_VAR(int &x);
  19. inline bool READ_VAR(long int &x); inline bool READ_VAR(long long int &x); inline bool READ_VAR(unsigned short int &x);
  20. inline bool READ_VAR(unsigned int &x); inline bool READ_VAR(unsigned long &x); inline bool READ_VAR(unsigned long long &x);
  21. inline bool READ_VAR(std::string &x); inline bool READ_VAR(char &x); inline bool READ_VAR(char*& x); inline bool READ_VAR(float &x);
  22. inline bool READ_VAR(double &x); inline bool READ_VAR(long double &x); template <typename T> inline void WRITE_INT(T x);
  23. inline void WRITE_STRING(std::string &x); inline void WRITE_CHAR(char x); inline void WRITE_CHAR_ARRAY(const char *x);
  24. inline void WRITE_FLOAT(float x); template <typename T> inline void WRITE_DOUBLE(T x); inline void WRITE_VAR(bool x);
  25. inline void WRITE_VAR(short int x); inline void WRITE_VAR(int x); inline void WRITE_VAR(long int x); inline void WRITE_VAR(long long int x);
  26. inline void WRITE_VAR(unsigned short int x); inline void WRITE_VAR(unsigned int x); inline void WRITE_VAR(unsigned long x);
  27. inline void WRITE_VAR(unsigned long long x); inline void WRITE_VAR(char x); inline void WRITE_VAR(const char *x);
  28. inline void WRITE_VAR(std::string &x); inline void WRITE_VAR(float x); inline void WRITE_VAR(double x); inline void WRITE_VAR(long double x);
  29. template<std::size_t N> inline void WRITE_VAR(std::bitset<N> &bit); template<std::size_t N> inline void WRITE_BITSET(std::bitset<N> &bit);
  30.  
  31. } __FIO__;
  32.  
  33.  
  34. #include <bits/stdc++.h>
  35.  
  36. int main() {
  37. 0, 0, __FIO__.WRITE_VAR(std::pow(2.0, 1000));
  38. return 0;
  39. }
  40.  
  41.  
  42. inline void FASTIO::ignore() {
  43. if(REMAINING_CHARACTER == true) REMAINING_CHARACTER = false; else READ_CHARACTER = getchar();
  44. }
  45.  
  46. inline void FASTIO::flush() {
  47. fflush(stdout);
  48. }
  49.  
  50. // cin modifications
  51.  
  52. template <typename T>
  53. inline bool FASTIO::READ_INT(T &x) {
  54. x = 0; T sig = 1;
  55. if(!REMAINING_CHARACTER) READ_CHARACTER = getchar(), REMAINING_CHARACTER = true; else REMAINING_CHARACTER = false;
  56. while (!isdigit(READ_CHARACTER) && READ_CHARACTER != EOF) sig = (READ_CHARACTER == '-' ? -sig : sig), READ_CHARACTER = getchar();
  57. if(READ_CHARACTER == EOF) return REMAINING_CHARACTER = false, false;
  58. while (isdigit(READ_CHARACTER)) x = x * 10 + READ_CHARACTER - '0', READ_CHARACTER = getchar();
  59. x *= sig; REMAINING_CHARACTER = true;
  60. return true;
  61. }
  62.  
  63. template <typename T>
  64. inline bool FASTIO::READ_STRING(T &x) {
  65. x = "";
  66. if(!REMAINING_CHARACTER) READ_CHARACTER = getchar(), REMAINING_CHARACTER = true; else REMAINING_CHARACTER = false;
  67. while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = getchar();
  68. if(READ_CHARACTER == EOF) return REMAINING_CHARACTER = false, false;
  69. while ((READ_CHARACTER != '\n' && READ_CHARACTER != '\t' && READ_CHARACTER != ' ' && READ_CHARACTER != EOF)) x += READ_CHARACTER, READ_CHARACTER = getchar();
  70. REMAINING_CHARACTER = true;
  71. return true;
  72. }
  73.  
  74. inline bool FASTIO::READ_GETLINE(std::string &x) {
  75. x = "";
  76. if(!REMAINING_CHARACTER) READ_CHARACTER = getchar(), REMAINING_CHARACTER = true; else REMAINING_CHARACTER = false;
  77. if(READ_CHARACTER == EOF) return REMAINING_CHARACTER = false, false;
  78. while ((READ_CHARACTER != '\n' && READ_CHARACTER != EOF)) x += READ_CHARACTER, READ_CHARACTER = getchar();
  79. REMAINING_CHARACTER = false;
  80. return true;
  81. }
  82.  
  83. template <typename T>
  84. inline bool FASTIO::READ_CHAR(T &x) {
  85. if(!REMAINING_CHARACTER) READ_CHARACTER = getchar(), REMAINING_CHARACTER = true; else REMAINING_CHARACTER = false;
  86. if(READ_CHARACTER == EOF) return REMAINING_CHARACTER = false, false;
  87. while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = getchar();
  88. x = READ_CHARACTER; REMAINING_CHARACTER = false;
  89. return true;
  90. }
  91.  
  92.  
  93. template<size_t N>
  94. inline bool FASTIO::READ_CHAR_ARRAY(char (&x)[N]) {
  95. if(!REMAINING_CHARACTER) READ_CHARACTER = getchar(), REMAINING_CHARACTER = true; else REMAINING_CHARACTER = false;
  96. while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = getchar();
  97. if(READ_CHARACTER == EOF) return REMAINING_CHARACTER = false, false;
  98. char *ptr = &x[0];
  99. while ((READ_CHARACTER != '\n' && READ_CHARACTER != '\t' && READ_CHARACTER != ' ' && READ_CHARACTER != EOF)) *ptr++ = READ_CHARACTER, READ_CHARACTER = getchar();
  100. *ptr = '\0', REMAINING_CHARACTER = true;
  101. return true;
  102. }
  103.  
  104. inline bool FASTIO::READ_CHAR_ARRAY(char*& x) {
  105. std::string y;
  106. if(READ_STRING(y) == false)
  107. return false;
  108. x = new char[(int)y.size() + 1];
  109. strcpy(x, y.c_str());
  110. return true;
  111. }
  112.  
  113. template <typename T>
  114. inline bool FASTIO::READ_FLOAT(T &x) {
  115. return (scanf("%f", &x) != EOF);
  116. }
  117.  
  118. template <typename T>
  119. inline bool FASTIO::READ_DOUBLE(T &x) {
  120. double y;
  121. if(scanf("%lf", &y) == EOF) return false;
  122. x = y;
  123. return true;
  124. }
  125.  
  126. template<std::size_t N>
  127. inline bool FASTIO::READ_BITSET(std::bitset<N> &x) {
  128. if(!REMAINING_CHARACTER) READ_CHARACTER = getchar(), REMAINING_CHARACTER = true; else REMAINING_CHARACTER = false;
  129. while ((READ_CHARACTER == '\n' || READ_CHARACTER == '\t' || READ_CHARACTER == ' ')) READ_CHARACTER = getchar();
  130. if(READ_CHARACTER == EOF) return REMAINING_CHARACTER = false, false;
  131. int i = 0; REMAINING_CHARACTER = true;
  132. while (READ_CHARACTER == '0' || READ_CHARACTER == '1') x[i++] = READ_CHARACTER - '0', READ_CHARACTER = getchar();
  133. return true;
  134. }
  135.  
  136. inline bool FASTIO::READ_VAR(short int &x) {
  137. return READ_INT(x);
  138. }
  139.  
  140. inline bool FASTIO::READ_VAR(int &x) {
  141. return READ_INT(x);
  142. }
  143.  
  144. inline bool FASTIO::READ_VAR(long int &x) {
  145. return READ_INT(x);
  146. }
  147.  
  148. inline bool FASTIO::READ_VAR(long long int &x) {
  149. return READ_INT(x);
  150. }
  151.  
  152. inline bool FASTIO::READ_VAR(unsigned short int &x) {
  153. return READ_INT(x);
  154. }
  155.  
  156. inline bool FASTIO::READ_VAR(unsigned int &x) {
  157. return READ_INT(x);
  158. }
  159.  
  160. inline bool FASTIO::READ_VAR(unsigned long &x) {
  161. return READ_INT(x);
  162. }
  163.  
  164. inline bool FASTIO::READ_VAR(unsigned long long &x) {
  165. return READ_INT(x);
  166. }
  167.  
  168. inline bool FASTIO::READ_VAR(std::string &x) {
  169. return READ_STRING(x);
  170. }
  171.  
  172. inline bool FASTIO::READ_VAR(char &x) {
  173. return READ_CHAR(x);
  174. }
  175.  
  176. template<size_t N>
  177. inline bool FASTIO::READ_VAR(char (&x)[N]) {
  178. return READ_CHAR_ARRAY(x);
  179. }
  180.  
  181. inline bool FASTIO::READ_VAR(char*& x) {
  182. return READ_CHAR_ARRAY(x);
  183. }
  184.  
  185. inline bool FASTIO::READ_VAR(float &x) {
  186. return READ_FLOAT(x);
  187. }
  188.  
  189. inline bool FASTIO::READ_VAR(double &x) {
  190. return READ_DOUBLE(x);
  191. }
  192.  
  193. inline bool FASTIO::READ_VAR(long double &x) {
  194. return READ_DOUBLE(x);
  195. }
  196.  
  197. template<std::size_t N>
  198. inline bool FASTIO::READ_VAR(std::bitset<N> &x) {
  199. return READ_BITSET(x);
  200. }
  201.  
  202. // cout modifications
  203.  
  204. template <typename T>
  205. inline void FASTIO::WRITE_INT(T x) {
  206. if (x < 0) {putchar('-'); x = -x; }
  207. char writeBuffer[20], *writePtr = writeBuffer;
  208. do {
  209. *writePtr++ = '0' + x % 10;
  210. x /= 10;
  211. }
  212. while (x);
  213. do { putchar(*--writePtr); }
  214. while (writePtr > writeBuffer);
  215. }
  216.  
  217. inline void FASTIO::WRITE_CHAR(char x) {
  218. putchar(x);
  219. }
  220.  
  221. inline void FASTIO::WRITE_CHAR_ARRAY(const char *x) {
  222. while(*x != '\0')
  223. putchar(*x++);
  224. }
  225.  
  226. inline void FASTIO::WRITE_STRING(std::string &x) {
  227. for(char c: x)
  228. putchar(c);
  229. }
  230.  
  231. inline void FASTIO::WRITE_FLOAT(float x) {
  232. printf("%.0f", x);
  233. }
  234.  
  235. template <typename T>
  236. inline void FASTIO::WRITE_DOUBLE(T x) {
  237. printf("%.0lf", (double)x);
  238. }
  239.  
  240. template<std::size_t N>
  241. inline void FASTIO::WRITE_BITSET(std::bitset<N> &x) {
  242. for(int i = (int)x.size() - 1; i >= 0; i--)
  243. putchar(x[i] + 48);
  244. }
  245.  
  246. inline void FASTIO::WRITE_VAR(bool x) {
  247. WRITE_INT(x);
  248. }
  249.  
  250. inline void FASTIO::WRITE_VAR(short int x) {
  251. WRITE_INT(x);
  252. }
  253.  
  254. inline void FASTIO::WRITE_VAR(int x) {
  255. WRITE_INT(x);
  256. }
  257.  
  258. inline void FASTIO::WRITE_VAR(long int x) {
  259. WRITE_INT(x);
  260. }
  261.  
  262. inline void FASTIO::WRITE_VAR(long long int x) {
  263. WRITE_INT(x);
  264. }
  265.  
  266. inline void FASTIO::WRITE_VAR(unsigned short int x) {
  267. WRITE_INT(x);
  268. }
  269.  
  270. inline void FASTIO::WRITE_VAR(unsigned int x) {
  271. WRITE_INT(x);
  272. }
  273.  
  274. inline void FASTIO::WRITE_VAR(unsigned long x) {
  275. WRITE_INT(x);
  276. }
  277.  
  278. inline void FASTIO::WRITE_VAR(unsigned long long x) {
  279. WRITE_INT(x);
  280. }
  281.  
  282. inline void FASTIO::WRITE_VAR(std::string &x) {
  283. WRITE_STRING(x);
  284. }
  285.  
  286. inline void FASTIO::WRITE_VAR(char x) {
  287. WRITE_CHAR(x);
  288. }
  289.  
  290. inline void FASTIO::WRITE_VAR(const char *x) {
  291. WRITE_CHAR_ARRAY(x);
  292. }
  293.  
  294. inline void FASTIO::WRITE_VAR(float x) {
  295. WRITE_FLOAT(x);
  296. }
  297.  
  298. inline void FASTIO::WRITE_VAR(double x) {
  299. WRITE_DOUBLE(x);
  300. }
  301.  
  302. inline void FASTIO::WRITE_VAR(long double x) {
  303. WRITE_DOUBLE(x);
  304. }
  305.  
  306. template<std::size_t N>
  307. inline void FASTIO::WRITE_VAR(std::bitset<N> &x) {
  308. WRITE_BITSET(x);
  309. }
  310.  
  311.  
  312.  
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
10715086071862673209484250490600018105614048117055336074437503883703510511249361224931983788156958581275946729175531468251871452856923140435984577574698574803934567774824230985421074605062371141877954182153046474983581941267398767559165543946077062914571196477686542167660429831652624386837205668069376