Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,a,b=map(int,input().split())

    if(a+b>n+1):
        print(-1)
        return
    if(a*b<n):
        print(-1)
        return

    # a*b=n のとき
    A=[None]*(a*b)
    for i in range(a):
        for j in range(b):
            A[i*b+j]=(i+1)*b-j

    d=a*b-n
    m=0
    for i in range(1,a):
        k=min(b-1,d)
        d-=k
        m+=k
        for j in range(i*b,(i+1)*b):
            if(j>=(i+1)*b-k): A[j]=None
            else: A[j]-=m

    ans=[a for a in A if(a is not None)]
    print(*ans)
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,a,b=map(int,input().split())
    if(a+b>n+1):
        print(-1)
        return
    if(a*b<n):
        print(-1)
        return

    ans=list(range(b,0,-1))
    now=b
    d=a*b-n
    for _ in range(a-1):
        k=min(d,b-1)
        d-=k
        next=now+(b-k)
        for i in range(next,now,-1):
            ans.append(i)
        now=next

    print(*ans)
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,a,b=map(int,input().split())

    if(a+b>n+1):
        print(-1)
        return
    if(a*b<n):
        print(-1)
        return

    # a*b=n のとき
    A=[]
    for i in range(a):
        for j in range(b,0,-1):
            A.append(i*b+j)

    d=a*b-n
    m=0
    for i in range(1,a):
        k=min(b-1,d)
        d-=k
        m+=k
        for j in range(i*b,(i+1)*b):
            if(j>=(i+1)*b-k): A[j]=None
            else: A[j]-=m

    ans=[a for a in A if(a is not None)]
    print(*ans)
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,a,b=map(int,input().split())
    if(a+b>n+1):
        print(-1)
        return
    if(a*b<n):
        print(-1)
        return

    ans=list(range(b,0,-1))
    now=b
    d=a*b-n
    for _ in range(a-1):
        k=min(d,b-1)
        d-=k
        next=now+(b-k)
        for i in range(next,now,-1):
            ans.append(i)
        now=next

    print(*ans)
resolve()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
from itertools import chain
def resolve():
    n,a,b=map(int,input().split())

    if(a+b>n+1):
        print(-1)
        return
    if(a*b<n):
        print(-1)
        return

    # a*b=n のとき
    A=[]
    for i in range(a):
        A.append(list(range((i+1)*b,i*b,-1)))

    d=a*b-n
    for arr in A[1:]:
        k=min(b-1,d)
        d-=k
        for _ in range(k): arr.pop()

    # A を座圧する
    S=sorted(list(chain.from_iterable(A)))
    D={a:i for i,a in enumerate(S,1)}
    ans=[None]*n
    for i,a in enumerate(chain.from_iterable(A)):
        ans[i]=D[a]

    print(*ans)
resolve()

Fixed submission:
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n,a,b=map(int,input().split())
    if(a+b>n+1):
        print(-1)
        return
    if(a*b<n):
        print(-1)
        return

    ans=list(range(b,0,-1))
    now=b
    d=a*b-n
    for _ in range(a-1):
        k=min(d,b-1)
        d-=k
        next=now+(b-k)
        for i in range(next,now,-1):
            ans.append(i)
        now=next

    print(*ans)
resolve()