Buggy python submission (verdict: Time Limit Exceeded):
input()
ns = [n for n in input()]
 
scores = 0
first = []
second = []
third = []
third_nums = None
 
for i in range(len(ns) - 2):
  if i in first:
    continue
  else:
    first.append(i)
  for j in range(i+1, len(ns) - 1):
    if ''.join([ns[i], ns[j]]) in second:
      continue
    else:
      second.append(''.join([ns[i], ns[j]]))
      third_nums = set(ns[j+1:])
      scores += len(third_nums)
      
print(scores)

Fixed submission:
input()
ns = [n for n in input()]
 
scores = 0
first = []
second = []
third = []
third_nums = None
 
for i in range(len(ns) - 2):
  if ns[i] in first:
    continue
  else:
    first.append(ns[i])
  for j in range(i+1, len(ns) - 1):
    if ''.join([ns[i], ns[j]]) in second:
      continue
    else:
      second.append(''.join([ns[i], ns[j]]))
      third_nums = set(ns[j+1:])
      scores += len(third_nums)
      
print(scores)

Buggy python submission (verdict: Time Limit Exceeded):
input()
ns = [n for n in input()]
 
answers = []
first = []
second = []
third = []
third_nums = None
 
for i in range(len(ns) - 2):
  if i in first:
    continue
  else:
    first.append(i)
  for j in range(i+1, len(ns) - 1):
    if ''.join([ns[i], ns[j]]) in second:
      continue
    else:
      second.append(''.join([ns[i], ns[j]]))
      third_nums = set(ns[j+1:])
      for k in third_nums:
        answers.append(''.join([ns[i], ns[j], k]))
print(len(set(answers)))

Fixed submission:
input()
ns = [n for n in input()]
 
scores = 0
first = []
second = []
third = []
third_nums = None
 
for i in range(len(ns) - 2):
  if ns[i] in first:
    continue
  else:
    first.append(ns[i])
  for j in range(i+1, len(ns) - 1):
    if ''.join([ns[i], ns[j]]) in second:
      continue
    else:
      second.append(''.join([ns[i], ns[j]]))
      third_nums = set(ns[j+1:])
      scores += len(third_nums)
      
print(scores)

Buggy python submission (verdict: Time Limit Exceeded):
input()
ns = [n for n in input()]
 
answers = []
first = []
second = []
third = []
 
for i in range(len(ns) - 2):
  if i in first:
    continue
  else:
    first.append(i)
  for j in range(i+1, len(ns) - 1):
    if ''.join([ns[i], ns[j]]) in second:
      continue
    else:
      second.append(''.join([ns[i], ns[j]]))
    for k in range(j+1, len(ns)):
      answers.append(''.join([ns[i], ns[j], ns[k]]))
print(len(set(answers)))

Fixed submission:
input()
ns = [n for n in input()]
 
scores = 0
first = []
second = []
third = []
third_nums = None
 
for i in range(len(ns) - 2):
  if ns[i] in first:
    continue
  else:
    first.append(ns[i])
  for j in range(i+1, len(ns) - 1):
    if ''.join([ns[i], ns[j]]) in second:
      continue
    else:
      second.append(''.join([ns[i], ns[j]]))
      third_nums = set(ns[j+1:])
      scores += len(third_nums)
      
print(scores)

Buggy python submission (verdict: Time Limit Exceeded):
input()
ns = [n for n in input()]

answers = []

for i in range(len(ns) - 2):
  for j in range(i+1, len(ns) - 1):
    for k in range(j+1, len(ns)):
      answers.append(''.join([ns[i], ns[j], ns[k]]))
print(len(set(answers)))

Fixed submission:
input()
ns = [n for n in input()]
 
scores = 0
first = []
second = []
third = []
third_nums = None
 
for i in range(len(ns) - 2):
  if ns[i] in first:
    continue
  else:
    first.append(ns[i])
  for j in range(i+1, len(ns) - 1):
    if ''.join([ns[i], ns[j]]) in second:
      continue
    else:
      second.append(''.join([ns[i], ns[j]]))
      third_nums = set(ns[j+1:])
      scores += len(third_nums)
      
print(scores)