Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = []
    for i in range(l):
        for j in range(i + 1, l + 1):
            sub = s[i:j]
            if sub not in subs:
                subs.append(sub)
    print(sorted(set(subs))[k - 1])


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = []
    for i in range(l):
        for j in range(i + 1, i + k + 1):
            sub = s[i:j]
            if sub not in subs:
                subs.append(sub)
    print(sorted(set(subs))[k - 1])


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = []
    for i in range(l):
        for j in range(i + 1, l + 1):
            sub = s[i:j]
            subs.append(sub)
    print(sorted(set(subs))[k - 1])


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = []
    for i in range(l):
        for j in range(i + 1, i + k + 1):
            sub = s[i:j]
            if sub not in subs:
                subs.append(sub)
    print(sorted(set(subs))[k - 1])


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = set(s)
    for i in range(l):
        for j in range(i + 1, l + 1):
            sub = s[i:j]
            subs.add(sub)
    print(sorted(subs)[k - 1])


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = []
    for i in range(l):
        for j in range(i + 1, i + k + 1):
            sub = s[i:j]
            if sub not in subs:
                subs.append(sub)
    print(sorted(set(subs))[k - 1])


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = set(s)
    for i in range(l):
        for j in range(i + 1, l + 1):
            sub = s[i:j]
            subs.add(sub)
    print(sorted(subs)[k - 1])


if __name__ == "__main__":
    resolve()


Fixed submission:
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = []
    for i in range(l):
        for j in range(i + 1, i + k + 1):
            sub = s[i:j]
            if sub not in subs:
                subs.append(sub)
    print(sorted(set(subs))[k - 1])


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Runtime Error):
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = set()
    for i in range(l):
        for j in range(i + 1, l):
            sub = s[i:j]
            print(sub)
            subs.add(sub)
    return sorted(subs)[k - 1]


if __name__ == "__main__":
    print(resolve())


Fixed submission:
def resolve():
    s = input()
    k = int(input())
    l = len(s)
    subs = []
    for i in range(l):
        for j in range(i + 1, i + k + 1):
            sub = s[i:j]
            if sub not in subs:
                subs.append(sub)
    print(sorted(set(subs))[k - 1])


if __name__ == "__main__":
    resolve()