Language: C++

#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
//#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define FORD(i,a,b) for(int i = (a); i >= (b); i--)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define M_PI 3.14159265358979323846
template<class C> void mini(C& _a4, C _b4) { _a4 = min(_a4, _b4); }
template<class C> void maxi(C& _a4, C _b4) { _a4 = max(_a4, _b4); }

template<class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
	while (*sdbg != ',')cerr << *sdbg++; cerr << '=' << h << ','; _dbg(sdbg + 1, a...);
}

template<class T> ostream& operator<<(ostream& os, vector<T> V) {
	os << "["; for (auto& vv : V) os << vv << ","; os << "]";
	return os;
}

template<class T> ostream& operator<<(ostream& os, set<T> V) {
	os << "["; for (auto& vv : V) os << vv << ","; os << "]";
	return os;
}

template<class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) {
	return os << "(" << P.st << "," << P.nd << ")";
}


#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#endif
const int mx = (int)1e6;

struct BigNum {
#define REDUCE() while(len>1 && cyf[len-1]==0) len--;
	const int BASE = 1000000000, BD = 9;
	int len, al;
	LL* cyf;
	BigNum(int v = 0, int l = 2, int base = 1000) {
		BASE = base;
		len = 1; al = l;
		cyf = new LL[al];
		REP(x, al) cyf[x] = 0;
		cyf[0] = v;
		if (v >= BASE) przen(1);
	}
	BigNum(const BigNum &a) {
		len = al = a.len;
		cyf = new LL[al];
		REP(x, al) cyf[x] = a.cyf[x];
	}
	~BigNum() { delete cyf; }
	void Res(int l) {
		if (l>al) {
			l = max(l, 2 * al);
			LL* n = new LL[l];
			REP(x, l) n[x] = x >= al ? 0 : cyf[x];
			delete cyf;
			cyf = n;
			al = l;
		}
	}
	void przen(int p) {
		int	x = 0;
		for (; x<p || cyf[x]<0 || cyf[x] >= BASE; x++) {
			Res(x + 2);
			if (cyf[x]<0) { LL i = (-cyf[x] - 1) / BASE + 1; cyf[x] += i*BASE; cyf[x + 1] -= i; }
			else
				if (cyf[x] >= BASE) { LL i = cyf[x] / BASE; cyf[x] -= i*BASE; cyf[x + 1] += i; }
		}
		len = max(len, x + 1);
		REDUCE();
	}
	/* Operatory porownawcze */
#define OPER1(op) bool operator op (const BigNum &a) const
	OPER1(== ) {
		if (a.len != len) return 0;
		REP(x, len) if (cyf[x] != a.cyf[x]) return 0;
		return 1;
	}
	OPER1(<) {
		if (len != a.len) return len<a.len;
		int x = len - 1;
		while (x && a.cyf[x] == cyf[x]) x--;
		return cyf[x]<a.cyf[x];
	}
	OPER1(>) { return a<*this; } /* Wymaga < */
	OPER1(<= ) { return !(a<*this); } /* Wymaga < */
	OPER1(>= ) { return !(*this<a); } /* Wymaga < */
	OPER1(!= ) { return !(*this == a); } /* Wymaga == */

										 /* Operatory Bignum - Int */
	BigNum &operator=(int a) {
		REP(x, len) cyf[x] = 0;
		len = 1; cyf[0] = a;
		if (a >= BASE) przen(1);
		return *this;
	}
	void operator+=(int a) { cyf[0] += a; przen(1); }
	void operator-=(int a) { cyf[0] -= a; przen(1); }
	void operator*=(int a) { REP(x, len) cyf[x] *= a; przen(len); }
	int operator/=(int a) { /* <b> Zwraca reszte z dzielenia </b> */
		LL w = 0;
		FORD(p, len - 1, 0) { w = w*BASE + cyf[p]; cyf[p] = w / a; w = w%a; }
		REDUCE();
		return w;
	}
	int operator%(int a) {
		LL w = 0;
		FORD(p, len - 1, 0) w = (w*BASE + cyf[p]) % a;
		return w;
	}
	/* Operatory Bignum - Bignum */
#define OPER2(op) BigNum& operator op (const BigNum &a)
	OPER2(+= ) {
		Res(a.len);
		REP(x, a.len) cyf[x] += a.cyf[x];
		przen(a.len);
		return *this;
	}
	OPER2(-= ) {
		REP(x, a.len) cyf[x] -= a.cyf[x];
		przen(a.len);
		return *this;
	}
	OPER2(*= ) {
		BigNum c(0, len + a.len);
		REP(x, a.len) {
			REP(y, len) c.cyf[y + x] += cyf[y] * a.cyf[x];
			c.przen(len + x);
		}
		*this = c;
		return *this;
	}
	OPER2(/= ) { /* Wymaga operatora <, += (BigNum) , *= (BigNum) , <<=, + (BigNum) , * (BigNum), << */
		int n = max(len - a.len + 1, 0);
		BigNum d(0, n), prod;
		FORD(i, n - 1, 0) {
			int l = 0, r = BASE - 1;
			while (l<r) {
				int	m = (l + r + 1) / 2;
				if (*this < prod + (a*m << i))
					r = m - 1;
				else
					l = m;
			}
			prod += a*l << i;
			d.cyf[i] = l;
			if (l) d.len = max(d.len, i + 1);
		}
		*this = d;
		return *this;
	}
	OPER2(%= ) { /* Wymaga operatora <, += (BigNum) , -= (BigNum) *= (BigNum) , /= (BigNum) <<=, + (BigNum) , * (BigNum), << */
		BigNum v = *this;
		v /= a;
		v *= a;
		*this -= v;
		return *this;
	}
	OPER2(= ) {
		Res(a.len);
		FORD(x, len - 1, a.len) cyf[x] = 0;
		REP(x, a.len) cyf[x] = a.cyf[x];
		len = a.len;
		return *this;
	}
	/* OPERATORY DO WCZYTYWANIA - WYPISYWANIA */
	void read(const vector<int> &v, int p) { /* Wymaga += (int), *= (int) */
		*this = 0;
		FORD(x, v.size() - 1, 0) {
			*this *= p;
			*this += v[x];
		}
	}
	BigNum &operator=(string a) { /* Wymaga = (int) */
		int s = a.length();
		*this = 0;
		Res(len = s / BD + 1);
		REP(x, s) cyf[(s - x - 1) / BD] = 10 * cyf[(s - x - 1) / BD] + a[x] - '0';
		REDUCE();
		return *this;
	}
	void write() const {
		printf("%d", int(cyf[len - 1]));
		FORD(x, len - 2, 0) printf("%0*d", BD, int(cyf[x]));
	}
	void write(char *buf) const {
		int p = sprintf(buf, "%d", int(cyf[len - 1]));
		FORD(x, len - 2, 0) p += sprintf(buf + p, "%0*d", BD, int(cyf[x]));
	}
	vector<int> write(int pod) const { /* Wymaga /= (int), = (BigNum) */
		vector<int> w;
		BigNum v;
		v = *this;
		while (v.len>1 || v.cyf[0]) w.PB(v /= pod);
		return w;
	}
	/* Inne operatory */
	BigNum &operator<<=(int ile) {
		if (cyf[0] == 0 && len == 1) return *this;
		Res(len + ile);
		FORD(x, len - 1, 0) cyf[x + ile] = cyf[x];
		REP(x, ile) cyf[x] = 0;
		len += ile;
		return *this;
	}
	BigNum &operator>>=(int ile) {
		if (ile >= len) ile = len;
		REP(x, len - ile) cyf[x] = cyf[x + ile];
		FOR(x, len - ile, ile) cyf[x] = 0;
		len -= ile;
		if (len == 0) len = 1;
		return *this;
	}
	BigNum sqrt() { /* Wymaga <, += (BigNum), *= (BigNum), <<= (int), + (BigNum), * (BigNum), << (int) */
		int n = (len + 1) / 2;
		BigNum a(0, n), sq;
		FORD(i, n - 1, 0) {
			int l = 0, r = BASE - 1;
			while (l<r) {
				int m = (l + r + 1) / 2;
				if (*this < sq + (a * 2 * m << i) + (BigNum(m)*m << 2 * i))
					r = m - 1;
				else
					l = m;
			}
			sq += (a * 2 * l << i) + (BigNum(l)*l << 2 * i);
			a.cyf[i] = l; a.len = n;
		}
		return a;
	}
#define OPER3(op) BigNum operator op(const BigNum &a) const {BigNum w=*this;  w op ## = a;  return w; }
#define OPER4(op) BigNum operator op(int a) {BigNum w = *this; w op ## = a; return w; }
	OPER3(+); /* Wymaga += (BigNum) */
	OPER3(-); /* Wymaga -= (BigNum) */
	OPER3(*); /* Wymaga *= (BigNum) */
	OPER3(/ ); /* Wymaga operatora <, += (BigNum) , *= (BigNum) , /= (BigNum) <<=, + (BigNum) , * (BigNum), << */
	OPER3(%); /* Wymaga operatora <, += (BigNum) , -= (BigNum), *= (BigNum) , /= (BigNum), %= (BigNum), <<=, + (BigNum) , * (BigNum), << */
	OPER4(<< ); /* Wymaga <<= (int) */
	OPER4(>> ); /* Wymaga >>= (int) */
};
int32_t main(int32_t argc, char ** argv) {
	ios_base::sync_with_stdio(0);
	int n, k;
	scanf("%d%d", n, k);
	if (k % 2 == 0) {
		cout << k / 2<<" ";
		REP(i, n - 1) {
			cout << k;
		}
	}
	else {
		vector<int> seq(n, (k + 1) / 2);
		REP(i, (n - 1) / 2) {
			if (seq.back() == 1) {
				seq.pop_back();
				continue;
			}
			else {
				seq.back()--;
				while (SZ(seq) != n) {
					seq.push_back(k);
				}
			}
		}
		REP(i, n) {
			cout << seq[i] << " ";
		}
	}
	return 0;
}

Compiler output:
a.cc: In constructor 'BigNum::BigNum(int, int, int)':
a.cc:59:22: error: assignment of read-only member 'BigNum::BASE'
   59 |                 BASE = base;
      |                 ~~~~~^~~~~~