Problem:


Score : 500 points

Problem Statement

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

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

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

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

Constraints

1 \leq M

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

Input

Input is given from Standard Input in the following format:

N M

Output

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

a_1 b_1
a_2 b_2
:
a_M b_M

Sample Input 1

4 1

Sample Output 1

2 3

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

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

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

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

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

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

Sample Input 2

7 3

Sample Output 2

1 6
2 5
3 4



Sample input:
4 1


Sample output:
2 3

Submission status: Wrong Answer

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

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

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,m = [int(j) for j in 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())
if N%2 == 0:
    for i in range(M):
        print(N//2-i,N//2+i+1)
else:
    for i in range(M):
        print(i+1,N-i-1)

Submission status: Wrong Answer

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

width = 0
for i in range(m):
    left = (i + 1 - n + i) % n
    if width == left:
        n -= 1

    width = (i + 1 - n + i) % n
    temp = (i + 1, n - i)
    print(*temp)

Submission status: Wrong Answer

Solution code:
def main():
    N,M=map(int,input().split())
    a=1
    for i in range(1,M+1):
        print(a,a+1)
        a+=1
if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

width = 0
for i in range(m):

    temp = (i + 1, n - i)
    left = (temp[0] - temp[1]) % n
    if width == left:
        temp[1] -= 1
        left = (temp[0] - temp[1]) % n
    width = left
    print(*temp)

Submission status: Wrong Answer

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

n = (N//2)*2

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

Submission status: Wrong Answer

Solution code:
def main():
    N,M=map(int,input().split())
    a=N//2
    b=N//2+1
    for i in range(1,M+1):
        print(a,b)
        a-=1
        b+=1
if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

m = (M//2)*2

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

Submission status: Wrong Answer

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

a[0][1]=n
for x in a:
  print(x[0],x[1])

Submission status: Wrong Answer

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

a[-1][1]=n
for x in a:
  print(x[0],x[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/python3

import math
#標準出力からの読み込み
input_1 = input()
n = int(input_1.split(" ")[0])
m = int(input_1.split(" ")[1])


#判定ロジック
for i in range(m):
    print(i+1, n-i)

Submission status: Wrong Answer

Solution code:
def main():
    N,M=map(int,input().split())
    a=1
    b=N-1
    for i in range(1,M+1):
        print(a,b)
        a+=1
        b-=1
if __name__=='__main__':
    main()

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()
ge = []
l = 1
r = n
for i in range(m):
    if i%2:
        ge.append(l)
    else:
        ge.append(r)
    l += 1; r -= 1
ge.sort(reverse = True)
x = 1
for i in range(m):
    print(x,x+ge[i])
    x += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    N,M=map(int,input().split())
    a=1
    b=2*M
    while(a<b):
        print(a,b)
        a+=1
        b-=1
if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def solve(N: int, M: int):
    for m in range(M):
        print(m+1, 2*M-m)
    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())
d=set()
a,b=1,N
for _ in range(M):
    print(a,b)
    d.add(b-a)
    d.add(N-b+a)
    a+=1
    b-=1
    if b-a in d or N-b+a in d: b-=1

Submission status: Wrong Answer

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

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

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,N-i
        print(a,b)
else:
    flag=False
    for i in range(1,M+1):
        a,b=i,N-i
        if b-a==N//2:
            flag=True
        a+=flag
        print(a,b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

n, m = map(int, input().split())

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

Submission status: Wrong Answer

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

a,b=1,N//2
c,d=N//2+1,N
i=0
while i<M:
    if i!=M:
        print(c,d)
        i+=1        
        c,d=c+1,d-1
    else:
        break
    if i!=M:
        print(a,b)
        a,b=a+1,b-1
        i+=1
    else:
        break

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

n, m = map(int, input().split())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def e_rotation_matching():
    N, M = [int(i) for i in input().split()]

    ans = []
    if N % 2 == 1:
        left, right = 1, N - 1
        while left < right:
            ans.append((left, right))
            left += 1
            right -= 1
    else:
        flag = False
        left, right = 1, N - 1
        while left < right:
            if not flag and right - left <= N // 2:
                right -= 1
                flag = True
            ans.append((left, right))
            left += 1
            right -= 1
    return '\n'.join([f'{a} {b}' for a, b in ans])

print(e_rotation_matching())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def e_rotation_matching():
    N, M = [int(i) for i in input().split()]

    if N % 2 == 1:
        ans = [(left, N - left) for left in range(1, (N // 2) + 1)]
    else:
        ans = []
        flag = False
        left, right = 1, N - 1
        while left < right:
            if not flag and right - left <= N // 2:
                right -= 1
                flag = True
            ans.append((left, right))
            left += 1
            right -= 1
    return '\n'.join([f'{a} {b}' for a, b in ans])

print(e_rotation_matching())

Submission status: Wrong Answer

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

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

    exit()

n1, n2 = N//2, N//2
cnt = 0
for n in range(N//2):
    if n+1 >= N//2-n:
        break
    print(n+1, N//2-n)
    cnt += 1
    if cnt == M:
        exit()

for n in range(N//2):
    if n+1 >= N//2-n-1:
        break
    print(n+1+N//2, N-n)
    cnt += 1
    if cnt == M:
        exit()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
if N%2==0:
    a = N//2
    b = N//2+1
    for m in range(M):
        print(a,b)
        a -= 1
        b += 1
else:
    if M%2==1:
        base1 = (N//2//2,N//2//2+2)
        base2 = (N - (N//2//2)-1,N - (N//2//2))
    else:
        base1 = ((N//2+1)//2,(N//2+1)//2+2)
        base2 = ((N//2+1)+N//2,(N//2+1)+N//2+1)
    cnt = 0
    cnt2 = 0
    for m in range(M):
        if cnt < N//2//2:
            print(base1[0]-cnt,base1[1]+cnt)
            cnt += 1
        else:
            print(base2[0]-cnt2,base2[1]+cnt2)
            cnt2 +=1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#!python3

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

# odd
def solve1():
    return [(i + 2, N - i) for i in range(M)]        


# even
def solve2():
    t = (N - 2) // 4
    l = [(i + 1, N - i) for i in range(t)]
    n = (N - 2) // 2 - t
    l = l + [(N // 2 + 1 + i, N // 2 - i) for i in range(n)]
    return l[:M]


def main():
    l = solve1() if N % 2 else solve2()
    for ans in l:
        print(*ans)
    

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!python3

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

# odd
def solve1():
    return [(i + 2, N - i) for i in range(M)]        


# even
def solve2():
    t = (N - 2) // 4
    l = [(i + 1, N - i) for i in range(t)]
    n = (N - 2) // 2 - t
    l = l + [(N // 2 + 1 + i, N // 2 - i) for i in range(n)]
    return l


def main():
    l = solve1() if N % 2 else solve2()
    for ans in l:
        print(*ans)
    

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
diffs=set()
idxs=set()
i=1
diff=n-1
cnt=0
while 1:
    if i>m:
      break
    while diff in diffs and n-diff in diffs or i+diff in idxs:
        diff-=1
    diffs.add(n-diff)
    diffs.add(diff)
    idxs.add(i+diff)
    print(i,i+diff)
    i+=1

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

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = 0
for i in range(m):
    if n % 2 == 0 and n % 4 != 0 and n-4*i-2 == 0:
        a = 1
    print('{} {}'.format(i+1, n-i-a))

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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:
    i = 1
    j = 0
    while i < m:
        if i == n / 2:
            i += 1
        print(i, n - j)
        i += 1
        j += 1

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:
    i = 1
    j = 0
    while j <= m:
        if i == n / 2:
            i += 1
        print(i, n - j)
        i += 1
        j += 1

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
diffs=set()
idxs=set()
i=1
diff=1
cnt=0
while 1:
    if cnt==m:
      break
    if i not in idxs:
        while diff in diffs and n-diff in diffs:
            diff+=1
        diffs.add(n-diff)
        diffs.add(diff)
        idxs.add(i)
        idxs.add(i+diff)
        cnt+=1
        print(i,i+diff)
    i+=1

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:
    i = 1
    j = 0
    while i <= m:
        if i == n / 2:
            i += 1
        print(i, n - j)
        i += 1
        j += 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
s=set()
i=1
diff=1
for _ in range(m):
    if diff in s or n-diff in s:
        diff+=1
        i+=1
        continue
    else:
        s.add(n-diff)
        s.add(diff)
        print(i,i+diff)
        i+=1
        diff+=1

Submission status: Wrong Answer

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

Mm=M*2 if M%2==1 else M*2+1

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
s=set()
i=1
for _ in range(m):
    if i in s and n-i in s:
        i+=1
        continue
    else:
        s.add(i)
        s.add(n-i)
        print(i,n-i)
        i+=1

Submission status: Wrong Answer

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

def main():
    N,M = map(int,input().split())
    cl = []
    for i in range(M//2):
        cl.append((i+1,(M//2)*2+1-i))
    for i in range(-(-M//2)):
        cl.append(((M//2)*2+i+2,N-i-(N+1)%2))
    
    for i in range(M):
        print(*cl[i])
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if n % 2 == 1:
    a = [i for i in range(1, m+1)]
    b = [i for i in reversed(range(m+1, 2*m+1))]
    ab = [(x, y) for x, y in zip(a, b)]
    ab = ab[:m]
else:
    ab = []
    evenl = 1
    evenr = (n-1)//2
    while evenl < evenr:
        ab.append((evenl, evenr))
        evenl += 1
        evenr -= 1

    oddl = evenr+1
    oddr = n-1
    while oddl < oddr:
        ab.append((oddl, oddr))
        oddl += 1
        oddr -= 1
    ab = ab[:m]

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

Submission status: Wrong Answer

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

def main():
    N,M = map(int,input().split())
    cl = []
    for i in range(M//2):
        cl.append((i+1,(M//2)*2+1-i))
    for i in range(-(-M//2)):
        cl.append(((M//2)*2+i+2,N-i))
    
    for i in range(M):
        print(*cl[i])
    
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if n % 2 == 1:
    a = [i for i in range(1, m+1)]
    b = [i for i in reversed(range(m+1, 2*m+1))]
    ab = [(x, y) for x, y in zip(a, b)]
else:
    ab = []
    evenl = 1
    evenr = (n-1)//2
    while evenl < evenr:
        ab.append((evenl, evenr))
        evenl += 1
        evenr -= 1

    oddl = evenr+1
    oddr = n-1
    while oddl < oddr:
        ab.append((oddl, oddr))
        oddl += 1
        oddr -= 1
    ab = ab[:m]

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

Submission status: Wrong Answer

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

if n % 2 == 1:
    a = [i for i in range(1, m+1)]
    b = [i for i in reversed(range(m+1, 2*m+1))]
    ab = [(x, y) for x, y in zip(a, b)]
else:
    ab = []
    evenl = 1
    evenr = (n-1)//2
    while evenl < evenr:
        ab.append((evenl, evenr))
        evenl += 1
        evenr -= 1

    oddl = evenr+1
    oddr = n-1
    while oddl < oddr:
        ab.append((oddl, oddr))
        oddl += 1
        oddr -= 1


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if n % 2 == 1:
    a = [i for i in range(1, m+1)]
    b = [i for i in reversed(range(m+1, 2*m+1))]
    ab = [(x, y) for x, y in zip(a, b)]
else:
    x = (n-1)//2
    a = [i for i in range(1, x//2+1)]
    b = [i for i in reversed(range(x//2+1, x+1))]
    ab_ev = [(x, y) for x, y in zip(a, b)]
    y = n//2
    a = [i for i in range(x+1, y//2+1)]
    b = [i for i in reversed(range(y//2+2, n))]
    ab_od = [(x, y) for x, y in zip(a, b)]
    ab = ab_ev+ab_od

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

Submission status: Wrong Answer

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

for i in range(1,M+1,1):
    print(i,N-1+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//2-i,n//2+i+1)
else:
    ni = 1
    l = 1
    r = n
    while ni < n//4 and ni <= m:
        print(l,r)
        l += 1
        r -= 1
        ni += 1
    r -= 1
    while ni <= m:
        print(l,r)
        l += 1
        r -= 1
        ni += 1

Submission status: Wrong Answer

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


m = (n-1) // 2
a = (n - 1) // 2
d = 1
memo = set([])
cnt = 0
for i in range(m):

    if (n - d in memo):
        cnt += 1
        d += 1
    memo.add(d)
    if cnt > 1 or a < 1 or a+d > n:
        print(1/0)
    print(a, a+d)
    a -= 1
    d += 2

Submission status: Wrong Answer

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

if n%2 == 1:
    l = n//2
    r = n//2+1
    for i in range(m):
        print(l,r)
        l -= 1
        r -= 1
else:
    l = 1
    r = n
    ni = 1
    while ni < n//2 and ni <= m:
        print(l,r)
        l += 1
        r -= 1
    r -= 1
    while ni <= m:
        print(l,r)
        l += 1
        r -= 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


m = (n-1) // 2
a = (n - 1) // 2
d = 1
memo = set([])
cnt = 0
for i in range(m):

    if (n - d in memo) or (d * 2 == n):
        cnt += 1
        d += 1
    memo.add(d)
    if cnt > 1 or a < 1 or a+d > n:
        print(1/0)
    print(a, a+d)
    a -= 1
    d += 2

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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