Language: C++

w#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
 
template<typename tp> inline void read(tp &x) {
  x = 0; char c = getchar(); int f = 0;
  for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
  for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if (f) x = -x;
}
#define pb push_back
#define int long long
typedef long long lo;
const int N = 3e5 + 233;
const int mo = 1e9 + 7;
int n, a[N], b[N], fac[N];


inline int sgn(int x) {
  return x > 0 ? 1 : -1;
}

signed main(void) {
  read(n);
  rep (i, n) read(a[i]);
  rep (i, n) read(b[i]);
  sort(a + 1, a + n + 1);
  sort(b + 1, b + n + 1);
  fac[0] = 1;
  rep (i, n) fac[i] = fac[i - 1] * i % mo;
  int posA = n, posB = 0;
  for (int i = 2; i <= n; i ++) {
    if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
        != abs(a[i] - b[i - 1]) + abs(a[i - 1] - b[i])) {
      posA = i - 1;
      break;
    }
  }
  for (int i = n; i >= 1; i --) {
    if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
        != abs(a[i] - b[i - 1]) + abs(a[i - 1] - b[i])) {
      posB = n - i;
      break;
    }
  }
  // cout << posA << " " << posB << "\n";
  cout << fac[posA] * fac[posB] % mo << "\n";
}


Compiler output:
a.cc:1:2: error: stray '#' in program
    1 | w#include <bits/stdc++.h>
      |  ^
a.cc:1:1: error: 'w' does not name a type
    1 | w#include <bits/stdc++.h>
      | ^
a.cc: In function 'void read(tp&)':
a.cc:9:19: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
    9 |   x = 0; char c = getchar(); int f = 0;
      |                   ^~~~~~~
a.cc:9:19: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:10:49: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
   10 |   for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
      |                                                 ^~~~~~~
a.cc:11:71: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
   11 |   for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
      |                                                                       ^~~~~~~
a.cc: In function 'int main()':
a.cc:28:8: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   28 |   rep (i, n) read(a[i]);
      |        ^
a.cc:2:29: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (rint i = 1; i <= (n); i ++)
      |                             ^
a.cc:29:8: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   29 |   rep (i, n) read(b[i]);
      |        ^
a.cc:2:29: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (rint i = 1; i <= (n); i ++)
      |                             ^
a.cc:30:3: error: 'sort' was not declared in this scope; did you mean 'short'?
   30 |   sort(a + 1, a + n + 1);
      |   ^~~~
      |   short
a.cc:33:8: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
   33 |   rep (i, n) fac[i] = fac[i - 1] * i % mo;
      |        ^
a.cc:2:29: note: in definition of macro 'rep'
    2 | #define rep(i, n) for (rint i = 1; i <= (n); i ++)
      |                             ^
a.cc:36:9: error: 'abs' was not declared in this scope
   36 |     if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
      |         ^~~
a.cc:43:9: error: 'abs' was not declared in this scope
   43 |     if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
      |         ^~~
a.cc:50:3: error: 'cout' was not declared in this scope
   50 |   cout << fac[posA] * fac[posB] % mo << "\n";
      |   ^~~~
a.cc: In instantiation of 'void read(tp&) [with tp = long long int]':
a.cc:27:7:   required from here
   27 |   read(n);
      |   ~~~~^~~
a.cc:9:26: error: 'getchar' was not declared in this scope
    9 |   x = 0; char c = getchar(); int f = 0;
      |                   ~~~~~~~^~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | w#include <bits/stdc++.h>