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:
#!/usr/bin/env python3
import sys

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

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
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())

a = N//2
b = a+1
flag = False

if b-a == N-b + a:
    b += 1
    flag = True

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

Submission status: Wrong Answer

Solution code:
import math

nums = [int(e) for e in input().split()]
n = nums[0]
m = nums[1]

x = -1
y = -1

ms = []

# if n%2 == 0:
#     x = int(n/2-1)
#     y = int(n/2+1)
# else:
x = math.floor(n/2)
y = math.floor(n/2)+1

for i in range(m):
    ms += [[x, y]]
    x -= 1
    y += 1

# print(ms)

for i in ms:
    print(str(i[0]) + " " + str(i[1]))

Submission status: Wrong Answer

Solution code:
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
  if b-a == N/2 + 1:
    b -= 1
  elif b-a == N/2:
    b -= 1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8


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

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


main()

Submission status: Wrong Answer

Solution code:
def abc165_e():
  n, m = map(int, input().split())
  for i in range(m):
    l = i + 1
    u = 2 * m - i
    print('{} {}'.format(l, u))

abc165_e()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():

    from bisect import bisect_left as bl, bisect_right as br, insort
    import sys,heapq,math
    from collections import defaultdict as dd, deque
    def data(): return sys.stdin.readline().strip()
    def mdata(): return list(map(int, data().split()))
    out = sys.stdout.write
    # sys.setrecursionlimit(100000)
    INF = int(1e9)
    mod = int(1e9)+7

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



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

n,m = map(int,input().split())
used = [True]*(n+1)
d = [True]*(n+1)
res = []
mi = 1

dis = 0

ctr = 1

while len(res) < m:
    pt1 = 1 + dis
    pt2 = n - dis
    dd = abs(pt1 - pt2)
    if not d[dd]:
        break


    d[dd] = d[n-dd] = used[pt1] = used[pt2] = False

    dis += 1
    res.append((pt1,pt2))



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

Submission status: Wrong Answer

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b=LI()
  for i in range(1,b+1):
    print(i,a-i)

main()
# print(main())

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
def main():
    n,m = map(int,input().split())
    ans = [[m,m+1]]
    for _ in range(m-1):
        v = ans[-1]
        new = [v[0]-1,v[1]+1]
        if new[0] == 0:
            new[0] = n
        if new[1] == n+1:
            new[1] = 1
        ans.append(new)
    for a in ans:
        print(*a)
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()

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

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

else:
    #lst=set([i for i in range(1,N//2+1)])
    visited=set()
    c=1
    z=1
    while M:
        if c>N:
            c=1
        if c in visited:
            c+=1
            continue
        else:
            Z=c+z
            if Z>N:
                Z-=N
            if c+z in visited:
                c+=1
                continue
            else:
                print(c,Z)
                visited.add(c)
                visited.add(c+z)
                c+=1
                z+=1
                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:
  if m == n//2 -1:
    print(m,m+2)
    m -= 1
  for i in range(m):
    print(i+1,n-i)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
Nlist = []
for i in range(1,N+1):
    Nlist.append(i)
count = 0
for i in range(N//2):
    count += 1
    if count>M:
        break
    print(Nlist[i],Nlist[-(i+1)])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import deque

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

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

for i in range(M):
    a = lis.popleft()
    b = lis.pop()

    print(a,b)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if(n % 2 == 0):
    d = n // 2 - 1
    c = 0
    i = 1
    while(d >= 0):
        print(i,i+d)
        d -= 2
        i += 1
        c += 1
        if(c == m):exit()
    d = n // 2 - 2
    i = n // 2 + 1
    while(d >= 0):
        print(i,i+d)
        d -= 2
        i += 1
        c += 1
        if(c == m):exit()


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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
A = list(range(1, N+1))
i = 1
while (len(A) >1) and i<=M:
    n = len(A)//2
    print(A.pop(n-1), A.pop(n-1))
    i+=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

if N%2 == 1:
    left=N//2
    right=left+2
    for i in range(M):
        print("{} {}".format(left,right))
        left -= 1
        right += 1

else:
    left=N//2
    right=left+1
    for i in range(M):
        print("{} {}".format(left,right))
        left -= 1
        right += 1

Submission status: Wrong Answer

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

n, m = [int(x) for x in input().split()]

left = n // 2
right = left + 1

ans = [[left, right]]

for i in range(m - 1):
    left -= 1
    right += 1
    ans.append([left, right])

for j in ans:
    print(*j)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
if n%2 == 1:
    d = list(range(1, n+1))
    from collections import deque
    d = deque(d)
    ans = [0]*m
    for i in range(m):
        a = d.popleft()
        b = d.pop()
        ans[i] = (a, b)
    for i in range(m):
        print(*ans[i])

else:
    d = list(range(1, n))
    from collections import deque
    d = deque(d)
    ans = [0]*m
    for i in range(m):
        a = d.popleft()
        b = d.pop()
        if b-a == n//2:
            a = n//2
            b = n//2+1
        ans[i] = (a, b)
    for i in range(m):
        print(*ans[i])

Submission status: Wrong Answer

Solution code:
def main():
    from itertools import combinations
    n, m = map(int, input().split())
    if n % 2 == 1:
        l = n // 2
        a = 1
        b = 2 * l
        while a <= l:
            print(a,b)
            a += 1
            b -= 1
    else:
        pass


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
com = list(map(int,input().split()))
N = com[0]
M = com[1]

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
res = []
if N % 2:
  for k in range(1, M + 1):
    res.append((k, N - k))
else:
  for k in range(1, M + 1):
    res.append((k, N - k))
for r in res: print(*r)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

count = 1
while True:
    if count >= N - count:
        break
    if count > M:
        break
    print(count, N - count)
    count += 1

Submission status: Wrong Answer

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

    for a, b in zip(range(M+3, 2*M+2), range(2*M+2, M, -1)):
        if a < b:
            print(a, b)
        else:
            break

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()

ans = [[0, 0] for _ in range(M)]
for i in range(M):
    ans[i][0] = i+1
for k, j in enumerate(range(N, N-M, -1)):
    ans[k][1] = j

for l in ans:
    print(*l)

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

    
l=range(n//2+1-m,n//2+1)
r=range(n//2+1,n//2+m+1)
if math.gcd(n,m)!=1:
    l=range(1,m+1)
    r=[n]+list(range(m+2,2*m+1))
    for i in range(m):
        print(l[i],r[i])
    exit()
for i in range(m):
    a,s=l[i],r[-i-1]
    print(a,s)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n, m = map(int, input().split())

s = 1
f = n
ans = []
d = defaultdict(lambda: defaultdict(lambda: False))
i = 0
while i < m:
    # print(s, f, i)
    tmp = abs(s - f)
    a, b = min(tmp, n - tmp), max(tmp, n - tmp)
    if d[a][b]:
        s += 1
        f -= 1
        continue
    d[a][b] = True
    ans.append(f"{s} {f}")
    s += 1
    f -= 1
    i += 1

print("\n".join(ans))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
def main():
    n,m = map(int,input().split())
    ans = [[1,m+1]]
    for _ in range(m-1):
        v = ans[-1]
        new = [v[0]+1,v[1]+1]
        if new[0] == 0:
            new[0] = n
        if new[1] == n+1:
            new[1] = 1
        ans.append(new)
    for a in ans:
        print(*a)
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

if n % 2 == 1 or m == n / 2 - 2:
    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)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import math

nums = [int(e) for e in input().split()]
n = nums[0]
m = nums[1]

x = -1
y = -1

ms = []

if n%2 == 0:
    x = int(n/2-1)
    y = int(n/2+1)
else:
    x = math.floor(n/2)
    y = math.floor(n/2)+1

for i in range(m):
    ms += [[x, y]]
    x -= 1
    y += 1

# print(ms)

for i in ms:
    print(str(i[0]) + " " + str(i[1]))

Submission status: Wrong Answer

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

# process
ans = []
if N%2 == 1:
    t = 1
    for i in range(M):
        ans.append((t, N-t))
        t += 1
else:
    ans.append((1, N//2))
    ans.append((N//2+1, N))
    t = 2
    for i in range(M-2):
        ans.append((t, N-t+1))
        t += 1

# output
[print(a, b) for a, b in ans]

Submission status: Wrong Answer

Solution code:
import bisect,sys
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29

DIV = (10**9) + 7

def mod_inv_prime(a, mod=DIV):
    return pow(a, mod-2, mod)


def mod_inv(a, b):
    r = a
    w = b
    u = 1
    v = 0
    while w != 0:
        t = r//w
        r -= t*w
        r, w = w, r
        u -= t*v
        u, v = v, u
    return (u % b+b) % b


def CONV_TBL(max, mod=DIV):
    fac, finv, inv = [0]*max, [0]*max, [0]*max
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, max):
        fac[i] = fac[i-1]*i % mod
        inv[i] = mod - inv[mod % i] * (mod//i) % mod
        finv[i] = finv[i-1]*inv[i] % mod

    class CONV:
        def __init__(self):
            self.fac =fac
            self.finv = finv
            pass

        def ncr(self, n, k):
            if(n < k):
                return 0
            if(n < 0 or k < 0):
                return 0
            return fac[n]*(finv[k]*finv[n-k] % DIV) % DIV
        
    return CONV()



sys.setrecursionlimit(200005)


def main():
    N,M = isRaw()
    for m in range(M):
        print(N//2-m,N//2+m+1)

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

ans = []
for i in range(M):
    print(*[i+1, 2 * M - i])

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

n,m = l_in()

#n = 12
#m = n//2-1



i = 1
if n%2 == 0:
    j = n
    for cnt in range(m):
        if cnt == m//2:
            j -= 1
        print(i,j)
#        print(min(j-i,n-(j-i)))
        i+=1

        j-=1
else:
    j = n-1
    for cnt in range(m):
        print(i,j)
#        print(min(j-i,n-(j-i)))
        i+=1

        j-=1

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

c = 0
for i in range(1, N + 1) :
  if N - i + 1 - i == N // 2 :
    continue
  c += 1
  print(i, N - i + 1)
  if c == M :
    break

Submission status: Wrong Answer

Solution code:
from math import ceil #切り上げ
import numpy as np
 
def inp(): return int(input()) #一個だけ読み取り
def inpm(): return map(int,input().split()) #mapオブジェクトで呼び出し
def inpl(): return list(map(int, input().split())) #数字リストをintで
def inpls(): return list(input().split()) #リストをstrで

N,M = inpl()

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
from math import ceil

N, M = map(int, input().split())
center = ceil(N/2)

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
l = list(range(1, N+1))
bet = N - 1

for i in range(M):
    flag = 1
    tmp = min(l)
    tmp_ind = l.index(tmp)
    while flag:
        tmp2 = tmp + bet
        if tmp2 > N:
            tmp2 = tmp % N
        if tmp2 in l and tmp != tmp2:
            print(tmp, tmp2)
            l.remove(tmp)
            l.remove(tmp2)
            flag = 0
            bet -= 1
            break
        tmp_ind += 1
        if tmp_ind == len(l):
            tmp_ind = 0
            bet -= 1
        tmp = l[tmp_ind]

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
# modint
# https://qiita.com/wotsushi/items/c936838df992b706084c
 
# MOD = 10**9 + 7
MOD = N
 
class ModInt:
    def __init__(self, x):
        self.x = x % MOD
 
    def __str__(self):
        return str(self.x)
 
    __repr__ = __str__
 
    def __add__(self, other):
        return (
            ModInt(self.x + other.x) if isinstance(other, ModInt) else
            ModInt(self.x + other)
        )
 
    def __sub__(self, other):
        return (
            ModInt(self.x - other.x) if isinstance(other, ModInt) else
            ModInt(self.x - other)
        )
 
    def __mul__(self, other):
        return (
            ModInt(self.x * other.x) if isinstance(other, ModInt) else
            ModInt(self.x * other)
        )
 
    # // : 商。　逆元はフェルマーの小定理を利用している
    def __truediv__(self, other):
        return (
            ModInt(
                self.x * pow(other.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(self.x * pow(other, MOD - 2, MOD))
        )
 
    # ** : 指数
    def __pow__(self, other):
        return (
            ModInt(pow(self.x, other.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(self.x, other, MOD))
        )
 
    # x が Modint、y が通常の int の場合に、y.__add__(x) に対して、何を適用するか、定義している（→ x.__add__(y)を呼べ） 
    __radd__ = __add__
 
    def __rsub__(self, other):
        return (
            ModInt(other.x - self.x) if isinstance(other, ModInt) else
            ModInt(other - self.x)
        )
 
    __rmul__ = __mul__
 
    def __rtruediv__(self, other):
        return (
            ModInt(
                other.x * pow(self.x, MOD - 2, MOD)
            ) if isinstance(other, ModInt) else
            ModInt(other * pow(self.x, MOD - 2, MOD))
        )
 
    def __rpow__(self, other):
        return (
            ModInt(pow(other.x, self.x, MOD)) if isinstance(other, ModInt) else
            ModInt(pow(other, self.x, MOD))
        )
    
    def int(self):
        return self.x
 
A = [int(i) for i in range(N)]
 
B = []
 
for n in range(1,M+1):
    i = ModInt(n)
    x = ModInt(A[0])
    A.remove(A[0])
 
    y = x + i
    if y.int() in A:
        A.remove(y.int())
        B.append((x,y))
        continue
 
    y = x - i
    if y.int() in A:
        A.remove(y.int())
        B.append((x,y))
        continue

for i in B:
    print(i[0]+1, i[1]+1)

Submission status: Wrong Answer

Solution code:
n,m=[int(i) for i in input().split()]
a=list(range(1,2*m+1))
one=a[:m]
two=a[m:]

for i in range(m):
    print(one[i],two[m-1-i])

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

for line in ans:
    print(*line)

Submission status: Wrong Answer

Solution code:
import sys
N, M = map(int, sys.stdin.readline().split())

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

Submission status: Wrong Answer

Solution code:
i = list(map(int, input().split()))
k=int(i[0]/2)
if i[0]%2==1:
    for j in range(i[1]):
        print(k-j, k+1+j)
else:
    for j in range(i[1]):
        if (k-j)*2!=(k+1+j):
            print(k-j, k+1+j)

Submission status: Wrong Answer

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

    left = 1
    right = left + 1
    for _ in range(M):
        print(left, right)
        left += 1
        right += 2


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = 1
b = n
count = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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:
#code
N,M=map(int,input().split())
p1=N//2
p2=N//2+1
print(p1,p2)
p1-=1
p2+=1
M-=1
while M:
    if(N%2==0 and (p2-p1)==N//2):
        p2+=1
    else:    
        print(p1%N+1,p2%N+1)
        p1-=1
        p2+=1
        M-=1

Submission status: Wrong Answer

Solution code:
from collections import deque
from itertools import product
import sys
import math

sys.setrecursionlimit(200000)
input = sys.stdin.readline


def read():
    N, M = map(int, input().strip().split())
    return N, M


def solve(N, M):
    pairs = []
    n = N # if N % 2 == 0 else N - 1
    for m in range(M):
        pairs.append((m+1, n-m))
    
    for a, b in pairs:
        print(a, b)

if __name__ == '__main__':
    inputs = read()
    solve(*inputs)

Submission status: Wrong Answer

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

count = 1
while True:
    if count >= N - count:
        break
    print(count, N - count)
    count += 1

Submission status: Wrong Answer

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  a,b=LI()
  for i in range(1,b+1):
    print(i,(i*2))

main()
# print(main())

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