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 time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N, M = In.ints()

i = N//2+1
j = N//2+2

k = 1
m = N

switch=False
for k in range(min(M, N)):
    if not switch:
        Out.ints([i,j])
        i-=1
        j+=1
    else:
        Out.ints([k,m])
        k+=1
        m-=1
    
    switch = not switch

        
######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Submission status: Wrong Answer

Solution code:
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N, M = In.ints()

i = N//2+1
j = N//2+2

for k in range(min(M, N)):
    Out.ints([i,j])
    i-=1
    j+=1

        
######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Submission status: Wrong Answer

Solution code:
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N, M = In.ints()

i = N//2+1
j = N//2+2

for k in range(min(M, N)):
    Out.ints([i+1,j+1])
    i-=1
    j+=1

        
######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Submission status: Wrong Answer

Solution code:
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N, M = In.ints()

i = N//2
j = N//2+1

for k in range(min(M, N)):
    Out.ints([i+1,j+1])
    i-=1
    j+=1

        
######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Submission status: Wrong Answer

Solution code:
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N, M = In.ints()

i = N//2
j = N//2+1

for k in range(min(M, N)):
    Out.ints([i,j])
    i-=1
    j+=1

        
######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Submission status: Wrong Answer

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import time
startTimeProblem=time.time()

import fileinput, sys, itertools, functools
from math import *
from bisect import *
from heapq import *
from collections import *

def lcm(a, b):  
    return (a*b)/gcd(a, b)

class InputHelper:
    def __init__(self):
        self.myinput = fileinput.input()

    def isLocal(self):
        return not fileinput.isstdin()

    def int(self):
        return int(self.myinput.readline().rstrip())

    def ints(self):
        return [int(_) for _ in self.myinput.readline().rstrip().split()]

    def str(self):
        return self.myinput.readline().rstrip()

    def strs(self):
        return [_ for _ in self.myinput.readline().rstrip().split()]

class OutputHelper:
    def int(self, a):
        print(a)    

    def ints(self, a):  
        print(" ".join([str(_) for _ in a]))
    
    def intsNL(self, a):
        for _ in a:
            print(_)
    
    def str(self, s):
        print(s)

    def strs(self, s):
        print(" ".join([_ for _ in s]))

    def strsNL(self, s):
        for st in s:
            print(st)

class ListNode:
    def __init__(self, val):
        self.val = val
        self.next = None
        self.prev = None

In = InputHelper()
Out = OutputHelper()

######################################

N, M = In.ints()

i = N//2
j = N//2+1

for k in range(M):
    Out.ints([i,j])
    i-=1
    j+=1

        
######################################

if len(sys.argv)>2 and sys.argv[2]=="TIMEIT":
    fin = (time.time()-startTimeProblem)*1000
    print("{:.2f}".format(fin) + "ms")

Submission status: Wrong Answer

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, M = [int(x) for x in input().split()]
    ans = [[] for j in range(M)]

    if N % 2:
        for i in range(M):
            ans[i].append(i + 1)
            ans[i].append(N - i - 1)
    else:
        memo = 0
        for i in range(M):
            memo = i
            if (i + 1) * 4 >= N:
                break
            ans[i].append(i + 1)
            ans[i].append(N - i - 1)

        for j in range(memo, M):
            ans[j].append(j + 1)
            ans[j].append(N - j - 2)
    for a in ans:
        print(*a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, M = [int(x) for x in input().split()]
    ans = [[] for j in range(M)]

    if N % 2 == 1:
        for i in range(M):
            ans[i].append(i + 1)
            ans[i].append(N - i - 1)
    else:
        memo = 0
        for i in range(M):
            memo = i
            if (i + 1) * 4 == N:
                break
            ans[i].append(i + 1)
            ans[i].append(N - i - 1)

        for j in range(memo, M):
            ans[j].append(j + 1)
            ans[j].append(N - j - 2)
    for a in ans:
        print(*a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, M = [int(x) for x in input().split()]
    ans = [[] for j in range(M)]

    if N % 2 == 1:
        for i in range(M):
            ans[i].append(i + 1)
            ans[i].append(N - i - 1)
    else:
        memo = 0
        for i in range(M):
            memo = i
            if (i + 1) * 2 == N:
                break
            ans[i].append(i + 1)
            ans[i].append(N - i - 1)

        for j in range(memo, M - 1):
            ans[j].append(j + 1)
            ans[j].append(N - j - 2)
    for a in ans:
        print(*a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
# (a,b) a<b とする
# b-a が同じ組み合わせは存在できない
# b-(a+N) もかぶったらだめ
right = 2*M
for i in range(M):
    print(i+1, right-M+1+i)

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, M = [int(x) for x in input().split()]
    ans = [[] for j in range(M)]

    for i in range(0, 2 * M):
        if i < M:
            ans[i].append(i + 1)
        else:
            ans[M - 1 - i % M].append(i + 1)

    for a in ans:
        print(*a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, M = [int(x) for x in input().split()]
    ans = [[] for j in range(M)]

    for i in range(0, 2 * M):
        if i < M:
            ans[i].append(i + 1)
        else:
            if M - 1 - i % M <= 1:
                ans[M - 1 - i % M].append(i + 1 + 1)
            else:
                ans[M - 1 - i % M].append(i + 1)

    for a in ans:
        print(*a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, M = [int(x) for x in input().split()]
    ans = [[] for j in range(M)]

    for i in range(0, 2 * M):
        if i < M:
            ans[i].append(i + 1)
        else:
            if M - 1 - i % M <= 1:
                ans[M - 1 - i % M].append(N - (M - 1 - i % M))
            else:
                ans[M - 1 - i % M].append(i + 1)

    for a in ans:
        print(*a)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, M = [int(x) for x in input().split()]
    ans = [[] for j in range(M)]

    for i in range(0,  2 * M):
        if i < M:
            ans[i].append(i + 1)
        else:
            ans[M - 1 - i % M].append(i + 1)

    for a in ans:
        print(*a)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
# (a,b) a<b とする
# b-a が同じ組み合わせは存在できない
# b-(a+N) もかぶったらだめ
right = 2*M
for i in range(M):
    print(i+1, right-i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import *
n,m = map(int,input().split())
d = dict()
i,j = 1,n
for y in range(m):
	if(n%2 == 0 and i > (m+1)//2):
		i += 1
	print(i,j)
	i += 1
	j -= 1

Submission status: Wrong Answer

Solution code:
from collections import *
n,m = map(int,input().split())
d = dict()
i,j = 1,n
for y in range(m):
	if(n%2 == 0 and i == (m+1)//2):
		i += 1
	print(i,j)
	i += 1
	j -= 1

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
INF = 2**62-1

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

def slv(N, M):
    if N % 2 != 0:
        ans = [ (i+1, N-i) for i in range(M)]
    else:
        ans = [(i+1 + (0 if i < N//2 -2 else 1), N-i) for i in range(M)]

    for a in ans:
        print(*a)


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



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import *
n,m = map(int,input().split())
d = dict()
i,j = 1,n
if(n&1): j -= 1
for y in range(m):
	if(n%2 == 0 and j-i == n//2):
		j -= 1
	print(i,j)
	i += 1
	j -= 1

Submission status: Wrong Answer

Solution code:
from collections import *
n,m = map(int,input().split())
d = dict()
i,j = 1,n
if(n&1): j -= 1
for y in range(m):
	if(n%2 == 0 and j-i == n//2):
		i += 1
	print(i,j)
	i += 1
	j -= 1

Submission status: Wrong Answer

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, M = [int(x) for x in input().split()]
    ans = [[] for j in range(M)]

    if M & 1:
        for i in range(M):
            if (i + 1) <= M // 2:
                ans[i].append(i + 1)
                ans[i].append(M - i)
            else:
                ans[i].append(M + i - (M // 2) + 1)
                ans[i].append(2 * M + i - (M // 2) + 1)
    else:
        for i in range(M):
            if (i + 1) <= M // 2:
                ans[i].append(i + 1)
                ans[i].append(M + 1 - i)
            else:
                ans[i].append(M + 2 + i - (M // 2))
                ans[i].append(M + 2 + i - (M // 2) + M - 1)

    for a in ans:
        print(*a)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = [i for i in range(1, m+1)]
b = [i for i in reversed(range(m+1, 2*m+1))]
for x, y in zip(a, b):
    print(x, y)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import *
n,m = map(int,input().split())
d = dict()
i,j = 1,n
for y in range(m):
	if(n%2 == 0 and j-i == n//2):
		i += 1
	print(i,j)
	i += 1
	j -= 1
	m -= 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import *
n,m = map(int,input().split())
d = dict()
i,j = 1,n
for y in range(m):
	if(j-i == n//2):
		i += 1
	print(i,j)
	i += 1
	j -= 1
	m -= 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import *
n,m = map(int,input().split())
d = dict()
i,j = 1,n//2
while(i < j):
	print(i,j)
	i += 1
	j -= 1
	m -= 1
	if(m == 0): break
i,j = n//2+1,n
if(m != 0):
	while(i < j):
		print(i,j)
		i += 1
		j -= 1
		m -= 1
		if(m == 0): break

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
if n % 2 == 0 and m > 1:
    ans = list(range(1, m*2+1))
    s = (len(ans)//2)//2
    for i in range(len(ans)//2):
        if i <= s:
            print(ans[i], ans[-1-i]+1)
        else:
            print(ans[i], ans[-1-i])
else:
    ans = list(range(1, m*2+1))
    for i in range(len(ans)//2):
        print(ans[i], ans[-1-i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, M = mi()

l = [i for i in range(1, N+1)]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, M = mi()

l = [i for i in range(1, N+1)]

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, M = mi()

l = [i for i in range(1, N+1)]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = list(map(int, input().strip().split()))
nums = [i+1 for i in range(N)]
for i in range(M):
    print(f'{nums[i]} {nums[-(i+1)]}')

Submission status: Wrong Answer

Solution code:
#!python3

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


def main():
    t = N // 2 + (M + 1) % 2
    l = []
    for i in range(t // 2):
        l.append((i + 1, t - i))
    for i in range((N - t) // 2):
        l.append((t + i + 1, N - i))
    
    for ans in l[:M]:
        print(*ans)
    

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

def r(start, length, done_num, M):
    for i in range(start, start+length):
    	print(f'{i} {i+length}')
    	done_num += 1
    	if done_num == M:
    		break
    else:
    	r(start+2*length, length+1, done_num, M)
    return

done_num = 0
r(1,1,done_num,M)

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, M = mi()

l = [i for i in range(1, N+1)]

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