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

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

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

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

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

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

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

#

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

Yes = 'Yes'
No = 'No'


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


main()

Submission status: Wrong Answer

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

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

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

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

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

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

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

#

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

Yes = 'Yes'
No = 'No'


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


main()

Submission status: Wrong Answer

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


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




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


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

Submission status: Wrong Answer

Solution code:
from sys import stdin

N, M = [int(x) for x in stdin.readline().rstrip().split()]

head = 1
tail = N

while head <= M:
    if N % 2 == 0 and tail - head == N // 2:
        tail -= 1
    print(head, tail)
    head += 1
    tail -= 1

Submission status: Wrong Answer

Solution code:
#coding:utf-8

n,m = map(int,input().split())
count = 0
skip = 0
back = 1
point_s = 1
point_e = 0

if m != 1 and n <= 8:
    print("1 2")
    point_s = 3

for i in range(m-1):
    
    point_e = point_s + i + 2
    print("{} {}".format(point_s,point_e))
    count += 1
    skip += 1
    
    if skip == 3:
        back += 1
        point_s = point_e - back
        skip = 1
    else:
        point_s = point_e - back

if m >= 4 :
    point_e -= 1
    point_s = point_e -1
    print("{} {}".format(point_s,point_e))
elif  m == 1:
    print("1 2")

Submission status: Wrong Answer

Solution code:
from sys import stdin

N, M = [int(x) for x in stdin.readline().rstrip().split()]

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

Submission status: Wrong Answer

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

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

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

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

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

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

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

#

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

Yes = 'Yes'
No = 'No'


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


main()

Submission status: Wrong Answer

Solution code:
from sys import stdin

N, M = [int(x) for x in stdin.readline().rstrip().split()]

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

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = 1
M = m
if n%4 == 2 and n%2 == 0: 
    while a<=M:
        print(a,int(2*m+1))
        a+=1
        m-=0.5
else:
    while a<=M:
        print(a,int(2*m))
        a+=1
        m-=0.5

Submission status: Wrong Answer

Solution code:
import math
N,M = map(int,input().split())
answer=[]
if N%2 == 0:
  c = N//2
  if c%2 == 1:
    c1 = c//2+1
    c2 = c+c1
    for i in range(M):
      j = i//2+1
      if i%2 == 0:
        answer.append([c1-j,c1+j])
      else:
        answer.append([c2-j,c2+j])
  else:
    c1 = c//2
    c2 = c+c1
    for i in range(M):
      j = i//2
      if i%2 == 0:
        answer.append([c1-j,c1+j+1])
      else:
        answer.append([c2-j,c2+j+1])
else:
  c = math.ceil(N/2)
  for i in range(1,M+1):
    answer.append([c-i,c+i])

for v in answer:
  print(v[0],v[1])

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = 1
if n%4 == 2 and n%2 == 0: 
    while a<=m:
        print(a,n-1)
        a+=1
        n-=1
else:
    while a<=m:
        print(a,n)
        a+=1
        n-=1

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
a = 1
while a<=m:
    print(a,n)
    a+=1
    n-=1

Submission status: Wrong Answer

Solution code:
import math
N,M = map(int,input().split())
answer=[]
if N%2 == 0:
  a,b,c,d=1,math.ceil(N/2),math.ceil(N/2)+1,N
  for i in range(M):
    if i%2 == 0:
      answer.append([a+i/2,b-i/2])
    else:
      answer.append([c+(i-1)/2,d-(i-1)/2])
else:
  c = math.ceil(N/2)
  for i in range(1,M+1):
    answer.append([c-i,c+i])

for v in answer:
  print(v[0],v[1])

Submission status: Wrong Answer

Solution code:
import math
N,M = map(int,input().split())
answer=[]
a,b,c,d=1,math.ceil(N/2),math.ceil(N/2)+1,N
for i in range(M):
  if i%2 == 0:
    answer.append([a+i/2,b-i/2])
  else:
    answer.append([c+(i-1)/2,d-(i-1)/2])
print('\n'.join([str(int(v[0]))+' '+str(int(v[1])) for v in answer]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


data = [[0] * 2 for _ in range(M)]

if(M%2 == 0):
    for i in range(M):
        data[i][0] = i + 1
        data[i][1] = N - (i + 1)

if(M%2 == 1):
    for i in range(M):
        data[i][0] = i + 1
        data[i][1] = N - (i)

for i in range(M):
    print("{} {}".format(data[i][0], data[i][1]))

Submission status: Wrong Answer

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


data = [[0] * 2 for _ in range(M)]

for i in range(M):
    data[i][0] = i + 1
    data[i][1] = N - (i)

for i in range(M):
    print("{} {}".format(data[i][0], data[i][1]))

Submission status: Wrong Answer

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


data = [[0] * 2 for _ in range(M)]

for i in range(M):
    data[i][0] = i + 1
    data[i][1] = N - (i + 1)

for i in range(M):
    print("{} {}".format(data[i][0], data[i][1]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, M = LI()
    used = [0 for _ in range(N)]
    cur = 0
    pairs = []
    used = set()
    if N % 2 == 0:
        a = 1
        b = N
        while len(pairs) < M:
            if b-a in used or N + a -b in used:
                b -= 1
            pairs.append((a, b))
            used.add(b-a)
            used.add(N+a - b)
            a += 1
            b -= 1

    else:
        a = 1
        b = N - 1
        while len(pairs) < M:
            pairs.append((a, b))
            a += 1
            b -= 1
    for p in pairs:
        print(p[0], p[1])



main()

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, M = LI()
    used = [0 for _ in range(N)]
    cur = 0
    pairs = []
    used = set()
    if N % 2 == 0:
        a = 1
        b = N
        while len(pairs) < M:
            if b-a in used:
                b -= 1
            pairs.append((a, b))
            used.add(b-a)
            used.add(N+a - b)
            a += 1
            b -= 1

    else:
        a = 1
        b = N - 1
        while len(pairs) < M:
            pairs.append((a, b))
            a += 1
            b -= 1
    for p in pairs:
        print(p[0], p[1])



main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    N, M = LI()
    used = [0 for _ in range(N)]
    cur = 0
    pairs = []

    if N % 2 == 0:
        a = 1
        b = N
        while len(pairs) < M:
            pairs.append((a, b))
            a += 1
            b -= 1

    else:
        a = 1
        b = N - 1
        while len(pairs) < M:
            pairs.append((a, b))
            a += 1
            b -= 1
    for p in pairs:
        print(p[0], p[1])



main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M=list(map(int, input().split()))
src=[i+1 for i in range(M*2+1)]
if N%2==0:
  for m in range(M//2):
    a=src[m]
    b=src[M-m]
    print('{} {}'.format(a,b))
  for m in range(M//2):
    a=src[M+1+m]
    b=src[-(m+1)]
    print('{} {}'.format(a,b))
else:
  for m in range(M//2):
    a=src[m]
    b=src[M-1-m]
    print('{} {}'.format(a,b))
  for m in range(M-(M//2)):
    a=src[M+m]
    b=src[-(m+1)]
    print('{} {}'.format(a,b))

Submission status: Wrong Answer

Solution code:
N,M=list(map(int, input().split()))
src=[i+1 for i in range(M*2+1)]
for m in range(M):
  a=src[m]
  b=src[-(m+1)]
  print('{} {}'.format(a,b))

Submission status: Wrong Answer

Solution code:
N,M=list(map(int, input().split()))
src=[i+1 for i in range(M*2)]
for m in range(M):
  a=src[m]
  b=src[-(m+1)]
  print('{} {}'.format(a,b))

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

#Nを半分に割る(切り捨て)
#分割点
dev=int(N/2)+0.5

for i in range(1,M+1):
    print(i,end='')
    print(' ',end='')
    print(int(dev+(dev-i)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=[int(i) for i in 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())
ans=[]
if N%2==1:
  for i in range(M):
    ans.append([i+1,N-i])
else:
  for i in range(M):
    ans.append([i+1,2*M-i])
for k in ans:
  print(*k,sep=' ')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# 君指先跃动の光は、私の一生不変の信仰に、唯私の超电磁炮永生き！
from sys import stdin, stdout
import math
import bisect
from collections import defaultdict
import datetime
import random

# n = int(stdin.readline().strip())
# arr = list(map(int, stdin.readline().strip().split()))

n, m = map(int, stdin.readline().strip().split())

if m == 1:
    stdout.writelines('1 2\n')
else:
    a = n // 2
    b = a + 1
    for i in range(m):
        stdout.writelines('%d %d\n' % (a, b))
        a -= 1
        b += 1

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
 
if M % 2 == 0:
  l = 1
  for i in range(M//2):
    L = []
    L.append(l)
    L.append(2*(M//2-i)+l)
    print(*L)
    l += 1
  l = 2*(M//2)+2
  for i in range(M//2):
    L = []
    L.append(l-1)
    L.append(2*(M//2-i)+l-1)
    print(*L)
    l += 1
  
  
elif M % 2 == 1:
  l = 1
  for i in range(M//2):
    L = []
    L.append(l)
    L.append(2*(M//2-i)+l)
    print(*L)
    l += 1
  l = 2*(M//2)+2
  for i in range(M//2+1):
    L = []
    L.append(l)
    L.append(2*(M//2+1-i)+l-1)
    print(*L)
    l += 1

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
 
if M % 2 == 0:
  l = 1
  for i in range(M//2):
    L = []
    L.append(l)
    L.append(M-i)
    print(*L)
    l += 1
  l = 2*(M//2)+2
  for i in range(M//2):
    L = []
    L.append(l-1)
    L.append(N-i-1)
    print(*L)
    l += 1
  
  
elif M % 2 == 1:
  l = 1
  for i in range(M//2):
    L = []
    L.append(l)
    L.append(M-i)
    print(*L)
    l += 1
  l = 2*(M//2)+2
  for i in range(M//2+1):
    L = []
    L.append(l)
    L.append(N-i)
    print(*L)
    l += 1

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
 
if M % 2 == 0:
  l = 1
  for i in range(M//2):
    L = []
    L.append(l)
    L.append(M-i)
    print(*L)
    l += 1
  l = 2*(M//2)+2
  for i in range(M//2):
    L = []
    L.append(l-1)
    L.append(N-i-1)
    print(*L)
    l += 1
  
  
elif M % 2 == 1:
  l = 1
  for i in range(M//2):
    L = []
    L.append(l)
    L.append(M-i-1)
    print(*L)
    l += 1
  l = 2*(M//2)+2
  for i in range(M//2+1):
    L = []
    L.append(l)
    L.append(N-i-1)
    print(*L)
    l += 1

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
 
if N % 2 == 0:
  cent = int(N/2)
  for i in range(cent//2):
    L = []
    L.append(i+1)
    L.append(cent-i)
    print(*L)
  for i in range(cent//2):
    L = []
    L.append(cent+i+1)
    L.append(N-i)
    print(*L)
  
  
elif N % 2 == 1:
  cent = int((N+1)/2)
  for i in range((cent-1)//2):
    L = []
    L.append(i+1)
    L.append(cent-i-1)
    print(*L)
  for i in range(cent//2):
    L = []
    L.append(cent+i)
    L.append(N-i)
    print(*L)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
 
if N % 2 == 0:
  cent = int(N/2)
  for i in range((cent-1)//2):
    L = []
    L.append(i+1)
    L.append(cent-i)
    print(*L)
  for i in range(cent//2):
    L = []
    L.append(cent+i)
    L.append(N-i-1)
    print(*L)
  
  
elif N % 2 == 1:
  cent = int((N+1)/2)
  for i in range((cent-1)//2):
    L = []
    L.append(i+1)
    L.append(cent-i-1)
    print(*L)
  for i in range(cent//2):
    L = []
    L.append(cent+i)
    L.append(N-i)
    print(*L)

Submission status: Wrong Answer

Solution code:
import math

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

start = 1
end = n

wq = n // 4
for i in range(m):
    if i == wq and i % 2 == 0:
        start += 1
    print(start, end)
    start += 1
    end -= 1

Submission status: Wrong Answer

Solution code:
import math

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

start = 1
end = n

wq = n // 4
for i in range(m):
    if i == wq:
        start += 1
    print(start, end)
    start += 1
    end -= 1

Submission status: Wrong Answer

Solution code:
import math

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

start = 1
end = n

_set = set()

for _ in range(m):
    _abs = min(end - start, start + n - end)
    if _abs in _set:
        start += 1
    print(start, end)
    _set.add(_abs)
    start += 1
    end -= 1

Submission status: Wrong Answer

Solution code:
import math

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

start = 1
end = n - 1

_set = set()

for _ in range(m):
    _abs = min(end - start, start + n - end)
    if _abs in _set:
        end -= 1
    print(start, end)
    _set.add(_abs)
    start += 1
    end -= 1

Submission status: Wrong Answer

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

for i in range(M):
  L = []
  if N % 2 == 0:
    L.append(i+2)
    L.append(N-i-1)
    print(*L)
  if N % 2 == 1:
    L.append(i+1)
    L.append(N-i-1)
    print(*L)

Submission status: Wrong Answer

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

for i in range(M):
  L = []
  if M % 2 == 0:
    L.append(i+2)
    L.append(N-i-1)
    print(*L)
  if M % 2 == 1:
    L.append(i+1)
    L.append(N-i-1)
    print(*L)

Submission status: Wrong Answer

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

x=list(range(1,N+1,1))
print(x)


if N%2==1:
    for i in range(M):
        print(x.pop(0),x.pop(-1))
        
else:
    x_f=x[1:int(N/2+1)]
    x_l=x[int(N/2+1):]
    
    count=0
    
    for i in range(M):
        if len(x_f)>1:
            print(x_f.pop(0),x_f.pop(-1))
            count+=1
            
        if count==M:
            break
        
        if len(x_l)>1:
            print(x_l.pop(0),x_l.pop(-1))
            count+=1
            
        if count==M:
            break

Submission status: Wrong Answer

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

x=list(range(1,N+1,1))
print(x)


if N%2==1:
    for i in range(M):
        print(x.pop(0),x.pop(-1))
        
else:
    x_f=x[1:int(N/2+1)]
    x_l=x[int(N/2+1):]
    print(x_f)
    print(x_l)
    
    count=0
    
    for i in range(M):
        if len(x_f)>1:
            print(x_f.pop(0),x_f.pop(-1))
            count+=1
            
        if count==M:
            break
        
        if len(x_l)>1:
            print(x_l.pop(0),x_l.pop(-1))
            count+=1
            
        if count==M:
            break

Submission status: Wrong Answer

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

x=list(range(1,N+1,1))
print(x)


if N%2==1:
    for i in range(M):
        print(x.pop(0),x.pop(-1))
        
else:
    x_f=x[1:int(N/2+1)]
    x_l=x[int(N/2+1):]
    
    count=0
    
    for i in range(M):
        if len(x_f)>1:
            print(x_f.pop(0),x_f.pop(-1))
            count+=1
            
        if count==M:
            break
        
        if len(x_l)>10:
            print(x_l.pop(0),x_l.pop(-1))
            count+=1
            
        if count==M:
            break

Submission status: Wrong Answer

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

x=list(range(1,N+1,1))
print(x)


if N%2==1:
    for i in range(M):
        print(x.pop(0),x.pop(-1))
        
else:
    x_f=x[1:int(N/2+1)]
    x_l=x[int(N/2+1):]
    print(x_l)
    print(x_f)
    
    count=0
    
    for i in range(M):
        if len(x_f)>1:
            print(x_f.pop(0),x_f.pop(-1))
            count+=1
            
        if count==M:
            break
        
        if len(x_l)>10:
            print(x_l.pop(0),x_l.pop(-1))
            count+=1
            
        if count==M:
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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