Problem p03353 (python)

Fixed submission:
s = input()
K = int(input())
substr = set()
for i in range(len(s)):
    for j in range(i+1, i+K+1):
        substr.add(s[i:j])
print(sorted(substr)[K-1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
s_list = []
for i in range(len(s)):
	for j in range(i + 1, i + K + 1):
		s_list.append(s[i:j])
s_set = set(s_list)
ans = list(s_set.sort())
print(ans[K - 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
s_list = []
for i in range(len(s)):
	for j in range(i + 1, K + 1):
		s_list.append(s[i:j])
s_set = set(s_list)
ans = list(s_set.sort())
print(ans[K - 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
s_list = []
for i in range(len(s)):
	for j in range(1, K + 1):
		s_list.append(s[i:j])
s_set = set(s_list)
ans = list(s_set.sort())
print(ans[K - 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
s_list = []
for i in range(len(s)):
	for j in range(1, K):
		s_list.append(s[i:j])
s_set = set(s_list)
ans = list(s_set.sort())
print(ans[K - 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s)):
	for j in range(len(s)):
		if s[i:j] != '':
			substring.append(s[i:j])
sub_set = set(substring)
ans = list(sub_set)
ans.sort()
if len(s) > 1:
	print(ans[K-1])
else:
	print(s)

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s)):
	for j in range(len(s)):
		if s[i:j] != '':
			substring.append(s[i:j])
sub_set = set(substring)
ans = list(sub_set)
ans.sort()
print(ans[K-1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s) + 1):
	for j in range(i + 1, len(s) + 1):
		substring.append(s[i:j])
substring = list(set(substring))
substring.sort()
print(substring[K - 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s) + 1):
	for j in range(i + 1, len(s) + 1):
		substring.append(s[i:j])
substring = list(set(substring))
substring.sort()
if len(substring) <= 1:
	print(s)
else:
	print(substring[K - 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s) + 1):
	for j in range(i + 1, len(s) + 1):
		substring.append(s[i:j])
substring = list(set(substring))
substring.sort()
if K <= 1 or len(s) <= 1:
	print(s)
else:
	print(substring[K + 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s) + 1):
	for j in range(i + 1, len(s) + 1):
		substring.append(s[i:j])
substring = list(set(substring))
substring.sort()
print(substring)
if K <= 1 or len(s) <= 1:
	print(s)
else:
	print(substring[K + 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s) + 1):
	for j in range(i + 1, len(s) + 1):
		if j == i + 1:
			substring.append(s[i])
		else:
			substring.append(s[i:j])
substring.sort()
if K <= 1 or len(s) <= 1:
	print(s)
else:
	print(substring[K + 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s) + 1):
	for j in range(i + 1, len(s) + 1):
		substring.append(s[i:j])
substring.sort()
if K <= 1 or len(s) <= 1:
	print(s)
else:
	print(substring[K + 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s) + 1):
	for j in range(i+1, len(s) + 1):
		if j == 0:
			substring.append(s[i])
		else:
			substring.append(s[i:j])
substring.sort()
if K <= 1 or len(s) <= 1:
	print(s)
else:
	print(substring[K + 1])

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
substring = []
for i in range(len(s) + 1):
	for j in range(i+1, len(s) + 1):
		if j == 0:
			substring.append(s[i])
		else:
			substring.append(s[i:j])
substring.sort()
print(substring[K + 1])