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:
def main():
    N,M=map(int,input().split())

    Left=[]
    Right=[]

    left=1
    right=N

    if N%2==1:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
    else:
        stuck_right=[]
        flag=0
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

            if flag==1:
                right=stuck_right.pop()

            if left==right:
                right=stuck_right.pop()
                flag=1
            if right-left==N-right+left:
                stuck_right.append(right)
                right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    left=1
    right=N

    if N%2==1:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
    else:
        stuck_right=[]
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

            if left==right:
                right=stuck_right.pop()

            if right-left==N-right+left:
                stuck_right.append(right)
                right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    left=1
    right=N

    if N%2==1:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
    else:
        tmp=[]
        index=N
        for _ in range(M):
            print(tmp)
            Left.append((left,right))
            left+=1
            if len(tmp)==0:
                index-=1
                right=index
            else:
                right=tmp.pop()
            if right-left==N-right+left:
                tmp.append(right)
                index=right

        for l in Left:
            print("{} {}".format(l[0],l[1]))
if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    left=1
    right=N

    if N%2==1:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
    else:
        tmp=[]
        pop_flag=0
        for _ in range(M):
            print(tmp)
            Left.append((left,right))
            left+=1
            if len(tmp)==0 and pop_flag==0:
                right-=1
            elif len(tmp)!=0:
                right=tmp.pop()
                pop_flag=1
            else:
                right=-2
            if right-left==N-right+left:
                tmp.append(right)
                right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    left=1
    right=N

    if N%2==1:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
    else:
        tmp=[]
        for _ in range(M):
            Left.append((left,right))
            left+=1
            if len(tmp)==0:
                right-=1
            else:
                right=tmp.pop()
            if right-left==N-right+left:
                tmp.append(right)
                right-=1
            
        for l in Left:
            print("{} {}".format(l[0],l[1]))
if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    left=1
    right=N

    if N%2==1:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
    else:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1
            if right-left>=N-right+left:
                right-=1
            
        for l in Left:
            print("{} {}".format(l[0],l[1]))
if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    left=1
    right=N

    if N%2==1:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
    else:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1
            if right-left<N-right+left:
                right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    left=1
    right=N

    if N%2==1:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
    else:
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1
            if right-left==N-right+left:
                right-=1

        for l in Left:
            print("{} {}".format(l[0],l[1]))
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
n,m=[int(_) for _ in input().split()]

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

Submission status: Wrong Answer

Solution code:
n,m=[int(_) for _ in input().split()]
m1=n//2
for i in range(min(m1//2,m)):
  print(i+1,m1-i)
if m>m1:
  for i in range(m-m1):
    print(m1+i+1,m1*2-i-1)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
h = int(N / 2)
l = h
r = l + 1
for m in range(M):
    print(str(l) + " " + str(r))
    l = l - 1
    r = r + 1

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
def check_ans(list_pairs):
  dict_people = {i: i for i in range(1, n+1)}
  for i in range(n):
    for k in range(m):
      val1 = dict_people[list_pairs[k][0]]
      val2 = dict_people[list_pairs[k][1]]
      if val1>val2:
        print(val2, val1, end=" / ")
      else:
        print(val1, val2, end=" / ")
    print("")
    for j in range(1, n+1):
      dict_people[j] = (dict_people[j]+1)%n
      if dict_people[j] == 0: dict_people[j] = n
ans = list()
count = 0
ind = 0
while count<m:
  node1 = (1-ind)%n
  if node1 == 0: node1 = n
  node2 = 2+ind
  if 2*node1!=n and 2*node2!=n:
    ans.append((node1, node2))
    count += 1
  ind += 1
[print(str(values[0])+" "+str(values[1])) for values in ans]
# check_ans(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    left=1
    right=N
    
    if N%2==1 or (N%2==0 and (N//2)%2==0):
        for _ in range(M):
            Left.append((left,right))
            left+=1
            right-=1
            if right-left==N-right+left:
                left+=1
    
        for l in Left:
            print("{} {}".format(l[0],l[1]))
    else:
        mid=N//2
        L_left=1
        L_right=mid
        R_left=mid+1
        R_right=N
        for _ in range(M//2):
            Left.append((L_left,L_right))
            L_left+=1
            L_right-=1
            Right.append((R_left,R_right))
            R_left+=1
            R_right-=1
        if M%2==1:
            Right.append((R_left, R_right))
    
    
        for left in Left:
            print("{} {}".format(left[0],left[1]))
        for right in Right:
            print("{} {}".format(right[0],right[1]))
    
if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    left=1
    right=N

    for _ in range(M):
        Left.append((left,right))
        left+=1
        right-=1
        if right-left==N-right+left:
            left+=1
            
    for l in Left:
        print("{} {}".format(l[0],l[1]))

    # mid=N//2
    # L_left=1
    # L_right=mid
    # R_left=mid+1
    # R_right=N
    # for _ in range(M//2):
    #     Left.append((L_left,L_right))
    #     L_left+=1
    #     L_right-=1
    #     Right.append((R_left,R_right))
    #     R_left+=1
    #     R_right-=1
    # if M%2==1:
    #     Right.append((R_left, R_right))
    #
    #
    # for left in Left:
    #     print("{} {}".format(left[0],left[1]))
    # for right in Right:
    #     print("{} {}".format(right[0],right[1]))

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]
    
    left=1
    right=N
    
    for _ in range(M):
        Left.append((left,right))
        left+=1
        right-=1
    for l in Left:
        print("{} {}".format(l[0],l[1]))

    # mid=N//2
    # L_left=1
    # L_right=mid
    # R_left=mid+1
    # R_right=N
    # for _ in range(M//2):
    #     Left.append((L_left,L_right))
    #     L_left+=1
    #     L_right-=1
    #     Right.append((R_left,R_right))
    #     R_left+=1
    #     R_right-=1
    # if M%2==1:
    #     Right.append((R_left, R_right))
    # 
    # 
    # for left in Left:
    #     print("{} {}".format(left[0],left[1]))
    # for right in Right:
    #     print("{} {}".format(right[0],right[1]))

if __name__=="__main__":
    main()

Submission status: Wrong Answer

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

    Left=[]
    Right=[]

    mid=N//2
    L_left=1
    L_right=mid
    R_left=mid+1
    R_right=N
    for _ in range(M//2):
        Left.append((L_left,L_right))
        L_left+=1
        L_right-=1
        Right.append((R_left,R_right))
        R_left+=1
        R_right-=1
    if M%2==1:
        Right.append((R_left, R_right))


    for left in Left:
        print("{} {}".format(left[0],left[1]))
    for right in Right:
        print("{} {}".format(right[0],right[1]))

if __name__=="__main__":
    main()

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=map(int,input().strip().split(' '))

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
if n%2==1:
  ab=[]
  a=n//2
  b=n//2+1
  ab.append([str(a),str(b)])
  for _ in range(m-1):
    a-=1
    b+=1
    ab.append([str(a),str(b)])
  for a,b in ab:
    print(a,b)
else:
  l=m
  ab=[]
  cnt=0
  for i in range(m):
    if i%2==0:
      a=i//2+1
      b=a+l
    else:
      a=n-(i//2+1)
      b=a-l
    ab.append([str(a),str(b)])
    l-=1
for a,b in ab:
  print(a,b)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
ab=[]
a=n//2
b=n//2+1
ab.append([str(a),str(b)])
for _ in range(m-1):
  a-=1
  b+=1
  ab.append([str(a),str(b)])
for a,b in ab:
  print(a,b)

Submission status: Wrong Answer

Solution code:
# 解説を参考に作成


def solve():
    N, M = map(int, input().split())
    N -= (N + 1) % 2

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


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:


def solve():
    N, M = map(int, input().split())
    N -= N % 2

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


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:


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

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


if __name__ == '__main__':
    solve()

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:
import sys


def main():
    input = sys.stdin.buffer.readline
    N, M = map(int, input().split())
    skip = None
    if N % 2 == 0 and N % 4 != 0:
        center = (N // 2) // 2 + 1
        if M >= center:
            skip = center
    right = N + 1
    left = 0
    count = 0
    while count < M:
        left += 1
        right -= 1
        if skip == left:
            continue
        print(left, right)
        count += 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys


def main():
    input = sys.stdin.buffer.readline
    N, M = map(int, input().split())
    skip = None
    center = None
    if N % 2 == 0 and N % 4 != 0:
        center = (N // 2) // 2 + 1
        if M >= center:
            skip = center
    right = N + 1
    left = 0
    for i in range(M):
        left += 1
        right -= 1
        if skip and left == center:
            continue
        print(left, right)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys


def main():
    input = sys.stdin.buffer.readline
    N, M = map(int, input().split())
    skip = None
    center = None
    if N % 2 == 0 and N % 4 != 0:
        center = (N // 2) // 2 + 1
        if M >= center:
            skip = center
    right = N
    left = 1
    for i in range(M):
        if skip and left == center:
            continue
        print(left, right)
        left += 1
        right -= 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys


def main():
    input = sys.stdin.buffer.readline
    N, M = map(int, input().split())
    left = 1
    right = N
    for i in range(M):
        print(left, right)
        left += 1
        right -= 1


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline

    n, m = map(int, input().split())
    if n % 2 == 1:
        for i in range(m):
            print(f"{i+1} {n-i}")
    else:
        flag = True
        for i in range(m):
            if flag and n - i - i - 2 >= n // 2:
                n -= 1
                flag = False
            print(f"{i+1} {n-i-1}")


main()

Submission status: Wrong Answer

Solution code:
def main():
    import sys
    input = sys.stdin.readline

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


main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

a = N//2
b = a + 1
for _ in range(M):
    print(a, b)
    a -= 1
    b += 1

Submission status: Wrong Answer

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

if N%2==1:
    S=1
    L=N
    for i in range(M):
        print(S+i,L-i)
else:
    S=1
    L=N
    for i in range(M):
        if S+i>=N/4:
            print(S+i,L-i-1)
        else:
            print(S+i,L-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):
        print(i, n-3-i)

    print(n-2, n)

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):
        print(i, n-2-i)

    print(n-1, n)

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-2):
        print(i, n-i)

    print(m-1, m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, m = na()

if n % 2 == 0:
    l, r = n // 2, n // 2 + 1
    cnt = 0
    while cnt < m:
        print(l, r)
        l -= 1
        r += 1
        cnt += 1
else:
    l, r = n // 2, n // 2 + 2
    cnt = 0
    while cnt < m:
        print(l, r)
        l -= 1
        r += 1
        cnt += 1

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

sys.setrecursionlimit(10 ** 7)

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

n, m = na()

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

Submission status: Wrong Answer

Solution code:
from operator import mul
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

if __name__ == '__main__':
    nm = input()
    nm = nm.split()
    n = int(nm[0])
    m = int(nm[1])


    ab_1 = [i+1 for i in range(int(n/2))]
    ab_1_len = len(ab_1)
    ab_2 = [i+1 for i in range(int(n/2),n)]
    ab_2_len = len(ab_2)

    print(ab_1,ab_2)

    if m%2==0:
        for i in range(int(m/2)):
            print(ab_1[int(ab_1_len/2)-1]-i,ab_1[int(ab_1_len/2)]+1+i)
            
        for i in range(int(m/2)):
            print(ab_2[int(ab_2_len/2)-1]-i,ab_2[int(ab_2_len/2)]+i)
    else:
        for i in range(int(m/2)):
            print(ab_1[int(ab_1_len/2)-1]-i,ab_1[int(ab_1_len/2)]+1+i)

        for i in range(int(m/2)+1):
            print(ab_2[int(ab_2_len/2)-1]-i,ab_2[int(ab_2_len/2)]+i)

Submission status: Wrong Answer

Solution code:
import itertools

if __name__ == '__main__':
    nm = input()
    nm = nm.split()
    n = int(nm[0])
    m = int(nm[1])


    ab = [i+1 for i in range(n)]
    for i in range(m):
        print(ab[int(n/2)-1]-i,ab[int(n/2)]+i)

Submission status: Wrong Answer

Solution code:
N, M = [ int(i) for i in input().strip().split(' ')]
if N % 2 == 0:
    for m in range(M):
        print(m+2, 2*M-m - 1)
else:
    for m in range(M):
        print(m+1, 2*M-m)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for m in range(1, M + 1):
    if N % 2 == 1:
        print(m, N - m + 1)
    else:
        start = m
        end = N // 2 - m
        if start >= end:
            start = N // 2 + 1
            end = N - m + 1
        print(start, end)

Submission status: Wrong Answer

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

for m in range(1, M + 1):
    if N % 2 is 1:
        print(m, N - m + 1)
    else:
        start = m
        end = N / 2 - m
        if start >= end:
            start = N / 2 + 1
            end = N - m + 1
        print(start, end)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans = []
end = M // 2 * 2 + 1
for i in range(M//2):
    ans.append((i+1, end))
    end -= 1
start = M // 2 * 2 + 2 if M // 2 > 1 else 1
end = N
for i in range(math.ceil(M/2)):
    ans.append((start+i, end-i))

for a in ans:
    print(*a, sep=" ")

Submission status: Wrong Answer

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

ans = []
i = -1
end = M // 2 * 2 + 1
for i in range(M//2):
    ans.append((i+1, end))
    end -= 1
start = i+2
end = N
for i in range(math.ceil(M/2)):
    ans.append((start+i, end-i))

for a in ans:
    print(*a, sep=" ")

Submission status: Wrong Answer

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

ans = []
end = M // 2 * 2 + 1
for i in range(M//2):
    ans.append((i+1, end))
    end -= 1
start = M // 2 * 2 + 2
end = N
for i in range(math.ceil(M/2)):
    ans.append((start+i, end-i))

for a in ans:
    print(*a, sep=" ")

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:
def main():
    N, M = map(int, input().split())  # N must be an odd number
    
    is_odd = (N-1) & 1
    bias = 0

    for i, distance in enumerate(range(N-1, 0, -2)):

        if is_odd and distance <= -distance % N:
            bias = 1
        
        left = i + 1
        right = left + distance - bias
        print(left, right)

        if i == M:
            return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())  # N must be an odd number

    left = 1
    count = 0
    buff = 0
    for d in range(N-1, 0, -2):

        if d % N == -d % N:
            buff = 1

        right = left + d - buff
        print(left, right)

        left += 1
        count += 1
        if count == M:
            return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())  # N must be an odd number

    for i in range(N):
        if i == M:
            return

        left = i + 1
        right = N - i
        d = right - left

        if d % N == -d % N:
            M += 1
            continue

        print(left, right)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())  # N must be an odd number

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())  # N must be an odd number

    left = 1
    for d in range(N-1, N//2, -2):
        print(left, left + d)
        left += 1
        if left == M + 1:
            return

    for d in range(N//2, 0, -2):
        print(left, left + d)
        left += 1
        if left == M + 1:
            return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map(int, input().split())  # N must be an odd number

    left = 1
    for d in range(N-1, N//2, -2):
        print(left, left + d)
        left += 1
        if left == M + 1:
            return

    for d in range(2, N//2, 2):
        print(left, left + d)
        left += 1
        if left == M + 1:
            return


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from sys import stdin, setrecursionlimit
input = stdin.buffer.readline

N, M = map(int, input().split())

if N % 2 == 0:
    num1 = M // 2 + M % 2
    end1 = num1 * 2
    for i in range(num1):
        print(i + 1, end1 - i)
    
    num2 = M // 2
    srt2 = end1 + 1
    end2 = srt2 + num2 * 2 + 1
    for i in range(num2):
        print(srt2 + i, end2 - i)
else:
    num1 = M
    end1 = num1 * 2
    for i in range(num1):
        print(i + 1, end1 - i)

Submission status: Wrong Answer

Solution code:
from sys import stdin, setrecursionlimit
input = stdin.buffer.readline
setrecursionlimit(10 ** 7)

from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict
from itertools import combinations, permutations, combinations_with_replacement
from itertools import accumulate
from math import ceil, sqrt, pi

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

#N = int(input())
#N, M= map(int, input().split())
#ABC = [list(map(int, input().split())) for _ in range(N)]

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

stack = list(range(1,N+1))
stack.reverse()

ans = []
for i in range(M):
    now = stack.pop()
    cand = now+i+1 if now + i + 1 >N else now+i+1-N
    pair = stack.pop(cand)
    ans.append([now,pair])

for an in ans:
    print(an[0],an[1])

Submission status: Wrong Answer

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

ans = []

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

for an in ans:
    print(an[0],an[1])

Submission status: Wrong Answer

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

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

for an in ans:
    print(an[0],an[1])

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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