Harryxun/stf_run huggingface dataset:
s=input()
t=input()
l=list()
for _ in list(t):
  if [i for i,x in enumerate(list(s)) if x==_] != list():
    l.append([i for i,x in enumerate(list(s)) if x==_])
  else:
    print(-1)
    exit()
if len(t)==1:
  print(s.index(t)+1)
  exit()
ed=l[0][0]
for i in range(len(t))[1:-1]:
  k=l[i]
  if max(k+[ed])==ed :
    cd+=1
    ed=k[0]
  else:
    ex=sorted(k+[ed])
    exex=ex.index()
    ed=k[exex]
k=l[len(t)-1]
if max(k+[ed])==ed :
  print((cd+1)*len(s)+min(k)+1)
else:
  ex=sorted(k+[ed])
  exex=ex.index(ed)
  ed=k[exex]
  print((cd)*len(s)+ed+1)

### FIXED CODE ###

def f():
    s,t=input(),input()
    n,m=len(s),len(t)
    table=[[]for i in  range(26)]
    d={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

    for j in range(n):
        table[d[s[j]]].append(j)
    now=0
    ind=0
    if set(list(t))-set(list(s)):print(-1);exit()
    from bisect import bisect_left as bl
    for p in t:
        if ind>table[d[p]][-1]:now+=1;ind=0
        ind=table[d[p]][bl(table[d[p]],ind)]+1

    print(now*n+ind)
if __name__ == "__main__":
    f()
n=int(input())
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))
b=[]
for i in range(n):
    b.sppend(list(map(int,input().split())))
a.sort()
b=sorted(b,key=lambda x: -x[1])
ans=0
vb=[]
for i in range(n):
    for j in range(n):
        if not j in vb:
            if a[i][0]<b[j][0] and a[i][1]<b[j][1]:
                vb.append(j)
                ans+=1
                break
print(ans)

### FIXED CODE ###

n=int(input())
a=[]
for i in range(n):
    a.append(list(map(int,input().split())))
b=[]
for i in range(n):
    b.append(list(map(int,input().split())))
b.sort()
a=sorted(a,key=lambda x: -x[1])
ans=0
vb=[]
for i in range(n):
    for j in range(n):
        if not j in vb:
            if a[i][0]<b[j][0] and a[i][1]<b[j][1]:
                vb.append(j)
                ans+=1
                break
print(ans)
s=input().split(' ')
N=int(s[0])
M=int(s[1])
room_from=[]
room_to=[]

for i in range(M):
  s=input().split(' ')

#道は両方向に使える
  room_from.append(int(s[0]))
  room_to.append(int(s[1]))
  room_from.append(int(s[1]))
  room_to.append(int(s[0]))

#for i in range(2*M):
#  print("from=",room_from[i],"to=",room_to[i])


#最小経路の回答を入れる. ansewr[room_from]=room_to


answer={}
temp={}
for (i,room) in enumerate(room_to): 
  if room_to[i] == 1:
    answer[room_from[i]]=1

temp={}
for n in range(N):
  for a in answer:
    for (i,room) in enumerate(room_to): 
      if room == a and room_from[i] not in temp and room_from[i] not in answer and room_from[i] != 1:
        temp[room_from[i]]=a
  #        print("temp=",temp)
  answer.update(temp)
#  print ("answer=",answer)

if len(answer)== N-1 :
  print ("Yes")
  for n in answer:
    print (answer[n])
else:
  print ("No")


### FIXED CODE ###

N=input()
n=int(N[-1])
if n in [2,4,5,7,9]:
  print("hon")
elif n in [0,1,6,8]:
  print("pon")
else:
  print("bon")
#揃える長さを決め打って二分探索
import sys
import math
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,k = map(int,readline().split())
lst1 = list(map(int,readline().split()))
lst1.sort(reverse=True)
def func(mid): #ここが関数部分
    res = 0
    for i in range(n):
        if mid >= lst1[i]:
            continue
        res += math.ceil(lst1[i]/mid)-1
        if res > k:
            return False
    return True


def binary_search(): #2分探索
    ok = 10**9
    ng = -1
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if func(mid):
            ok = mid
        else:
            ng = mid

    return ok


print(binary_search())

### FIXED CODE ###

#揃える長さを決め打って二分探索
import sys
import math
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n,k = map(int,readline().split())
lst1 = list(map(int,readline().split()))
lst1.sort(reverse=True)
def func(mid): #ここが関数部分
    res = 0
    for i in range(n):
        if mid >= lst1[i]:
            continue
        res += math.ceil(lst1[i]/mid)-1
        if res > k:
            return False
    return True


def binary_search(): #2分探索
    ok = 10**9
    ng = 0
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if func(mid):
            ok = mid
        else:
            ng = mid

    return ok

print(binary_search())
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from functools import cmp_to_key
import itertools

N, T = map(int, readline().split())
m = map(int, read().split())
AB0 = []
AB1 = []
for a,b in zip(m,m):
    if a == 0:
        AB0.append(b)
    else:
        AB1.append((a,b))

if not AB1:
    raise

def sort_func(ab0, ab1):
    a0, b0 = ab0
    a1, b1 = ab1
    return a1*b0 - a0*b1

AB0.sort()
AB1.sort(key=cmp_to_key(sort_func))
AB0, AB1

def compute_0():
    INF = T + 1
    dp = [INF] * 40
    dp[0] = 0
    for a,b in AB1:
        for n in range(39, -1, -1):
            if dp[n] > T:
                continue
            x = (dp[n] + 1) * (a + 1) + b
            if x < dp[n+1]:
                dp[n+1] = x
    return dp

def compute_1():
    return [0] + list(itertools.accumulate(x + 1 for x in AB0))

dp0 = compute_0()
dp1 = compute_1()

R = len(dp1) - 1
answer = 0
for i,x in enumerate(dp0):
    if x > T:
        break
    while x + dp1[R] > T:
        R -= 1
    value = i + R
    if answer < value:
        answer = value

print(answer)

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from functools import cmp_to_key
import itertools

N, T = map(int, readline().split())
m = map(int, read().split())
AB0 = []
AB1 = []
for a,b in zip(m,m):
    if a == 0:
        AB0.append(b)
    else:
        AB1.append((a,b))

def sort_func(ab0, ab1):
    a0, b0 = ab0
    a1, b1 = ab1
    return a1*(1+b0) - a0*(1+b1)

AB0.sort()
AB1.sort(key=cmp_to_key(sort_func))
AB0, AB1

def compute_0():
    INF = T + 1
    dp = [INF] * 40
    dp[0] = 0
    for a,b in AB1:
        for n in range(39, -1, -1):
            if dp[n] > T:
                continue
            x = (dp[n] + 1) * (a + 1) + b
            if x < dp[n+1]:
                dp[n+1] = x
    return dp

def compute_1():
    return [0] + list(itertools.accumulate(x + 1 for x in AB0))

dp0 = compute_0()
dp1 = compute_1()

R = len(dp1) - 1
answer = 0
for i,x in enumerate(dp0):
    if x > T:
        break
    while x + dp1[R] > T:
        R -= 1
    value = i + R
    if answer < value:
        answer = value

print(answer)
import sys
input = sys.stdin.readline

print(a + a*a + a*a*a)

### FIXED CODE ###

import sys
input = sys.stdin.readline

a = int(input())
print(a + a*a + a*a*a)
def calc(money, count):
    if money == n:
        return count
    if money > n:
        return inf
    a = [calc(money+i, count+1) for i in num]
    return min(a)
import bisect
inf = 10 ** 10
num = [6 ** i for i in range(7)] + [9 ** i for i in range(1, 6)]
n = int(input())
num = num[:bisect.bisect_left(num, n)]
calc(0, 0)

### FIXED CODE ###

n = int(input())
inf = 10 ** 9
dp = [inf] * (n+1)
dp[0] = 0
for i in range(n):
    dp[i+1] = min(dp[i]+1, dp[i+1])
    j, k = 1, 1
    while (i + 6**j) <= n:
        dp[i + 6**j] = min(dp[i]+1, dp[i + 6**j])
        j += 1
    while (i + 9**k) <= n:
        dp[i + 9**k] = min(dp[i]+1, dp[i + 9**k])
        k += 1
print(dp[-1])
q, h, s, d = map(int, input().split())
n = int(input())
n4 = n * 4
# jリットルになるようにしたi番目までの総和最小値
# dp[i][j] = 
w = [1, 2, 4, 8]
v = [q, h, s, d]
dp = [[10**8+1]*(n4+1) for i in range(4)]
for i in range(4):
  dp[i][0] = 0
for i in range(4):
  for j in range(n4+1):
    if j >= w[i] and i >= 1:
      dp[i][j] = min(dp[i-1][j], dp[i][j-w[i]] + v[i])
    else:
      dp[i][j] = dp[i-1][j]
print(dp[3][n4])

### FIXED CODE ###

q, h, s, d = map(int, input().split())
n = int(input())
h = min(q*2, h)
s = min(h*2, s)
d = min(s*2, d)
if n % 2 == 0:
  print(min(s*n, d*(n//2)))
else:
  print(min(s*n, d*(n//2)+s))
ab=[]

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

for i in range(m):
    ab.append(tuple(map(int,input().split())))

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

res=0
milestone=0
while(1):
    for j in range(len(ab)):
        if ab[0][1] < ab[j][0]:
          milestone=j
          res+=1
          break
    del ab[:milestone]
    if len(ab)==1:
      res+=1
      ab.remove(0)
    if len(ab)==0
      break

print(res)

### FIXED CODE ###

ab=[]

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

for i in range(m):
    ab.append(tuple(map(int,input().split())))

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

res=0
for z in range(len(ab)):
    x=ab[0][1]
    for j in range(len(ab)):
        if x > ab[0][0]:
            del ab[0]
        else:
            res+=1
            break
    if len(ab)==0:
        res+=1
        break
    
print(res)
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=list(map(int,list(input())))
    if len(S)%2==0:
        left=len(S)//2-1
        right=len(S)//2
        ans=len(S)//2
        if S[left]==S[right]:
            x=S[left]
            while S[left]==S[right]==x and left>=0 and right<len(S):
                left-=1
                right+=1
                ans+=1
            if S[left]!=x or S[right]!=x:
                ans-=1
    else:
        left=len(S)//2-1
        right=len(S)//2+1
        ans=len(S)//2+1
        x=S[len(S)//2]
        if S[left]==S[right]==x:
            ans+=1
            while S[left]==S[right]==x and left>=0 and right<len(S):
                left-=1
                right+=1
                ans+=1
            if S[left]!=x or S[right]!=x:
                ans-=1
        elif S[left]==x or S[right]==x:
            ans+=1
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=list(map(int,list(input())))
    N=len(S)
    if N%2==0:
        left=N//2-1
        right=N//2
        ans=N//2
        if S[left]==S[right]:
            x=S[left]
            while left-1>=0 and S[left-1]==x:
                left-=1
            while right+1<N and S[right+1]==x:
                right+=1
            ans+=min(N//2-left,right-N//2+1)
    else:
        left=N//2
        right=N//2
        x=S[N//2]
        ans=N//2+1
        if left-1>=0 and S[left-1]==x:
            while left-1>=0 and S[left-1]==x:
                left-=1
        if right+1<N and S[right+1]==x:
            while right+1<N and S[right+1]==x:
                right+=1
        ans+=min(N//2-left,right-N//2)
    print(ans)

if __name__ == '__main__':
    main()
X=int(input())
dp = [0]*(X+1)
dp[0]=1
dp[100]=1
dp[101]=1
dp[102]=1
dp[103]=1
dp[104]=1
dp[105]=1
if X>105:

    for i in range(106,X+1):
	        if dp[i-100] == 1:
	    	        dp[i]=1
	        elif dp[i-101] == 1:
	    	        dp[i]=1
	        elif dp[i-102] == 1:
	    	        dp[i]=1
	        elif dp[i-103] == 1:
	    	        dp[i]=1
	        elif dp[i-104] == 1:
	        	dp[i]=1
	        elif dp[i-105] == 1:
	    	        dp[i]=1
	        else:
	    	        dp[i]=0
	    
print(dp[X])


### FIXED CODE ###

x = int(input())
f = (x%100)//5
ff = (x%100)%5
a = [0,101,102,103,104]
if 105*f+a[ff]<= x:
    print(1)
else:
    print(0)
a, b = int(input()), int(input())
print(a*b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
T = input()

ans = ""
for i in range(len(T)):
    if(T[i] == "P" or T[i] == "D"):
        ans += T[i]
    elif(i != 0 and ans[i-1] == "P"):
        ans += "D"
    elif(i != len(T)-1 and T[i+1] == "?"):
        ans += "P"
    elif(i != len(T)-1 and T[i+1] == "D"):
        ans += "P"

print(ans)

### FIXED CODE ###

T = input()

ans = ""
for i in range(len(T)):
    if(T[i] == "?"):
        ans +="D"
    else:
        ans += T[i]
print(ans)
k, x = map(int, input())
print('Yes' if 500 * k >= x else 'No')

### FIXED CODE ###

k, x = map(int, input().split())
print('Yes' if 500 * k >= x else 'No')
print(-(-sum(int,input(),split()//2)))

### FIXED CODE ###

a,b=map(int,input().split())
print(-((-a-b)//2))
a,b=map(int, input().split())
if (0<a<10　and 0<b<10):
  print(a*b)
else:
  print(-1)

### FIXED CODE ###

a,b=map(int, input().split())
if 0<a<10 and 0<b<10:
	print(a*b)
else:
	print('-1')
_MULTITEST = False
##
def solve():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort()
    neg = sum(1 for x in a if x < 0)
    pos = sum(1 for x in a if x > 0)
    zeroes = a.count(0)
    
    ### Set lower bound for answer
    ans = 0
    if pos == 0:
        if zeroes == 0:
            ans = -1 * (10**16)
    
    ### Solve by window-sliding
    # set some initial vars
    prod = 1
    zero_counter = 0
    for i in range(n-1, n-1-k, -1):
        if a[i] == 0:
            zero_counter += 1
        else:
            prod *= a[i]
    if zero_counter > 0:
        ans = max(ans, 0)
    else:
        ans = max(ans, prod)
    
    # sliding
    p1 = 0
    p2 = (n-k)
    while p2 < n:
        if a[p1] == 0:
            zero_counter += 1
        else:
            prod *= a[p1]
        if a[p2] == 0:
            zero_counter -= 1
        else:
            prod //= a[p2]
        p1 += 1; p2 += 1;
        if zero_counter > 0:
            ans = max(ans, 0)
        else:
            ans = max(ans, prod)
    
    ###
    #print(ans)
    print(ans % (10**9 + 7))


##
if __name__ == "__main__":
    t = (int(input()) if _MULTITEST else 1)
    for tt in range(t):
        solve()

### FIXED CODE ###

_MULTITEST = False
##
def solve():
    n = int(input())
    k = (n // 1000) + (1 if n % 1000 != 0 else 0)
    print(k*1000 - n)

##
if __name__ == "__main__":
    t = (int(input()) if _MULTITEST else 1)
    for tt in range(t):
        solve()
n = int(input())
h = int(input())
w = int(input())
a = []
b = []
i = 1
while i <= n:
    a.append(int(input))
    b.append(int(input))

i = 0
flag = 0

while i < n:
    if a[i] >= h and b[i] >=w:
        flag = flag + 1
    i = i + 1
print(flag)

### FIXED CODE ###

n,h,w = input().split()
a = [0] * int(n)
b = [0] * int(n)
i = 0
while i < int(n):
    a[i],b[i] = input().split()
    i = i + 1

i = 0
flag = 0

while i < int(n):
    if int(a[i]) >= int(h) and int(b[i]) >= int(w):
        flag = flag + 1
    i = i + 1
print(flag)
v=[]
v = str(input()).splitlines()
dif_max = -200000

for i in range(len(v)):
    v[i] = int(v[i])

for i in range(1,v[0],1):
    for j in range(i+1, v[0], 1):
        dif = v[j] - v[i]
        dif_max = dif if dif_max < dif else dif_max
print("{}".format(dif_max))

### FIXED CODE ###

cnt = int(input())
dif_max = -1000000000
v_min = 1000000000

for i in range(cnt):
    buf = int(input())
    if i > 0:
        dif_max = dif_max if buf - v_min < dif_max else buf - v_min
    v_min = buf if buf < v_min else v_min
print(dif_max)
n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +1)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1
 
for i in range(len(med)):
    if med[i] == 1:
      if med[i+1] == 1:
          med[i+1] = 0
          ans += 1
      else:
        ans += 1
        
print(ans)

### FIXED CODE ###

n = input()
a = list(map(int,input().split()))
a.insert(0,0.5)
alen = len(a)
a.append(0.5)
a.append(0.5)

ans = 0
 
med = [0 for x in range(alen +2)]
 
for i in range(alen):
    if a[i] == i:
        med[i+1] = 1

for i in range(len(med)):
    if med[i] == 1:
        if med[i+1] == 1:
            med[i+1] = 0
            ans += 1
        else:
            ans += 1
        
print(ans)
n, W = map(int, input().split())
MAX_V = 1000
dp = [0] + [float('INF')]*MAX_V
for _ in range(n):
    w, v = map(int, input().split())
    tmp_dp = [min(dp[sum_v], dp[sum_v - v] + w) if sum_v >= v else min(dp[sum_v], w) for sum_v in range(MAX_V) ]
    dp = tmp_dp

ans = 0
while dp[ans+1] <= W:
    ans +=1
print(ans)


### FIXED CODE ###

N, W = map(int, input().split())
MAX_V = 10**5+1
dp = [float('inf')] * MAX_V
dp[0] = 0
for _ in range(N):
    w, v = map(int, input().split())
    for sum_v in range(MAX_V)[::-1]:
        if sum_v >= v:
            dp[sum_v] = min(dp[sum_v - v] + w, dp[sum_v])
        else:
            dp[sum_v] = min(dp[sum_v], w)
ans = 0
for v in range(MAX_V)[:: -1]:
    if dp[v] <= W:
        ans = v
        break
print(ans)
A, B = maP(int, input().split())

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")


### FIXED CODE ###

A, B = map(int, input().split())

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 == 0:
    print("Possible")
else:
    print("Impossible")
def calc(i, k):
    ans_list = [i]
    count = 1
    i = a[i]
    while (i not in ans_list) & (count < k):
        ans_list.append(i)
        count += 1
        i = a[i]
    index = ans_list.index(i)
    ans_list.append(i)
    return count, ans_list

n, k = map(int, input().split())
a = [int(i) - 1 for i in input().split()]

count, ans_list = calc(0, k)
if count < k:
    index = ans_list.index(ans_list[-1])
    k = k - index
    ans_list = ans_list[index + 1:]
    print(ans_list[k % len(ans_list) - 1] + 1)
else:
    print(ans_list[k] + 1)

### FIXED CODE ###

n, k = map(int, input().split())
a = [int(i) - 1 for i in input().split()]
visit = {0}
tmp = 0
a_list = [0]
ans = True
for i in range(k):
    tmp = a[tmp]
    if tmp in visit:
        left = a_list.index(tmp)
        ans = False
        print(a_list[left + (k - left) % (i + 1 - left)] + 1)
        break
    else:
        visit.add(tmp)
        a_list.append(tmp)
if ans:
    print(tmp + 1)
s = str(input())
if s = "RRR":
  print(3)
elif s = "RRS" or s = "SRR":
  print(2)
elif s = "RSS" or s = "SRS" or s = "SSR" or s = "RSR":
  print(1)
else:
  print(0)

### FIXED CODE ###

s = input()
if s == "RRR":
  print(3)
if s == "SSS":
  print(0)
if s == "RRS":
  print(2)
if s == "SRR":
  print(2)
if s == "RSS":
  print(1)
if s == "SRS":
  print(1)
if s == "SSR":
  print(1)
if s == "RSR":
  print(1)
mport bisect
from collections import defaultdict
N,M,Q = map(int,input().split())
lr = [tuple(map(int,input().split())) for i in range(M)]
pq = [tuple(map(int,input().split())) for i in range(Q)]
lr.sort()
l = [lr[i][0] for i in range(M)]
r = [lr[i][1] for i in range(M)]

l_I = {}
for p in range(1,N+1):
    l_I[p] = bisect.bisect_left(l,p)

r_d = {}
for i in range(1,N+1):
    r_d[i] = sorted(r[l_I[i]:])
ans = defaultdict(lambda:{})
for p in range(1,N+1):
    for q in range(p,N+1):
        ans[p][q] = bisect.bisect(r_d[p],q)
for i in range(Q):
    p,q = pq[i]
    print(ans[p][q])

### FIXED CODE ###

import numpy as np
N,M,Q = map(int,input().split())
c = [[0]*(N+1) for i in range(N+1)]
for i in range(M):
    l,r = map(int,input().split())
    c[l][r] += 1
c = np.cumsum(np.cumsum(c,axis=0),axis=1)
for i in range(Q):
    p,q = map(int,input().split())
    print(c[q][q]-c[q][p-1]-c[p-1][q]+c[p-1][p-1])
n = int(input())
s = input()

arr = []
arr.append(s[1])
for i in range(n-1):
    if s[i+1] != s[i]:
        arr.append(s[i+1])



        
c = len("".join(arr))
print(arr)
if c == 0:
    print(1)
else:
    print(c)

### FIXED CODE ###

n = int(input())
s = input()

arr = []
arr.append(s[0])
for i in range(n-1):
    if s[i+1] != s[i]:
        arr.append(s[i+1])


c = len(arr)
print(c)
import re

def hoge(str):
	if str == "":
		return True
	for word in ["dreamer", "eraser", "dream", "erase"]:
		keyword = word[::-1]
		pattern = re.compile(r"^%s" % keyword)
		if(pattern.match(str)):
			return hoge(re.sub(pattern, "", str))
	return False

S= input()

if(hoge(S[::-1])):
	print("YES")
else:
	print("NO")

### FIXED CODE ###

def main():
    S = input()

    while len(S) >= 5:
        if len(S) >= 7 and S[-7:] == "dreamer":
            S = S[:-7]
            continue

        if len(S) >= 6 and S[-6:] == "eraser":
            S = S[:-6]
            continue

        elif S[-5:] == "dream" or S[-5:] == "erase":
            S = S[:-5]
            continue

        else:
            break

    if len(S) == 0:
        print("YES")
    else:
        print("NO")

main()
N = int(input())
items = []
count = 0
for x in range(N):
  thing = input()
  if thing not x in items:
    count += 1
  	items.append(thing)
print(count)

### FIXED CODE ###

N = int(input())
arr = []
for x in range(N):
  arr.append(input())

print(len(list(set(arr))))
from collections import deque

N, M = map(int, input().split())
A = list(map(int, input().split()))

A = deque(A)
A = sorted(A)

for i in range(M):
    temp = A.pop() // 2

    for j in range(N)[::-1]:
        if j>0:
            if A[j-1] <= temp:
                A.insert(j,temp)
                print(A)
                break
        else:
            A.insert(0,temp)

print(sum(A))


### FIXED CODE ###

from heapq import heappop,heappush

N, M = map(int, input().split())
A = list(map(int, input().split()))

H = []

for i in A:
    heappush(H, -i)

for _ in range(M):
    heappush(H, -((-heappop(H)//2)) )

print(-sum(H))
class RMQ:
    import math

    def __init__(self, length):
        self.length = 2 ** math.ceil(math.log(length, 2))
        self.segtree = [float("inf")] * (2 ** (self.length + 1) - 1)

    def update(self, index, n):
        leaf_index = index + self.length - 1
        self.segtree[leaf_index] = n
        while leaf_index > 0:
            leaf_index = (leaf_index - 1) // 2
            self.segtree[leaf_index] = min(self.segtree[leaf_index * 2 + 1], self.segtree[leaf_index * 2 + 2])

    def find(self, a, b, index, l, r):
        if b < l or r < a:
            return float("inf")
        elif a <= l <= r <= b:
            return self.segtree[index]
        else:
            return min(self.find(a, b, index * 2 + 1, l, (l + r) // 2), self.find(a, b, index * 2 + 2, (l + r) // 2, r))

v_num, query = (int(n) for n in input().split(" "))
rmq = RMQ(v_num)
for _ in range(query):
    com, i, n = (int(n) for n in input().split(" ") )
    if com == 0:
        rmq.update(i, n)
    else:
        print(rmq.find(i, n, 0, 0, rmq.length))

### FIXED CODE ###

class RMQ:
    def __init__(self, length, ini_num = float("inf")):
        self.length = 1
        self.ini_num = ini_num
        while self.length < length:
            self.length <<= 1
        self.segtree = [ini_num] * (2 * self.length - 1)

    def update(self, index, n):
        leaf_index = index + self.length - 1
        self.segtree[leaf_index] = n
        while leaf_index > 0:
            leaf_index = (leaf_index - 1) // 2
            self.segtree[leaf_index] = min(self.segtree[leaf_index * 2 + 1], self.segtree[leaf_index * 2 + 2])

    def find(self, a, b, index, l, r):
        if a <= l <= r <= b:
            return self.segtree[index]
        elif b < l or r < a:
            return self.ini_num
        else:
            return min(self.find(a, b, index * 2 + 1, l, (l + r) // 2), self.find(a, b, index * 2 + 2, (l + r) // 2 + 1, r))

v_num, query = map(int, input().split(" "))
rmq = RMQ(v_num, 2147483647)
for _ in [0] * query:
    com, i, n = map(int, input().split(" "))
    if com == 0:
        rmq.update(i, n)
    else:
        print(rmq.find(i, n, 0, 0, rmq.length - 1))
n, m = int(input()), int(input())
print(n*(n-1)//2+m*(m-1)//2)


### FIXED CODE ###

n, m = [int(x) for x in input().split()]
print(n*(n-1)//2+m*(m-1)//2)
x, a, b = map(int,input().split())
 
if x => abs(b - a):
  print("safe")
elif x <= abs(b - a):
  print("dangerous")
else:
  print("delicious")


### FIXED CODE ###

x, a, b = map(int,input().split())
 
if 0 >= (b - a):
  print("delicious")
elif x < (b - a):
  print("dangerous")
else:
  print("safe")
n = int(input())
an = input().split()
if n == 1:
    print(an[0])
else:
    print(" ".join(list(reversed(an[1::2]))+an[::2]) if n%2==0 else " ".join(reversed(an[::2])+an[1::2]))


### FIXED CODE ###

n = int(input())
an = input().split()
if n == 1:
    print(an[0])
else:
    print(" ".join(list(reversed(an[1::2]))+an[::2]) if n%2==0 else " ".join(list(reversed(an[::2]))+an[1::2]))