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 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:72:17: error: reference to 'left' is ambiguous
   72 |                 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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:73:17: error: reference to 'right' is ambiguous
   73 |                 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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:73:25: error: reference to 'left' is ambiguous
   73 |                 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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:75:33: error: reference to 'left' is ambiguous
   75 |                         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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:75:48: error: reference to 'right' is ambiguous
   75 |                         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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:76:25: error: reference to 'left' is ambiguous
   76 |                         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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:77:25: error: reference to 'right' is ambiguous
   77 |                         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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:81:17: error: reference to 'left' is ambiguous
   81 |                 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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:82:17: error: reference to 'right' is ambiguous
   82 |                 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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:84:33: error: reference to 'left' is ambiguous
   84 |                         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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:84:48: error: reference to 'right' is ambiguous
   84 |                         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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:85:25: error: reference to 'left' is ambiguous
   85 |                         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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:86:25: error: reference to 'right' is ambiguous
   86 |                         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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:88:17: error: reference to 'left' is ambiguous
   88 |                 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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:89:17: error: reference to 'right' is ambiguous
   89 |                 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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:91:33: error: reference to 'left' is ambiguous
   91 |                         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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:91:48: error: reference to 'right' is ambiguous
   91 |                         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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:92:25: error: reference to 'left' is ambiguous
   92 |                         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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:93:25: error: reference to 'right' is ambiguous
   93 |                         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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:97:17: error: reference to 'left' is ambiguous
   97 |                 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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:98:17: error: reference to 'right' is ambiguous
   98 |                 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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:100:33: error: reference to 'left' is ambiguous
  100 |                         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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:100:48: error: reference to 'right' is ambiguous
  100 |                         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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:101:25: error: reference to 'left' is ambiguous
  101 |                         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:67:4: note:                 'long long int left'
   67 | ll left, right;
      |    ^~~~
a.cc:102:25: error: reference to 'right' is ambiguous
  102 |                         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:67:10: note:                 'long long int right'
   67 | ll left, right;
      |          ^~~~~
a.cc:104:17: error: reference to 'left' is ambiguous
  104 |                 left = N / 2 + 1;
      |                 ^~~~
/usr/include/c++/14/bits/ios_base.h:1062:3: note: candida