Buggy python submission (verdict: Time Limit Exceeded):
int(input())
u = input()
l = []
res = 0


def remove_ad(li):
    li2 = ""
    q = ""
    r = ""
    s = ""
    for p in str(li):
        if (p != q):
            li2 = li2 + p
        else:
            if (p != r):
                li2 = li2 + p
            else:
                if (p != s): li2 = li2 + p
        s = r
        r = q
        q = p
    return(li2)



t = remove_ad(u)
n = len(t)
l = set([])

for i in range(0,n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if(t[i]+t[j]+t[k] not in l):
                l.add(t[i]+t[j]+t[k])
                res += 1

print(res)

Fixed submission:
from itertools import product

N = int(input())
S = input()
S = [int(s) for s in S]


res = 0
for q in product(range(10), repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                res += 1
                break
            else:
                i+=1
print (res)

Buggy python submission (verdict: Time Limit Exceeded):
from itertools import product

N = int(input())
S = input()
S = [int(s) for s in S]


res = 0
for q in product(range(10), repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                res += 1
                break
            else:
                i+=1
print (res)

Fixed submission:
from itertools import product

N = int(input())
S = input()
S = [int(s) for s in S]


res = 0
for q in product(range(10), repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                res += 1
                break
            else:
                i+=1
print (res)

Buggy python submission (verdict: Runtime Error):

N = int(input())
S = input()

S = [int(s) for s in S]


res = 0
for q in product(range(10), repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                res += 1
                break
            else:
                i+=1
print (res)

Fixed submission:
from itertools import product

N = int(input())
S = input()
S = [int(s) for s in S]


res = 0
for q in product(range(10), repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                res += 1
                break
            else:
                i+=1
print (res)

Buggy python submission (verdict: Time Limit Exceeded):
import re

int(input())
u = input()
l = []
res = 0


def remove_ad(li):
    li2 = ""
    q = ""
    r = ""
    s = ""
    for p in str(li):
        if (p != q):
            li2 = li2 + p
        else:
            if (p != r):
                li2 = li2 + p
            else:
                if (p != s): li2 = li2 + p
        s = r
        r = q
        q = p
    return(li2)



t = remove_ad(u)
n = len(t)

for i in range(0,n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if(t[i]+t[j]+t[k] not in l):
                l.append(t[i]+t[j]+t[k])
                res += 1

print(res)

Fixed submission:
from itertools import product

N = int(input())
S = input()
S = [int(s) for s in S]


res = 0
for q in product(range(10), repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                res += 1
                break
            else:
                i+=1
print (res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
l = []
res = 0

for i in range(0,n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if(s[i]+s[j]+s[k] not in l):
                l.append(s[i]+s[j]+s[k])
                res += 1
print(res)

Fixed submission:
from itertools import product

N = int(input())
S = input()
S = [int(s) for s in S]


res = 0
for q in product(range(10), repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                res += 1
                break
            else:
                i+=1
print (res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
l = []
res = 0

for i in range(0,n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if(s[i]+s[j]+s[k] not in l):
                l.append(s[i]+s[j]+s[k])
                res += 1
print(res)

Fixed submission:
from itertools import product

N = int(input())
S = input()
S = [int(s) for s in S]


res = 0
for q in product(range(10), repeat=3):
    i = 0
    for s in S:
        if s==q[i]:
            if i==2:
                res += 1
                break
            else:
                i+=1
print (res)