Problem:
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.

Incorrect submission (verdict: Wrong Answer):
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np

from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,m = inpm()
    ans = []
    if m%2 == 0:
        for i in range(m):
            print(i+1,n-i)
            return
    dic = defaultdict(int)
    dic1 = defaultdict(int)
    for i in range(m):
        if i == 0:
            ans.append([1,n])
            dic[1] += 1
            dic[n] += 1
            dic1[n-2] += 1
            dic1[0] += 1
        elif i == 1:
            ans.append([2,n-2])
            dic[2] += 1
            dic[n-2] += 1
            dic1[n-5] += 1
            dic1[3] += 1
        elif i%2 == 0:
            dic[ans[-1][0]+2] += 1
            dic[ans[-1][1]+1] += 1
            num = ans[-1][1]+1 - ans[-1][0]-2 -1
            dic1[ num] += 1
            dic1[n-2-num] += 1
            ans.append([ans[-1][0]+2,ans[-1][1]+1])
        else:
            dic[ans[-1][0]-1] += 1
            dic[ans[-1][1]-2] += 1
            num = ans[-1][1]+1 - ans[-1][0]-2 -1
            dic1[ num] += 1
            dic1[n-2-num] += 1
            ans.append([ans[-1][0]-1,ans[-1][1]-2])
    for i in range(len(ans)):
        print(*ans[i])

    
if __name__ == "__main__":
    main()

Fixed, accepted submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
def main():
    n,m = map(int,input().split())
    x = m//2
    y = m - x
    for i in range(x):
        print(i+1,2*x+1-i)
    for i in range(y):
        print(2*x+2+i,2*x+2*y+1-i)
    
if __name__ == "__main__":
    main()