Buggy python submission (verdict: Runtime Error):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,a,b = map(int,ipt().split())
    if a*b < n or a+b-1 > n:
        print(-1)
        exit()
    ans = [str(b-i) for i in range(b)]
    si = n-a+2
    ue = n+1
    i = 0
    while True:
        if si <= b:
            break
        ans[i] += " "+" ".join(map(str,range(si,ue)))
        ue = si
        si -= a-1
        i += 1
    if i < b and b+1 < ue-1:
        ans[i] += " "+" ".join(map(str,range(b+1,ue)))
    print(" ".join(ans))
    return

if __name__ == '__main__':
    main()


Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,a,b = map(int,ipt().split())
    if a*b < n or a+b-1 > n:
        print(-1)
        exit()
    ans = [str(b-i) for i in range(b)]
    si = n-a+2
    ue = n+1
    i = 0
    while True:
        if si <= b or a == 1:
            break
        ans[i] += " "+" ".join(map(str,range(si,ue)))
        ue = si
        si -= a-1
        i += 1
    if i < b and b+1 < ue:
        ans[i] += " "+" ".join(map(str,range(b+1,ue)))
    print(" ".join(ans))
    return

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,a,b = map(int,ipt().split())
    if a*b < n or a+b-1 > n:
        print(-1)
        exit()
    ans = [str(b-i)+" " for i in range(b)]
    si = n-a+2
    ue = n+1
    i = 0
    while True:
        if si <= b:
            break
        ans[i] += " ".join(map(str,range(si,ue)))
        ue = si
        si -= a-1
        i += 1
    if i < b:
        ans[i] += " ".join(map(str,range(b+1,ue)))
    print(" ".join(ans))
    return

if __name__ == '__main__':
    main()


Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,a,b = map(int,ipt().split())
    if a*b < n or a+b-1 > n:
        print(-1)
        exit()
    ans = [str(b-i) for i in range(b)]
    si = n-a+2
    ue = n+1
    i = 0
    while True:
        if si <= b or a == 1:
            break
        ans[i] += " "+" ".join(map(str,range(si,ue)))
        ue = si
        si -= a-1
        i += 1
    if i < b and b+1 < ue:
        ans[i] += " "+" ".join(map(str,range(b+1,ue)))
    print(" ".join(ans))
    return

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,a,b = map(int,ipt().split())
    if a*b < n or a+b-1 > n:
        print(-1)
        exit()
    ans = [[b-i] for i in range(b)]
    si = n-a+2
    ue = n+1
    i = 0
    while True:
        if si <= b:
            break
        for j in range(si,ue):
            ans[i].append(j)
        ue = si
        si -= a-1
        i += 1
    for j in range(b+1,ue):
        ans[i].append(j)
    aa = [" ".join(map(str,i)) for i in ans]
    print(" ".join(aa))
    return

if __name__ == '__main__':
    main()


Fixed submission:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,a,b = map(int,ipt().split())
    if a*b < n or a+b-1 > n:
        print(-1)
        exit()
    ans = [str(b-i) for i in range(b)]
    si = n-a+2
    ue = n+1
    i = 0
    while True:
        if si <= b or a == 1:
            break
        ans[i] += " "+" ".join(map(str,range(si,ue)))
        ue = si
        si -= a-1
        i += 1
    if i < b and b+1 < ue:
        ans[i] += " "+" ".join(map(str,range(b+1,ue)))
    print(" ".join(ans))
    return

if __name__ == '__main__':
    main()