#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[]) {
for(int i = 0; i < N; i++) {
for(int b = 0; b < 8; b += 2) {
int x = 0;
if (M[i] & (1 << b)) x ^= 1;
if (M[i] & (1 << b+1)) x ^= 2;
while(x--) send(i*4 + b/2);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[]) {
vector<int> re(N);
map<int,int> cnt;
for(int x = 0; x < L; x++) {
cnt[X[x]]++;
}
for(auto &[p, c]: cnt) {
int i = p / 4, b = p % 4 * 2;
if (c & 1) re[i] ^= 1 << b;
if (c & 2) re[i] ^= 1 << b+1;
}
for(int &x: re) output(x);
}