Problem:


Score : 500 points

Problem Statement

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

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

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

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

Constraints

1 \leq M

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

Input

Input is given from Standard Input in the following format:

N M

Output

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

a_1 b_1
a_2 b_2
:
a_M b_M

Sample Input 1

4 1

Sample Output 1

2 3

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

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

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

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

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

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

Sample Input 2

7 3

Sample Output 2

1 6
2 5
3 4



Sample input:
4 1


Sample output:
2 3

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
count = []
for i in range(N):
    z = [0] * N
    count.append(z)
for i in range(N):
    count[i][i] = 1
a = 1
b = 2
ans = []
used = [0] *(N+1)
for i in range(M):
    used[a] = 1
    used[b] = 1
    ans += [a,b]
    print(*[a,b])
    for j in range(N):
        count[a-1][b-1] = 1
        count[b-1][a-1] = 1
        a += 1
        if a > N:
            a %= N
        b += 1
        if b > N:
            b %= N
    for k in range(N):
        for l in range(N):
            if count[k][l] == 0:
                if used[k+1] == 0 and used[l+1] == 0:
                    a = k+1
                    b = l+1
                    break
                    break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import heapq

N, M = map(int, input().split())
ans = []
remaining = [i for i in range(1, N+1)]
s = set(remaining)
heapq.heapify(remaining)
for diff in range(1, M+1):
  while True:
    i = heapq.heappop(remaining)
    if i in s:
      break
  j = i + diff
  ans.append([i, j])
  s.discard(i); s.discard(j)

for a in ans:
  print(*a)

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n, m = LI()
    if n & 1: n -= 1
    ans = []
    for i in range(m + 1):
        if (4 * i + 2) == n: continue
        ans.append((i + 1, n))
        n -= 1
    for a in ans[:m]:
        print(*a)
    return


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

Submission status: Wrong Answer

Solution code:

import sys
# sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
# arr = [[int(el) for el in input().split()] for i in range(n)]

# def cal(a, b, k):
#     for i in range(a, b + 1):
#         if i % k == 0:
#             return True
#     return False

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

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
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 solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    used = set()
    left = 1
    right = N
    for i in range(M):
        if right - left not in used:
            if N - (right - left) not in used:
                print(left, right)
                used |= {right - left}
                used |= {N - (right - left)}
                left += 1
                right -= 1
            else:
                print(left, right - 1)
                used |= {right - left - 1}
                used |= {N - (right - left - 1)}
                left += 1
                right -= 2
        else:
            print(left, right - 1)
            used |= {right - left - 1}
            used |= {N - (right - left - 1)}
            left += 1
            right -= 2

    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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


# 
# (0,M),(1,M+2), ... (M//2, 2M)
# (M//2+1, M+1), ...

half = M+1
cnt = 0
i = 0
j = half
while j < N and cnt < M:
    print(i+1, j+1)
    i += 1
    j += 2
    cnt += 1

j = half+1
while j < N and cnt < M:
    print(i+1, j+1)
    i += 1
    j += 2
    cnt += 1

Submission status: Wrong Answer

Solution code:
i = list(map(int, input().split()))
n = i[0]
m = i[1]

for num in range(m, 0, -1):
    print(n//2 - num+1, n//2 + num)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

# if n%2 != 0:
#     n -= 1
l = n//2
r = l + 1

for i in range(m):
    print(str(l)+" "+str(r))
    l -= 1
    r += 1
    if l < 1 or n < r:
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s, e = 1, 2 * M
for _ in range(M):
    print(s, e)
    s, e = s + 1, e - 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
L = [[1,N]]
for i in range(1,M):
    L.append([L[0][0]+i,L[0][1]-i])

for i in L:
    print(" ".join(map(str,i)))

Submission status: Wrong Answer

Solution code:
inf = 10**15
mod = 10**9+7
n,m = map(int, input().split())
if n % 2 == 0:
    for i in range(m):
        print('{} {}'.format(2+i, n-1-i))
else:
    for i in range(m):
        print('{} {}'.format(1+i, n-1-i))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import bisect
import collections
import sys

sys.setrecursionlimit(100000)
input = sys.stdin.readline
ACMOD = 1000000007
INF = 1 << 62


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


def llmi(n):
    return [lmi() for _ in range(n)]


N, M = lmi()


def validate(ans):
    battled = set()
    for n in range(N):
        for x, y in ans:
            p1 = (x + N - n) % N
            p2 = (y + N - n) % N
            b = frozenset([p1,p2])
            print(b)
            if b in battled:
                return False
    return True



def solve():
    ans = []
    for i in range(M):
        ans.append((i + 1, N - i))
        print(*ans[-1])
    return ans

solve()
# print(validate(solve()))

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
i=0
while i<M:
    print(i+1,N-i)
    i=i+1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

C = math.floor(N / 2)
D = C+1

for i in range(M):
    print(C, D)
    C = C - 1
    D = D + 1

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

Solution code:
import sys
n, m = map(int, sys.stdin.readline().split())
i = 1
if n % 2 == 0:
  while i <= m:
    print(i, n+1-i)
    i += 1
else:
  while i <= n/2:
    print(i, n-i)
    i += 1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

aa = n//2
bb = aa+1

for i in range(m):
    print(aa,bb)
    aa-=1
    if aa==0:
        aa=n
    bb+=1
    if bb ==n+1:
        bb=1

Submission status: Wrong Answer

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

if n%2 != 0:
    n -= 1
l = n//2
r = l + 1

for i in range(m):
    print(str(l)+" "+str(r))
    l -= 1
    r += 1
    if l < 1 or n < r:
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []
max_ = 2 * m
for i in range(m):
    ans.append((i + 1, max_ - i))
for i in ans:
    print(*i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n,m=MI()
    if n%2:
        for a in range(1,m+1):
            print(a,m*2+1-a)
    else:
        for a in range(1, m + 1):
            if a<3:
                print(a,2*m+2-a)
            else:
                print(a, 2 * m + 1 - a)

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

for i in range(b):
    print(str(i+1) + ' ' + str(a-i))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=range(n//2+1-m,n//2+1)
r=range(n//2+1,n//2+m+1)
for i in range(m):
    a,s=l[i],r[-i-1]
    print(a,s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

ansl = []

start = n // 2
end = n // 2 + 1
for i in range(m):
    if n % 2 == 0:
        ansl.append((start - i-1, end + i))
    else:
        ansl.append((start-i, end+i))

for a,b in sorted(ansl):
    print(a,b)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n, m = LI()
    if n & 1: n -= 1
    ans = []
    for i in range(m + 1):
        if (n - i - 1) * 2 == n: continue
        ans.append((i + 1, n))
        n -= 1
    for a in ans[:m]:
        print(*a)
    return


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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from math import floor
import sys
input = sys.stdin.readline
N,M=(int(x) for x in input().rstrip('\n').split())
a = 1
b = N
for i in range(1,M+1):
  print(a,b)
  a += 1
  b -= 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if n != 4 and n % 2 == 0:
    n = n-1

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n, m = LI()
    if n & 1: n -= 1
    ans = []
    for i in range(m + 1):
        if (n - i + 1) * 2 == n: continue
        ans.append((i + 1, n))
        n -= 1
    for a in ans[:m]:
        print(*a)
    return


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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
import sys
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7
input = sys.stdin.readline


def inp():
    return int(input())


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


N, M = inpl()

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

            print(a, b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,M=map(int,input().split())

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

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

Submission status: Wrong Answer

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    a=N//2
    b=a+1
    for i in range(M):
        print(a,b)
        a-=1
        b+=1
    

main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat May  2 21:39:58 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

#N = int(input())
N, M = map(int,input().split())
#A = list(map(int,input().split()))
#graph = [[] for _ in range(N+1)]
#for _ in range(N-1):
#    a, b = map(lambda x : int(x)-1, input().split())
#    graph[a].append(b)
#    graph[b].append(a)

odd = (N % 2 != 0)
ans = []
if odd:
    x = N - 1
else:
    x = N

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

for a in ans:
    print(' '.join(map(str,a)))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())

for i in range(1, M + 1):
    print("{} {}".format(i, N - i + 1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

import sys
sys.setrecursionlimit(300000)


def solve(N: int, M: int):
    if N % 2 == 1:
        s = N // 2
        for i in range(M):
            v = i * 2 + 1
            print(s, s + v)
            s -= 1
    else:
        s = N // 2
        for i in range(M - 1):
            v = i * 2 + 1
            print(s, s + v)
            s -= 1
        print(s, N)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    solve(N, M)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math
import sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from functools import lru_cache, reduce
from heapq import heapify, heappop, heappush
from itertools import chain, combinations, permutations, product
from typing import List, Dict

# import numpy as np

sys.setrecursionlimit(10**5 + 1)
input = sys.stdin.readline
write = sys.stdout.write


def read_item(cls=int):
    return cls(input())


def read_n_item(cls=int) -> list:
    return [cls(s) for s in input().split()]


def list2d(row, col, init_val=0) -> List[list]:
    return [[init_val] * col for _ in range(row)]


MOD = 10**9 + 7
# MOD = 998244353


N, M = read_n_item()

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

Submission status: Wrong Answer

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

U = [False]*N
a = 1
b = N
for i in range(M):
  while U[b-a] or U[a+N-b]:
    b -= 1
  assert a<b
  print(a, b)
  U[b-a] = U[a+N-b] = True
  a += 1
  b -= 1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i in range(1,M+1):
  print(f'{i} {N+1-i}')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
N, M = map(int, input().split())

for i in range(1, M + 1):
    print("{} {}".format(i, N - i))

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
li = []
if N&1 == 1:
    a, b = 1, N-1
    li.append([a, b])
    for i in range((N-1)//2-1):
        a += 1
        b -= 1
        li.append([a,b])
else:
    a, b = 1, N
    li.append([a, b])
    for i in range((N-1)//2-2):
        a += 1
        b -= 1
        if b - a <= N+a-b and - b + a + N+a-b <= 2:
            b -= 1
        li.append([a,b])
    a += 1
    b -= 1
    li.append([a,b])
for x in li:
    print(*x)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

aa = n//2
bb = aa+1

for i in range(m):
    print(aa,bb)
    aa-=1
    bb+=1

Submission status: Wrong Answer

Solution code:
import sys

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

    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp():
    '''
    一つの整数
    '''
    return int(input())
def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


n, m = inpl()
ans=[]
for i in range(0,2*m,2):
    print("{} {}".format(i+1,2*m-i))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

# sys.setrecursionlimit(100000)
input = sys.stdin.buffer.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, M):
    # A = deque(range(1, N+1))
    # B = [(0, 5), (1, 4), (2, 3)]
    # for i in range(N):
    #     print(A)
    #     for i, j in B:
    #         print(A[i], A[j])
    #     A.append(A.popleft())

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


def main():
    N, M = read_int_n()
    (slv(N, M))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

U = [False]*N
a = 1
b = N
for i in range(M):
  if U[b-a] or U[a+N-b]:
    b -= 1
  print(a, b)
  U[b-a] = U[a+N-b] = True
  a += 1
  b -= 1

Submission status: Wrong Answer

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

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

aa = n//2
bb = aa+1

for i in range(m):
    print(aa,bb)
    aa-=1
    if aa==0:
        aa=n
    bb+=1
    if bb ==n:
        bb=0

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ansl = []

start = n // 2
end = n // 2 + 1
for i in range(m):
    ansl.append((start-i, end+i))

for a,b in sorted(ansl):
    print(a,b)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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


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