#include <algorithm>
#include <array>
#include <iostream>
#include <stdexcept>
int main() {
    std::array<int,2> buffer_free{0,0};int upload=0,compute=0,download=0;
    std::array<int,3> finished{};
    for(std::size_t chunk=0;chunk<3;++chunk) {
        const auto slot=chunk%2;
        upload=std::max(upload,buffer_free[slot])+2;
        compute=std::max(compute,upload)+5;
        download=std::max(download,compute)+2;
        buffer_free[slot]=download;finished[chunk]=download;
    }
    if(finished!=std::array<int,3>{9,14,19}) throw std::runtime_error("dependency schedule");
    std::cout<<"serial_units="<<3*(2+5+2)<<" pipeline_units="<<download<<'\n';
}
