Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
H,W,D = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for _ in range(H)]
Q = int(input())

tmp = [0]*(H*W)
for i in range(H):
    for j in range(W):
        tmp[A[i][j]-1] = [i,j]

ans = []
for _ in range(Q):
    aaa = 0
    L,R = [int(zz) for zz in input().split()]
    bl = tmp[L-1][0]
    br = tmp[L-1][1]
    for i in range(L+D,R+1,D):
        l = tmp[i-1][0]
        r = tmp[i-1][1]
        aaa += abs(bl-l) + abs(br-r)
        bl = l
        br = r
    ans.append(aaa)

[print(i) for i in ans]


Fixed submission:
H,W,D = [int(i) for i in input().split()]
A = [[int(i) for i in input().split()] for _ in range(H)]
Q = int(input())

tmp = [0]*(H*W)
for i in range(H):
    for j in range(W):
        tmp[A[i][j]-1] = [i,j]

ans = [0]*(H*W)
for i in range(D):
    bl = tmp[i][0]
    br = tmp[i][1]
    i += D
    zp = 0
    while i < H*W:
        l = tmp[i][0]
        r = tmp[i][1]
        ans[i] = abs(bl-l)+abs(br-r)+zp
        zp = ans[i]
        bl = l
        br = r
        i += D

jjj = []
for _ in range(Q):
    L,R = [int(i) for i in input().split()]
    jjj.append(ans[R-1]-ans[L-1])

[print(i) for i in jjj]
Buggy python submission (verdict: Runtime Error):
from collections import deque
import numpy as np

H,W = [int(zz) for zz in input().split()]
map = [['#']*(W+2) for _ in range(H+2)]

ans = 0
for i in range(1,H+1):
    tmp = input()
    s = list('#'+tmp+'#')
    map[i] = s
    ans += tmp.count('#')

check = [[1]*(W+2) for _ in range(H+2)]
count = [[0]*(W+2) for _ in range(H+2)]
q = deque([(1,1)])
check[1][1] = 0
while q:
    x,y = q.popleft()
    for i,j in [(1,0),(0,1),(-1,0),(0,-1)]:
        if check[x+i][y+j] and map[x+i][y+j] == '.':
            check[x+i][y+j] = 0
            q.append((x+i,y+j))
            count[x+i][y+j] = count[x][y]+1
zz = count[H][W]
if zz == 0:
    print(-1)
else:
    count = set((np.array(count)).flatten())
    for i in count:
        if i > zz:
            ans -= 1
    print(H*W-len(count)-ans)


Fixed submission:
from collections import deque
import numpy as np

H,W = [int(i) for i in input().split()]
l = [list(input()) for _ in range(H)]
check = [[False]*W for _ in range(H)]
ans = [[0]*W for _ in range(H)]

q = deque()
q.append([0,0])
check[0][0] = True

while q:
    i,j = q.popleft()
    for next_i, next_j in [[i+1,j], [i-1,j], [i,j+1], [i,j-1]]:
        if 0 <= next_i < H and 0 <= next_j < W:
            if not check[next_i][next_j] and l[next_i][next_j] != '#':
                q.append([next_i,next_j])
                check[next_i][next_j] = True
                ans[next_i][next_j] = ans[i][j]+1

cnt = 0
for i in range(H):
    for j in range(W):
        if l[i][j] == '.':
            cnt += 1

if ans[H-1][W-1]:
    print(cnt-ans[H-1][W-1]-1)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(zz) for zz in input().split()]
B = set(A)

ans = 0
for i in B:
    p = A.count(i)
    if i > p:
        ans += p
    elif i < p:
        ans += p - i

print(ans)


Fixed submission:
import bisect

N = int(input())
A = [int(zz) for zz in input().split()]
B = set(A)
A.sort()
ans = 0
for i in B:
    p = bisect.bisect_right(A, i) - bisect.bisect_left(A, i)
    if i > p:
        ans += p
    elif i < p:
        ans += p - i

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = (int(i) for i in input().split())
li = [int(i) for i in input().split()]

li.sort()
max = li[-1]

while(len(li) > 1):
    v = li[0]
    for i in range(1, len(li)):
        li[i] = li[i]%v
    for _ in range(li.count(0)):
        li.remove(0)
    li.sort()

if K <= max:
    if K%li[0] == max%li[0]:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')


Fixed submission:
N,K = (int(i) for i in input().split())
li = [int(i) for i in input().split()]

max = max(li)

b = min(li)
for a in li:
    while True:
        if a%b == 0:
            break
        tb = b
        b = a%b
        a = tb

if K <= max:
    if K%b == max%b:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
s = list(innput())

if len(s) == len(set(s)):
    print('yes')
else:
    print('no')


Fixed submission:
s = list(input())

if len(s) == len(set(s)):
    print('yes')
else:
    print('no')
Buggy python submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]

q = [0] * N
for _ in range(N):
    a,b = [int(i) for i in input().split()]
    q[a-1] += 1
    q[b-1] += 1

for i in range(M):
    if q[i]%2 != 0:
        print('NO')
        exit()

print('YES')


Fixed submission:
N,M = [int(i) for i in input().split()]

q = [0] * N
for _ in range(M):
    a,b = [int(i) for i in input().split()]
    q[a-1] += 1
    q[b-1] += 1

for i in range(M):
    if q[i]%2 != 0:
        print('NO')
        exit()

print('YES')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

li = []
li_2 = []
li_3 = []
count = 0
for i in A:
    li.append(i)
    li_2.append(i)
    li_3.append(i)
    li_2.sort()
    li_3.sort(reverse=True)
    if li != li_2 and li != li_3:
        count += 1
        li = [i]
        li_2 = [i]
        li_3 = [i]

print(count+1)


Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

p = A[0]
count = 0
b = 0
c = 0
for i in range(1,N):
    a = A[i]
    b += a-p
    c += abs(a-p)
    if abs(b) != c:
        count += 1
        b = 0
        c = 0
    p = a
print(count+1)
Buggy python submission (verdict: Time Limit Exceeded):
K,S = [int(i) for i in input().split()]

ans = 0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k == S:
                ans += 1
            elif i+j+k > S:
                continue

print(ans)


Fixed submission:
K,S = [int(i) for i in input().split()]

ans = 0
for i in range(K+1):
    for j in range(K+1):
        k = S-i-j
        if k >= 0 and k <= K:
            ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

if N%2 == 0:
    for i in range(1,N,2):
        if A.count(i) != 2:
            print(0)
            exit()
else:
    if A.count(0) != 1:
        print(0)
        exit()
    for i in range(2,N,2):
        if A.count(i) != 2:
            print(0)
            exit()

p = N//2
print(2**p)


Fixed submission:
from collections import Counter

N = int(input())
A = [int(i) for i in input().split()]
zz = Counter(A)

if N%2 == 0:
    for i in range(1,N,2):
        if zz[i] != 2:
            print(0)
            exit()
else:
    if zz[0] != 1:
        print(0)
        exit()
    for i in range(2,N,2):
        if zz[i] != 2:
            print(0)
            exit()

p = N//2
print(2**p%(10**9+7))
Buggy python submission (verdict: Runtime Error):
A = list(input())
B = list(input())
C = list(input())

for _ in range(A.count('a')):
    A.remove('a')

for _ in range(B.count('b')):
    B.remove('b')

for _ in range(C.count('c')):
    C.remove('c')

tmp = A.pop()
while True:
    if tmp == 'a':
        if len(A) == 0:
            print('A')
            exit()
        else:
            tmp = A.pop()

    if tmp == 'b':
        if len(B) == 0:
            print('B')
            exit()
        else:
            tmp = B.pop()

    if tmp == 'c':
        if len(C) == 0:
            print('C')
            exit()
        else:
            tmp = C.pop()


Fixed submission:
from collections import deque

A = deque(list(input()))
B = deque(list(input()))
C = deque(list(input()))

tmp = A.popleft()
while True:
    if tmp == 'a':
        if len(A) == 0:
            print('A')
            break
        else:
            tmp = A.popleft()

    elif tmp == 'b':
        if len(B) == 0:
            print('B')
            break
        else:
            tmp = B.popleft()

    else:
        if len(C) == 0:
            print('C')
            break
        else:
            tmp = C.popleft()
Buggy python submission (verdict: Runtime Error):
li = [int(i) for i in input().split()]

for i in li:
    if i%2 == 0:
        print(0)
        exit()

li.pop(max(li))
ans = 1
for i in li:
    ans *= i

print(ans)


Fixed submission:
li = [int(i) for i in input().split()]

for i in li:
    if i%2 == 0:
        print(0)
        exit()

li.remove(max(li))
ans = 1
for i in li:
    ans *= i

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
lis = input().split()
count = 0
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if(count == n-1)
    print('Three')
    count++


Fixed submission:
n = int(input())
lis = input().split()
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if i == n-1:
    	print('Three')

Buggy python submission (verdict: Runtime Error):
n = int(input())
lis = input().split()
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if i == n-1
    print('Three')

Fixed submission:
n = int(input())
lis = input().split()
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if i == n-1:
    	print('Three')
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())
a = math.sqrt(n)

if n % a == 0.0:
    b = int(math.log10(a)) + 1
    print(b)
else:
    a = int(a)
    while n % a != 0:
        a = a + 1
    b = int(math.log10(a)) + 1
    print(b)

Fixed submission:
import math


n = int(input())
a = math.sqrt(n)

if n % a == 0.0:
    b = int(math.log10(a)) + 1
    print(b)
else:
    a = int(a)
    for i in range(a, 0, -1):
    	if n % i == 0:
    		a = n / i
    		break
    b = int(math.log10(a)) + 1
    print(b)
Buggy python submission (verdict: Runtime Error):
lis = list(map(int, input().split()))
a=lis[0], b=lis[1], c=lis[2], d=lis[3]
x=c-a, y=d-b

for i in range(x):
    print('R', end='')
for i in range(y):
    print('U', end='')
for i in range(x):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
for i in range(x+1):
    print('R', end='')
for i in range(y+2):
    print('U', end='')
for i in range(x+2):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
print('R',end='')




Fixed submission:
lis = list(map(int, input().split()))
a=lis[0]
b=lis[1]
c=lis[2]
d=lis[3]
x=c-a
y=d-b
 
for i in range(x):
    print('R', end='')
for i in range(y):
    print('U', end='')
for i in range(x):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
for i in range(x+1):
    print('R', end='')
for i in range(y+1):
    print('U', end='')
print('L', end='')
print('U', end='')
for i in range(x+1):
    print('L', end='')
for i in range(y+1):
    print('D', end='')
print('R',end='')
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split(" "))
p = list(map(int, input().split(" ")))

sort(p)
print(sum(p[:K]))

         
           

Fixed submission:
N, K = map(int, input().split(" "))
p = list(map(int, input().split(" ")))
 
p.sort()
print(sum(p[:K]))
Buggy python submission (verdict: Runtime Error):
x = list(map(int, input().split(" ")))
ans = 0
for i in range(5):
	if x[i] == 0:
    	ans = i + 1
        
print(ans)

Fixed submission:
x = list(map(int, input().split(" ")))
ans = 0
for i in range(5):
	if x[i] == 0:
		ans = i + 1
        
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split(" "))
S = input()

alp = S[K-1]
if alp == "A":
  S[K-1] = "a"
elif alp == "B":
  S[K-1] = "b"
else:
  S[K-1] = "c"
  
print(S)

Fixed submission:
N, K = map(int, input().split(" "))
S = input()

alp = S[K-1]
if alp == "A":
  print(S[:K-1] + "a" + S[K:])
elif alp == "B":
  print(S[:K-1] + "b" + S[K:])
else:
  print(S[:K-1] + "c" + S[K:])
Buggy python submission (verdict: Runtime Error):
a = []
for i in range(5):
  a.append(int(input()))
k = int(input())

ans = "Yay!"
for i in range(4):
  for j in range(i+1, 5):
  	if a[i] - a[j] > k:
    	ans = ":("
    
print(ans)

Fixed submission:
a = []
for i in range(5):
  a.append(int(input()))
k = int(input())

if a[4] - a[0] <= k:
  print("Yay!")
else:
  print(":(")
Buggy python submission (verdict: Runtime Error):
dish = []
for i in range(5):
    dish.append(int(input()))
print(sum([d // 10 + (d % 10 > 0) for d in dish]) * 10 + sorted([d % 10 for d in dish if d % 10 > 0])[0] - 10)

Fixed submission:
dish = []
for i in range(5):
    dish.append(int(input()))
tmp1 = sum([d // 10 + (d % 10 > 0) for d in dish]) * 10
tmp2 = sum(sorted([d % 10 for d in dish if d % 10 > 0])[:1])
if tmp2 > 0:
    print(tmp1 + tmp2 - 10)
else:
    print(tmp1)
Buggy python submission (verdict: Runtime Error):
N = int(input())
norimono = []
for _ in range(5):
  norimono.append(int(input()))
  
if 
print((N-1) // min(norimono) + 5)

Fixed submission:
N = int(input())
norimono = []
for _ in range(5):
  norimono.append(int(input()))
  
print((N-1) // min(norimono) + 5)
Buggy python submission (verdict: Runtime Error):
N = int(input())
C = [int(input()) for _ in range(N)]

MOD = 10 ** 9 + 7
recent = [-1 for _ in range(N)]
hist = []

ans = 1
for i in range(N):
    c = C[i] - 1
    if recent[c] >= 0 and recent[c] != i-1:
        ans = (ans + hist[recent[c]]) % MOD
    recent[c] = i
    hist.append(ans)
    
print(ans)

Fixed submission:
N = int(input())
C = [int(input()) for _ in range(N)]

MOD = 10 ** 9 + 7
recent = [-1 for _ in range(max(C))]
hist = []

ans = 1
for i in range(N):
    c = C[i] - 1
    if recent[c] >= 0 and recent[c] != i-1:
        ans = (ans + hist[recent[c]]) % MOD
    recent[c] = i
    hist.append(ans)
    
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
X, U = [], []
for i in range(N):
    x, u = input().split(" ")
    X.append(float(x))
    U.append(u)

ans = 0
for i in range(N):
    if u == 'BTC':
        ans += x * 380000
    else:
        ans += x
print(ans)

Fixed submission:
N = int(input())
X, U = [], []
for i in range(N):
    x, u = input().split(" ")
    X.append(float(x))
    U.append(u)

ans = 0
for i in range(N):
    if U[i] == 'BTC':
        ans += X[i] * 380000
    else:
        ans += X[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
X, U = [], []
for i in range(N):
    x, u = map(int, input().split(" "))
    X.append(x)
    U.append(u)

ans = 0
for i in range(N):
    if u == 'BTC':
        ans += x * 380000
    else:
        ans += x
print(ans)

Fixed submission:
N = int(input())
X, U = [], []
for i in range(N):
    x, u = input().split(" ")
    X.append(float(x))
    U.append(u)

ans = 0
for i in range(N):
    if U[i] == 'BTC':
        ans += X[i] * 380000
    else:
        ans += X[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()
 
arr = [0 if s == "W" else 1 for s in S]
sorted_arr = sorted(arr)
 
state = [arr[i] * i for i in range(len(S))]
final_state = [sorted_arr[i] * i for i in range(len(S))]
 
print(final_state - state)
S = input()

arr = [0 if s == "W" else 1 for s in S]

state = sum([arr[i] * i for i in range(len(S))])
final_state = sum([sorted(arr)[i] * i for i in range(len(S))])

print(final_state - state)

Fixed submission:
S = input()
 
arr = [0 if s == "W" else 1 for s in S]
sorted_arr = sorted(arr)
  
state = sum([arr[i] * i for i in range(len(S))])
final_state = sum([sorted_arr[i] * i for i in range(len(S))])
 
print(final_state - state)

Buggy python submission (verdict: Runtime Error):
S = input()
 
arr = [0 if s == "W" else 1 for s in S]
 
state = [arr[i] * i for i in range(len(S))]
final_state = [sorted(arr)[i] * i for i in range(len(S))]
 
print(final_state - state)
S = input()

arr = [0 if s == "W" else 1 for s in S]

state = sum([arr[i] * i for i in range(len(S))])
final_state = sum([sorted(arr)[i] * i for i in range(len(S))])

print(final_state - state)

Fixed submission:
S = input()
 
arr = [0 if s == "W" else 1 for s in S]
sorted_arr = sorted(arr)
  
state = sum([arr[i] * i for i in range(len(S))])
final_state = sum([sorted_arr[i] * i for i in range(len(S))])
 
print(final_state - state)

Buggy python submission (verdict: Runtime Error):
S = input()

arr = [0 if s == "W" else 1 for s in S]

state = [arr[i] * i for i in range(len(S))]
final_state = [sorted(arr)[i] * i for i in range(len(S))]

print(final_state - state)

Fixed submission:
S = input()
 
arr = [0 if s == "W" else 1 for s in S]
sorted_arr = sorted(arr)
  
state = sum([arr[i] * i for i in range(len(S))])
final_state = sum([sorted_arr[i] * i for i in range(len(S))])
 
print(final_state - state)
Buggy python submission (verdict: Runtime Error):
D = int(input())
n_eve = 25 - D
text = "Christmas"
for _ in n_eve:
    text += " Eve"
print(text)

Fixed submission:
D = int(input())
n_eve = 25 - D
text = "Christmas"
for _ in range(n_eve):
    text += " Eve"
print(text)
Buggy python submission (verdict: Runtime Error):
import math
 
N, M = [int(i) for i in input().split(" ")]
S = input()
T = input()
 
def solve():
    gcd = math.gcd(N, M)
    for i in range(1, gcd + 1):
        if S[-int(N / gcd) * i] != T[-int(M / gcd) * i]:
            return -1
    return int(N * M / gcd)
 
print(solve())

Fixed submission:
import fractions
 
N, M = [int(i) for i in raw_input().split(" ")]
S = raw_input()
T = raw_input()
 
def solve():
    gcd = fractions.gcd(N, M)
    for i in range(1, gcd + 1):
        if S[-int(N / gcd) * i] != T[-int(M / gcd) * i]:
            return -1
    return int(N * M / gcd)
 
print(solve())

Buggy python submission (verdict: Runtime Error):
import math
 
N, M = [int(i) for i in input().split(" ")]
S = input()
T = input()
 
def solve():
    gcd = math.gcd(N, M)
    for i in range(1, gcd + 1):
        if S[-int(N / gcd) * i] != T[-int(M / gcd) * i]:
            return -1
    return int(N * M / gcd)
 
print(solve())

Fixed submission:
import fractions
 
N, M = [int(i) for i in raw_input().split(" ")]
S = raw_input()
T = raw_input()
 
def solve():
    gcd = fractions.gcd(N, M)
    for i in range(1, gcd + 1):
        if S[-int(N / gcd) * i] != T[-int(M / gcd) * i]:
            return -1
    return int(N * M / gcd)
 
print(solve())

Buggy python submission (verdict: Runtime Error):
import math

N, M = [int(i) for i in input().split(" ")]
S = input()
T = input()

def solve():
    gcd = math.gcd(N, M)
    for i in range(1, gcd + 1):
        if S[-int(N / gcd) * i] != T[-int(M / gcd) * i]:
            return -1
    return N * M / gcd

print(solve())

Fixed submission:
import fractions
 
N, M = [int(i) for i in raw_input().split(" ")]
S = raw_input()
T = raw_input()
 
def solve():
    gcd = fractions.gcd(N, M)
    for i in range(1, gcd + 1):
        if S[-int(N / gcd) * i] != T[-int(M / gcd) * i]:
            return -1
    return int(N * M / gcd)
 
print(solve())

Buggy python submission (verdict: Runtime Error):
import math

N, M = [int(i) for i in input().split(" ")]
S = input()
T = input()

print(-1 if S[0] != T[0] else int(N * M / math.gcd(N, M)))

Fixed submission:
import fractions
 
N, M = [int(i) for i in raw_input().split(" ")]
S = raw_input()
T = raw_input()
 
def solve():
    gcd = fractions.gcd(N, M)
    for i in range(1, gcd + 1):
        if S[-int(N / gcd) * i] != T[-int(M / gcd) * i]:
            return -1
    return int(N * M / gcd)
 
print(solve())
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = list(map(int, input().split()))

#hoge日めにhoge枚の株券持ち
dp = [[-10 for _ in range(2010)] for _ in range(n+1)]

dp[0][0] = 1000

#　i日目にj枚の株を持っているときに
for i in range(n):
    for j in range(2005):
        if dp[i][j] < 0:
            continue
        #print("i: %d, j: %d, dp: %d"%(i,j,dp[i][j]) )
        maxbuy = dp[i][j]//l[i]
        for k in range(maxbuy+1):
            dp[i+1][j+k] = max(dp[i+1][j+k], dp[i][j]-l[i]*k)
        for k in range(j+1):
            dp[i+1][j-k] = max(dp[i+1][j-k], dp[i][j]+l[i]*k)
print(dp[n][0])

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

#hoge日めにhoge枚の株券持ち
dp = [-7 for _ in range(n+1)]

dp[0] = 1000

#　i日目の所持金
for i in range(1,n+1):
    dp[i] = dp[i-1]
    for j in range(i):
        buy = dp[j]//l[j]
        tmp = dp[j]%l[j] + buy*l[i-1]
        dp[i] = max(dp[i], tmp)

print(dp[n])
Buggy python submission (verdict: Time Limit Exceeded):
def search(string,n):
    cnt=0
    for i in range(1000):
        s=str(i)
        if len(s)==1:
            s='00'+s
        elif len(s)==2:
            s='0'+s
        k=0
        for j in range(n):
            if k==2 and s[k]==string[j]:
                cnt+=1
                #print(l[i])
                break
            if s[k]==string[j]:
               k+=1
    
    return cnt
    
    

n=int(input())
s=input()
l=search(s,n)
print(l)


Fixed submission:
def search(string,n):
    cnt=0
    for i in range(1000):
        s=str(i)
        if len(s)==1:
            s='00'+s
        elif len(s)==2:
            s='0'+s
        k=0
        for j in range(n):
            if k==2 and s[k]==string[j]:
                cnt+=1
                #print(l[i])
                break
            if s[k]==string[j]:
               k+=1
    
    return cnt
    
    

n=int(input())
s=input()
l=search(s,n)
print(l)

Buggy python submission (verdict: Time Limit Exceeded):
def search(string,n):
    l=[]
    for i in range(1000):
        s=str(i)
        if len(s)==1:
            s='00'+s
        elif len(s)==2:
            s='0'+s
        l.append(s)
    cnt=0
    for i in range(1000):
        k=0
        for j in range(n):
            if k==2 and l[i][k]==string[j]:
                cnt+=1
                #print(l[i])
                break
            if l[i][k]==string[j]:
               k+=1
    
    return cnt
    
    

n=int(input())
s=input()
l=search(s,n)
print(l)


Fixed submission:
def search(string,n):
    cnt=0
    for i in range(1000):
        s=str(i)
        if len(s)==1:
            s='00'+s
        elif len(s)==2:
            s='0'+s
        k=0
        for j in range(n):
            if k==2 and s[k]==string[j]:
                cnt+=1
                #print(l[i])
                break
            if s[k]==string[j]:
               k+=1
    
    return cnt
    
    

n=int(input())
s=input()
l=search(s,n)
print(l)
Buggy python submission (verdict: Runtime Error):
n,m=map(int(input().split()))
if m=1:
    print(0)
else:
    print(n-m)

Fixed submission:
n,m=map(int,input().split())
if m==1:
    print(0)
else:
    print(n-m)

Buggy python submission (verdict: Runtime Error):
n,m=map(int(input().split()))
if m=1:
    print(0)
else:
    print(m-n)

Fixed submission:
n,m=map(int,input().split())
if m==1:
    print(0)
else:
    print(n-m)