1) typing , List

from typing import List
  1. 파이썬의 typing 모듈은 함수, 클래스, 변수 등에 대한 타입 힌트를 제공하기 위해 사용됩니다.
  2. List 는 리스트 타입을 좀 더 명시적으로 보이게끔 힌트를 주는 것이다.

2) itertools

  1. permutaions 와 combinations
permutations(array, 2) => [1,2], [1,3], [2,1], [2, 3], [3, 1], [3, 2]
combinations(array, 2) => [1,2], [1,3], [2,3]

#사용

import itertools

n, m = map(int, input().split())
nums = [i for i in range(1, n+1)]

array = itertools.permutations(nums, m)

for i in array:
    for j in i:
        print(j, end = ' ')
    print()

3) heapq

heaps