#include <cstdlib>
#include <ctime>
#include <algorithm>
#include <iterator>
#include <iostream>
int main()
{
constexpr int MIN = 1 ;
constexpr int MAX = 50 ;
constexpr std::size_t SZ = MAX - MIN + 1 ;
constexpr std::size_t N = 7 ;
std::srand( std::time(nullptr) ) ;
// 1. create an array containing numbers 1 to 50
int a[SZ] ;
std::iota( std::begin(a), std::end(a), MIN ) ;
// 2. generate a random permutation of the array
std::random_shuffle( std::begin(a), std::end(a) ) ;
// 3. pick the first 7 numbers
for( std::size_t i = 0 ; i < N ; ++i ) std::cout << a[i] << ' ' ;
std::cout << '\n' ;
}
I2luY2x1ZGUgPGNzdGRsaWI+CiNpbmNsdWRlIDxjdGltZT4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPGl0ZXJhdG9yPgojaW5jbHVkZSA8aW9zdHJlYW0+CgppbnQgbWFpbigpCnsKICAgIGNvbnN0ZXhwciBpbnQgTUlOID0gMSA7CiAgICBjb25zdGV4cHIgaW50IE1BWCA9IDUwIDsKICAgIGNvbnN0ZXhwciBzdGQ6OnNpemVfdCBTWiA9IE1BWCAtIE1JTiArIDEgOwogICAgY29uc3RleHByIHN0ZDo6c2l6ZV90IE4gPSA3IDsKCiAgICBzdGQ6OnNyYW5kKCBzdGQ6OnRpbWUobnVsbHB0cikgKSA7CgogICAgLy8gMS4gY3JlYXRlIGFuIGFycmF5IGNvbnRhaW5pbmcgbnVtYmVycyAxIHRvIDUwCiAgICBpbnQgYVtTWl0gOwogICAgc3RkOjppb3RhKCBzdGQ6OmJlZ2luKGEpLCBzdGQ6OmVuZChhKSwgTUlOICkgOwoKICAgIC8vIDIuIGdlbmVyYXRlIGEgcmFuZG9tIHBlcm11dGF0aW9uIG9mIHRoZSBhcnJheQogICAgc3RkOjpyYW5kb21fc2h1ZmZsZSggc3RkOjpiZWdpbihhKSwgc3RkOjplbmQoYSkgKSA7CgogICAgLy8gMy4gcGljayB0aGUgZmlyc3QgNyBudW1iZXJzCiAgICBmb3IoIHN0ZDo6c2l6ZV90IGkgPSAwIDsgaSA8IE4gOyArK2kgKSBzdGQ6OmNvdXQgPDwgYVtpXSA8PCAnICcgOwogICAgc3RkOjpjb3V0IDw8ICdcbicgOwp9Cg==