Language: C++

#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define ll long long
#define PLL pair<ll,ll>
#define rep(i,n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i,n) for (ll i = 1; i <= (ll)(n); i++)
#define repR(i,n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define rep1R(i,n) for (ll i = (ll)(n); i >= 1; i--)
#define loop(i,a,B) for (ll i = a; i B; i++)
#define loopR(i,a,B) for (ll i = a; i B; i--)
#define all(v) v.begin(), v.end()
#define fcout cout<<fixed<<setprecision(15)
#define PI 3.1415926535897932384626433832795028841971693993751058209749445923078160628620899
const unsigned int BIT_FLAG_0 = (1 << 0);
const unsigned int BIT_FLAG_1 = (1 << 1);
const unsigned int BIT_FLAG_2 = (1 << 2);
const unsigned int BIT_FLAG_3 = (1 << 3);
const unsigned int BIT_FLAG_4 = (1 << 4);
const unsigned int BIT_FLAG_5 = (1 << 5);
const unsigned int BIT_FLAG_6 = (1 << 6);
const unsigned int BIT_FLAG_7 = (1 << 7);
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ll INF = 1000000000000000000;

string S, T, U;
char V[1100000];
ll ANS = 0, SUM = 0, NOW = 0, N, M, A, B, C, D, E, F[1100000] = { 0 }, G[1100000] = { 0 }, H[1100000] = { 0 }, I[1100000] = { 0 };
double n, m, a, b, c, d, e;
bool ans = 0, now = 0, sum = 0;
PLL ARM[1100000];

ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll kai(ll x, ll y) {
	ll res = 1;
	for (ll i = x - y; i <= x; i++) {
		res *= i;
		res %= MOD;
	}
	return res;
}

ll comb(ll x, ll y) {
	if (y > x) return 0;
	return kai(x, y) * mod_pow(kai(x, y), MOD - 2, MOD) % MOD;
}

ll gcd(ll x, ll y) {
	if (x < y) {
		swap(x, y);
	}
	ll r = x % y;
	while (r != 0) {
		x = y;
		y = r;
		r = x % y;
	}
	return y;
}

ll lcm(ll x, ll y) {
	ll ans = x * y / gcd(x, y);
	return ans;
}

ll ketasu(ll n) {
	ll count = 1;
	while (n >= 10) {
		n /= 10;
		count++;
	}
	return count;
}

string sortS(string s) {
	string sortS;
	vector<char> t(s.size());
	rep(i, s.size()) t[i] = s[i];
	sort(t.begin(), t.end());
	rep(i, s.size()) sortS += t[i];
	return sortS;
}

bool anagram(string a, string b) {
	if (sortS(a) == sortS(b)) return true;
	else return false;
}

ll euclidA(ll a, ll b) {
	bool h = false;
	ll i = 1;
	int ansa;
	while (!h) {
		if (((i * a) - gcd(a, b)) % b == 0) {
			ansa = i;
			h = true;
		}
		i++;
	}
	return ansa;
}

ll eucridB(ll a, ll b) {
	bool h = false;
	ll i = 1;
	ll ansb;
	while (!h) {
		if (((i * a) - gcd(a, b)) % b == 0) {
			ansb = ((i * a - gcd(a, b)) / b);
			h = true;
		}
		i++;
	}
	return ansb;
}

ll twobeki(ll n) {
	if (n == 0) return 1;
	if (n % 2 == 0) {
		int k = twobeki(n / 2);
		return k * k;
	}
	return twobeki(n - 1) * 2;
}

bool isOKlow(ll index, ll key, ll a[]) {
	if (a[index] > key) return true;
	else return false;
}

ll nibutanlowL(ll k, ll a[], ll b, ll c) {
	ll left = b - 1;
ll right = c + 1;
while (right - left > 1) {
	ll mid = left + (right - left + 1) / 2;
	if (a[mid] >= k) right = mid;
	else left = mid;
}
return left;
}

ll nibutanlowR(ll k, ll a[], ll b, ll c) {
	ll left = b - 1;
	ll right = c + 1;
	while (right - left > 1) {
		ll mid = left + (right - left + 1) / 2;
		if (a[mid] >= k) right = mid;
		else left = mid;
	}
	return right;
}

bool isOKup(ll index, ll key, ll a[]) {
	if (a[index] >= key) return true;
	else return false;
}

ll nibutanupL(ll k, ll a[], ll b, ll c) {
	ll left = b - 1;
	ll right = c + 1;
	while (right - left > 1) {
		ll mid = left + (right - left + 1) / 2;
		if (a[mid] > k) right = mid;
		else left = mid;
	}
	return left;
}

ll nibutanupR(ll k, ll a[], ll b, ll c) {
	ll left = b - 1;
	ll right = c + 1;
	while (right - left > 1) {
		ll mid = left + (right - left + 1) / 2;
		if (a[mid] > k) right = mid;
		else left = mid;
	}
	return right;
}

ll mod(ll a, ll b) {
	if (a >= 0) return a % b;
	ll c = 0 - a;
	ll d = c % b;
	return b - d;
}

ll alpNO(char S) {
	vector<char> alp(26);
	alp = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
	rep(i, 26) {
		if (S == alp[i]) {
			return i;
		}
	}
	return 0;
}

char caeser(char S, ll N) {
	vector<char> alp(26);
	alp = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' };
	ll A = alpNO(S) + N;
	A = mod(A, 26);
	return alp[A];
}

ll left, right;

int main(void) {
	cin >> N >> M;
	if (N % 2 == 1) {
		left = N / 2;
		right = left + 1;
		rep(i, M) {
			cout << left << " " << right << endl;
			left--;
			right++;
		}
	}
	else if (N%4!=0) {
		left = 1;
		right = N / 2 - 1;
		rep(i, (N-2) / 4) {
			cout << left << " " << right << endl;
			left++;
			right--;
		}
		left = N / 2;
		right = N - 1;
		rep(i, (N - 2) / 4) {
			cout << left << " " << right << endl;
			left++;
			right--;
		}
	}
	else {
		left = 1;
		right = N / 2;
		rep(i, N / 4) {
			cout << left << " " << right << endl;
			left++;
			right--;
		}
		left = N / 2 + 1;
		right = N - 1;
		rep(i, N / 4 - 1) {
			cout << left << " " << right << endl;
			left++;
			right--;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:257:17: error: reference to 'left' is ambiguous
  257 |                 left = N / 2;
      |                 ^~~~
In file included from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/istream:40,
                 from /usr/include/c++/14/fstream:40,
                 from a.cc:4:
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:258:17: error: reference to 'right' is ambiguous
  258 |                 right = left + 1;
      |                 ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:258:25: error: reference to 'left' is ambiguous
  258 |                 right = left + 1;
      |                         ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:260:33: error: reference to 'left' is ambiguous
  260 |                         cout << left << " " << right << endl;
      |                                 ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:260:48: error: reference to 'right' is ambiguous
  260 |                         cout << left << " " << right << endl;
      |                                                ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:261:25: error: reference to 'left' is ambiguous
  261 |                         left--;
      |                         ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:262:25: error: reference to 'right' is ambiguous
  262 |                         right++;
      |                         ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:266:17: error: reference to 'left' is ambiguous
  266 |                 left = 1;
      |                 ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:267:17: error: reference to 'right' is ambiguous
  267 |                 right = N / 2 - 1;
      |                 ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:269:33: error: reference to 'left' is ambiguous
  269 |                         cout << left << " " << right << endl;
      |                                 ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:269:48: error: reference to 'right' is ambiguous
  269 |                         cout << left << " " << right << endl;
      |                                                ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:270:25: error: reference to 'left' is ambiguous
  270 |                         left++;
      |                         ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:271:25: error: reference to 'right' is ambiguous
  271 |                         right--;
      |                         ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:273:17: error: reference to 'left' is ambiguous
  273 |                 left = N / 2;
      |                 ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:274:17: error: reference to 'right' is ambiguous
  274 |                 right = N - 1;
      |                 ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:276:33: error: reference to 'left' is ambiguous
  276 |                         cout << left << " " << right << endl;
      |                                 ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:276:48: error: reference to 'right' is ambiguous
  276 |                         cout << left << " " << right << endl;
      |                                                ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:277:25: error: reference to 'left' is ambiguous
  277 |                         left++;
      |                         ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:278:25: error: reference to 'right' is ambiguous
  278 |                         right--;
      |                         ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:282:17: error: reference to 'left' is ambiguous
  282 |                 left = 1;
      |                 ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:283:17: error: reference to 'right' is ambiguous
  283 |                 right = N / 2;
      |                 ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:285:33: error: reference to 'left' is ambiguous
  285 |                         cout << left << " " << right << endl;
      |                                 ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:285:48: error: reference to 'right' is ambiguous
  285 |                         cout << left << " " << right << endl;
      |                                                ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:286:25: error: reference to 'left' is ambiguous
  286 |                         left++;
      |                         ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candidates are: 'std::ios_base& std::left(ios_base&)'
 1062 |   left(ios_base& __base)
      |   ^~~~
a.cc:252:4: note:                 'long long int left'
  252 | ll left, right;
      |    ^~~~
a.cc:287:25: error: reference to 'right' is ambiguous
  287 |                         right--;
      |                         ^~~~~
/usr/include/c++/14/bits/ios_base.h:1070:3: note: candidates are: 'std::ios_base& std::right(ios_base&)'
 1070 |   right(ios_base& __base)
      |   ^~~~~
a.cc:252:10: note:                 'long long int right'
  252 | ll left, right;
      |          ^~~~~
a.cc:289:17: error: reference to 'left' is ambiguous
  289 |                 left = N / 2 + 1;
      |                 ^~~~
/usr/includ