#include <bits/stdc++.h>
#include "transmission.h"

#define pb push_back

using namespace std;


std::vector<bool> transmit(const std::vector<bool>& data, int d)
{
    int BATCH = 50; 
    int Q = 6;
    if(d == 1)
        BATCH = 500, Q = 10;

    if(d > 100)
        BATCH = 20;

    int n = data.size();
    BATCH = max(40, n / (10 * d));

    std::vector<bool> message;
    for(int j = 0; j < n; j += BATCH) 
    {
        for(int l = 0; l < Q; l++) message.pb(1);
        message.pb(0);
        for(int k = j; k < j + BATCH; k++)
            message.pb(data[k]);
    }

    return message;
}
