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(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:
    for i in range(M//2+1):
        print(l[N//2-i-1], l[N//2+i+1])
    for i in range(M//2+1, M):
        print(l[N//2-i-2], l[N//2+i+1])

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    main()

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

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+2)]}')

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if not (1 <= M):
    1 // 0
if not (M * 2 + 1 <= N <= 200000):
    1 // 0

Submission status: Wrong Answer

Solution code:
#!python3

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


def main():
    t = N // 2
    l = []
    for i in range(t // 2):
        l.append((i + 1, t - i))
    t += (M + 1) % 2
    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:
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:
    for i in range(M//2):
        print(l[N//2-i-1], l[N//2+i+1])
    for i in range(M//2, M):
        print(l[N//2-i-2], l[N//2+i+1])

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []
for i in range(m + 1):
    if n % 2 == 0 and i == 0:continue
    if n % 2 == 1 and i == m:continue
    temp = (i + 1, n - i)
    ans.append(temp)

for i in ans:
    print(*i)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
ans = list(range(1, m*2+1))
if n % 2 == 0 and m % 2 == 0:
    for i in range(len(ans)//2):
        if i == 0:
            print(ans[i], ans[-1-i]+1)
        else:
            print(ans[i], ans[-1-i])
else:
    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())
if(n%2==1):
    for i in range(1,m+1):
        print(' '.join(map(str,[i,n+1-i])))
    exit()

print(' '.join(map(str,[1,1+n//2])))
m1,m2 = m//2 ,(m-1)//2
sum1 = 1 + n//2
sum2 = (n//2+2) + (n-1)
for i in range(m1):
    print(' '.join(map(str,[2+i,n//2 -i])))
for i in range(m2):
    print(' '.join(map(str,[n//2+2+i,n-1-i])))

Submission status: Wrong Answer

Solution code:
#!python3

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


def main():
    t = N // 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 = map(int,input().split())
for i in range(m):
    temp = (i + 1, n - i)
    print(*temp)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
head1 = 1
tail1 = N // 2
head2 = tail1 + 1
tail2 = N
i = 0
while i < M:
    print(head1, tail1)
    head1 += 1
    tail1 -= 1
    i += 1
    if i >= M:
        break
    print(head2, tail2)
    head2 += 1
    tail2 -= 1
    i += 1

Submission status: Wrong Answer

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

if m%2:
    m+=1;m//=2
    ans1= [(m-i,m+i+1) for i in range(m)]
    ans2=[(2*m-i+2,2*m+i+4) for i in range(m-1)]
    for p in ans1:
        print(*p)
    for p in ans2:
        print(*p)
else:
    m//=2
    ans1= [(m-i,m+i+1) for i in range(m)]
    ans2=[(2*m-i+2,2*m+i+4) for i in range(m)]
    for p in ans1:
        print(*p)
    for p in ans2:
        print(*p)

Submission status: Wrong Answer

Solution code:
#解説参照
#例みて添え字ガチャ
n,m=map(int, input().split( ))

if m%2:
    m+=1;m//=2
    ans1= [(m-i,m+i+1) for i in range(m)]
    ans2=[(2*m-i+1,2*m+i+3) for i in range(m-1)]
    for p in ans1:
        print(*p)
    for p in ans2:
        print(*p)
else:
    m//=2
    ans1= [(m-i,m+i+1) for i in range(m)]
    ans2=[(2*m-i+2,2*m+i+4) for i in range(m)]
    for p in ans1:
        print(*p)
    for p in ans2:
        print(*p)

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
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:
import itertools
import numpy as np

# N,M  = map(int,input().split())
N,M = 7,3
L = np.array([int(_) for _ in range(1,N+1)])
for ls in list(itertools.permutations(L,M*2)):
    ls = np.array(ls)
    data = []
    for m in range(M):
        temp = sorted([ls[2*m],ls[2*m+1]])
        data.append(temp)
    for n in range(N-1):
        ls = np.where(ls<N,ls+1,1)
        for m in range(M):
            temp = sorted([ls[2*m],ls[2*m+1]])
            if temp in data:
                break
            else:
                data.append(temp)
        else:
            continue
        break
    if len(data) == (N*(N-1))//2:
        print(data)
        for t in range(M):
            print(*data[t])
        exit()

Submission status: Wrong Answer

Solution code:
# 解説参照
n,m=map(int, input().split( ))

if m%2:
    m+=1;m//=2
    ans1= [(m-i,m+i+1) for i in range(m)]
    ans2=[(2*m-i+1,2*m+i+3) for i in range(m-1)]
    for p in ans1:
        print(*p)
    for p in ans2:
        print(*p)
else:
    m//=2
    ans1= [(m-i,m+i+1) for i in range(m)]
    ans2=[(2*m-i+1,2*m+i+3) for i in range(m)]
    for p in ans1:
        print(*p)
    for p in ans2:
        print(*p)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Wrong Answer

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Wrong Answer

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

l = 1
r = n
cnt = 0
dp = [False] * (n+1)
while cnt < m:
    if dp[r-l]: r -= 1
    print(l,r)
    dp[r-l] = True
    dp[(l-r)%n] = True
    l += 1
    r -= 1
    cnt += 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)]
#print(l)
flag = 0
for i in range(M):
    #print('a', N//2-i, N//2+i+1)
    if N+l[N//2-i-1]-l[N//2+i] == l[N//2+i]-l[N//2-i-1]:
        print(l[N//2-i-1-1], l[N//2+i])
        flag = 1
        continue
    print(l[N//2-i-1-flag], l[N//2+i])

Submission status: Wrong Answer

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

l = 1
r = n
cnt = 0
while cnt < m:
    if (r-l) == (l-r) % n :r -= 1

    print(l,r)
    l += 1
    r -= 1
    cnt += 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)]
#print(l)
flag = 0
for i in range(M):
    #print('a', N//2-i, N//2+i+1)
    if N+l[N//2-i-1]-l[N//2+i] == l[N//2+i]-l[N//2-i-1]:
        print(l[N//2-i-1], l[N//2+i+1])
        flag = 1
        continue
    print(l[N//2-i-1], l[N//2+i+flag])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
count = 0
if(N % 2 == 1):
  for gap in range(1, 2*M, 2):
    count += 1
    if(count > M):
      break
    cnt = (gap-1)//2
    l = (N+1)//2 - cnt
    r = l + gap
    print(l, r)
    
else:
  for gap in range(1, N//2, 2):
    count += 1
    if(count > M):
      break
    cnt = (gap-1)//2
    l = (N+1)//2 - cnt
    r = l + gap
    print(l, r)
  for gap in range(N-2, N//2 + 1, -2):
    count += 1
    if(count > M):
      break
    cnt = (N-gap)//2
    l = cnt
    r = l + gap
    print(l, r)

Submission status: Wrong Answer

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

age = (N+2-1)//2
sage = N//2

for i in range(M):
    if age == sage:
        age += 1

    print(str(age) + " " + str(sage))

    age += 1
    sage -= 1

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

l = 1
r = n
cnt = 0
while cnt < m:
    print(l,r)
    
    l += 1
    r -= 1
    cnt += 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)]
#print(l)
for i in range(M):
    #print('a', N//2-i, N//2+i+1)
    #if N+l[N//2-i-1]-l[N//2+i] == l[N//2+i]-l[N//2-i-1]:

    print(l[N//2-i-1], l[N//2+i+1])

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()


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

    """
    奇数人のときは１飛ばし、３飛ばし、５飛ばし、、、とすればよい。
    偶数人のときは１飛ばし、３飛ばし、、、で途中から偶数飛ばしに切り替えるとよい。
    構成問題苦手だ。。。
    """

    if N % 2 == 1:
        for l in range(1, N // 2 + 1):
            r = N - l + 1
            print("{} {}".format(l, r))
    else:
        for l in range(1, N // 4 + 1):
            r = N - l + 1
            print("{} {}".format(l, r))
        for l in range(N // 4 + 1, N // 2):
            r = N - l
            print("{} {}".format(l, r))
    

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N,M = map(int, read().split())
a ,b = 1, 2*M

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

Submission status: Wrong Answer

Solution code:
def main():
    from collections import deque
    N, M = (int(i) for i in input().split())
    if N % 2 == 0:
        A = deque([i+1 for i in range(N)])
        p = 0
        for i in range(1, M+1):
            if (N-1)-i != N//2:
                print(A[i], A[N-i-p])
            else:
                p += 1
                print(A[i], A[N-i-p])
    else:
        A = deque([i for i in range(N)])
        for i in range(1, M+1):
            print(A[i], A[N-i])


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
if M%2 != 0:
    M = M + 1
    c = M//2
    d = int((c + 1 + 2*M + 1) / 2)
    print(M, c, d)
    
    i = 0
    while i < c:
        print(c-i, c+1+i)
        i += 1
    j = 0
    while i < M-1:
        print(d-(j+1), d+(j+1))
        i += 1
        j += 1

Submission status: Wrong Answer

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    N,M=map(int,readline().split())
    a=1
    b=N-1
    if N%2==1:
        for _ in range(M):
            print(a,b)
            a+=1
            b-=1
    else:
        for _ in range(M):
            if b-a==N//2:
                b-=1
                print(a,b)
                a+=1
                b-=1
            else:
                print(a,b)
                a+=1
                b-=1
                
if __name__=="__main__":
    main()

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())
ans = []
i = 1
if N % 2 == 0:
    for m in range(M):
        ans.append([i,N-i])
        i+= 1

else:
    for m in range(M):
        ans.append([i,N+1-i])
        i+= 1
        
for a in ans:
    print(*a)

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
if n%2:
    i = 1
    while i < n-i:
        if i > m:break
        print(i,n-i)
        i+=1
else:
    i = 1
    while i < n-i:
        if i >= m:break
        print(i,n-i)
        i+=1
    print(1,2)

Submission status: Wrong Answer

Solution code:
#
import sys
import math
import numpy as np
import itertools

# いくつか入力
n,m = (int(i) for i in input().split())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#
import sys
import math
import numpy as np
import itertools

# いくつか入力
n,m = (int(i) for i in input().split())

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

Submission status: Wrong Answer

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

if n % 2 == 0:
    i = 1
    while i <= m:
        if i < (n - 2) // 2:
            a_i = str(i)
        else:
            a_i = str(i + 1)
        
        b_i = str(n - i)
        
        print(a_i + " " + b_i)
        i += 1
        
elif n % 2 == 1:
    for i in range(1, m + 1):
        a_i = str(i)
        b_i = str(n - i)
        
        print(a_i + " " + b_i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,m=n1()

if n%2==0:
    if m>=2:
        e=n//2
        s=1
        l=e-s
        while e>s:
            print(s,e)
            s+=1
            e-=1
        e=n
        s=n-l+1
        while e>s:
            print(s,e)
            s+=1
            e-=1
    else:
        print(1,2)
else:
    if m>=2:
        e=n//2+1
        s=1
        l=e-s
        while e>s:
            print(s,e)
            s+=1
            e-=1
        e=n
        s=n-l+1
        while e>s:
            print(s,e)
            s+=1
            e-=1
    else:
        print(1,2)

Submission status: Wrong Answer

Solution code:
n,k=map(int,input().split())
ans=[]
a=1
b=n
s=set()
for _ in range(k):
  s.add(abs(a-b))
  s.add(abs(n+a-b)%n)
  ans.append([a,b])
  a+=1
  b-=1
  if abs(a-b) in s or abs(n+a-b)%n in s:
    b-=1
for i in range(k):
  print(*ans[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
INT_MAX=10**19+7
MOD=10**12+7
def INPUT():return list(int(i) for i in input().split())
def LIST_1D_ARRAY(n):return [0 for _ in range(n)]
def LIST_2D_ARRAY(m,n):return [[0 for _ in range(n)]for _ in range(m)]
#=======================================================================
import math as M
n,m=INPUT()
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())
flag = [False]*(10**6)
plu_flag = [False]*(10**6)
plu_max = M
plu_min = 1
even_odd = 1
for i in range(1,N+1):
  if M==0:
    break
    
  if even_odd%2==1:
    if (flag[i])or(flag[i+plu_max]):
      continue
    if (plu_flag[plu_max])or(plu_flag[N-plu_max]):
      plu_max-=1
      continue
    plu_flag[plu_max]=True
    plu_flag[N-plu_max]=True
    flag[i]=True
    flag[i+plu_max]=True
    print(i,i+plu_max)
    plu_max-=1
    M-=1
    even_odd+=1
  else:
    if (flag[i])or(flag[i+plu_min]):
      continue
    if (plu_flag[plu_min])or(plu_flag[N-plu_min]):
      plu_min+=1
      continue
    plu_flag[plu_min]=True
    plu_flag[N-plu_min]=True
    flag[i]=True
    flag[i+plu_min]=True
    print(i,i+plu_min)
    plu_min+=1
    M-=1
    even_odd+=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)]
#print(l)
for i in range(M):
    #print('a', N//2-i, N//2+i+1)
    print(l[N//2-i-1], l[N//2+i])

Submission status: Wrong Answer

Solution code:
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m=map(int,input().split())
half=n//2
lst=[]
if n%2==1:
    for i in range(m):
        lst.append([half-i,half+i+1])
else:
    for i in range(m):
        if i%2==1:
            lst.append([half-i//2,half+i//2+1])
        else:
            lst.append([1+i//2,n-1+i//2])

for i in range(m):
    print(*lst[i])

# dic=defaultdict(int)
# for i in range(m):
#     tmp=lst[i]
#     dic[tmp[1]-tmp[0]]+=1
#     dic[n-tmp[1]+tmp[0]]+=1
# print(dic)

Submission status: Wrong Answer

Solution code:
N,M=map(int,input().split())
a=N//2
b=a+1
print(a,b)
flg=False
for i in range(M-1):
  a,b=a-1,b+1
  if i==M-2 and flg:
    b=_b
  if a+(N//2)==b and N%2==0:
    b+=1
    _b=b-1
    flg=True
  print(a,b)

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
X = [0 for _ in range(N)]
if N % 2 == 0 and N != 4:
    for i in range(M-1):
        print(N-i, i+1)
    print(N//2-1, N//2+1)
elif N == 4:
    print(1, 2)
else:
    for i in range(M):
        print(N-i, i+1)