The Substring Game! challenge
Don't name things str.
Use a list comprehension to build substr.
s+str[i+1:j] would be simpler as str[i:j].
Iterate through num, rather than the range(q)
Your can wrap your print keywords with (), so this is a bit more Python 3 compatible.


This can get:

S = raw_input()
q = int(raw_input())
nums = map(int, raw_input().split(' '))

substr = [
    S[i:j+1]
    for i in range(len(S))
    for j in range(i, len(S))
]

for i in nums:
    try:
        print(substr[i-1])
    except IndexError:
        print(-1)


However this uses \$O(S^3)\$ of memory. So about \$10^{15}\$, or 1 petabyte of storage. So your code doesn't feasibly work.
Instead work things in the reverse order.

If you have the number \$5\$, you know it's \$5 \gt 3\$, \$5-3 = 2\$, \$2 \le 2\$, and so is S[1:1+2]. And so I'd use:

S = raw_input()
q = raw_input()
nums = map(int, raw_input().split(' '))

for num in nums:
    for i, s in enumerate(reversed(range(1, len(S)+1))):
        if num &lt;= s:
            print(S[i:i+num])
            break
        num -= s
    else:
        print(-1)


Which is still better than yours in terms of time complexity, as it's \$O(nS)\$, \$~10^8\$, rather than \$O(n + S^2)\$, \$10^3 + 10^{10}\$.