#include <algorithm>
#include <array>
#include <iostream>
#include <numeric>
#include <random>
#include <vector>
constexpr std::size_t seq_len = 16;
constexpr std::size_t num_balls = 52;
int main() // this is not generalized for an odd sequence length
{
auto generator = std::mt19937{ std::random_device{}() };
auto balls = std::array<int, num_balls>{};
std::iota(balls.begin(), balls.end(), 1);
std::shuffle(balls.begin(), balls.end(), generator);
auto sequence = std::vector<int>{ balls.begin(), balls.begin() + seq_len / 2 };
std::shuffle(balls.begin(), balls.begin() + seq_len/2, generator);
sequence.insert(sequence.end(), balls.begin(), balls.begin() + seq_len/2);
for (auto ball : sequence)
std::cout << ball << ' ';
}
I2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGFycmF5PgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxudW1lcmljPgojaW5jbHVkZSA8cmFuZG9tPgojaW5jbHVkZSA8dmVjdG9yPgoKY29uc3RleHByIHN0ZDo6c2l6ZV90IHNlcV9sZW4gPSAxNjsKY29uc3RleHByIHN0ZDo6c2l6ZV90IG51bV9iYWxscyA9IDUyOwoKaW50IG1haW4oKSAgICAgIC8vIHRoaXMgaXMgbm90IGdlbmVyYWxpemVkIGZvciBhbiBvZGQgc2VxdWVuY2UgbGVuZ3RoCnsKICAgIGF1dG8gZ2VuZXJhdG9yID0gc3RkOjptdDE5OTM3eyBzdGQ6OnJhbmRvbV9kZXZpY2V7fSgpIH07CiAgICAKICAgIGF1dG8gYmFsbHMgPSBzdGQ6OmFycmF5PGludCwgbnVtX2JhbGxzPnt9OwogICAgc3RkOjppb3RhKGJhbGxzLmJlZ2luKCksIGJhbGxzLmVuZCgpLCAxKTsKICAgIHN0ZDo6c2h1ZmZsZShiYWxscy5iZWdpbigpLCBiYWxscy5lbmQoKSwgZ2VuZXJhdG9yKTsKCiAgICBhdXRvIHNlcXVlbmNlID0gc3RkOjp2ZWN0b3I8aW50PnsgYmFsbHMuYmVnaW4oKSwgYmFsbHMuYmVnaW4oKSArIHNlcV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