F - Monotonically Increasing Editorial
			
			by 
cai_lw
			
		
		
		Pythonの標準ライブラリには、combinationsというM個の要素のからN個を取り出す方を全て辞書順に出力する関数があります。
from itertools import combinations
n, m = list(map(int, input().split()))
for l in combinations(range(1, m + 1), n):
    print(*l, sep=' ')
				posted:
				
				
				last update:
				
			
