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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import pprint

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 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))
elif n%4==2:
    print(1,n)
    for i in range(m-1):
        print(i+2,n-(i+2))
elif n%4==0:
    print(1,n)
    if m==1:
        exit()
    print(2,n-1)
    for i in range(m-2):
        print(i+3,n-(i+2))

Submission status: Wrong Answer

Solution code:
n,m=list(map(int,input().split()))
if n%2==0:
    n-=1
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:
N,M=map(int,input().split())
i=1
for _ in range(M):
    print(i,N-i)
    i+=1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

def input_one_number():
    return int(input())

def input_multiple_number():
    return map(int, input().split())

def input_multiple_number_as_list():
    return list(map(int, input().split()))

def print2Num(x,y):
	print(str(x) + " " + str(y))

N, M = input_multiple_number()

for i in range(1,M+1):
	print2Num(i,M*2-i)

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:
n,m = map(int,input().split())

stage = 1
i = 2
pl = [False] * n
pair = [["1","2"]]
pl[0] = True
pl[1] = True
while stage < m:
    if n % i != 0:
        i2 = i
        while pl[i2] or pl[(i2+i)%n]:
            i2 = (i2+1) % n
        stage += 1
        pair.append([str(i2+1), str((i2+i)%n+1)])
    i += 1

for p in pair:
    print(" ".join(p))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if n % 2 == 1:
    a = [i+1 for i in range(m)]
    b = [n-i-1 for i in range(m)]
else:
    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:
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):
        if i == 1:
            print(*[1, N])
        else:
            print(*[i, N-i])

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
l = 1
r = m*2
if n%2==0: r += 1
for i in range(m):
    print(l,r)
    l += 1
    r -= 1
    if n%2==0 and i==0:
        r -= 1

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
print(1, 2)
used_idx = {0, 1}
unused_idx = set(range(N)) - used_idx
dist = 2
while len(used_idx) < M * 2:
    for v1 in unused_idx:
        v2 = (v1 + dist) % N
        if v2 not in used_idx:
            used_idx.add(v1)
            used_idx.add(v2)
            unused_idx.remove(v1)
            unused_idx.remove(v2)
            print(v1 + 1, v2 + 1)
            break
    dist += 1

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
n,m=mii()

a=1
b=(n//2)*2
c=(a+b)//2
a=c
b=c+1


for i in range(m):
    print(a-i,b+i)

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-1-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 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())

    i = 0
    cnt = 0
    while cnt < M:
        if (N - i - 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())
for m in range(M):
    print(m+1, N - m)

Submission status: Wrong Answer

Solution code:
from collections import deque, Counter, defaultdict
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math
import bisect
from functools import lru_cache
import itertools

sys.setrecursionlimit(10 ** 8)

M = 10 ** 9 + 7
INF = 10 ** 17


def main():
    # N = int(input())
    N, M = [int(a) for a in input().split()]

    D = (M - 1) // 2 + 1
    D2 = M - D

    for ii in range(M):

        if ii % 2 == 0:
            j = (ii) // 2
            a = D - 1 - j
            b = a + 2 * j + 1
        else:
            j = (ii - 1) // 2
            a = 2 * D + (D2 - 1 - j)
            b = a + 2 * j + 1
        print(a + 1, b + 1)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ans=[]
for i in range(m):
  ans.append([i+1,2*m-i])
if n%2==0:
  ans.reverse()
  flag=0
  for i in range(len(ans)):
    if ans[i][1]-ans[i][0]==n//2:
      flag=1
    if flag==1:
      ans[i][1]+=1
  ans.reverse()
for i in range(len(ans)):
  print(ans[i][0],ans[i][1])

Submission status: Wrong Answer

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

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

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

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):
    if (g-s)!=N-(g-s):
        print(s,g)
    s-=1
    g+=1

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
	N,M = map(int, input().split())
	ans = []

	l = N//2
	r = l+1
	
	for _ in range(M):
		print('{} {}'.format(l,r))
		l -= 1
		r -= 1
		if l == 0:
			l = N
		if r == 0:
			r = N

Submission status: Wrong Answer

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

from math import gcd

A = []
for i in range(1,N+1):
    if gcd(i,N) == 1:
        A.append(i)

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

A = sorted(A,reverse = True)

r = 1
for i in A:
    if r == M+1:
        break
    print("{} {}".format(r,r+i))
    r += 1

Submission status: Wrong Answer

Solution code:
import sys
import math
import itertools 
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
    
N,M=nm()
for i in range(M):
    print(i+1,N-i)

Submission status: Wrong Answer

Solution code:
import sys
n, m = map(int, sys.stdin.readline().split())
i = 1
while i <= m:
  print(i, n+1-i)
  i += 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:
N,M=[int(s) for s in input().split()]
if N%2==1:
  a=1
  b=N-1
  for i in range(M):
    print(*[a,b])
    a+=1
    b-=1
else:
  x=(N+2)//4
  a=1
  b=N-1
  for i in range(x-1):
    print(*[a,b])
    a+=1
    b-=1
  a+=1
  for i in range(N//2-x):
    print(*[a,b])
    a+=1
    b-=1

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(1000000)

def solve(N, M):
    used = set()
    i = 1
    ans = []
    for k in range(1, M + 1):
        ans.append(str(i) + " " + str(i+k))
        used.add(i)
        used.add(i+k)
        while i in used:
            i += 1
    return "\n".join(ans)

if __name__ == "__main__":
    N, M = tuple(map(int, input().split(" ")))
    print(solve(N, M))

Submission status: Wrong Answer

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

if N % 2 == 0:
    d = N - 1
else:
    d = N - 2
for a in range(1, M + 1):
    b = a + d
    print(a, b)
    d -= 2

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
i=0
while m>0:
  if n%(n-2*i-1)!=0:
    print(n-i,i+1)
    m-=1
    i+=1
  else:pass

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
cnt = 0
idx = 1
while True:
    print(idx, n - idx + 1)
    idx += 1
    cnt += 1
    if cnt == m:
        exit()

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)
else:
  l=[]
  for i in range(n//2):
    if n-1-2*i!=n//2:
      l.append([i+1,n-i])
  for i in range(m):
    print(*l[i])

Submission status: Wrong Answer

Solution code:
#!python3

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

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

    for i, j in zip(range(1, M+1), range(2*M, M, -1)):
        print(i, j)

if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
def main():
    n,m = map(int,input().split())
    ans = [[n//2,n//2+1]]
    for _ in range(m-1):
        ans.append([ans[-1][0]-1,ans[-1][1]+1])
    for a in ans:
        print(*a)
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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):
    if N%2!=0 or (s-g)!=int(N/2):
        print(s,g)
    s-=1
    g+=1

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
if N%2!=0:
    for i in range(M):
        print(1+2*i,N-1-2*i)
else:
    for i in range(M):
        print(1+2*i,N-1-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):
    if N%2!=0 or (s-g)==int(N/2):
        print(s,g)
    s-=1
    g+=1

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
d = list(range(1, n+1))
from collections import deque
d = deque(d)
ans = [0]*m
for i in range(m):
    a = d.popleft()
    b = d.pop()
    ans[i] = (a, b)
for i in range(m):
    print(*ans[i])

Submission status: Wrong Answer

Solution code:

def resolve():
    n,m= map(int, input().split())
    [print(m-i+1,m+i)  for i in range(1,m+1)]

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
t=1
for i in range(1,m+1):
    print(t,t+i)
    t += i+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()
if N & 1:
    for i in range(1, M+1):
        print(i, N-i+1)
else:
    used = [False] * (N+1)
    left, right = 1, N
    cnt = 0
    for i in range(1, N//2+1):
        if cnt == M:
            break
        if not used[right-left] and not used[left+N-right]:
            used[right-left] = used[left+N-right] = True
            print(left, right)
            cnt += 1
            left += 1
            right -= 1
        else:
            left += 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,2*M+1-i)
else:
    for i in range(1,M+1):
        j = 2*M+1-i
        if i==1 and M>=2:
            j += 1
        print(i,j)

Submission status: Wrong Answer

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    if(N&1):
        N+=1
    for i in range(M):
        print(i+1+1,N-i-2+1)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

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

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:
# -*- coding: utf-8 -*-

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

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

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

     # n:odd, m:even
     # n:even, m:even


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
n,m=mii()

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def diff(i,j):
  if j<i:
    i,j = j,i
  return min( j-i, n+i-j )

def get_diff(i, d):
  left = i-d if i-d>0 else i-d+ n
  right = i +d if i+d<=n else i+d-n
  return left, right

paired = []
used = set([])
d = 1
for i in range(1, n+1):
  if i in used:
    continue
  l,r = get_diff(i, d)
  if l not in used:
    print(i,l)
    used.add(i)
    used.add(l)
    d += 1
  elif r not in used:
    print(i,r)
    used.add(i)
    used.add(r)
    d += 1

Submission status: Wrong Answer

Solution code:
a,b= map(int,input().split())
dp = [i for i in range(1,a+1)]
dp2 = [1+2*i for i in range(b)]
cnt = b

for i in range(1,b+1):
    print(i,i+dp2[b-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
    d = defaultdict(int)
    d[0] = 1
    d[n] = 1
    for i in range(n):
        if d[4 * i + 2]: continue
        if d[v - i - 1]: continue
        ans.append((i + 1, v))
        d[v - i - 1] = 1
        d[4 * i + 2] = 1
        v -= 1
    for a in ans[:m]:
        print(*a)
    return


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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

for j in range(m):
  print(x[j],x[-j-1])

Submission status: Wrong Answer

Solution code:
from collections import *
n,m = map(int,input().split())
d = dict()
st,off = 1,2
for i in range(m-1):
	print(st,st+off)
	d[st] = 1
	d[st+off] = 1
	off += 1
	while(st in d):
		st += 1
for i in range(1,n):
	if i not in d and i+1 not in d:
		print(i,i+1)
		break

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

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
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########
A=deque([i+1 for i in range(n)])
for i in range(m):
    a=A.popleft()
    b=A.pop()
    print(a,b)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
i=0
while m>0:
  if n%(n-2*i-1)!=0:
    print(n-i,i+1)
    m-=1
    i+=1

  else:pass

Submission status: Wrong Answer

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

    left = 1
    right = N//2 * 2
    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())
l=1
r=n
d=1
for i in range(m):
    print(l,r)
    l+=1
    r-=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input=lambda: sys.stdin.readline().rstrip()
n,m=map(int,input().split())
if n%2:
  for i in range(m):
    print(i+1,n-i)
else:
  for i in range(m):
    print(1,n-i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = [int(i) for i in input().split()]
a = set(range(n))
for i in range(m):
    for j in a:
        k = (j + i + 1)%n
        if j in a and k in a:
            break
    a.discard(j)
    a.discard(k)
    print(j+1,k+1)

Submission status: Wrong Answer

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

k = n//2
for i in range(m):
    a = k-i
    b = k+i+1
    print(a,end=" ")
    print(b)

Submission status: Wrong Answer

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

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

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())
N = N // 2 * 2 
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))
    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())
for i in range(M):
	print(i+1,2*M-i)

Submission status: Wrong Answer

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

for i in range(1, M + 1):
    j = i + (M - (i - 1)) * 2 - 1
    print(i, j)

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

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())

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

Submission status: Wrong Answer

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

for i in range(m):
  if n // 2 == 2 * i + 1:
    e = 1
  print(str(n // 2 - i) + " " + str(n // 2 + 1 + i + e))

Submission status: Wrong Answer

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