Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from collections import deque 
N = int(input())
S = input()
s = deque(list(S))
count = 0
def findb(ind,checker):
    global count
    st = S[ind:]
    if "B" in set(st):
        add = st.count("B")
        if add > 0:
            if ind + checker < N:
                if st[checker] == "B":
                    add -= 1
            count += add
def findg(ind,checker):
    global count
    st = S[ind:]
    if "G" in set(st):
        add = st.count("G")
        if add > 0:
            if ind + checker < N:
                if st[checker] == "G":
                    add -= 1
            count += add
def findr(ind,checker):
    global count
    st = S[ind:]
    if "R" in set(st):
        add = st.count("R")
        if add > 0:
            if ind + checker < N:
                if st[checker] == "R":
                    add -= 1
            count += add
for i in range(N-2):
    temp = s.popleft()
    if temp == "R":
        for j in [x for x, y in enumerate(S[i:]) if y == 'G']:
            findb(i+j,j)
        for j in [x for x, y in enumerate(S[i:]) if y == 'B']:
            findg(i+j,j)
    elif temp == "G":
        for j in [x for x, y in enumerate(S[i:]) if y == 'B']:
            findr(i+j,j)
        for j in [x for x, y in enumerate(S[i:]) if y == 'R']:
            findb(i+j,j)
    else:
        for j in [x for x, y in enumerate(S[i:]) if y == 'R']:
            findg(i+j,j)
        for j in [x for x, y in enumerate(S[i:]) if y == 'G']:
            findr(i+j,j)
print(count)

### FIXED CODE ###

N = int(input())
S = input()
r = S.count('R')
g = S.count('G')
b = S.count('B')
count = r * g * b
for i in range(N):
    for j in range(i+1,N-1):
        if 2*j - i <= N-1:
            l = set([S[i],S[j],S[2*j-i]])
            if len(l) == 3:
                count -= 1
print(count)
### BUGGY CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]

for i in range(N):
    temp = A[:i] + A[i + 1:]
    print(max(temp))


### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
sorted_A = sorted(A)
[print(sorted_A[-2] if sorted_A[-1] == A[i] else sorted_A[-1]) for i in range(N)]
### BUGGY CODE ###

import bisect
import heapq
import itertools
import math
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(N)]

a = np.array(list(itertools.accumulate(A, max)))
b = list(itertools.accumulate(A[::-1], max))[::-1]

for i in range(len(A)):
    r = 0
    if len(a[:i]) > 0:
        r = max(r, *a[:i])
    if len(b[i + 1:]) > 0:
        r = max(r, *b[i + 1:])
    print(r)


### FIXED CODE ###

import itertools
import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
A = [int(sys.stdin.readline()) for _ in range(N)]

a = list(itertools.accumulate(A, max))
b = list(itertools.accumulate(A[::-1], max))[::-1]

for i in range(len(A)):
    r = 0
    if 0 <= i - 1 < N:
        r = max(r, a[i - 1])
    if 0 <= i + 1 < N:
        r = max(r, b[i + 1])
    print(r)
### BUGGY CODE ###

import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
A=list(map(int,input().split()))
L=[]

for j in range(1,N+1):
	item = j
	for index in range(0,N):
		if item==A[index]:
			L.append(index+1)
		

print(*L)

### FIXED CODE ###

import sys
import heapq
from collections import deque
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')



N=int(input())
p=list(map(int,input().split()))	
pp=deque(p)
pp.appendleft(0)

q=sorted(range(len(pp)),key=lambda k:pp[k])
qq=deque(q)
qq.popleft()

print(*qq)
### BUGGY CODE ###

n = int(input())
g = [[-1, -1] for i in range(n*n)]
z = [0] * (n*n)

a = []
for _ in range(n):
    a.append([int(i) for i in input().split()])

for i in range(n):
    for j in range(n-2):
        p, q = (i, a[i][j]-1)
        r, s = (i, a[i][j+1]-1)
        r, s = (min(r, s), max(r ,s))
        if p < q:
            g[p*n+q][0] = r*n + s
        else:
            g[q*n+p][1] = r*n + s
        z[r*n+s] += 1

from collections import deque
qu = set([])
for i in range(n):
    p, q = (i, a[i][0]-1)
    p, q = (min(p, q), max(p ,q))
    if z[p*n+q] == 0:
        qu.add(p*n+q)

ans = 0
re = 0
qu = deque(qu)
while True:
    nqu = deque()
    while qu:
        s = qu.popleft()
        re += 1
        for t in g[s]:
            if t != -1:
                z[t] -= 1
                if z[t] == 0:
                    nqu.append(t)
    ans += 1    
    qu = nqu
    if not qu:
        break

if re == n*(n-1)//2:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

n = int(input())
g = [[-1, -1] for i in range(n*n)]
z = [0] * (n*n)

a = []
for _ in range(n):
    a.append([int(i) for i in input().split()])

for i in range(n):
    for j in range(n-2):
        p, q = (i, a[i][j]-1)
        r, s = (i, a[i][j+1]-1)
        r, s = (min(r, s), max(r ,s))
        if p < q:
            g[p*n+q][0] = r*n + s
        else:
            g[q*n+p][1] = r*n + s
        z[r*n+s] += 1

qu = set([])
for i in range(n):
    p, q = (i, a[i][0]-1)
    p, q = (min(p, q), max(p ,q))
    if z[p*n+q] == 0:
        qu.add(p*n+q)

ans = 0
re = 0
while True:
    nqu = []
    while qu:
        s = qu.pop()
        re += 1
        for t in g[s]:
            if t != -1:
                z[t] -= 1
                if z[t] == 0:
                    nqu.append(t)
    ans += 1    
    qu = nqu
    if not qu:
        break

if re == n*(n-1)//2:
    print(ans)
else:
    print(-1)
### BUGGY CODE ###

# coding: utf-8
# Your code here!
N,= map(int, input().split())
S=[]
su=0
for i in range(N):
    a= input()
    if(a in S):
        continue
    S+=[a]
    su+=1
print(su)

### FIXED CODE ###

# coding: utf-8
# Your code here!
N,= map(int, input().split())
S=[]
su=0
for i in range(N):
    a = input()
    S+=[a]    
print(len(set(S)))
### BUGGY CODE ###

n,k = map(int, input().split())
a = []
for i in range(10**18):
    n = abs(n-k)
    a.append(n)
    if a[len(a)-2] < n:
        print(a[len(a)-2])
        break

### FIXED CODE ###

n,k = map(int, input().split())
a,b = divmod(n,k)
print(min(b,k-b))
### BUGGY CODE ###

import math

H, N = map(int,input().split()) # 複数の数字を変数に格納
List = [list(map(int,input().split())) for i in range(N)] # [[1,2],[3,4],[5,6]]

#for i in range(N):
#    List[i].append(List[i][0] / List[i][1])
    
#List.sort(key=lambda x: x[2], reverse=True)

table = [[0] * H for i in range(N)]

for i in range(H):
    table[0][i] = List[0][1] * (math.ceil((i+1) / List[0][0]))
    
for j in range(1,N):
    attack = List[j][0]
    MP = List[j][1]
    for i in range(H):
        if (i+1) < attack:
            table[j][i] = min(table[j-1][i], MP)
        else:
            table[j][i] = min(table[j-1][i], table[j][i-attack]+MP)
            
print(table[N-1][H-1])

### FIXED CODE ###

import math

H, N = map(int,input().split()) # 複数の数字を変数に格納
List = [list(map(int,input().split())) for i in range(N)] # [[1,2],[3,4],[5,6]]

#for i in range(N):
#    List[i].append(List[i][0] / List[i][1])
    
#List.sort(key=lambda x: x[2], reverse=True)

table = [[0] * H for i in range(N)]

for i in range(H):
    table[0][i] = List[0][1] * (math.ceil((i+1) / List[0][0]))
    
for j in range(1,N):
    attack = List[j][0]
    MP = List[j][1]
    for i in range(H):
        if (i+1) < attack:
            table[j][i] = min(table[j-1][i], MP)
        else:
            table[j][i] = min(table[j-1][i], table[j][i-attack]+MP)
            
print(table[N-1][H-1])
### BUGGY CODE ###

def inpl(): return list(map(int, input().split()))

def match(x):
    return (2, 5, 5, 4, 5, 6, 3, 7, 6)[x-1]
N, M = inpl()
A = inpl()
A.sort(reverse = True)
matnum = set([match(a) for a in A])
maxdig = 1
Dig = [{0}]
for i in range(1,1+N//min(matnum)):
    k = set()
    for v in Dig[-1]:
        for a in matnum:
            k.add(a+v)
    if N in k:
        maxdig = i
    Dig.append(k)
N1 = N
anstr = ''
for i in range(maxdig, 0, -1):
    for a in A:
        if N1-match(a) in Dig[i-1]:
            anstr += str(a)
            N1 -= match(a)
            break
        
print(anstr)


### FIXED CODE ###

def inpl(): return list(map(int, input().split()))

N, M = inpl()
A = inpl()
A.sort(reverse = True)

inf = float('inf')
match = (inf, 2, 5, 5, 4, 5, 6, 3, 7, 6)
matnum = set([match[a] for a in A])
dp = [0]+[-inf]*N

for i in range(1, N+1):
    dp[i] = max([10*dp[max(-1,i-match[a])] + a for a in A])

print(''.join(sorted(str(dp[-1]), reverse = True)))
### BUGGY CODE ###

A, B, M = map(int, input().split())
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
m = []
for n in range(M):
    m.append([int(s) for s in input().split()])

min = a[0] + b[0]
for i in range( len(a)):
    for j in range(len(b)):
        price = a[i] + b[j]
        discountPrice = price
        for k in range(M):
            if i + 1 in m[k] and j + 1 in m[k]:
                discountPrice = price - m[k][2]
            if min > discountPrice:
                min = discountPrice


print(min)


### FIXED CODE ###

A, B, M = map(int, input().split())
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
m = []


for n in range(M):
    m.append([int(s) for s in input().split()])

minValue = min(a) + min(b)

for i in range(M):
    discountPrice = a[m[i][0] - 1] + b[m[i][1] - 1] - m[i][2]
    if discountPrice  < minValue:
        minValue = discountPrice

print(minValue)
### BUGGY CODE ###

r,g,b,n=map(int,input().split())

lst=[r,g,b]
lst.sort()
r=lst[2]
g=lst[1]
b=lst[0]

rlim=n//r
glim=n//g
blim=n//b

blist=[]
for i in range(blim+1):
    blist.append(i*b)


cnt=0
for i in range(rlim+1):
    #glim=(n-i*r)//g
    for j in range(glim+1):
        if (n-i*r-j*g) in blist:
            cnt+=1
print(cnt)

### FIXED CODE ###

r,g,b,n=map(int,input().split())

lst=[r,g,b]
lst.sort()
r=lst[2]
g=lst[1]
b=lst[0]

rlim=n//r
glim=n//g
blim=n//b

"""
blist = [i*b for i in range(blim+1)]

glist = [i*g for i in range(glim+1)]

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1
    return False
"""

cnt=0

for i in range(rlim+1):
    glim=(n-i*r)//g
    for j in range(glim+1):
        if (n-i*r-j*g)%b==0:
            cnt+=1
print(cnt)
### BUGGY CODE ###

#from math import gcd
from fractions import gcd
#from functools import reduce

mod = 10**9 + 7

def lcm(a, b):
	return a * b // gcd(a, b)


N = int(input())
A = [i for i in map(int, input().split())]

#ans = reduce(lcm, A)

a = 1
for i in A:
	a = lcm(a, i)

#print(a, ans)
B = [a//i for i in A]

print(sum(B) % mod)


### FIXED CODE ###

#from math import gcd
from fractions import gcd
from functools import reduce

mod = 10**9 + 7

def lcm(a, b):
	return a * b // gcd(a, b)


N = int(input())
A = [i for i in map(int, input().split())]

ans = reduce(lcm, A)

#print(ans)
B = [ans//i for i in A]

print(sum(B) % mod)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

n,t = map(int, input().split())

apple_price = list(map(int, input().split()))
price_diff = []

for i in range(n):
    if(i <= n-2):
        if(apple_price[i] < apple_price[i+1]):
            for j in range(i,n):
                diff = apple_price[j] - apple_price[i]
                if(diff>0):
                    price_diff.append(diff)
    else:
        for j in range(i, n):
            diff = apple_price[j] - apple_price[i]
            if (diff > 0):
                price_diff.append(diff)

if(price_diff):
    print(price_diff.count(max(price_diff)))
else:
    print(0)

### FIXED CODE ###

# -*- coding: utf-8 -*-

n,t = map(int, input().split())

apple_price = list(map(int, input().split()))
price_diff = []
now_min = 10**9


for i in range(n):
    if(now_min > apple_price[i]):
        now_min = apple_price[i]
    else:
        price_diff.append(apple_price[i] - now_min)

if(price_diff):
    print(price_diff.count(max(price_diff)))
else:
    print(0)
### BUGGY CODE ###

from sys import stdin

N = stdin.readline().rstrip().split()
N = int(N[0])

str_list = stdin.readline().rstrip().split()
int_list = int_data = [int(i) for i in str_list]

cnt_list = []
ret_list = []

for i in range(1, N+1):
    tmp_cnt = int_list.count(i)
    cnt_list.append(tmp_cnt)

for i in range(N):
    tmp_ret = 0
    for j in range(N):
        if i == j:
            if cnt_list[j] < 3:
                continue
            else:
                tmp_ret += (cnt_list[j]-1)*(cnt_list[j]-2) // 2
        else:
            if cnt_list[j] < 2:
                continue
            else:
                tmp_ret += cnt_list[j]*(cnt_list[j]-1) // 2
    
    ret_list.append(tmp_ret)

for i in int_list:
    print(ret_list[i-1])

### FIXED CODE ###

from sys import stdin

N = stdin.readline().rstrip().split()
N = int(N[0])

int_list = list(map(int, stdin.readline().rstrip().split()))
cnt_list = [0] * N

for i in int_list:
    cnt_list[i-1] += 1

ret_list = [0] * N

# これはO(N)でいける

tmp_ans = 0
for i in range(N):
    if cnt_list[i] > 1:
        tmp_ans += cnt_list[i]*(cnt_list[i]-1) // 2


for i in range(N):
    if cnt_list[i] < 1:
        tmp_ret = 0
    else:
        tmp_ret = tmp_ans - cnt_list[i]*(cnt_list[i]-1) // 2 + (cnt_list[i]-1)*(cnt_list[i]-2) // 2
    ret_list[i] = tmp_ret

for i in int_list:
    print(ret_list[i-1])
### BUGGY CODE ###

n = int(input())
item_list = []
ans = 0
for i in range(n):
  item = input()
  if not item in item_list:
    item_list.append(item)
    ans +=1
print(ans)

### FIXED CODE ###

n = int(input())
ans = set()
for i in range(n):
  ans.add(input())
print(len(ans))
### BUGGY CODE ###

N = int(input())
h = list(map(int, input().split()))
cnt = 0
start = 0
end = 0
while True:
    for i in range(N):
        if h[i] != 0:
            start = i
            break

    end = N
    for i in range(start + 1, N):
        if h[i] == 0:
            end = i
            break

    for i in range(start, end):
        h[i] = h[i] - 1

    cnt += 1
    start = 0
    end = 0
    if sum(h) == 0:
        break

print(cnt)

### FIXED CODE ###

import sys

N = int(input())
h = list(map(int, input().split()))
cnt = 0
start = 0
end = 0
if sum(h) == 0:
    print(0)
    sys.exit()

while True:
    for i in range(N):
        if h[i] != 0:
            start = i
            break

    end = N
    for i in range(start + 1, N):
        if h[i] == 0:
            end = i
            break

    for i in range(start, end):
        if h[i] != 0:
            h[i] = h[i] - 1

    cnt += 1
    start = 0
    end = 0
    if sum(h) == 0:
        break

print(cnt)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
k, q = map(int, input().split())
d = list(map(int, input().split()))

query = []
for _ in range(q):
    query.append(list(map(int, input().split())))

def answer_query(n, x, m):
    l = [d[i]%m for i in range(k)]
    n -= 1
    zero = l.count(0)
    count = n // k
    zero_total = zero*count
    rem = n % k
    s = sum(l)
    total = s%m * count + x%m
    for i in range(rem):
        total += l[i]
        if l[i] == 0:
            zero_total += 1

    total //= m
    total += s//m * count

    print(n-total-zero_total)
for n, x, m in query:
    answer_query(n, x, m)


### FIXED CODE ###

import sys
input = sys.stdin.readline
k, q = map(int, input().split())
d = list(map(int, input().split()))
query = [None]*q
for i in range(q):
    query[i] = list(map(int, input().split()))

def answer_query(n, x, m):
    l = [m if i%m == 0 else i%m for i in d]
    count = n // k
    rem = n % k
    s = sum(l)
    total = s%m * count + x%m
    for i in range(rem):
        total += l[i]

    total //= m
    total += s//m * count

    print(n-total)


for n, x, m in query:
    answer_query(n-1, x, m)
### BUGGY CODE ###

from scipy.misc import comb


def solve(string):
    n, m, k = map(int, string.split())
    base = n * m * ((n + 1) * (m + 1) * (n + m - 2) - n**2 - m**2 + 2) // 6 % (10**9 + 7)
    return str(base * (comb(n * m - 2, k - 2, exact=True) % (10**9 + 7)) % (10**9 + 7))


if __name__ == '__main__':
    print(solve(input()))


### FIXED CODE ###

mod = 10**9 + 7


def comb(n, k):
    x, y = 1, 1
    k = min(k, n - k)
    for i in range(k):
        x *= n - i
        x %= mod
        y *= i + 1
        y %= mod
    return x * pow(y, mod - 2, mod) % mod


def solve(string):
    n, m, k = map(int, string.split())
    base = n * m * ((n + 1) * (m + 1) * (n + m - 2) - n**2 - m**2 + 2) // 6 % mod
    return str(base * comb(n * m - 2, k - 2) % mod)


if __name__ == '__main__':
    print(solve(input()))
### BUGGY CODE ###

n=int(input())

count=0
for a in range(1,n+1):
    for b in range(1,n//a+1):
        c=n-(a*b)
        if c>0:
            count+=1
        else:
            continue

print(count)

### FIXED CODE ###

n=int(input())

count=0
for a in range(1,n+1):
    for b in range(a,n//a+1):
        c=n-(a*b)
        if c>0:
            if a==b:
                count+=1
            else:
                count+=2
        else:
            continue

print(count)
### BUGGY CODE ###

n = int(input())
a = { (i + 1):int(input()) for i in range(n) }
s = 1
ans = 0
while True:
    if s == 2:
        break
    s = a[s]
    ans += 1
    if s == 1:
        ans = -1
        break
print(ans)


### FIXED CODE ###

n = int(input())
a = { (i + 1):int(input()) for i in range(n) }
s = 1
ans = 0
seen = set()
while True:
    if s == 2:
        break
    seen.add(s)
    s = a[s]
    ans += 1
    if s == 1 or s in seen:
        ans = -1
        break
print(ans)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
B=sorted(A)
ans=[]
for i in range(N):
    ans.append(A.index(B[i])+1)

ans = map(str,ans)
print(" ".join(ans))


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
for i in range(N):
    A[i] = [i+1, A[i]]

A.sort(key=lambda x:x[1])

ans=[]
for i in range(N):
    ans.append(A[i][0])

ans = map(str, ans)
print(' '.join(ans))
### BUGGY CODE ###

#####segfunc######                                                              
def segfunc(x,y):
    return x+y

def init(init_val):
    #set_val                                                                    
    for i in range(n):
        seg[i+num-1]=init_val[i]
    #built                                                                      
    for i in range(num-2,-1,-1):
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2])
    
def update(k,x):
    k+=num-1
    seg[k]=x
    while k+1:
        k=(k-1)//2
        seg[k]=segfunc(seg[k*2+1],seg[k*2+2])

def query(p,q):
    if q<=p:
        return ide_ele
    p+=num-1
    q+=num-2
    res=ide_ele
    while q-p>1:
        if p&1==0:
            res=segfunc(res,seg[p])
        if q&1==1:
            res=segfunc(res,seg[q])
            q-=1
        p=p//2
        q=(q-1)//2
    if p==q:
        res=segfunc(res,seg[p])
    else:
        res=segfunc(segfunc(res,seg[p]),seg[q])
    return res

ide_ele=0
n,q=map(int,input().split())
num=2**(n-1).bit_length()
seg=[ide_ele]*2*num
c=list(map(int,input().split()))
lr=[]
for i in range(q):
    lr.append(list(map(int,input().split())) + [i])
lr.sort(key=lambda x: x[1])
ans=[0]*q
ll=0
lastc=[-1]*(n+1)
for l,r,ind in lr:
    l-=1
    r-=1
    while ll<=r:
        if lastc[c[ll]]==-1:
            lastc[c[ll]]=ll
            update(ll,1)
        else:
            update(lastc[c[ll]],0)
            lastc[c[ll]]=ll
            update(lastc[c[ll]],1)
        ll+=1
    ans[ind]=query(l,r+1)
for i in ans:
    print(i)


### FIXED CODE ###

import sys
input=sys.stdin.readline
#####segfunc######                                                              
def segfunc(x,y):
    return x+y

def init(init_val):
    #set_val                                                                    
    for i in range(n):
        seg[i+num-1]=init_val[i]
    #built                                                                      
    for i in range(num-2,-1,-1):
        seg[i]=segfunc(seg[2*i+1],seg[2*i+2])
    
def update(k,x):
    k+=num-1
    seg[k]=x
    while k+1:
        k=(k-1)//2
        seg[k]=segfunc(seg[k*2+1],seg[k*2+2])

def query(p,q):
    if q<=p:
        return ide_ele
    p+=num-1
    q+=num-2
    res=ide_ele
    while q-p>1:
        if p&1==0:
            res=segfunc(res,seg[p])
        if q&1==1:
            res=segfunc(res,seg[q])
            q-=1
        p=p//2
        q=(q-1)//2
    if p==q:
        res=segfunc(res,seg[p])
    else:
        res=segfunc(segfunc(res,seg[p]),seg[q])
    return res

ide_ele=0
n,q=map(int,input().split())
num=2**(n-1).bit_length()
seg=[ide_ele]*2*num
c=list(map(int,input().split()))
lr=[]
for i in range(q):
    lr.append(list(map(int,input().split())) + [i])
lr.sort(key=lambda x: x[1])
ans=[0]*q
ll=0
lastc=[-1]*(n+1)
for l,r,ind in lr:
    l-=1
    r-=1
    while ll<=r:
        if lastc[c[ll]]==-1:
            lastc[c[ll]]=ll
            update(ll,1)
        else:
            update(lastc[c[ll]],0)
            lastc[c[ll]]=ll
            update(lastc[c[ll]],1)
        ll+=1
    ans[ind]=query(l,r+1)
for i in ans:
    print(i)
### BUGGY CODE ###

N = int(input())
S = [s for s in input()]
ans = 0
for i in range(1000):
    v = str(i).zfill(3)
    idx = 0
    for j, s in enumerate(S):
        if v[idx] in S[j:]:
            if v[idx] == s:
                idx += 1
                if idx < 3 and v[idx] not in S[j+1:]:
                    break
            if idx == 3:
                ans += 1
                break
        else:
            break
print(ans)

### FIXED CODE ###

N = int(input())
S = input()
ans = 0
for i in range(1000):
    v = str(i).zfill(3)
    idx = 0
    c = 0
    idx_now = 0
    for j in range(3):
        idx = S[idx_now:].find(v[j])
        if idx == -1:
            break
        else:
            idx_now += idx + 1
            c += 1
    if c == 3:
        ans += 1
print(ans)
### BUGGY CODE ###

def fib(n):
    if n == 0 or n == 1:
        return 1
    return fib(n-1) + fib(n-2)

n = int(input())
print(fib(n))

### FIXED CODE ###

def fib(n, fib_table):
    if n == 0 or n == 1:
        return 1
    if fib_table[n] != None:
        return fib_table[n]
    fib_table[n] = fib(n-1, fib_table) + fib(n-2, fib_table)
    return fib_table[n]

n = int(input())
fib_table = [None]*(n+1)
fib_table[0] = 1
fib_table[1] = 1

print(fib(n, fib_table))
### BUGGY CODE ###

a=input()
m=[a[i] for i in range(len(a))]
b=input()
n=[b[i] for i in range(len(b))]
m.sort()
n.sort()
i=0
while 1>0:
  if m[i]<n[i]:
    print("Yes")
    break
  if i==len(a) or i==len(b):
    print("No")
    break
 

### FIXED CODE ###

a=input()
m=[a[i] for i in range(len(a))]
b=input()
n=[b[i] for i in range(len(b))]
m.sort()
n.sort(reverse=1)
i=0
while 1>0:
  if i==len(b):
    print("No")
    break
  if i==len(a):
    print("Yes")
    break
  if m[i]<n[i]:
    print("Yes")
    break
  if m[i]>n[i]:
    print("No")
    break
  i+=1