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:
from math import sqrt
n,m = map(int,input().split())
a = 1
b = n
d = dict()
for i in range(1,n+1):
    d[i] = i

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

Submission status: Wrong Answer

Solution code:
import os
from collections import Counter

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M = list(map(int, sys.stdin.buffer.readline().split()))


def test(ans):
    hist = []
    for a, b in ans:
        hist.append((0, (b - a) % N))
        hist.append((0, (a - b) % N))
    print(len(set(hist)) == M * 2)
    print(Counter(hist))


ans = []
if N % 2 == 1:
    for i in range(M):
        a, b = i + 1, N - i
        ans.append((a, b))
else:
    hist = set()
    d = 0
    for i in range(M):
        a, b = i + 1, N - i - d
        if (a - b) % N in hist or (b - a) % N in hist:
            d += 1
            a, b = i + 1, N - i - d
        hist.add((a - b) % N)
        hist.add((b - a) % N)
        ans.append((a, b))

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

# test(ans)

Submission status: Wrong Answer

Solution code:
import os

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M = list(map(int, sys.stdin.buffer.readline().split()))

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

Submission status: Wrong Answer

Solution code:
import os

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M = list(map(int, sys.stdin.buffer.readline().split()))

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

Submission status: Wrong Answer

Solution code:
import os

import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M = list(map(int, sys.stdin.buffer.readline().split()))

ans = []
d = 1
for i in range(M):
    ans.append((i, (i + d) % N))
    d += 1

for a, b in ans:
    print(a + 1, b + 1)

Submission status: Wrong Answer

Solution code:
# N人,会場数M
# Nラウンド行う
# 同じ相手と2回以上戦わないようにする
# M0:1vs3, M1:2vs0,... というように会場に番号が割り当てられていて、自分がその番号になったらそこへ移動
# 試合後、全員の番号xは、x=(x+1)%N となる
import itertools
def main():
    N,M = map(int, input().split())
    ab_arr = list(itertools.permutations([i for i in range(N)], 2*M))
    for ab in ab_arr:
        a = [ab[j*2] for j in range(M)]
        b = [ab[j*2+1] for j in range(M)]
        players = [j for j in range(N)]
        players_vshistory = [[False]*N for j in range(N)]
        flag0 = False
        # ラウンドloop
        for j in range(N):
            # 全会場チェック
            flag1 = False
            for k in range(M):
                # 会場kで自分の数字がa[k]とb[k]の人同士で対戦(両者存在の場合のみ)
                if a[k] in players and b[k] in players:
                    idx0 = players.index(a[k])
                    idx1 = players.index(b[k])
                    # 過去に対戦済みならbreakして次のabへ
                    if players_vshistory[idx0][idx1] == True:
                        flag1 = True
                        break
                    # 初めて戦ったらvshistoryを更新
                    else:
                        players_vshistory[idx0][idx1] = True
                        players_vshistory[idx1][idx0] = True
            if flag1:
                flag0 = True
                break
            # ラウンド終了時、全員を+1
            players = [(p+1)%N for p in players]
        if flag0:
            continue

        # abを出力して終了
        for j in range(M):
            print(str(a[j])+" "+str(b[j]))
        break

main()

Submission status: Wrong Answer

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

if (N%2==1):
    N1 = (N-1)/2
    while(b<=M):
        print(b,N-b)
        b += 1
else:
    N1 = int(N/2)
    while (b<=M):
        if (N-b-b+1==3):
            print(b,b+2)
            b += 1
        else:
            print(b,N-b+1)
            b += 1

Submission status: Wrong Answer

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


def solve(N: int, M: int):

    if N %2 == 1 or (N <= 5):
        for x in range(1, M+1):
            print("{} {}".format(x, N+1-x))
    else:
        m = 0
        for x in range(1, (N-1)//4):
            print("{} {}".format(x, N+1-x))
            m += 1
            if m == M : return
        for x in range((N-1)//4, (N-1)//2+1):
            print("{} {}".format(x+1, N+1-x))
            m += 1
            if m == M : return

        



    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())
l=1
if n%2==1:
    r=n
    for i in range(m):
        d=min(abs(l-r),n-abs(l-r))
        print(l,r)
        l+=1
        r-=1
else:
    r=n-1
    rev=False
    for i in range(m):
        d=min(abs(l-r),n-abs(l-r))
        if d == n//2:
            rev=True
            l+=1
            print(l,r)
        else:
            print(l,r)
        l+=1
        r-=1

Submission status: Wrong Answer

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


def main() -> None:
    N, M = rmi()
    a, b = 1, 2 * M + 1
    for m in range(M):
        wm(a, b)
        a += 1
        b -= 1


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(r())


def rmi(delim: str = ' ') -> tuple:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(*data, delim: str = ' ') -> None:
    print(delim.join(map(str, data)))


if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10**9)
    main()

Submission status: Wrong Answer

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


def main() -> None:
    N, M = rmi()
    a, b = 1, 2 * M
    for m in range(M):
        wm(a, b)
        a += 1
        b -= 1


def r() -> str:
    return input().strip()


def ri() -> int:
    return int(r())


def rmi(delim: str = ' ') -> tuple:
    return tuple(map(int, input().split(delim)))


def w(data) -> None:
    print(data)


def wm(*data, delim: str = ' ') -> None:
    print(delim.join(map(str, data)))


if __name__ == '__main__':
    import sys
    sys.setrecursionlimit(10**9)
    main()

Submission status: Wrong Answer

Solution code:

def main():
    n, m = map(int, input().split())
    left = 1
    right = n
    is_shift = False
    ans = []
    while left < right:
        if right - left <= n // 2 and not is_shift:
            left += 1
            is_shift = True
        ans.append([left, right])
        left += 1
        right -= 1

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
n,m = map(int, input().split())
x = math.floor(n/2)
count = 1
for i in range(1,x+1):
    if count <= m:
        print(i,n+1-i)
    count += 1

Submission status: Wrong Answer

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

gu = 1
ki = m + 1

for i in range(1, m+1)[::-1]:
    if i % 2 == 0:
        print(gu, gu+i)
        gu += 1
    else:
        print(ki, ki+i)
        ki += 1

Submission status: Wrong Answer

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

if N % 2 == 1:
    for a in range(1, M + 1):
        print(a, N - a + 1)
else:
    for a in range(1, M + 1):
        if a <= N // 4:
            print(a, N - a + 1)
        else:
            print(M, N - M)

Submission status: Wrong Answer

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

#N人の参加者から、M組選ぶ
#これをNセット実施。
#組合わせの距離が重複しなければ、成立


#参加者を半分に分け、
#前半を距離偶数、後半を距離奇数にする

#参加者を半分に分ける
div_point=int(N/2)
#前半グループを偶数にする
if div_point%2!=0:
    div_point+=1

#前半グループ・・・距離が偶数になるように組み分け
#更に半分に分ける
re_point=int(div_point/2)
#組を作る
for i in range(re_point):
    ent1=i+1 #前半グループ：一人目
    ent2=div_point-i #前半グループ：二人目
    print(str(ent1) + ' ' + str(ent2))

#後半グループ・・・距離が奇数になるように組み分け
#更に半分に分ける
re_point=int(div_point+(div_point/2))
#組を作る
for j in range(M-i-1):
    ent1=div_point+j+1 #後半グループ：一人目
    if (N-div_point)%2==0:
        ent2=N-j-1 #後半グループ：二人目
    else:
        ent2=N-j #後半グループ：二人目
    print(str(ent1) + ' ' + str(ent2))

Submission status: Wrong Answer

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

#N人の参加者から、M組選ぶ
#これをNセット実施。
#組合わせの距離が重複しなければ、成立


#参加者を半分に分け、
#前半を距離偶数、後半を距離奇数にする

#参加者を半分に分ける
if N%2==0:
    div_point=N//2
else:
    div_point=N//2+1

#前半グループ・・・距離が偶数になるように組み分け
#更に半分に分ける
re_point=int(div_point/2)
#組を作る
for i in range(re_point):
    ent1=i+1 #前半グループ：一人目
    ent2=div_point-i #前半グループ：二人目
    print(str(ent1) + ' ' + str(ent2))

#後半グループ・・・距離が奇数になるように組み分け
#更に半分に分ける
re_point=int(div_point+(div_point/2))
#組を作る
for j in range(M-i-1):
    ent1=div_point+j+1 #後半グループ：一人目
    ent2=N-j #後半グループ：二人目
    print(str(ent1) + ' ' + str(ent2))

Submission status: Wrong Answer

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

#N人の参加者から、M組選ぶ
#これをNセット実施。
#組合わせの距離が重複しなければ、成立


#参加者を半分に分け、
#前半を距離偶数、後半を距離奇数にする

#参加者を半分に分ける
if N%2==0:
    div_point=N//2
else:
    div_point=N//2+1

#前半グループ・・・距離が偶数になるように組み分け
#更に半分に分ける
re_point=int(div_point/2)
#組を作る
for i in range(re_point):
    ent1=i+1 #前半グループ：一人目
    ent2=div_point-i #前半グループ：二人目
    print(str(ent1) + ' ' + str(ent2))

#後半グループ・・・距離が奇数になるように組み分け
#更に半分に分ける
re_point=int(div_point+(div_point/2))
#組を作る
for j in range(M-i-1):
    ent1=div_point+j+1 #後半グループ：一人目
    if (N-div_point)%2==0:#後半グループが偶数人なら
        ent2=N-j-1 #後半グループ：二人目・・・最後から1人目から
    else:
        ent2=N-j #後半グループ：二人目・・・最後の人から
    print(str(ent1) + ' ' + str(ent2))

Submission status: Wrong Answer

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


def solve(N: int, M: int):

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

        



    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:
#!/usr/bin/env python3
import sys
 
 
def solve(N: int, M: int):
 
    if N %2 == 1:
        for x in range(1, M+1):
            print("{} {}".format(x, N+1-x))
    else:
        m = 0
        for x in range(1, (N-1)//4):
            print("{} {}".format(x, N+1-x))
            m += 1
            if m == M : break
        for x in range((N-1)//4, (N-1)//2+1):
            print("{} {}".format(x+1, N+1-x))
            m += 1
            if m == M : break
 
        
 
 
 
    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())
if n%2 == 1:
    ans = []
    a = 1
    b = n-1
    for i in range(m):
        ans.append((a, b))
        a += 1
        b -= 1
else:
    ans = []
    a = 1
    b = n-1
    flag = True
    for i in range(m):
        if flag and b-a >= n//2:
            b -= 1
            flag = False
        ans.append((a, b))
        a += 1
        b -= 1
for i in range(m):
    print(*ans[i])

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lange=[1]*(n+1)
for i in range(1,n+1):
  a=i
  b=n-a
  if lange[a]:lange[b]=0
langes=[]
for i in range(1,n+1):
  if lange[i]:
    if len(langes)%2:langes.append(n-i)
    else:langes.append(i)
langes.sort(reverse=1)
for i in range(m):print(i+1,i+1+langes[i])

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
lange=[1]*(n+1)
for i in range(n):
  a=i+1
  b=n-a-1
  if lange[a]:lange[b]=0
langes=[]
for i in range(n):
  if lange[i]:
    if len(langes)%2:langes.append(i)
    else:langes.append(n-i)
langes.sort(reverse=1)
for i in range(len(langes)):print(i+1,i+1+langes[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N, M = lr()
    if N%2 == 1:
        for i in range(0, M):
            print(f'{2+i} {1+2*M-i}')
    else:
        print(f'{2} {3}')
        for i in range(0, M-1):
            print(f'{4+i} {3+2*(M-1)-i}')
resolve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N, M = lr()
    if N%2 == 1:
        for i in range(1, M+1):
            print(f'{i+1} {2*M+1-i+1}')
    else:
        if N == 4:
            print(f'{2} {3}')
        if N >= 6:
            print(f'{1} {3}')
            for i in range(1, M):
                print(f'{i+3} {4+2*(M-1)-i}')
resolve()

Submission status: Wrong Answer

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N, M = lr()
    if N%2 == 1:
        for i in range(1, M+1):
            print(f'{i+1} {2*M+1-i+1}')
    else:
        if N == 4:
            print(f'{2} {3}')
        if N >= 6:
            print(f'{1} {3}')
            for i in range(4, 4+M-1+1):
                print(f'{i} {4+2*(M-1)-i}')
resolve()

Submission status: Wrong Answer

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

for i in range(m):
    print(i + 1, n // 2 - i)
    if n // 2 - 2 * i - 1 > 0:
        break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split(" ")))
half = m // 2

if m >= 2:
    for i in range(half):
        print(f"{m + half - i + 1} {m + half + i + 3}")

    for i in range(half + m % 2):
        print(f"{half - i + 1} {half + i + 2}")
else:
    print("1 2")

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split(" ")))
half = m // 2

if m >= 2:
    for i in range(half):
        print(f"{m + half - i} {m + half + i + 2}")

    for i in range(half + m % 2):
        print(f"{half - i} {half + i + 1}")
else:
    print("1 2")

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split(" ")))
half = m // 2
loop = (half + 1) if m % 2 else half
for i in range(loop):
    print(f"{m + half - i} {m + half + i + 2}")

for i in range(half):
    print(f"{half - i} {half + i + 1}")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split(" ")))
half = lhalf = n // 2
if n % 2 == 0:
    lhalf -= 1
for i in range(m):
    print(f"{lhalf - i} {half + i}")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def solve(N: int, M: int):

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

        



    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:
#!/usr/bin/env python3
import sys


def solve(N: int, M: int):

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

        



    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 = list(map(int,input().strip().split()))
left = 1 
right= N//2+1
for i in range(1,M+1):
    print(left,right)
    left+=1
    right-=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#E
import numpy as np
n, m = list(map(int, input().split()))
lists = list(np.arange(1, n+1))

list1 = lists[:n//2]
list2 = lists[n//2:]

num = m

if n%2 == 1:
    for i in range(m):
        if num == 0:
            break
            print(list2[i],list2[len(list2)-1-i])
            num -= 1
        if num == 0:
            break
        print(list1[i],list1[len(list1)-1-i])
        num -= 1
else:
     for i in range(m):
        if num == 0:
            break
            print(list2[i],list2[len(list2)-1-i])
            num -= 1
        if num == 0:
            break
        print(list1[i+1],list1[len(list1)-1-i])
        num -= 1

Submission status: Wrong Answer

Solution code:
#E
import numpy as np
n, m = list(map(int, input().split()))
lists = list(np.arange(1, n+1))

list1 = lists[:n//2]
list2 = lists[n//2:]
num = m
if n%2 == 1:
    for i in range(m//2 +1):
        if num == 0:
            break
            print(list2[i],list2[len(list2)-1-i])
            num -= 1
        if num == 0:
            break
        print(list1[i],list1[len(list1)-1-i])
        num -= 1
else:
     for i in range(m//2 +1):
        if num == 0:
            break
            print(list2[i],list2[len(list2)-1-i])
            num -= 1
        if num == 0:
            break
        print(list1[i+1],list1[len(list1)-1-i])
        num -= 1

Submission status: Wrong Answer

Solution code:
#E
import numpy as np
n, m = list(map(int, input().split()))
lists = list(np.arange(1, n+1))
list1 = lists[:n//2]
list2 = lists[n//2:]
num = m
for i in range(m//2 +1):
    if num == 0:
        break
    print(list2[i],list2[len(list2)-1-i])
    num -= 1
    if num == 0:
        break
    print(list1[i],list1[len(list1)-1-i])
    num -= 1

Submission status: Wrong Answer

Solution code:
#coding:utf-8

n,m = map(int,input().split())
point_s = 1
point_e = n + 1

if n % 2 == 0:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))
        if n % 4 == 0 and (point_e - point_s) * 2 == n:
            point_e -= 1
        elif n % 4 != 0 and (point_e - point_s) * 2 == n + 2:
            point_e -= 1
elif n % 2 == 1:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))

Submission status: Wrong Answer

Solution code:
#coding:utf-8

n,m = map(int,input().split())
point_s = 0
point_e = n + 1

if n % 2 == 0:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))
        if (point_e - point_s) * 2 == n :
            point_e -= 1
elif n % 2 == 1:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))

Submission status: Wrong Answer

Solution code:
from collections import Counter, defaultdict, deque
import itertools 
import bisect
from sys import stdin, stdout
from itertools import repeat
import sys


# sys.stdin = open('input')
# sys.stdout = open('/mnt/d/Gg/output', 'w')
# n, k = map(int, raw_input().split())
# da = map(int, raw_input().split())
# db = map(int, raw_input().split())




def main():
    n, m = map(int, raw_input().split())
    ans = []
    n = m*2+1
    for i in range(m):
        ans.append("%s %s" % (i+1, n-i))
    print '\n'.join(ans)


    
# import time
# pre = time.time()
main()

Submission status: Wrong Answer

Solution code:
from collections import Counter, defaultdict, deque
import itertools 
import bisect
from sys import stdin, stdout
from itertools import repeat
import sys


# sys.stdin = open('input')
# sys.stdout = open('/mnt/d/Gg/output', 'w')
# n, k = map(int, raw_input().split())
# da = map(int, raw_input().split())
# db = map(int, raw_input().split())




def main():
    n, m = map(int, raw_input().split())
    ans = []
    if n%2==1:
        n-=1
    for i in range(m):
        ans.append("%s %s" % (i+1, n-i))
    print '\n'.join(ans)


    
# import time
# pre = time.time()
main()

Submission status: Wrong Answer

Solution code:
#coding:utf-8

n,m = map(int,input().split())
point_s = 0
point_e = n + 1

if n % 2 == 0:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))
        if (point_e - point_s) * 2 == n + 2:
            point_e += 1
elif n % 2 == 1:
    for i in range(1,m+1):
        point_s += 1
        point_e -= 1
        print("{} {}".format(point_s,point_e))

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    N, M = mis()
    if N&1:
        q = deque(range(M*2))
        while q:
            print(q.popleft()+1, q.pop()+1)
    else:
        q = deque(range((M+1)*2))
        while len(q)>1:
            print(q.popleft()+1, q.pop()+1)
            if len(q)==M+1:
                q.pop()


main()