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:
n,m = list(map(int, input().split()))
flag = 0

if n%2!=0:
    for i in range(m):
        print(i+1,n-i)
else:
    for i in range(m):
        if ((n-i)-(i+1))*2==n:
            flag = 1
        if flag==0:
            print(i+1,n-i)
        else:
            print(i+1,n-i-1)

Submission status: Wrong Answer

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

highest = n // 2 * 2
for i in range(1, m + 1):
    print("{0} {1}".format(i, highest - i + 1))

Submission status: Wrong Answer

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n,m = iim()
if m == 1:
    print(1,2)
else:
    l = list(range(1,n//2+1))[::-1]
#    print(l)
    for i in l[:m]:
        print(i,n-i)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


N,M = m()

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

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

Submission status: Wrong Answer

Solution code:
import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 10 ** 9 + 7

def read_values(): return map(int, input().split())
def read_index(): return map(lambda x: int(x) - 1, input().split())
def read_list(): return list(read_values())
def read_lists(N): return [read_list() for n in range(N)]
def init_dp1(init, N): return [init for _ in range(N)]
def init_dp2(init, N, M): return [[init for _ in range(M)] for _ in range(N)]


class V:
    def __init__(self, f, v=None):
        self.f = f
        self.v = v
 
    def __str__(self):
        return str(self.v)
 
    def ud(self, n):
        if n is None:
            return

        if self.v is None:
            self.v = n
            return
        self.v = self.f(self.v, n) 


def main():
    N, M = read_values()

    if N % 2 == 1: 
        L = N // 2
        R = L + 1
        for _ in range(M):
            print(L, R)
            L -= 1
            R += 1
    else:
        L = 1
        R = 1 + M
        for _ in range(M, 0, -2):
            print(L, R)
            L += 1
            R -= 1
        
        L = M + 2
        R = 2 * M + 1
        for _ in range(M - 1, -1, -2):
            print(L, R)
            L += 1
            R -= 1


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    m = kwargs["m"]
    res = [[] for i in range(m)]

    for i in range(m):
        res[i] = [i % n + 1, (n - 2 - i) % n + 1]

    res = "\n".join([" ".join([str(i) for i in r]) for r in res])
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["n"], kwargs["m"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N, M = map(int, read().split())
    ans1 = N // 2
    ans2 = N // 2 + 1
    for _ in range(M):
        print(ans1, ans2)
        ans1 -= 1
        ans2 += 1
    return

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import deque

N, M = map(int, input().split())
matches = []
used = [False] * N
q = deque(range(N))
l = 1
while q and len(matches) < M:
    i = q.popleft()
    j = (i + l) % N
    if used[i] or used[j]: continue
    used[i], used[j] = True, True
    matches.append((i+1, j+1))
    l += 1
for a, b in matches:
    print(a, b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
n,m=mii()

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

Submission status: Wrong Answer

Solution code:
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
#      .      '                    Udit Gupta @luctivud         ,              
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            ##     ##  #######  # #  ######
                            ##     ##  ##   ##  ###    ##
                            ##     ##  ##    #  # #    ##
                            #########  #######  # #    ##
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

import sys
import math
# sys.setrecursionlimit(10**6)

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))

def printwsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end="tst, ")

MOD = int(1e9+7); BABYMOD = 998244353;
# ################################ HELPER PROGRAMS USED ###################################
# ################################## MAIN STARTS HERE #####################################
# for _testcases_ in range(int(input())):
n, m = get_ints()
if n % 2 == 0:
    a = 1; b = n;
    for i in range(m):
        print(a+i, b-i)
else :
    a = 1; b = n-1;
    for i in range(m):
        print(a+i, b-i)


# #########################################################################################
'''
THE LOGIC AND APPROACH WAS DEVELOPED BY ME @luctivud.
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
PLEASE DO NOT PLAGIARISE.
'''

Submission status: Wrong Answer

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

import math

# 素数判定関数
def isPrime(num):
    # 2未満の数字は素数ではない
    if num < 2: return False
    # 2は素数
    elif num == 2: return True
    # 偶数は素数ではない
    elif num % 2 == 0: return False

    # 3 ~ numまでループし、途中で割り切れる数があるか検索
    # 途中で割り切れる場合は素数ではない
    for i in range(3, math.floor(math.sqrt(num))+1, 2):
        if num % i == 0:
            return False

    # 素数
    return True

# 素数判定
def callIsPrime(input_num=1000):
    numbers = []
    # ループしながら素数を検索する
    for i in range(1, input_num):
        if isPrime(i):
            numbers.append(i)

    # 素数配列を返す
    return numbers
  
#kouho = list(set(list(range(1,n+1))) - set(make_divisors(n)))
kouho = callIsPrime(n)
kouho.sort(reverse=True)
kouho.append(1)

l = 1
r = n + 1
count = 0
for i in kouho:
  if l+i < r:
    print(l, l+i)
    r = l+i
    l += 1
    count += 1
  if count == m:
    break

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=map(int,input().split())
l=m//2
for i in range(l):
  print(i+1,10+m-i)

for i in range(m-l):
  print(i+11,m-i+1)

Submission status: Wrong Answer

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

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

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

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())
# if n%2==1:
half=n//2
for i in range(m):
    print(*[half-i,half+i+1])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
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 = [int(x) for x in input().split()]

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

Submission status: Wrong Answer

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

# entry = {i:i for i in range(n)}
# for i in range(n):
#     print(i)
#     print(entry[0],":", entry[5])
#     print(entry[1],":", entry[4])
#     print(entry[2],":", entry[3])
#     for k in entry.keys():
#         entry[k] += 1
#         entry[k] %= n


for i in range(m):
    n = 2*m - 1
    print(i+1,n-i+1)

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
A = list(range(1,M+1))
B = reversed(list(range(N+1-M,N+1)))
for a,b in zip(A,B):
    print(a,b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt1 = M+1
cnt2 = M+2
for i in range(M):
    print(cnt1,cnt2)
    cnt1-=1
    cnt2+=1

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
from copy import copy, deepcopy
from operator import itemgetter

from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds

#mod = 10**9+7
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

#N = int(input())
N, M = map(int, input().split())
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [list(map(int, input().split())) for i in range(N)]

s=N//2
g=s+1
count=0
cset=set()

while count<M:
    if (g-s) not in cset:
        print(s,g)
        cset.add(N-(g-s))
        count+=1
    s-=1
    g+=1

Submission status: Wrong Answer

Solution code:
N,M = map(int,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())

a=1
b=n

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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())
a = 1
b = N
for i in range(M):
    print(str(a) + " " + str(b))
    a += 1
    b -= 1

Submission status: Wrong Answer

Solution code:
a,b= map(int,input().split())
dp = [i for i in range(1,a+1)]
dp2 = [1+2*i for i in range(b)]
cnt = b

if a %2==0:
  for i in range(1,b+1):
    print(i,a-i+1)
else:
  for i in range(1,b+1):
    print(i,i+dp2[b-i])

Submission status: Wrong Answer

Solution code:
def LI():return list(map(int,input().split()))

# toriaezudasudakedasu

n,m=LI()

for i in range(1,m+1):
    a=i
    b=(a+m+(i-1))
    while b>n:
        b-=m
    print(a,b)

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 = list(map(int, input().split(' ')))


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

Submission status: Wrong Answer

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

if N % 2 == 1:
    ans = [[1, N - 1]]
    l, r = 1, N - 1
    while len(ans) < M:
        l += 1
        r -= 1
        ans.append([l, r])

else:
    ans = [[1, N]]
    l, r = 1, N
    while len(ans) < M:
        l += 1
        r -= 1
        ans.append([l, r])


for l, r in ans:
    print(l, r)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)


def solve(N: int, M: int):
    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())
for i in range(1, M + 1):
  print(i, N - i)

Submission status: Wrong Answer

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""


N,M = m()

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

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

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()
        ans[i] = (a, b)
    for i in range(m):
        print(*ans[i])

Submission status: Wrong Answer

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    if N%2==1:
        a=1
        b=N
        for i in range(M):
            print(a,b)
            a+=1
            b-=1
    else:
        used=[0]*N
        a=N//2-1
        diff=1
        for i in range(M):
            while used[a]==1:
                a+=1
                if a>=N:
                    a%=N
            b=a+diff
            if b>=N:
                    b%=N
            diff+=1
            used[a]=1
            used[b]=1
            print(a+1,b+1)
            
            
                    
            
            
        
        
    

main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M = getlist()
	n = int(N // 2)
	if N % 2 == 0 and N % 4 != 0:
		cnt = 0
		for i in range(M + 1):
			if 4 * i + 2 != N:
				print(n - i, n + 1 + i)
				cnt += 1
			if cnt == M:
				break

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


	


if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
import sys
import math
from collections import deque
import heapq
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,M = IL()

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

Submission status: Wrong Answer

Solution code:
import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    m = kwargs["m"]
    res = [[] for i in range(m)]

    for i in range(m):
        res[i] = [i % n + 1, (n - 1 - i) % n + 1]

    res = "\n".join([" ".join([str(i) for i in r]) for r in res])
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    #kwargs["n"] = cin[0]
    #kwargs["n"], kwargs["k"] = cin
    #kwargs["n"] = [int(i) for i in cin][0]
    kwargs["n"], kwargs["m"] = [int(i) for i in cin]

    cout = main(kwargs)
    print(cout)

Submission status: Wrong Answer

Solution code:
from math import floor
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())
ans = [(1, N)]

for _ in range(M-1):
    a, b = ans[-1]
    ans.append((a+1, b-1))

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

Submission status: Wrong Answer

Solution code:
import sys
n, m = map(int, sys.stdin.readline().split())
i = 1
while i <= m and i <= n/2:
  print(i, n+1-i)
  i += 1

Submission status: Wrong Answer

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

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

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-1-i)
else:
    for i in range(M):
        print(2*i+1,N-2*i)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:


def submit():
    n, m = map(int, input().split())

    if n % 2 == 1:
        e = n - 1
    else:
        e = n

    for i in range(m):
        print(i + 1, e - i)
            

submit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
from collections import deque, defaultdict
from itertools import combinations, combinations_with_replacement
import bisect
from math import factorial, sqrt, log, ceil, floor

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

    start = 1
    end = N - 1 if N % 2 == 0 else N

    for m in range(M):
        print("{} {}".format(start, end))
        start += 1
        end -= 1

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = []
max_ = 2 * m

nokori = n - 2 * m
nokori_hen = nokori + 1
for i in range(m):
    ans.append((i + 1, max_ - i))

if nokori_hen <= m * 2 - 1 and n % 2 == 0:
    ans[0] = (n, ans[0][1])

for i in ans:
    print(*i)

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:
n, m = map(int,input().split())

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split(" "))
if N%2 :
    j=N//2
    for i in range(M) :
        apart = i*2+1
        j = (j+N)%N
        k = (j+apart+N)%N
        print(j+1, k+1)
        j -= 1
else :
    j=N//2 -1
    apart=1
    can_use = set(range(N))
    for i in range(M) :
        if apart == N//2 :
            apart += 1
        j = (j+N)%N
        k = (j+apart+N)%N
        can_use.remove(k)
        can_use.remove(j)
        print(j+1, k+1)
        j -= 1
        apart += 2

Submission status: Wrong Answer

Solution code:
def main():
    N, M = map( int, input().split())
    ANS = []
    if N%2 == 1:
        n = N//2
        for i in range(M):
            ANS.append([n-i, n+1+i])
    else:
        n = N//2
        t = 0
        for i in range(M):
            if 2*i+1 == n:
                t = 1
            ANS.append([n-i, n+1+t+i])

    print( "\n".join( [" ".join( map( str,ans)) for ans in ANS]))
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()
l = 1
r = n
if n%2==0: r -= 1
for i in range(m):
    print(l,r)
    l += 1
    r -= 1
    if n%2 == 0 and i==0:
        r -= 1

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:
N, M = map(int, input().split())

a = N//2
b = a+1

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
import sys
import math
import heapq
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
from collections import Counter
from math import ceil
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#ソート、"a"+"b"、再帰ならPython3の方がいい
#######ここから天ぷら########
dist=[0 for i in range(n)]
A=deque([i+1 for i in range(n)])
i=0
while 1:
    a=A.popleft()
    b=A.pop()
    if dist[b-a]==0 and dist[a+n-b]==0:
        print(a,b)
        i+=1
    else:
        A.appendleft(a)
        a=A.popleft(a)
        continue
    if i==m:
        exit()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

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

aa = n//2
bb = aa+1

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

    for i in range(m):
        print(aa,bb)
        aa-=2
        if aa<=0:
            aa=1
        bb+=1
        if bb>=n+1:
            bb=1

Submission status: Wrong Answer

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