len2910

FRFW

Apr 21st, 2025 (edited)
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. char buf[1 << 20], *p1, *p2;
  2. #define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin), p1 == p2) ? EOF : *p1++)
  3. inline void read(int &x)
  4. {
  5.     register bool f{true};
  6.     register char ch = getchar();
  7.     x ^= x;
  8.     while (ch < 48 || ch > 57)
  9.     {
  10.         if (ch == 45)
  11.             f = false;
  12.         ch = getchar();
  13.     }
  14.     while (ch > 47 && ch < 58)
  15.         x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  16.     x *= (f << 1) - 1;
  17. }
  18. char obuf[1 << 20], *p3 = obuf;
  19. #define putchar(x) (p3 - obuf < 1 << 20) ? (*p3++ = x) : (fwrite(obuf, p3 - obuf, 1, stdout), p3 = obuf, *p3++ = x)
  20. inline void write(register int x)
  21. {
  22.     if (!x)
  23.     {
  24.         putchar(48);
  25.         return;
  26.     }
  27.     static int_fast8_t c[20];
  28.     register int_fast64_t len{};
  29.     if (x < 0)
  30.         x = -x, putchar(45);
  31.     while (x)
  32.         c[len++] = x % 10 ^ 48, x /= 10;
  33.     while (len--)
  34.         putchar(c[len]);
  35. }
  36. struct _FAST_
  37. {
  38.     ~_FAST_()
  39.     {
  40.         fwrite(obuf, p3 - obuf, 1, stdout);
  41.     }
  42. } _fast_;
Advertisement
Add Comment
Please, Sign In to add comment