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:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

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

Submission status: Wrong Answer

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

tables = [[1 + i, n] for i in range(m)]
used = set()
used.add(n-1)
for i in range(1, m):
    tables[i][1] = tables[i - 1][1]-1
    diff = (n + tables[i][1] - tables[i][0]) % n
    while diff in used or diff == n-diff:
        tables[i][1] -= 1
        diff = (n + tables[i][1] - tables[i][0]) % n
    used.add(diff)
for i in range(m):
    print(tables[i][0], tables[i][1])

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split(' ')]
for i in range(0, m):
  print(i + 1, (2*i) % n + 1 + 1)

Submission status: Wrong Answer

Solution code:
import sys
N, M = map(int, sys.stdin.readline().split())

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(i+1,n-i)

Submission status: Wrong Answer

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


def solve(N: int, M: int):
    left = 1
    right = N if N%2 == 0 else N-1

    if N%2 == 0:
        for _ in range(M):
            if right-left == N//2:
                continue
            print(left,right)
            left += 1
            right -= 1
    else:
        for _ in range(M):
            print(left,right)
            left += 1
            right -= 1
    return


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())
dat = []
for i in range(m):
    dat.append([i+1])
#print(dat)
for i in range(m):
    dat[i].append(n - i)
#for i in range(m):
#    dat[m - 1 - i].append(m+i+1)
#print(dat)
for a,b in dat:
    print(a,b)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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


if((4*m-2)!=n):
    a=1
    b=n
    for i in range(m):
        print(a,b)
        a+=1
        b-=1

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

Submission status: Wrong Answer

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

mid = N//2
for i in range(M):
    print(mid-i, mid+1+i)

Submission status: Wrong Answer

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

if n%2 == 1:
  n -= 1
for i in range(m):
  print('{} {}'.format(i+1, n-i))

Submission status: Wrong Answer

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

for i in range(M):
  print(f'{i} {N - 2 - i}')

Submission status: Wrong Answer

Solution code:
N,M= list(map(int , input().split()))
k = N//2
s = N %2
if s == 1:
    for i in range (M):
        n = i+1
        print (n,N-n)
if s == 0:
    w = 0
    for i in range (M):
        if ((2*i + 1)==k):
            w += 1
        
        print (k-i-w,k+1+i+w)

Submission status: Wrong Answer

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

import sys
# import math
# from string import ascii_lowercase, ascii_upper_case, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import accumulate             # accumulate(iter[, f])
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from copy import deepcopy                    # to copy multi-dimentional matrix without reference
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)


def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79...e+308
    inf = 2 ** 64 - 1               # (for fast JIT compile in PyPy) 1.84...e+19
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n, m = mi()
    L = [i for i in range(1, n+1)]
    for dist in range(m):
        print(f"{L[dist]} {L[-1-dist]}")
        



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor

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

    start = 1
    end = N

    used = set()
    for m in range(M):
        print("{} {}".format(start, end))
        fdiff = end - start
        bdiff = N - fdiff
        used.add(fdiff)
        used.add(bdiff)

        start += 1
        end -= 1

        fdiff = end - start
        bdiff = N - fdiff

        if fdiff in used or bdiff in used:
            start += 1

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

a = [str(i) for i in range(1,N+1)]
b = [str(i) for i in range(N,0,-1)]

if N%2 == 0:
    for i in range(M):
        print(a[i+1] + ' ' + b[i+1])
else:
    for i in range(M):
        print(a[i] + ' ' + b[i+1])

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())
    nHalf = N // 2
    ans = []
    x = nHalf
    y = x + 1
    for i in range(M):
        ans.append(str(x) + ' ' + str(y))
        x -= 1
        y += 1
    print(*ans, sep='\n')

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

    left = 1
    right = N
    for _ in range(M):
        print(left, right)
        left += 1
        right -= 1


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = list(range(1,M+1))
B = reversed(list(range(M+1,M+M+1)))
for a,b in zip(A,B):
    print(a,b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = n // 2
b = a // 2
count = 0
for i in range(b):
    print(i + 1, a - i)
    count += 1
    if count == m:
        break
    else:
        print(i + a + 1, a * 2 - i)
        count += 1
        if count == m:
            break
else:
    if count != m:
        print(b + 1, b + a + 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
import math
import itertools
from collections import defaultdict
from collections import Counter
import numpy as np

import heapq
a,b=list(map(int,input().split()))
ans=[False for _ in range(a)]
t=0
for i in range(a):
    if ans[i]:
        continue

    t+=1
    ne=i+t
    if ne+1>a:
        ne=ne-a
    ans[i]=True
    ans[ne]=True
    print(i+1,ne+1)
    if t==b:
        exit()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
import sys
import math
import heapq
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
from math import ceil
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
import random as ra
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########
dist=[0 for i in range(n+34)]
A=deque([i+1 for i in range(n)])
i=0
while 1:
    a=ra.choice(A) ; b=ra.choice(A)
    if a>=b:continue
    if dist[b-a]==0 and dist[a+n-b]==0:
        print(a,b)
        dist[b-a]=1
        dist[a+n-b]=1
        A.remove(a) ; A.remove(b)
        i+=1

    if i==m:
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV
        
    return CONV()



sys.setrecursionlimit(200005)


def main():
    N,M = isRaw()
    ans = ""
    for m in range(M):
        ans+=str(m+1)+" "+str(N-m)+"\n"
    return ans[:-1]
    
if __name__ == "__main__":
    print(main())

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.buffer.readline

def main():
    N,M = map(int,input().split())
    if (N-2)%4 != 0:
        for i in range(M):
            print(i+1,N-i)
    else:
        num = (N-2)//4
        if M <= num:
            for i in range(M):
                print(i+1,N-i)
        else:
            for i in range(num):
                print(i+1,N-i)
            for i in range(M-num):
                i += num
                print(i+1,N-i-1)
    
if __name__ == "__main__":
    main()

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, 2 * m + 1 - i)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque

N, M = map(int, input().split())
matches = []
used = [False] * N
q = deque([0])
l = 1
while q and len(matches) < M:
    i = q.popleft()
    j = (i + l) % N
    if used[i] or used[j]: continue
    used[i], used[j] = True, True
    matches.append((i+1, j+1))
    l += 1
    q += list(range(i+1, j))
    q.append((j + 1) % N)
for a, b in matches:
    print(a, b)

Submission status: Wrong Answer

Solution code:
import random
N,M = map(int, input().split())
player=set([i for i in range(1,N+1)])
dis=set()
for i in range(M):
    q=True
    while q:
        a=random.sample(player,2)
        x=a[0]
        y=a[1]
        if abs(x-y) not in dis:
            print(x,y)
            dis.add(abs(x-y))
            dis.add(N-abs(x-y))
            player.remove(x)
            player.remove(y)
            q=False

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
Ans = [[0, 0] for i in range(M)]
if N % 2 == 1:
    for i in range(M):
        Ans[i] = [i + 1, N - i - 1]
        print(Ans[i][0], end=" ")
        print(Ans[i][1])
else:
    num = 1
    for i in range(M):
        Ans[i] = [num, (num + 1 + i) % N]
        num = (num + i + 2) % N
        print(Ans[i][0], end=' ')
        print(Ans[i][1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#code
N,M=map(int,input().split())
p1=N//2
p2=N//2+1
print(p1,p2)
p1-=1
p2+=1
M-=1
while M:
    if(N%(p2-p1)):
        print(p1,p2)
        p1-=1
        p2+=1
        M-=1
    else:
        p1-=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []
max_ = 2 * m

if n % 2 == 1:
    for i in range(m):
        ans.append((i + 1, max_ - i))
elif m == 1:
    for i in range(m):
        ans.append((1, 2))
else:
    for i in range(m):
        ans.append((i + 1, n - i))
    ans[-1] = (ans[-1][0], ans[-1][0] + 2)

for i in ans:
    print(*i)

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:
  if m>m//4:
    for i in range(1,n//4+1):
      print(i,n-i+1)
    for i in range(n//4+1,m+1):
      print(i,i*2-1)
  else:
    for i in range(1,m+1):
      print(i,n-i+1)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(100000000)


def main():
    n, m = map(int, input().split())

    init = int(n / 2)
    res_list = [(init, init + 1)]
    for i in range(1, m):
        res_list.append((init - i, init + 1 + i))

    for l in res_list:
        print(str(l[0]) + " " + str(l[1]))

main()

Submission status: Wrong Answer

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, M = iim()

    if N % 2 == 0:
        N -= 1

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

if __name__ == "__main__":
    resolve()

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())
ans_i = n//2
ans_j = ans_i+1
for _ in range(m):
    if abs(ans_j-ans_i) == abs(n-ans_j+ans_i):
        if ans_i <= n-ans_j: ans_j += 1
        else: ans_i -= 1
    print(ans_i, ans_j)
    ans_i -= 1
    ans_j += 1

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, M = map(int, rl().split())
    
    last = N if N % 2 == 0 else N - 1
    left = [i for i in range(1, N // 2 + 1)]
    right = [i for i in range(last, N // 2, -1)]
    
    ans = []
    for ans_i in zip(left, right):
        ans.append(ans_i)
    
    for i in range(M):
        if i % 2 == 0:
            print(*ans[i // 2])
        else:
            print(*ans[-((i + 1) // 2)])


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

if n%2==0:
    for i in range(m):
        l=n//2-(m-1)+i
        r=n//2+m-i
        print(str(l)+" "+str(r))
else:
    for i in range(m):
        l=(n-1)//2-(m-1)+i
        r=(n+1)//2+(m-1)-i
        print(str(l)+" "+str(r))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = [int(x) for x in input().split()]
if(n % 2 == 0):
    for i in range(m):
        print(i+1, n-i)

else:
    for i in range(m):
        print(i+1, 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,b)
	a += 1
	b -= 1

Submission status: Wrong Answer

Solution code:
a,b = map(int,input().split())

if a%2 == 1:
    for i in range(b):
        print(str(i+1) + ' ' + str(a-i))
else:
    for i in range(b):
        if i < b-1:
            print(str(i+1) + ' ' + str(a-i-1))
        else:
            print(str(a) + ' ' + str(i+1))

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N, M = map(int, read().split())
    ans1 = N // 2
    ans2 = N // 2 + 1
    if N%4 == 2:
        ans2 += 1
    for _ in range(M):
        print(ans1, ans2)
        ans1 -= 1
        ans2 += 1
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans_i = n//2
ans_j = ans_i+1
for _ in range(m):
    if abs(ans_j-ans_i) == abs(n-ans_j+ans_i):
        if ans_i <= n-ans_j: ans_j -= 1
        else: ans_i -= 1
    print(ans_i, ans_j)
    ans_i -= 1
    ans_j += 1

Submission status: Wrong Answer

Solution code:
from bisect import *
from collections import *

N, M = map(int, input().split())
if M == 1:
    print(1, 2)
    exit()
print(1, 2*M)
print(2, 2*M-1)
for i in range(M-2):
    print(i+3, 2*M-i-2)

Submission status: Wrong Answer

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

for i in range(m):
    print('{} {}'.format(i+1, n-i-1))

Submission status: Wrong Answer

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

a = [str(i) for i in range(1,N+1)]
b = [str(i) for i in range(N,0,-1)]

if N%2 == 0:
    for i in range(M):
        print(a[i] + ' ' + b[i])
else:
    for i in range(M):
        print(a[i] + ' ' + b[i+1])

Submission status: Wrong Answer

Solution code:
def main():

    N, M = map(int, input().split())
    lv = [[i, N-i] for i in range(1, M+1)]
    for v in lv:
        print(" ".join(map(str, v)))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []

for i in range(1, M+1):
    tmp = [str(i), str(M*2-(i-1))]
    tmp = ' '.join(tmp)
    ans.append(tmp)
print(*ans, sep='\n')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int,input().split())
ans = []
d = 1
for m in range(1,M+1):
    ans.append([m,m+d])
    d += 1
for e in ans:
    print(*e)

Submission status: Wrong Answer

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

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(2*i-1, N+1-i)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
i = 0
c = n // 2
a = c
b = c + 1
while c - a < m:
    print(a, b)
    a -= 1
    b += 1

Submission status: Wrong Answer

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

evenpart = (NM[0] + 1) % 2
half = int(NM[0] / 2)
start = half - NM[1] + 1
for i in range(NM[1]):
    print(start + i, NM[0] - start - i + evenpart)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(100000000)


def main():
    n, m = map(int, input().split())

    init = int(n / 2)
    res_list = [(init, init + 1)]
    for i in range(1, m):
        res_list.append((init - i, init + 1 + i))

    for l in res_list:
        print(l)


main()

Submission status: Wrong Answer

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
#from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 1, 0, -1, 1, -1, -1, 1]
dy = [1, 0, -1, 0, 1, -1, 1, -1]
debugmode = True

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
start = 1
for i in range(M)[::-1]:
    print(start, start + 2 * i + 1)
    start += 1

Submission status: Wrong Answer

Solution code:
from math import ceil

N, M = map(int, input().split())
center = ceil(N/2)

for i in range(M):
    a, b = center-1-i, center+i
    print(a, b)

Submission status: Wrong Answer

Solution code:
from bisect import *
from collections import *

N, M = map(int, input().split())
if M == 1:
    print(1, 2)
    exit()
print(1, 2*M-1)
print(2, 2*M)
for i in range(M-2):
    print(i+3, 2*M-i-2)

Submission status: Wrong Answer

Solution code:
nm = [int(i) for i in input().split()]
n = nm[0]
m = nm[1]
start = 0
end = 1
gap = 1
for i in range(m):
  print(str(start)+' '+str(end))
  gap += 1
  start = end%n+1
  end = (start + gap-1)%n+1

Submission status: Wrong Answer

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

ans = [[0, 0] for i in range(M)]

half = N // 2

for i in range(M-1, -1, -1):
    j = M - i - 1
    ans[i] = [half-j, half+j+1]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if N%2 ==1:
    A = list(range(1, N))
else:
    A = list(range(1, N+1))
i = 1
while (len(A) >1) and i<=M:
    print(A.pop(0), A.pop(0))
    i+=1

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    m = kwargs["m"]
    res = [[] for i in range(m)]

    for i in range(m):
        res[i] = [2 * (i + 1), i + 1]

    res = "\n".join([" ".join([str(i) for i in r]) for r in res])
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["n"], kwargs["m"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

from math import gcd

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def solve():
    n,m = map(int,input().split())
    if n%2==1:
        for i in range(m):
            print(i+1,2*m+1-i)
    else:
        for i in range(m):
            print(i+1,2*m-i)
if __name__=='__main__':
    solve()

Submission status: Wrong Answer

Solution code:
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=lambda x:int(math.floor(x)),lambda x:int(math.ceil(x))
from functools import reduce;gcd=lambda*x:reduce(math.gcd,x);lcm=lambda*x:reduce(lambda x,y:(x*y)//gcd(x,y),x,1)
from collections import deque
Yes=lambda b:print("Yes"if b else"No");YES=lambda b:print("YES"if b else"NO")
is_even=lambda x:True if x%2==0 else False

def is_palindrome(s):
  n=len(s);b=True
  for i in range(int(0.5*n)):
    if s[i]!=s[n-i-1]:b=False
  return b

def main():
  n,m = ints()
  l = n if n%2==0 else n-1
  for i in range(m):
    print(1+i,l-i)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

n,m = map(int,input().split())
used = [True]*(n+1)
res = []
mi = 1

ctr = 1

while len(res) < m:
    while not used[mi]:
        mi += 1
    for j in range(mi,n+1):
        jj = j+ctr
        if jj > n:
            jj -= n
        if used[j] and used[jj]:
            res.append((j,jj))
            used[j] = used[jj] = False
            break
    
    ctr += 1


for a,b in res:
    print(a,b)

Submission status: Wrong Answer

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

    i = 0
    cnt = 0
    while cnt < M:
        if (N - i * 2 - 1) * 2 != N:
            print(1 + i, N - i)
            cnt += 1
        i += 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
ans_i = n//2
ans_j = ans_i+1
for _ in range(m):
    if abs(ans_j-ans_i) == abs(n-ans_j+ans_i):
        ans_i -= 1
        ans_j += 1
    print(ans_i, ans_j)
    ans_i -= 1
    ans_j += 1

Submission status: Wrong Answer

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