Problem:


Score : 500 points

Problem Statement

You are going to hold a competition of one-to-one game called AtCoder Janken. (Janken is the Japanese name for Rock-paper-scissors.)
N players will participate in this competition, and they are given distinct integers from 1 through N.
The arena has M playing fields for two players. You need to assign each playing field two distinct integers between 1 and N (inclusive).
You cannot assign the same integer to multiple playing fields.
The competition consists of N rounds, each of which proceeds as follows:

For each player, if there is a playing field that is assigned the player's integer, the player goes to that field and fight the other player who comes there.

Then, each player adds 1 to its integer. If it becomes N+1, change it to 1.

You want to ensure that no player fights the same opponent more than once during the N rounds.
Print an assignment of integers to the playing fields satisfying this condition.
It can be proved that such an assignment always exists under the constraints given.

Constraints

1 \leq M

M \times 2 +1 \leq N \leq 200000

Input

Input is given from Standard Input in the following format:

N M

Output

Print M lines in the format below.
The i-th line should contain the two integers a_i and b_i assigned to the i-th playing field.

a_1 b_1
a_2 b_2
:
a_M b_M

Sample Input 1

4 1

Sample Output 1

2 3

Let us call the four players A, B, C, and D, and assume that they are initially given the integers 1, 2, 3, and 4, respectively.

The 1-st round is fought by B and C, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 2, 3, 4, and 1, respectively.

The 2-nd round is fought by A and B, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 3, 4, 1, and 2, respectively.

The 3-rd round is fought by D and A, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 4, 1, 2, and 3, respectively.

The 4-th round is fought by C and D, who has the integers 2 and 3, respectively. After this round, A, B, C, and D have the integers 1, 2, 3, and 4, respectively.

No player fights the same opponent more than once during the four rounds, so this solution will be accepted.

Sample Input 2

7 3

Sample Output 2

1 6
2 5
3 4



Sample input:
4 1


Sample output:
2 3

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())

if n %2 == 0:
    left = 1
    right = 2*m+1
    for i in range(m):
        print(left,right)
        if i == 0:
            left += 1
            right -= 2
        else:
            left += 1
            right -= 1
else:
    left = 1
    right = 2*m
    for i in range(m):
        print(left,right)
        left += 1
        right -= 1

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map( int, input().split())
    ANS = []
    if N%2 == 1:
        n = N//2
        for i in range(M):
            ANS.append([n-i, n++1+i])
    else:
        n = N//2
        ANS.append([n,n+1])
        for i in range(1,M):
            ANS.append([n-i, n+2-i])

    print( "\n".join( [" ".join( map( str,ans)) for ans in ANS]))
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
if N%2==1:
    for i in range(M):
        print(i+1,N-i-1)
else:
    for i in range(M):
        print(i+1,N-i)

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    t = N // 2
    if N % 2 == 1:
        m = N // 2
    else:
        m = -1 + (N // 2)
    l = []
    for i in range((m//2)+1):
        l.append((i+1, M-i+1))
    for i in range(m//2):
        l.append((N-i, N-M+1+i))
    print(l)
    i = 0
    while i < M:
        if l[i][0] == l[i][1]:
            i += 1
            continue
        print(l[i][0], l[i][1])
        i += 1
main()

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if N%2!=0:
    for i in range(M):
        print(i+1,N-i-1)
else:
    for i in range(M):
        print(1+2*i,N-1-2*i)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

ans = [[1, N - 1]]
l, r = 1, N - 1
for n in range(2, M + 1):
    l += 1
    r -= 1
    ans.append([l, r])

for l, r in ans:
    print(l, r)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

for i in range(1, M + 1) :
  print(i, N - i + 1)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())

if n%2 == 0:
    s = n//2
else:
    s = (n-1)//2
    
cnt = 0

for i in range(m):
    print(s-cnt, s+1+cnt)
    cnt += 1

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())

for i in range(m):
    print(i+1,2*m-i)

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
if N % 2 == 1:
	for i in range(1,1+M):
		print(i, 2*M+1-i)
else:
	a = [2*i for i in range(1,N//4)] + [2*j + 1 for j in range(N//4, N//2)]
	for i in range(1, 1+M):
		print(i, i+a[-i])

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
ans = []
if N % 2 == 1:
    N -= 1
    a = N // 2
    b = N // 2 + 1
    ans.append([a,b])
    for i in range(M):
        a -= 1
        b += 1
        ans.append([a,b])
else:
    x = (N - 2) // 2 + 1
    a = N // 2
    b = N // 2 + 1
    if b - a != x:
        ans.append([a,b])
    for i in range(M+1):
        a -= 1
        b += 1
        if b - a != x:
            ans.append([a,b])
for i in range(M):
    print('{0} {1}'.format(ans[i][0],ans[i][1]))

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if n % 2 == 0:
  for turn in range(1,m+1):
    print(turn,n-turn)
else:
  for turn in range(1,m+1):
    print(turn,n-turn)

Submission status: Wrong Answer

Solution code:
def main():

    from bisect import bisect_left as bl, bisect_right as br, insort
    import sys,heapq,math
    from collections import defaultdict as dd, deque
    def data(): return sys.stdin.readline().strip()
    def mdata(): return list(map(int, data().split()))
    out = sys.stdout.write
    # sys.setrecursionlimit(100000)
    INF = int(1e9)
    mod = int(1e9)+7

    n,m=mdata()
    for i in range(1,m+1):
        print(i*2-1,i*2)



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    n, m = map(int, input().split())
    l = 0
    r = n-1
    g = []
    for i in range(m):
        print(l+1, r+1)
        g.append([l, r])
        l += 1
        r -= 1
        if n % 2 == 0 and r-l == n//2:
            r -= 1


main()

Submission status: Wrong Answer

Solution code:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
#      .      '                    Udit Gupta @luctivud         ,              
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            ##     ##  #######  # #  ######
                            ##     ##  ##   ##  ###    ##
                            ##     ##  ##    #  # #    ##
                            #########  #######  # #    ##
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

import sys
import math
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))

def printwsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end="tst, ")

MOD = int(1e9+7); BABYMOD = 998244353;
# ################################ HELPER PROGRAMS USED ###################################
# ################################## MAIN STARTS HERE #####################################
# for _testcases_ in range(int(input())):
n, m = get_ints()
a = 1; b = n;
for i in range(m):
    print(a+i, b-i)


# #########################################################################################
'''
THE LOGIC AND APPROACH WAS DEVELOPED BY ME @luctivud.
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
PLEASE DO NOT PLAGIARISE.
'''

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m = na()

if n%2 == 0:
    a,b = n//2,n//2+1
    for i in range(m):
        print(a,b)
        a,b = a-1,b+1
else:
    a,b = n//2,n//2+1
    for i in range(m):
        print(a,b)
        a,b = a-1,b+1

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if n%2 == 1:
  for i in range(m):
    print((n-1)//2-i,(n+1)//2-i)
else:
  for i in range(m):
    print(n//2-i,n//2+1-i)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
if M%2==1:
    for i in range(M):
        print(i+1,N-i-1)
else:
    for i in range(M):
        print(i+1,N-i)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range(m):
  print(str(i+1)+" "+str(n-i))

Submission status: Wrong Answer

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
if m == 1:
    print(1,2)
else:
    for i in range(1,m+1):
        print(i,n-i)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
used = set()
cnt = 1
ans = []
for i in range(1, n+1):
    if i not in used:
        ans.append((i, i+cnt))
        used.add(i)
        used.add(i+cnt)
        cnt += 1
        if cnt > m:
            break
    else:
        continue

#print(ans)
for i in range(m):
    print(*ans[i])

Submission status: Wrong Answer

Solution code:
from sys import stdin


def input():
    return stdin.readline().strip()


def main():
    N, M = map(int, input().split())
    if N % 2 == 0:
        N += 1

    a = list(range(1, N + 1))
    for i in range(M):
        print(a[i], a[-i - 2])


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:

def factorize(n):
    ## 素因数分解
    # arr = factorize(20)
    # arr == [[2, 2], [5, 1]]
    
    result = []
    tmp = n
    for k in range(2, int(n ** 0.5) + 1):
        cnt = 0
        while tmp % k == 0:
            cnt += 1
            tmp //= k
        if cnt > 0:
            result.append([k, cnt])
    if tmp != 1:
        result.append([tmp, 1])
    return result

def divisorize(n):
    ## 約数
    # arr = factorize(20)
    # arr == [2, 4, 5, 10, 20]
    f = factorize(n)
    divisors = [1]
    for k in range(len(f)):
        num_divisors = len(divisors)
        for i in range(1, f[k][1] + 1):
            for j in range(num_divisors):
                divisors.append(divisors[j] * f[k][0] ** i)
    return sorted(divisors)

n, m = list(map(int, input().split()))
d = divisorize(n)[1:]


a = []
b = []
for i in range(1, n):
    if i not in d:
        if i not in b:
            a.append(i)
            b.append(n - i)

k = 1
d = []
for i in a[::-1]:
    while True:
        if k not in d:
            if k + i not in d:
                print(k, k+i)
                d.append(k)
                d.append(k + i)
                k += 1
                break
        k += 1

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):
    for i in range(M):
        print(i+1,2*M-i)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
a = 1
b = 2 * M
for _ in range(M):
    print(a, b)
    a += 1
    b -= 1

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
# 和が一定になるように出力
# even => n + 1
# odd  => n
x = n // 2
s = n + 1 if n % 2 == 0 else n
cnt = 0
while True:
    print(x, s - x)
    x -= 1
    cnt += 1
    if cnt == m:
        exit()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
for i in range (m):
    a=i+1
    b=2*m-i
    print (a)
    print (b)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(" "))
if N%2 :
    j=N//2
    for i in range(M) :
        apart = i*2+1
        j = (j+N)%N
        k = (j+apart+N)%N
        print(j+1, k+1)
        j -= 1
else :
    j=N//2 
    apart=1
    for i in range(M) :
        if apart == N//2 :
            apart += 1
        j = (j+N)%N
        k = (j+apart+N)%N
        print(j+1, k+1)
        j -= 1
        apart += 2

Submission status: Wrong Answer

Solution code:
def solve(n,m):
    Ans=[]
    if n%2==1:
        for i in range(1,m+1):
            Ans.append((i,n-i))
        return Ans
    a=1; b=n
    d1=n-1; d2=1
    while d1>d2:
        Ans.append((a,b))
        a+=1; b-=1
        d1-=2; d2+=2
    b-=1
    while a<=m:
        Ans.append((a,b))
        a+=1
        b-=1
    return Ans
    
def main():
    n,m=map(int,input().split())
    Ans=solve(n,m)
    for ans in Ans:
        print(*ans)
    
if __name__=='__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())

if N%2 == 1:
    for i in range(1,M+1):
        print(i,N-i)
else:
    for i in range(1,M+1):
        print(i,N+1-i)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n, m = LI()
    ans = []
    v = n
    for i in range(m + 1):
        if (4 * i + 2) == n: continue
        ans.append((i + 1, v))
        v -= 1
    for a in ans[:m]:
        print(*a)
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m = na()

if n%2 == 0:
    a,b = n//2,n//2+1
    for i in range(m):
        print(a,b)
        a,b = a-1,b+1
else:
    a,b = n//2,n//2+2
    for i in range(m):
        print(a,b)
        a,b = a-1,b+1

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range(m):
    print(1, i+2)

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().split()))

for i in range(1, M + 1):
  print(f'{i} {N - i}')

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if N%2:
    for i in range(1,M+1):
        print(i,N-i)
else:
    if N==4:
        print(2,3)
    else:
        for i in range(1,M):
            print(i,N-i+1)
        print(M,N-M)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())

a = [i+1 for i in range(m)]
b = [n-i for i in range(m)]

for i in range(m):
    print(a[i], b[i])

Submission status: Wrong Answer

Solution code:

MOD = 10 ** 9 + 7

def main():
    for _ in inputt(1):
        N, M = inputi()
        if N % 2:
            for i in range(M):
                print(i + 1, N - i)
        else:
            for i in range(M - 1):
                print(i + 1, N - i)
            print(M, M + 2)

# region M


# region import

from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(1000)

# endregion

# region fastio

BUFSIZE = 8192
class FastIO(io.IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = io.BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(io.IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
def print(*args, **kwargs):
    if args:
        sys.stdout.write(str(args[0]))
        split = kwargs.pop("split", " ")
        for arg in args[1:]:
            sys.stdout.write(split)
            sys.stdout.write(str(arg))
    sys.stdout.write(kwargs.pop("end", "\n"))
def debug(*args, **kwargs):
    print("debug", *args, **kwargs)
    sys.stdout.flush()
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip()
inputt = lambda t = 0: range(t) if t else range(int(input()))
inputs = lambda: input().split()
inputi = lambda k = int: map(k, inputs())
inputl = lambda t = 0, k = lambda: list(inputi()): [k() for _ in range(t)] if t else list(k())

# endregion

# region bisect

def len(a):
    if isinstance(a, range):
        return -((a.start - a.stop) // a.step)
    return builtins.len(a)
def bisect_left(a, x, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    while lo < hi:
        mid = (lo + hi) // 2
        if key(a[mid]) < x: lo = mid + 1
        else: hi = mid
    return lo
def bisect_right(a, x, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    while lo < hi:
        mid = (lo + hi) // 2
        if x < key(a[mid]): hi = mid
        else: lo = mid + 1
    return lo
def insort_left(a, x, key = None, lo = 0, hi = None):
    lo = bisect_left(a, x, key, lo, hi)
    a.insert(lo, x)
def insort_right(a, x, key = None, lo = 0, hi = None):
    lo = bisect_right(a, x, key, lo, hi)
    a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right
def index(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    if key == None: key = do_nothing
    i = bisect_left(a, x, key, lo, hi)
    if lo <= i < hi and key(a[i]) == x: return a[i]
    if default != None: return default
    raise ValueError
def find_lt(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_left(a, x, key, lo, hi)
    if lo < i <= hi: return a[i - 1]
    if default != None: return default
    raise ValueError
def find_le(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_right(a, x, key, lo, hi)
    if lo < i <= hi: return a[i - 1]
    if default != None: return default
    raise ValueError
def find_gt(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_right(a, x, key, lo, hi)
    if lo <= i < hi: return a[i]
    if default != None: return default
    raise ValueError
def find_ge(a, x, default = None, key = None, lo = 0, hi = None):
    if lo < 0: lo = 0
    if hi == None: hi = len(a)
    i = bisect_left(a, x, key, lo, hi)
    if lo <= i < hi: return a[i]
    if default != None: return default
    raise ValueError

# endregion

# region csgraph
# TODO

class Tree:
    def __init__(n):
        self._n = n
        self._conn = [[] for _ in range(n)]
        self._list = [0] * n
    def connect(a, b):
        pass

# endregion

# region ntheory

class Sieve:
    def __init__(self):
        self._n = 6
        self._list = [2, 3, 5, 7, 11, 13]
    def extend(self, n):
        if n <= self._list[-1]: return
        maxbase = int(n ** 0.5) + 1
        self.extend(maxbase)
        begin = self._list[-1] + 1
        newsieve = [i for i in range(begin, n + 1)]
        for p in self.primerange(2, maxbase):
            for i in range(-begin % p, len(newsieve), p):
                newsieve[i] = 0
        self._list.extend([x for x in newsieve if x])
    def extend_to_no(self, i):
        while len(self._list) < i: 
            self.extend(int(self._list[-1] * 1.5))
    def primerange(self, a, b):
        a = max(2, a)
        if a >= b: return
        self.extend(b)
        i = self.search(a)[1]
        maxi = len(self._list) + 1
        while i < maxi:
            p = self._list[i - 1]
            if p < b:
                yield p
                i += 1
            else: return
    def search(self, n):
        if n < 2: raise ValueError
        if n > self._list[-1]: self.extend(n)
        b = bisect(self._list, n)
        if self._list[b - 1] == n: return b, b
        else: return b, b + 1
    def __contains__(self, n):
        if n < 2: raise ValueError
        if not n % 2: return n == 2
        a, b = self.search(n)
        return a == b
    def __getitem__(self, n):
        if isinstance(n, slice):
            self.extend_to_no(n.stop + 1)
            return self._list[n.start: n.stop: n.step]
        else:
            self.extend_to_no(n + 1)
            return self._list[n]

sieve = Sieve()
def isprime(n):
    if n <= sieve._list[-1]:
        return n in sieve
    for i in sieve:
        if not n % i: return False
        if n < i * i: return True
prime = sieve.__getitem__
primerange = lambda a, b = 0: sieve.primerange(a, b) if b else sieve.primerange(2, a)
def factorint(n):
    factors = []
    for i in sieve:
        if n < i * i: break
        while not n % i:
            factors.append(i)
            n //= i
    if n != 1: factors.append(n)
    return factors
factordict = lambda n: Counter(factorint(n))

# endregion

# region main

if __name__ == "__main__":
    main()

# endregion


# endregion

Submission status: Wrong Answer

Solution code:
n, m  = map(int, input().split())
a = n // 2
d = 1
for i in range(m):
    print(a, a+d)
    a -= 1
    d += 2

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())

if N % 2 == 0:
    for i in range(M):
        print("{} {}".format(N // 2 - 1 - i, N // 2 + 2 + i))
else:
    for i in range(M):
        print("{} {}".format(N // 2 - i, N // 2 + 2 + i))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

#N = int(input())
N, M = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]

s=N//2
g=s+1

for i in range(M):
    print(s,g)
    s-=1
    g+=1

Submission status: Wrong Answer

Solution code:
import math
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from functools import lru_cache, reduce
from heapq import heapify, heappop, heappush
from itertools import chain, combinations, permutations, product
from typing import List, Dict

# import numpy as np

sys.setrecursionlimit(10**5 + 1)
input = sys.stdin.readline
write = sys.stdout.write


def read_item(cls=int):
    return cls(input())


def read_n_item(cls=int) -> list:
    return [cls(s) for s in input().split()]


def list2d(row, col, init_val=0) -> List[list]:
    return [[init_val] * col for _ in range(row)]


MOD = 10**9 + 7
# MOD = 998244353


N, M = read_n_item()
for i in range(1, M+1):
    print(i, N-i+1)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
a=1
b=n-1
for i in range(m):
  print(a+i,b-i)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
l=1
r=2
for i in range(m):
    print(l,r)
    l+=1
    r+=2

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())

for i in range(min(N, M // 4)):
    print("{} {}".format(i + 1, M - i))

center = (M + 1) // 2

for i in range(max(0, N - M // 4)):
    print("{} {}".format(center - i - 1, center + i + 1))

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
import sys
sys.setrecursionlimit(10**9)
# input=sys.stdin.readline
from collections import deque
import heapq
from itertools import combinations

n,m=map(int,input().split())
if n%2==1:
    for i in range(m):
        print(i+1,n-(i+1))
else:
    print(1,n)
    for i in range(m-1):
        print(i+2,n-(i+2))

Submission status: Wrong Answer

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()

for i in range(1,m+1):
    print(i,n-i)

Submission status: Wrong Answer

Solution code:
inf = 10**15
mod = 10**9+7
n,m = map(int, input().split())
if n % 2 == 0:
    for i in range(m):
        print('{} {}'.format(1+i, n-i))
else:
    for i in range(m):
        print('{} {}'.format(1+i, n-1-i))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
i=0
while i<M:
    print(i+1,2*i+2)
    i+=1

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
x = n//2
y = 1
for i in range(m):
  print(x,x+y)
  x -= 1
  y += 2

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
for i in range(m):
  print(n-i-1,i+1)

Submission status: Wrong Answer

Solution code:
import sys
n, m = map(int, sys.stdin.readline().split())
i = 1
if n % 2 == 0:
  while i <= m:
    print(i, n+1-i)
    i += 1
else:
  while i <= m:
    print(i, n-i)
    i += 1

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,m = na()

if n%2 == 0:
    a,b = n//2,n//2+1
    for i in range(m):
        print(a,b)
        a,b = a-1,b+1
else:
    a,b = n//2,n//2+2
    for i in range(m):
        print(a,b)
        a,b = a+1,b-1

Submission status: Wrong Answer

Solution code:
def resolve():
    N,M = map(int,input().split())
    cmb = []
    if N % 2 ==1:
        for i in range(1,M+1):
            print(i,N-i)
    else:
        for i in range(1,M+1):
            print(N//2-i+1,N//2+i)



resolve()

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())

for i in range(1,m+1):
    print(i, n-i)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
for i in range(1, m+1):
    print(i, n-i)

Submission status: Wrong Answer

Solution code:
i = list(map(int, input().split()))
n = i[0]
m = i[1]

for num in range(m):
    print(n//2 - num, n//2 +num +1)

Submission status: Wrong Answer

Solution code:
from collections import deque

def main():
    N, M = map(int, input().split())

    table_num = deque()
    if N % 2 == 1:
        for i in range(1, M+1):
            table_num.append('%s %s' % (i, N-i))

    else:
        table_num.append('%s %s' % (1, N-1))
        for i in range(2, M+1):
            table_num.append('%s %s' % (i, N-1-i))
    
    for i_table in table_num:
        print(i_table)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())


left=N//2
right=left+1
for i in range(M):
    print("{} {}".format(left,right))
    left -= 1
    right += 1

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())

for i in range(m):
  print(str(i+1)+" "+str(2*m-i))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,M=map(int,input().split())
    left=1
    right=N
    for _ in range(M):
        if (right-left)*2==N:
            right-=1
        print(left,right)
        left+=1
        right-=1
    

if __name__ == '__main__':
    main()