Language: C++

#include<bit
s/stdc++.h>
const i
nt MAXN = 4e5 + 10;
using namespace std;
inline i

nt read() {
    char c
    
    = getchar(); in
    t x = 0, f = 1;
    while(c < '
    0' || c > '9') {if(c == '-') f = -1; c = getchar();}
    while(c >= '0' && c
    <= '9') x = x * 10 + c - '0', c = getchar();
    return x * f;
    
}
int N;
int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
map<int, bool> ti;
int find(int x) 
{
    return fa[x] == x ? fa[x] : fa[x] = find(fa[x]);
}
int unionn(int x, int y) {
    fa[x] = y;
}
int main() {
    N = read();
    for(int i = 1; i <= N; i++) a[i] = read(), sa ^= a[i]; a[N + 1] = sa;
    for(int i = 1; i <= N; i++) b[i] = read(), sb ^= b[i]; b[N + 1] = sb;
    N++;
    memcpy(ta, a, sizeof(a)); memcpy(tb, b, sizeof(b));
    sort(ta + 1, ta + N + 1); sort(tb + 1, tb + N + 1);
    for(int i = 1; i <= N - 1; i++) if(ta[i] != tb[i]) return puts("-1"), 0;

    int ans = 0, num = 0;
    for(int i = 1; i
    <= N; i++) 
        if(a[i] != b[i] || (i == N)) {
            date[+
            +num] = a[i]; date[++num] = b[i];
            if(i < N)
            ans++;
        }
        
    if(ans == 0) return puts("0"), 0;


    sort(date + 1, date + num 
    + 1);
    
    num = unique(date + 1, date + num + 1) - date - 1;
    for(int i = 1; i <= num
    ; i++) fa[i] = i;
    for(int i = 1; i <=
    N; i++)
        if(a[i] != b[i]) {
            a[i] = lower
            _bound(date + 1, date + num + 1, a[i]) - date,
            b[i] = lower_b
            ound(date + 1, date + num + 1, b[i]) - date;
            if(!ti[a[i]]) ti[a[i]] = 1;
            if(!ti[b[i]]) ti[
                b[i]] = 1;
            unionn(find(a[i]), find(b[i]));
        }

    for(int i = 1; i <= num; i++)
        if(fa[i] == i) ans++;
    printf("%d", ans - 1);

    return 0;
}

Compiler output:
a.cc:1:13: error: missing terminating > character
    1 | #include<bit
      |             ^
a.cc:13:15: warning: missing terminating ' character
   13 |     while(c < '
      |               ^
a.cc:13:15: error: missing terminating ' character
a.cc:14:6: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
   14 |     0' || c > '9') {if(c == '-') f = -1; c = getchar();}
      |      ^~~~~~~~~~
a.cc:14:17: warning: multi-character literal with 11 characters exceeds 'int' size of 4 bytes
   14 |     0' || c > '9') {if(c == '-') f = -1; c = getchar();}
      |                 ^~~~~~~~~~~~~
a.cc:14:31: warning: missing terminating ' character
   14 |     0' || c > '9') {if(c == '-') f = -1; c = getchar();}
      |                               ^
a.cc:14:31: error: missing terminating ' character
   14 |     0' || c > '9') {if(c == '-') f = -1; c = getchar();}
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:2:1: error: 's' does not name a type
    2 | s/stdc++.h>
      | ^
a.cc:6:8: error: 'i' does not name a type
    6 | inline i
      |        ^
a.cc:21:7: error: 'MAXN' was not declared in this scope
   21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
      |       ^~~~
a.cc:21:16: error: 'MAXN' was not declared in this scope
   21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
      |                ^~~~
a.cc:21:26: error: 'MAXN' was not declared in this scope
   21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
      |                          ^~~~
a.cc:21:36: error: 'MAXN' was not declared in this scope
   21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
      |                                    ^~~~
a.cc:21:65: error: 'MAXN' was not declared in this scope
   21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
      |                                                                 ^~~~
a.cc:21:75: error: 'MAXN' was not declared in this scope
   21 | int a[MAXN], b[MAXN], ta[MAXN], tb[MAXN], sa, sb, tot = 0, date[MAXN], fa[MAXN];
      |                                                                           ^~~~
a.cc:22:1: error: 'map' does not name a type
   22 | map<int, bool> ti;
      | ^~~
a.cc: In function 'int find(int)':
a.cc:25:12: error: 'fa' was not declared in this scope; did you mean 'sa'?
   25 |     return fa[x] == x ? fa[x] : fa[x] = find(fa[x]);
      |            ^~
      |            sa
a.cc: In function 'int unionn(int, int)':
a.cc:28:5: error: 'fa' was not declared in this scope; did you mean 'sa'?
   28 |     fa[x] = y;
      |     ^~
      |     sa
a.cc:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^
a.cc: In function 'int main()':
a.cc:31:9: error: 'read' was not declared in this scope
   31 |     N = read();
      |         ^~~~
a.cc:32:33: error: 'a' was not declared in this scope
   32 |     for(int i = 1; i <= N; i++) a[i] = read(), sa ^= a[i]; a[N + 1] = sa;
      |                                 ^
a.cc:32:60: error: 'a' was not declared in this scope; did you mean 'sa'?
   32 |     for(int i = 1; i <= N; i++) a[i] = read(), sa ^= a[i]; a[N + 1] = sa;
      |                                                            ^
      |                                                            sa
a.cc:33:33: error: 'b' was not declared in this scope
   33 |     for(int i = 1; i <= N; i++) b[i] = read(), sb ^= b[i]; b[N + 1] = sb;
      |                                 ^
a.cc:33:60: error: 'b' was not declared in this scope; did you mean 'sb'?
   33 |     for(int i = 1; i <= N; i++) b[i] = read(), sb ^= b[i]; b[N + 1] = sb;
      |                                                            ^
      |                                                            sb
a.cc:35:12: error: 'ta' was not declared in this scope; did you mean 'sa'?
   35 |     memcpy(ta, a, sizeof(a)); memcpy(tb, b, sizeof(b));
      |            ^~
      |            sa
a.cc:35:5: error: 'memcpy' was not declared in this scope
   35 |     memcpy(ta, a, sizeof(a)); memcpy(tb, b, sizeof(b));
      |     ^~~~~~
a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include<bit
  +++ |+#include <cstring>
    2 | s/stdc++.h>
a.cc:35:38: error: 'tb' was not declared in this scope; did you mean 'sb'?
   35 |     memcpy(ta, a, sizeof(a)); memcpy(tb, b, sizeof(b));
      |                                      ^~
      |                                      sb
a.cc:36:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   36 |     sort(ta + 1, ta + N + 1); sort(tb + 1, tb + N + 1);
      |     ^~~~
      |     short
a.cc:37:63: error: 'puts' was not declared in this scope
   37 |     for(int i = 1; i <= N - 1; i++) if(ta[i] != tb[i]) return puts("-1"), 0;
      |                                                               ^~~~
a.cc:43:13: error: 'date' was not declared in this scope
   43 |             date[+
      |             ^~~~
a.cc:49:25: error: 'puts' was not declared in this scope
   49 |     if(ans == 0) return puts("0"), 0;
      |                         ^~~~
a.cc:52:10: error: 'date' was not declared in this scope
   52 |     sort(date + 1, date + num
      |          ^~~~
a.cc:55:11: error: 'unique' was not declared in this scope
   55 |     num = unique(date + 1, date + num + 1) - date - 1;
      |           ^~~~~~
a.cc:57:12: error: 'fa' was not declared in this scope; did you mean 'sa'?
   57 |     ; i++) fa[i] = i;
      |            ^~
      |            sa
a.cc:61:20: error: 'lower' was not declared in this scope
   61 |             a[i] = lower
      |                    ^~~~~
a.cc:65:17: error: 'ti' was not declared in this scope; did you mean 'i'?
   65 |             if(!ti[a[i]]) ti[a[i]] = 1;
      |                 ^~
      |                 i
a.cc:66:17: error: 'ti' was not declared in this scope; did you mean 'i'?
   66 |             if(!ti[b[i]]) ti[
      |                 ^~
      |                 i
a.cc:72:12: error: 'fa' was not declared in this scope; did you mean 'sa'?
   72 |         if(fa[i] == i) ans++;
      |            ^~
      |            sa
a.cc:73:5: error: 'printf' was not declared in this scope
   73 |     printf("%d", ans - 1);
      |     ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
    1 | #include<bit
  +++ |+#include <cstdio>
    2 | s/stdc++.h>