Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = ()
for i in range(n):
    for j in range(i+1, n):
        a = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans.append(a)
ans = (str(l) for l in ans)

for k in range(1, n):
    finalans=ans.count(str(k))
    print(finalans)


Fixed submission:
# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0] * n
for i in range(n):
    for j in range(i+1, n):
        dist = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans[dist] += 1
for k in range(1, n):
    print(ans[k])

Buggy python submission (verdict: Time Limit Exceeded):
# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = []
for i in range(n):
    for j in range(i+1, n):
        a = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans.append(a)
ans = [str(l) for l in ans]

for k in range(1, n):
    finalans=ans.count(str(k))
    print(finalans)


Fixed submission:
# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0] * n
for i in range(n):
    for j in range(i+1, n):
        dist = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans[dist] += 1
for k in range(1, n):
    print(ans[k])

Buggy python submission (verdict: Time Limit Exceeded):
# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = []
for i in range(n):
    for j in range(i+1, n):
        a = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans.append(a)
ans = [str(l) for l in ans]

for k in range(1, n):
    finalans=ans.count(str(k))
    print(finalans)


Fixed submission:
# = map(int, input().split())
# = list(map(int, input().split()))
n, x, y = map(int, input().split())
x -= 1
y -= 1
ans = [0] * n
for i in range(n):
    for j in range(i+1, n):
        dist = min([j-i, abs(x-i)+abs(y-j)+1, abs(y-i)+abs(x-j)+1]) 
        ans[dist] += 1
for k in range(1, n):
    print(ans[k])
Buggy python submission (verdict: Runtime Error):
s = list(input())
n = len(s)
s_0 = s[:(n-1)//2]
s_1 = s[(n+1)//2:]
if s_0 == s_0[::-1] and s_1 == s_1[::-1] and s == s[::-1]
    print("Yes")
else:
    print("No")

Fixed submission:
s = list(input())
n = len(s)
s_0 = s[:(n-1)//2]
s_1 = s[(n+1)//2:]
if s_0 == s_0[::-1] and s_1 == s_1[::-1] and s == s[::-1]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
s = input()
q_num = int(input())
head = []
tail = []
flip = 0
for i in range(q_num):
    q = tuple(input().split())
    if q[0] == '1':
        flip ^= 1
    else:
        f = int(q[1]) - 1
        c = q[2]
        if f ^ flip == 0:
            head.append(c)
        else:
            tail.append(c)
if flip:
    head, tail = tail, head
    s = s[::-1]
head = ''.join(head)
tail = ''.join(tail)
print(head[::-1] + s + tail)

Fixed submission:
s = input()
if s == 'AAA' or s == 'BBB':
    ans = 'No'
else:
    ans = 'Yes'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q_num = int(input())
for i in range(q_num):
    q = tuple(input().split())
    if q[0] == '1':
        s = s[::-1]
    else:
        if q[1] == '1':
            s = q[2] + s 
        else:
            s += q[2]
print(s)

Fixed submission:
s = input()
q_num = int(input())
head = []
tail = []
flip = 0
for i in range(q_num):
    q = tuple(input().split())
    if q[0] == '1':
        flip ^= 1
    else:
        f = int(q[1]) - 1
        c = q[2]
        if f ^ flip == 0:
            head.append(c)
        else:
            tail.append(c)
if flip:
    head, tail = tail, head
    s = s[::-1]
head = ''.join(head)
tail = ''.join(tail)
print(head[::-1] + s + tail)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q_num = int(input())
for i in range(q_num):
    q = tuple(input().split())
    if q[0] == '1':
        s = s[::-1]
    else:
        if q[1] == '1':
            s = q[2] + s 
        else:
            s += q[2]
print(s)

Fixed submission:
s = input()
q_num = int(input())
head = []
tail = []
flip = 0
for i in range(q_num):
    q = tuple(input().split())
    if q[0] == '1':
        flip ^= 1
    else:
        f = int(q[1]) - 1
        c = q[2]
        if f ^ flip == 0:
            head.append(c)
        else:
            tail.append(c)
if flip:
    head, tail = tail, head
    s = s[::-1]
head = ''.join(head)
tail = ''.join(tail)
print(head[::-1] + s + tail)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q_num = int(input())
for i in range(q_num):
    q = list(input().split())
    if q[0] == '1':
        s = s[::-1]
    else:
        if q[1] == '1':
            s = q[2] + s 
        else:
            s += q[2]
print(s)

Fixed submission:
s = input()
q_num = int(input())
head = []
tail = []
flip = 0
for i in range(q_num):
    q = tuple(input().split())
    if q[0] == '1':
        flip ^= 1
    else:
        f = int(q[1]) - 1
        c = q[2]
        if f ^ flip == 0:
            head.append(c)
        else:
            tail.append(c)
if flip:
    head, tail = tail, head
    s = s[::-1]
head = ''.join(head)
tail = ''.join(tail)
print(head[::-1] + s + tail)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split()) 
ans = ['', '', '']
if M == 0:
    print(0)
    exit()
for i in range(M):
    s, c = input().split()
    s = int(s)-1
    if ans[s] in ['', c]:
        ans[s] = c
    else:
        print(-1)
        exit()

if ans[0] == '0' and n >1:
    ans = -1
 
elif ans[0] == '' and ans[1] == '0' and n == 3:
    ans = -1

if ans == -1:
    print(ans)
    exit()

if ans[1] == '':
    ans[1] = '0'
if ans[2] == '':
    ans[2] = '0'

if N == 2:
    ans.pop()
if N == 1:
    ans = ans[0]

print(''.join(ans))

Fixed submission:
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(m)]
for i in range(1000):
    i = str(i)
    if len(i) != n:
        continue
    for [x, y] in lst:
        if i[x-1] != str(y):
            break
    else: 
        print(i)
        exit()

print(-1)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
N = int(input())
S = [input() for i in range(N)]
c = Counter(S)
ans = c.most_common()
ans = [i[0] for i in ans if i[1] == ans[0][1]]
for i in sorted(ans):
    print(i)

Fixed submission:
l =list(map(int, input().split()))
if len(l) == len(set(l)) + 1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
S =[input() for _ in range(N)]
A = [S.count(S[i]) for i in range (N)]
Max_A = max(A)
ans = []
for i in A:
    if i == Max_A:
        ans.append(S[i])
ans = set(ans)
ans = list(ans)
ans.sort()
print("\n".join(ans))
　　　　

Fixed submission:
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
c = Counter(S)
ans = c.most_common()
ans = [i[0] for i in ans if i[1] == ans[0][1]]
for i in sorted(ans):
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S =[input() for _ in range(N)]
A = [S.count(S[i]) for i in range (N)]
Max_A = max(A)
ans = []
for j in range(N):
    if S.count(S[j]) == Max_A:
        ans.append(S[j])
ans = set(ans)
ans = list(ans)
ans.sort()
print("\n".join(ans))


Fixed submission:
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
c = Counter(S)
ans = c.most_common()
ans = [i[0] for i in ans if i[1] == ans[0][1]]
for i in sorted(ans):
    print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A_list = list(map(int, input().split()))
for i in range(len(A_list)):
    for j in range(i+1, len(A_list)):
        if A_list[i] == A_list[j]:
            print("NO")
            exit()
print("YES")

Fixed submission:
N = int(input())
A_list = list(map(int, input().split()))
A_set = set(A_list)
if len(A_list) == len(A_set):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
lst = [[0, 0] for _ in range(n)]
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1][1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    if lst[i][0] == 1:
        wrong += lst[i][1]
print(correct, wrong)

Fixed submission:
a = "abcdefghijklmnopqrstuvwxyz"
a = list(a)

c = input()
n = a.index(c)
print(a[n+1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
n, m = map(int, input().split())
lst = []
for _ in range(n):
    lst.append([0, 0])

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1][1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    wrong += lst[i][1]
print(correct, wrong)


Fixed submission:
n, m = map(int, input().split())
lst = []
for _ in range(n):
    lst.append([0, 0])

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1][1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    if lst[i][0] == 1:
        wrong += lst[i][1]
print(correct, wrong)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
if k <= a:
    a1 = a - k
    b1 = b
elif a < k and k < a + b:
    a1 = 0
    b1 = b - (k-a)
else:
    a1 = 0
    b1 = 0

print(a1, b1)

Fixed submission:
s, t = input().split()
print(t+s)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
if k <= a:
    a1 = a - k
elif a < k and k < a + b:
    a1 = 0
    b1 = b - (k-a)
else:
    a1 = 0
    b1 = 0

print(a1, b1)

Fixed submission:
a, b, k = map(int, input().split())
if k <= a:
    a1 = a - k
    b1 = b
elif a < k and k < a + b:
    a1 = 0
    b1 = b - (k-a)
else:
    a1 = 0
    b1 = 0

print(a1, b1)
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int, input().split())

ans = (a * b) // math.gcd(a, b)
print(ans)

Fixed submission:
import fractions
a,b = map(int, input().split())

ans = (a * b) // fractions.gcd(a, b)
print(ans)

Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int, input().split())

ans = (a * b) // math.gcd(a, b)
print(ans)

Fixed submission:
import fractions
a,b = map(int, input().split())

ans = (a * b) // fractions.gcd(a, b)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())
ans = 0
for X in range(min(K, S)+1):
    for Y in range(min(K, S)+1):
        if 0 <= S-X-Y <= min(K, S):
            ans += 1 
print(ans)

Fixed submission:
K, S = map(int, input().split())
ans = 0
for X in range(min(K, S)+1):
    for Y in range(min(K, S-X)+1):
        if 0 <= S-X-Y <= K:
            ans += 1 
print(ans)
Buggy python submission (verdict: Runtime Error):
import re

x = input()
pattern = "R+"
pat = re.match(pattern, x)
print(len(pat.group()))

Fixed submission:
import re

x = input()
pattern = "R+"
pat = re.search(pattern, x)
if pat:
  print(len(pat.group()))
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n=int(input())

ans=[0]*(1001)
for x in range(1,34):
    for y in range(1,34):
        for z in range(1,34):
            total=x**2+y**2+z**2+x*y+y*z+z*x
            if total<=1000:
                ans[total]+=1

for i in range(1,n+1):
    print(ans[i])


Fixed submission:
n=int(input())

max_n=10**4+5
ans=[0]*(max_n+1)
for x in range(1,105):
    for y in range(1,105):
        for z in range(1,105):
            total=x**2+y**2+z**2+x*y+y*z+z*x
            if total<=max_n:
                ans[total]+=1

for i in range(1,n+1):
    print(ans[i])
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())

l=[0]*(n+1)
for i in range(1,n+1):
    for j in range(i,n+1,i):
        l[j]+=1

ans=0
for i in range(1,n+1):
    ans+=i*l[i]
print(ans)


Fixed submission:
n=int(input())

l=[0]*(n+1)
for i in range(1,n+1):
    for j in range(i,n+1,i):
        l[j]+=1
# print(l)

ans=0
for i in range(1,n+1):
    ans+=i*l[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))

a.sort()
if a[0]==a[1]:
    flag=True
else:
    flag=False
for i in range(n-1):
    if a[i]==0:
        continue
    else:
        for j in range(i+1,n):
            # print(a[j],a[i])
            if a[j]%a[i]==0:
                a[j]=0
            # print(a)

print(n-a.count(0)-1 if flag else n-a.count(0))



Fixed submission:
n=int(input())
a=list(map(int, input().split()))

from collections import Counter
c=Counter(a)

max_a=max(a)
bls=[0]*(max_a+1)
for a_i in a:
    for j in range(a_i, max_a+1, a_i):
        bls[j]+=1
ans=0
for a_i in a:
    if bls[a_i]==1 and c[a_i]==1:
        ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if (a+v*t)>=(b+w*t) and (b-a)%(v-w)==0:
    print('YES')
else:
    print('NO')


Fixed submission:
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())

if v<=w:
    print('NO')
elif a<b:
    if (a+v*t)>=(b+w*t):
        print('YES')
    else:
        print('NO')
else:
    if (a-v*t)<=(b-w*t):
        print('YES')
    else:
        print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=list(map(int, input().split()))

from itertools import accumulate

for _ in range(k):
    imos=[0]*(n+1)
    for i in range(n):
        l=max(0,i-a[i])
        r=min(n,i+a[i]+1)
        imos[l]+=1
        imos[r]-=1
    a=list(accumulate(imos[:n]))
    if a.count(n)==n:
        break
print(*a)


Fixed submission:
n,k=map(int,input().split())
a=list(map(int, input().split()))

from itertools import accumulate

for _ in range(k):
    imos=[0]*(n+1)
    for i in range(n):
        l=max(0,i-a[i])
        r=min(n,i+a[i]+1)
        imos[l]+=1
        imos[r]-=1
    a=list(accumulate(imos[:n]))
    if a.count(n)==n:
        break
print(*a)
Buggy python submission (verdict: Runtime Error):
n, k_in=map(int, input().split())
a_l=list(map(int, input().split()))

def f(s):
    a = s
    b = s
    i=1
    while True:
        a = a_l[a-1]
        a = a_l[a-1]
        b = a_l[b-1]
        if a == b:
            break
        i+=1

    j=1
    a = a_l[0]
    while True:
        a = a_l[a-1]
        b = a_l[b-1]
        if a == b:
            break
        j+=1

    k=1
    while True:
        a = a_l[a-1]
        a = a_l[a-1]
        b = a_l[b-1]
        if a == b:
            break
        k+=1

    return j, k

lam, myu = f(a_l[0])

pos=[]
pos.append(a_l[0])
for i in range(n):
    pos.append(a_l[pos[i]])

if k_in<=lam:
    print(pos[k_in-1])
else:
    k_in=(k_in-lam)%myu
    print(pos[lam+k_in-1])


Fixed submission:
n, k=map(int, input().split())
a=list(map(int, input().split()))

for i in range(n):
    a[i]-=1

rec=[-1]*n
turn=0
current=0

while True:
    if k<=0:
        print(current+1)
        break
    if rec[current]==-1:
        rec[current]=turn
        turn+=1
        current=a[current]
        k-=1
    else:
        loop=turn-rec[current]
        k%=loop
        rec=[-1]*n
Buggy python submission (verdict: Time Limit Exceeded):
n,m,k=map(int, input().split())

mod=998244353

def modinv(a, mod):
    return pow(a, mod-2, mod)

def mod_comb_count(n, r, mod):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

ans=0

for i in range(k+1):
    ans += mod_comb_count(n-1, i, mod) * m * ((m-1)**(n-1-i)) %mod
print(ans%mod)


Fixed submission:
n,m,k=map(int, input().split())

mod=998244353
ans=0
c=1
for i in range(k+1):
    ans+=c*m*pow(m-1, n-1-i, mod)
    ans%=mod
    c*=(n-i-1)*pow(i+1, mod-2, mod)
    c%=mod
print(ans%mod)
Buggy python submission (verdict: Runtime Error):
x=int(input())
for a in range(-100,100):
    for b in range(-100,100):
        if (a**5-b**5)==x:
            a_ans=a
            b_ans=b
            break

print(a_ans,b_ans)

Fixed submission:
x=int(input())
for a in range(-200,200):
    for b in range(-200,200):
        if (a**5-b**5)==x:
            a_ans=a
            b_ans=b
            break

print(a_ans,b_ans)
Buggy python submission (verdict: Time Limit Exceeded):
# from itertools import accumulate
n=int(input())
a=list(map(int, input().split()))
# acc=accumulate(a)

cnt=0
for i in range(n):
    # if acc[]-acc[]=
    for j in range(i,n):
        if a[i]+a[j]==j-i:
            cnt+=1
print(cnt)


Fixed submission:
from collections import defaultdict

n=int(input())
a=list(map(int, input().split()))

d=defaultdict(int)
ans=0

for i, item in enumerate(a):
    d[i+item]+=1
    ans+=d[i-item]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=math.gcd(math.gcd(a,b),c)
print(ans)

Fixed submission:
import math
k=int(input())
ans=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans+=math.gcd(math.gcd(a,b),c)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()

cnt=s.count('R')*s.count('G')*s.count('B')
for i in range(n-2):
    for j in range(i+1,n-1):
        k=2*j-i
        if j<k<n:
            if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                cnt-=1
print(cnt)


Fixed submission:
n=int(input())
s=input()

cnt=s.count('R')*s.count('G')*s.count('B')
for i in range(n-2):
    for j in range(i+1,n-1):
        k=2*j-i
        if j<k<n:
            if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                cnt-=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])

Fixed submission:
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])
Buggy python submission (verdict: Runtime Error):
h,n=map(int,input().split())
a=list(map(int, input().split()))
print('Yes' if h<=sum(a) else (No))

Fixed submission:
h,n=map(int,input().split())
a=list(map(int, input().split()))
print('Yes' if h<=sum(a) else ('No'))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))
mod=10**9+7

bins_zero=[0]*61
bins_one=[0]*61
for a_i in a:
    a_i_bin=list(str(bin(a_i))[2:].zfill(61))
    for i in range(len(a_i_bin)):
        if a_i_bin[i]=='0':
            bins_zero[i]+=1
        else:
            bins_one[i]+=1

ans=0
for i in range(61):
    ans+=(bins_one[i]*bins_zero[i]*(2**(60-i)))
print(ans%mod)



Fixed submission:
n=int(input())
a=list(map(int, input().split()))
mod=10**9+7

bins_zero=[0]*61
bins_one=[0]*61
for a_i in a:
    a_i_bin=list(str(bin(a_i))[2:].zfill(61))
    for i in range(len(a_i_bin)):
        if a_i_bin[i]=='0':
            bins_zero[i]+=1
        else:
            bins_one[i]+=1

ans=0
for i in range(61):
    ans+=(bins_one[i]*bins_zero[i]*(2**(60-i)))
print(ans%mod)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input())

ans=set()
for i in range(n-1):
    i_set=set(s[i+1:])

    for j in i_set:
        j_ind=s.index(j)
        s_i=s[i+1:]
        j_set=set(s_i[s_i.index(j)+1:])
        [ans.add(s[i]+j+k) for k in j_set]

print(len(ans))

Fixed submission:
n = int(input())

s = input()

ans = set()
for i in range(10):
    a = s.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = s.find(str(j), a+1)
        if b == -1:
            continue
        for k in range(10):
            if s.find(str(k), b+1) != -1:
                ans.add(str(i)+str(j)+str(k))
print(len(ans))

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())

for i in range(n-1):
    i_set=set(s[i+1:])

    for j in i_set:
        j_ind=s.index(j)
        s_i=s[i+1:]
        j_set=set(s_i[s_i.index(j)+1:])
        [ans.add(s[i]+j+k) for k in j_set]

print(len(ans))

Fixed submission:
n = int(input())

s = input()

ans = set()
for i in range(10):
    a = s.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = s.find(str(j), a+1)
        if b == -1:
            continue
        for k in range(10):
            if s.find(str(k), b+1) != -1:
                ans.add(str(i)+str(j)+str(k))
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input())

ans=[]
for i in range(n-1):
    i_set=set(s[i+1:])

    for j in i_set:
        j_ind=s.index(j)
        s_j=s[i+1:]
        j_set=set(s_j[s_j.index(j)+1:])
        # print(s_j)

        for k in j_set:
            k_ind=s.index(k)
            ans.append(s[i]+s[j_ind]+s[k_ind])
            # print(s[i]+s[j_ind]+s[k_ind])

print(len(set(ans)))

Fixed submission:
n = int(input())

s = input()

ans = set()
for i in range(10):
    a = s.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = s.find(str(j), a+1)
        if b == -1:
            continue
        for k in range(10):
            if s.find(str(k), b+1) != -1:
                ans.add(str(i)+str(j)+str(k))
print(len(ans))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input())

ans=[]
for i in range(n-1):
    i_set=set(s[i+1:])

    for j in i_set:
        j_ind=s.index(j)
        s_j=s[i+1:]
        j_set=set(s_j[s_j.index(j)+1:])
        # print(s_j)

        for k in j_set:
            k_ind=s.index(k)
            ans.append(s[i]+s[j_ind]+s[k_ind])
            # print(s[i]+s[j_ind]+s[k_ind])

print(len(set(ans)))

Fixed submission:
n = int(input())

s = input()

ans = set()
for i in range(10):
    a = s.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = s.find(str(j), a+1)
        if b == -1:
            continue
        for k in range(10):
            if s.find(str(k), b+1) != -1:
                ans.add(str(i)+str(j)+str(k))
print(len(ans))
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())
mod=10**9+7

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def mod_combinations_cont(n, r, mod):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

if (x+y)%3!=0:
    print(0)
else:
    n=(x+y)//3
    m=(-x+2*y)/3
    if n<0 or m<0:
        print(0)
        exit()
    else:
        print(mod_combinations_cont(n,m,mod)%mod)


Fixed submission:
x,y=map(int,input().split())
mod=10**9+7

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def mod_combinations_count(n, r, mod):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

if (x+y)%3!=0:
    print(0)
else:
    n=(x+y)//3
    m=(-x+2*y)//3
    if n<0 or m<0 or n<m:
        print(0)
        exit()
    else:
        print(mod_combinations_count(n,m,mod)%mod)
Buggy python submission (verdict: Runtime Error):
a,b=map(int(input().split()))

print(a*b if 1<=a<=9 and 1<=b<=9 else -1)

Fixed submission:
a,b=map(int,input().split())

print(a*b if 1<=a<=9 and 1<=b<=9 else -1)

Buggy python submission (verdict: Runtime Error):
a,b=map(int(input().split()))

print('Yes' if 1<=a<=9 and 1<=b<=9 else 'No')

Fixed submission:
a,b=map(int,input().split())

print(a*b if 1<=a<=9 and 1<=b<=9 else -1)
Buggy python submission (verdict: Runtime Error):
print(((int(input())+1)//2)/n)

Fixed submission:
n=int(input())
print(((n+1)//2)/n)