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

S = input()
T = input()
N = len(S)
done_alphabets = []

for i in range(N):
    if S[i] in done_alphabets:
        continue
    if S[i] != T[i]:
        memo_char_num = []
        for j in range(i+1, N):
            if T[j] == T[i]:
                memo_char_num.append(j)
        for k in range(i+1, N):
            if k in memo_char_num:
                if S[i] != S[k]:
                    print("No")
                    quit()
            else:
                if S[i] == S[k]:
                    print("No")
                    quit()
        done_alphabets.append(S[i])
        done_alphabets.append(T[i])

print("Yes")


### FIXED CODE ###

S = input()
T = input()
N = len(S)

memo_s = {"a":-1,"b":-1,"c":-1,"d":-1,"e":-1,"f":-1,"g":-1,"h":-1,"i":-1,"j":-1,"k":-1,"l":-1,"m":-1,"n":-1,"o":-1,"p":-1,"q":-1,"r":-1,"s":-1,"t":-1,"u":-1,"v":-1,"w":-1,"x":-1,"y":-1,"z":-1}
memo_t = {"a":-1,"b":-1,"c":-1,"d":-1,"e":-1,"f":-1,"g":-1,"h":-1,"i":-1,"j":-1,"k":-1,"l":-1,"m":-1,"n":-1,"o":-1,"p":-1,"q":-1,"r":-1,"s":-1,"t":-1,"u":-1,"v":-1,"w":-1,"x":-1,"y":-1,"z":-1}

for i in range(N):
    if memo_s[S[i]] == -1 and memo_t[T[i]] == -1:
        memo_s[S[i]] = T[i]
        memo_t[T[i]] = S[i]
    else:
        if memo_s[S[i]] != T[i] or memo_t[T[i]] != S[i]:
            print("No")
            quit()

print("Yes")
### BUGGY CODE ###

from scipy.sparse.csgraph import shortest_path
import numpy as np


n, x, y = map(int, input().split())
ans = [0] * (n - 1)

table = []
for i in range(n):
  l = [0] * n
  if i + 1 < n:
    l[i + 1] = 1
  if i - 1 > -1:
    l[i - 1] = 1
  if i == x - 1:
    l[y - 1] = 1
  if i == y - 1:
    l[x - 1] = 1
  table.append(l)

a = shortest_path(np.array(table))
for i in a:
  for j in i:
    ans[int(j) - 1] += 1

ans = list(map(lambda x: x // 2, ans))
ans[-1] = 0
for i in range(n - 1):
  print(ans[i])


### FIXED CODE ###

n, x, y = map(int, input().split())
ans = [0] * n
for i in range(1, n + 1):
  for j in range(i + 1, n + 1):
    d = min(j - i, abs(i - x) + abs(j - y) + 1)
    ans[d] += 1
    
for i in range(1, n):
    print(ans[i])
### BUGGY CODE ###

L, R = (int(i) for i in input().split())  
unko = []
flag = True
if flag:
  for i in range(L,R+1):
    for j in range(i+1,R+1):
      n = (i*j) % 2019
      unko.append((i*j) % 2019)
      if n == 0:
        flag = False
print(min(unko))

### FIXED CODE ###

l,r = (int(i) for i in input().split())
a = []
for i in range(l,min(r,l+2019)):
  for j in range(i+1,min(r,l+2019)+1):
    a.append(i*j%2019)
print(min(a))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
 
n, k = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort(reverse = True)
F = [int(i) for i in input().split()]
F.sort()
"""
n = 11
k = 14
A = [1,1,2,3,3,4,5,5,5,6,9]
F = [9,9,8,8,7,6,4,3,3,2,2]
"""

 
P = [A[i]*F[i] for i in range(n)]
sum_A = sum(A)
 
def b(p):
    result = 0
    for i in range(n):
        if P[i] > p:
            r = (P[i] - p) // F[i]
            if P[i] - r * F[i] > p:
                r += 1
            result += r
    return result
 
if sum_A <= k: print('0')
else: 
    left = 0
    right = max(P)
    middle = int((left + right) / 2)
    bm = b(middle)
    
    
    
    while right - left > 1:
        
        if bm > k: left = middle
        else: right = middle
            
        middle = int((left + right) / 2)
        bm = b(middle)
 
    if b(left) <= k: print(left)
    else: print(right)

### FIXED CODE ###

# -*- coding: utf-8 -*-
 
n, k = map(int, input().split())
A = [int(i) for i in input().split()]
A.sort(reverse = True)
F = [int(i) for i in input().split()]
F.sort()
"""
n = 11
k = 14
A = [1,1,2,3,3,4,5,5,5,6,9]
F = [9,9,8,8,7,6,4,3,3,2,2]
"""

 
P = [A[i]*F[i] for i in range(n)]
sum_A = sum(A)
 
def b(p):
    result = 0
    for i in range(n):
        if P[i] > p:
            r = (P[i] - p) // F[i]
            if P[i] - r * F[i] > p:
                r += 1
            result += r
    return result
 
if sum_A <= k: print('0')
else: 
    left = 0
    right = max(P)
    middle = int((left + right) / 2)
    bm = b(middle)
    
    
    
    while right - left > 1:
        
        if bm > k: left = middle
        else: right = middle
            
        middle = int((left + right) / 2)
        bm = b(middle)
 
    if b(left) <= k: print(left)
    else: print(right)
### BUGGY CODE ###

n=int(input())
v=list(input().split())

even=[v[i] for i in range(n) if i%2 == 0]
odd=[v[i] for i in range(n) if i%2 == 1]
ans=0

e_n=max(even,key=even.count)
o_n=max(odd,key=odd.count)

if even==odd:
    print(even.count(even[0]))
else:
    ans=len(even)-even.count(e_n)+len(odd)-odd.count(o_n)
    print(ans)

### FIXED CODE ###

import collections
n=int(input())
v=list(input().split())
ans=0

even=[v[i] for i in range(n) if i%2 == 0]
odd=[v[i] for i in range(n) if i%2 == 1]

ep=collections.Counter(even).most_common()
op=collections.Counter(odd).most_common()
ep.append((0,0))
op.append((0,0))

if ep[0] != op[0]:
    ans=n-(ep[0][1]+op[0][1])
else:
    if len(even)-ep[1][1]<len(odd)-op[1][1]:
        ans=n-ep[1][1]-op[0][1]
    else:
        ans=n-ep[0][1]-op[1][1]
print(ans)
### BUGGY CODE ###

def main():
    n = int(input())
    l_dic = {}
    r_dic = {}
    i = 0
    for a in map(int, input().split()):
        ld = l_dic.setdefault(i + a, [])
        ld.append(i)
        rd = r_dic.setdefault(i-a, [])
        rd.append(i)
        i += 1

    count = 0
    for rk, rv_list in r_dic.items():
        if rk not in l_dic:
            continue
        lv_list = l_dic[rk]
        for rv in rv_list:
            # count += len([lv for lv in lv_list if lv < rv])
            for lv in lv_list:
                if lv < rv:
                    count += 1

    print(count)


main()



### FIXED CODE ###

def is_ok(mid: int, target: int, ls: []):
    return target <= ls[mid]


def bi_search(target: int, ls: []):
    ng = -1
    ok = len(ls)

    cnt = 0
    while ok - ng > 1:
        mid = ng + int((ok - ng) / 2)
        cnt += 1
        if is_ok(mid, target, ls):
            ok = mid
        else:
            ng = mid
    return ok


def main():
    n = int(input())
    l_dic = {}
    r_dic = {}
    i = 0
    for a in map(int, input().split()):
        ld = l_dic.setdefault(i + a, [])
        ld.append(i)
        rd = r_dic.setdefault(i - a, [])
        rd.append(i)
        i += 1

    count = 0
    for rk, rv_list in r_dic.items():
        if rk not in l_dic:
            continue
        lv_list = l_dic[rk]
        for rv in rv_list:
            ind = bi_search(rv, lv_list)
            if ind == len(lv_list):
                count += ind
            else:
                count += ind + 1
            # for lv in lv_list:
            #     if lv < rv:
            #         count += 1
            #     else:
            #         break

    print(count)


main()
### BUGGY CODE ###

class BIT:
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

sc = iter(open(0).read().split())
ni = lambda: int(next(sc))
ns = lambda: next(sc)

N, S, Q = ni(), list(ns()), ni()

B = [BIT(N) for _ in range(26)]
for i, s in enumerate(S, 1):
    B[ord(s) - ord('a')].add(i, 1)

A = []
for _ in range(Q):
    if ni() == 1:
        i, c = ni(), ns()
        B[ord(S[i - 1]) - ord('a')].add(i, -1)
        S[i - 1] = c
        B[ord(c) - ord('a')].add(i, 1)
    else:
        l, r = ni(), ni()
        A.append(sum(b.sum(l - 1) < b.sum(r) for b in B))

print("\n".join(map(str, A)))

### FIXED CODE ###

# https://atcoder.jp/contests/abc157/tasks/abc157_e

class BIT:
    def __init__(self, N):
        self.size = N
        self.tree = [0] * (N + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

sc = iter(open(0).read().split())
ni = lambda: int(next(sc))
ns = lambda: next(sc)

N, S, Q = ni(), list(ns()), ni()

B = [BIT(N) for _ in range(26)]
for i, s in enumerate(S, 1):
    B[ord(s) - ord('a')].add(i, 1)

A = []
for _ in range(Q):
    if ni() == 1:
        i, c = ni(), ns()
        B[ord(S[i - 1]) - ord('a')].add(i, -1)
        S[i - 1] = c
        B[ord(c) - ord('a')].add(i, 1)
    else:
        l, r = ni(), ni()
        A.append(sum(b.sum(l - 1) < b.sum(r) for b in B))

print("\n".join(map(str, A)))
### BUGGY CODE ###

A,B, C, K = map(int,input().split())
for k in range(K):
  A,B,C = B+C, C+A, A+B
if abs(A-B) > 10**18:
  print("Unfair")
else:
  print(A-B)

### FIXED CODE ###

A,B, C, K = map(int,input().split())
if K%2==0:
  print(A-B)
else:
  print(B-A)
### BUGGY CODE ###

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

num_R = S.count('R')
num_G = S.count('G')
num_B = S.count('B')
S = '_' + S

count = 0
for i in range(1, N+1):
    for j in range(i, N+1):
        for k in range(j, N+1):
            if j - i == k - j and S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                count += 1
#                print(i, j, k)
print(num_R*num_G*num_B - count)

### FIXED CODE ###

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

num_R = S.count('R')
num_G = S.count('G')
num_B = S.count('B')
S = '_' + S

count = 0
for i in range(1, N+1):
    for j in range(i, N+1):
        k = 2*j - i
        if j <= k and k <= N:
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                count += 1
#                 print(i, j, k)
print(num_R*num_G*num_B - count)
### BUGGY CODE ###

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

for i in range(k):
    b =  [0] * n
    for j in range(n):
        d = a[j] + 0.5
        for l in range(int(d)):
            if j + l + 1 < n:
                b[j + l + 1] += 1
            if j - l - 1 >= 0:
                b[j - l - 1] += 1
    #print('ans')
    #print(list(x + y for x, y in zip([1] * n, b)))
    a = list(x + y for x, y in zip([1] * n, b))
print(*a, sep=' ')

### FIXED CODE ###

import copy

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

for i in range(k):
    b = [0] * (n + 1)
    for j in range(n):
        d = a[j]
        l = max(0, j - d)
        r = min(j + d + 1, n)
        b[l] += 1
        b[r] -= 1

    for j in range(n):
        b[j + 1] += b[j]
    b = b[:-1]

    if b == a:
        break
    a = copy.deepcopy(b)
print(*a, sep=' ')
### BUGGY CODE ###

N, M = map(int, input().split(' '))

PreYear = [[] for i in range(N)]
PY = [input().split(' ') for i in range(M)]
for i in range(M):
    Pi, Yi = PY[i]
    PreYear[int(Pi)-1].append(int(Yi))


for i in range(M):
    Pi, Yi = map(int,PY[i])
    count = 0
    for j in range(len(PreYear[int(Pi)-1])):
        if PreYear[int(Pi)-1][j] <= Yi:
            count+=1
    print('{0:06d}{1:06d}'.format(Pi,count))

### FIXED CODE ###

from operator import itemgetter


N, M = map(int, input().split(' '))
data = []
for i in range(M):
    Pi, Yi = map(int, input().split(' '))
    data.append([i,Pi,Yi])

sorted_data = sorted(data, key=itemgetter(1,2))

codes = []
prev_p = 0
for i,p,y in sorted_data:
    if p!=prev_p:
        x = 1
        prev_p = p
    else:
        x+=1

    code = '{0:06d}{1:06d}'.format(p,x)
    codes.append([i,code])

sorted_codes = sorted(codes, key = itemgetter(0))

for code in sorted_codes:
    print(code[1])
### BUGGY CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
l = list(map(int, input().split()))
l.sort()

cnt = 0
pre_a = -1
for i in range(N-1,1,-1):
    tmp = 0
    a = l[i]
    lm = a//2
    for j in range(i-1,0,-1):
        b = l[j]
        if b<=lm:
            continue
        a_b = a+b
        for k in range(j):
            c = l[k]
            if (b+c>a):
                tmp += j-k
                break
    cnt += tmp
    pre_a = a
print(cnt)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
N = int(input())
l = list(map(int, input().split()))
l.sort()

cnt = 0
pre_a = -1
for i in range(N-1,1,-1):
    tmp = 0
    a = l[i]
    lm = a//2
    pre_k = 0
    for j in range(i-1,0,-1):
        b = l[j]
        if b<=lm:
            continue
        a_b = a+b
        for k in range(pre_k,j):
            c = l[k]
            if (b+c>a):
                tmp += j-k
                pre_k = k
                break
    cnt += tmp
print(cnt)
### BUGGY CODE ###

X, K, D = map(int, input().split())
for i in range(K):
    if 0 <= X:
      absX = abs(X - D*i)
      if absX <= D:
         if (K-i)%2==0:
              ans = absX
              print(ans)
              exit(0)
         if (K-i)%2==1:
              ans = abs(X - D*(i+1))
              print(ans)
              exit(0)
    if X < 0:
      absX = abs(X + D*i)
      if absX <= D:
         if (K-i)%2==0:
              ans = absX
              print(ans)
              exit(0)
         if (K-i)%2==1:
              ans = abs(X + D*(i+1))
              print(ans)
              exit(0)

if 0 <= X:
    ans = X-D*K
    print(ans)
if X < 0:
    ans = abs(X+D*K)
    print(ans)


### FIXED CODE ###

X, K, D = map(int, input().split())
if 0 <= X:
    ans = X-D*K
    if 0 < ans:
        print(ans)
        exit(0)
if X < 0:
    ans = X+D*K
    if ans < 0:
        print(abs(ans))
        exit(0)

for i in range(K):
    if 0 <= X:
      absX = abs(X - D*i)
      if absX <= D:
         if (K-i)%2==0:
              ans = absX
              print(ans)
              exit(0)
         if (K-i)%2==1:
              ans = abs(X - D*(i+1))
              print(ans)
              exit(0)
    if X < 0:
      absX = abs(X + D*i)
      if absX <= D:
         if (K-i)%2==0:
              ans = absX
              print(ans)
              exit(0)
         if (K-i)%2==1:
              ans = abs(X + D*(i+1))
              print(ans)
              exit(0)
### BUGGY CODE ###

import itertools

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

acc = [0] + list(itertools.accumulate(A))

count = 0
for l in range(N + 1):
    for r in range(l + 1, N + 1):
        if (acc[r] - acc[l]) % M == 0:
            count += 1
print(count)

### FIXED CODE ###

import itertools

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

acc = [0] + list(itertools.accumulate(A))

B = [ai % M for ai in acc]
B.sort()
B.append(-1)

result = 0
count = 1

for i in range(N + 1):
    if B[i + 1] == B[i]:
        count += 1
    else:
        result += count * (count - 1) // 2
        count = 1
print(result)
### BUGGY CODE ###

n = int(input())
a = []
for x in input().split():
    a.append(int(x))

ans = []

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def gcd_list(numbers):
    while len(numbers) > 2:
        x1 = numbers.pop()
        y1 = numbers.pop()
        numbers.append(gcd(x1, y1))
    return gcd(numbers[0], numbers[1])

if n == 2:
    print(max(a))
else:
    for i in range(n):
        c = a.copy()
        c.remove(a[i])
        ans.append(gcd_list(c))

    print(max(ans))


### FIXED CODE ###

def gcd(x,y):
    if x<y:
        x,y=y,x
    #x>y
    if y==0:
        return x
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)

N=int(input())
A=[int(i) for i in input().split()]
X=[0 for i in range(N)]
Y=[0 for i in range(N)]
for i in range(1,N):
    X[i]=gcd(X[i-1],A[i-1])
for i in range(N-1)[::-1]:
    Y[i]=gcd(Y[i+1],A[i+1])
Z=[gcd(X[i],Y[i]) for i in range(N)]
print(max(Z))
### BUGGY CODE ###

S = input()
s = len(S)
dp = [[0]*13 for i in range(s+1)]
dp[0][0] = 1
S = S[::-1]
for i in range(s):
    if S[i]=="?":
        a = 10**i
        for j in range(13):
            for k in range(10):
                dp[i+1][(a*k+j)%13] += dp[i][j]
    else:
        a = int(S[i])*(10**i)
        for j in range(13):
            dp[i+1][(a+j)%13] += dp[i][j]
MOD = 10**9+7
print(dp[s][5]%MOD)

### FIXED CODE ###

MOD = pow(10,9)+7
S = input()[::-1]
N = len(S)

DP = [[0]*13 for i in range(N)]
K = 1
for i in range(N):
    if S[i]=="?":
        for j in range(10):
            if i==0:
                DP[0][(j*K)%13] = 1
            else:
                for k in range(13):
                    DP[i][(j*K+k)%13] += DP[i-1][k]
    else:
        j = int(S[i])*K
        if i==0:
            DP[0][(j*K)%13] = 1
        else:
            for k in range(13):
                DP[i][(j+k)%13] += DP[i-1][k]
    K = (K*10)%13
    for j in range(13):
        DP[i][j] = DP[i][j]%MOD
print(DP[N-1][5]%MOD)
### BUGGY CODE ###

def solve(string):
    n = len(string)
    q_pos = [i for i in range(n) if string[n - i - 1] == "?"]
    table = [[0] * 13 for _ in range(len(q_pos) + 1)]
    table[0][int(string.replace("?", "0")) % 13] = 1
    for i in range(len(q_pos)):
        base = pow(10, q_pos[i], 13)
        for j in range(13):
            for k in range(10):
                table[i + 1][(j + k * base) % 13] += table[i][j]
    return str(table[-1][5] % (10**9 + 7))


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


### FIXED CODE ###

def solve(string):
    n = len(string)
    q_pos = [i for i in range(n) if string[n - i - 1] == "?"]
    table = [[0] * 13 for _ in range(2)]
    table[0][int(string.replace("?", "0")) % 13] = 1
    for i in range(len(q_pos)):
        base = pow(10, q_pos[i], 13)
        for j in range(13):
            for k in range(10):
                table[1][(j + k * base) % 13] += table[0][j]
        for j in range(13):
            table[1][j] %= (10**9 + 7)
        table[0] = table[1]
        table[1] = [0] * 13
    return str(table[0][5])


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

n = int(input())
data = []
for i in range(n):
    s = list(input())
    s.sort()
    data.append(s)
data.sort()
i=0
j=0
count=0
for i in range(n):
  for j in range(i+1,n):
    if data[i]==data[j]:
      count=count+1
print(count)

### FIXED CODE ###

n = int(input())
data = []
for i in range(n):
    s = list(input())
    s.sort()
    data.append(s)
data.sort()
i=0
j=0
count=1
decount=0
for i in range(n-1):
  if data[i]==data[i+1]:
    count=count+1
  else:
    decount=decount+(count-1)*count/2
    count=1
decount=decount+(count-1)*count/2
print(int(decount))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n, m, s = map(int,input().split())
    E = []
    for _ in range(m):
        u, v, a, b = map(int,input().split())
        u -= 1; v -= 1
        E.append((u, v, -a, b)) # a : cost of silver
    for v in range(n):
        c, d = map(int,input().split()) # c : earning silver
        E.append((v, v, c, d))

    S = 5050 # silver を 5000 以上稼ぐ必要はない
    dp = [[INF] * S for _ in range(n)]
    dp[0][min(s, S - 1)] = 0

    # 基本的には Bellman - Ford で確定
    for _ in range(2 * n + 2):
        for u, v, ds, dt in E:
            for s in range(S):
                ns = s + ds
                if not (0 <= ns < S):
                    continue
                dp[v][ns] = min(dp[v][ns], dp[u][s] + dt)
                dp[u][ns] = min(dp[u][ns], dp[v][s] + dt)

    for i in range(1, n):
        print(min(dp[i][j] for j in range(S)))
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n, m, s = map(int,input().split())
    E = [None] * m
    S = 0
    for i in range(m):
        u, v, a, b = map(int,input().split())
        S += a
        E[i] = (u - 1, v - 1, -a, b)

    exchange = [tuple(map(int,input().split())) for _ in range(n)]
    dp = [[INF] * (S + 1) for _ in range(n)]
    dp[0][min(s, S)] = 0

    for _ in range(2 * n - 3):
        # 先に両替を済ませる
        for v in range(n):
            for s in range(S + 1):
                ds, dt = exchange[v]
                dp[v][min(s + ds, S)] = min(dp[v][min(s + ds, S)], dp[v][s] + dt)
        # 移動する
        for u, v, ds, dt in E:
            for s in range(S + 1):
                ns = s + ds
                if ns < 0:
                    continue
                dp[u][ns] = min(dp[u][ns], dp[v][s] + dt)
                dp[v][ns] = min(dp[v][ns], dp[u][s] + dt)

    for v in range(1, n):
        print(min(dp[v][j] for j in range(S + 1)))
resolve()
### BUGGY CODE ###

i = int(input())
S = [input() for _ in range(i)]
d = {}
max = 0
for s in list(set(S)):
  d[s] = S.count(s)
  if S.count(s) > max:
    max = S.count(s) 
keys = sorted([k for k, v in d.items() if v == max])
for key in keys:
  print(key)

### FIXED CODE ###

import collections
i = int(input())
S = collections.Counter([input() for _ in range(i)])
max_v = max(S.values())
[print(s) for s in sorted([s for s in S if S[s] == max_v])]
### BUGGY CODE ###

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, Q = lr()
squares = np.zeros(N+2, np.bool)
squares[0] = 1; squares[N+1] = 1
S = np.array(list('-' + sr() + '-'))
TD = [sr().split() for _ in range(Q)]
for t, d in TD[::-1]:
    index = np.where(S==t)[0]
    if d == 'L':
        i = -1
    else:
        i = 1
    squares[index] = squares[index] | squares[index+i]

answer = N + 2 - np.count_nonzero(squares)
print(answer)
# 49


### FIXED CODE ###

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, Q = lr()
S = '-' + sr() + '-'
TD = [sr().split() for _ in range(Q)]

L = 1
for t, d in TD[::-1]:
    if d == 'L':
        if L <= N and S[L] == t:
            L += 1
    if d == 'R':
        if L >= 1 and S[L-1] == t:
            L -= 1
R = N
for t, d in TD[::-1]:
    if d == 'L':
        if R <= N and S[R+1] == t:
            R += 1
    if d == 'R':
        if R >= 1 and S[R] == t:
            R -= 1

answer = max(0, R - L + 1)
print(answer)
# 34
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
  print(a.count(i))

### FIXED CODE ###

x=[0]*int(input())
for i in input().split():
    x[int(i)-1]+=1
print(*x)
### BUGGY CODE ###

cnt=0
n=int(input())
S=[0 for i in range(n)]
S=input().split()
q=int(input())
T=[0 for i in range(q)]
T=input().split()
for i in range(q):
    p=0
    for j in range(n):
        if T[i]==S[j]:
            if p==0:
                cnt+=1
                p+=1
print(cnt)


### FIXED CODE ###

def BinarySearch(n,key,A):
    left=0
    right=n
    while left<right:
        mid=(int)((left+right)/2)
        if A[mid]==key:
            return 2
        if key<A[mid]:
            right=mid
        if key>A[mid]:
            left=mid+1
    return 1
cnt=0
n=int(input())
S=[0 for i in range(n)]
S=input().split()
for i in range(n):
    S[i]=(int)(S[i])
q=int(input())
T=[0 for i in range(q)]
T=input().split()
for i in range(q):
    T[i]=(int)(T[i])
    a=BinarySearch(n,T[i],S)
    if a==2:
        cnt+=1
print(cnt)
### BUGGY CODE ###

N=int(input())

A=list(map(int,input().split()))
ans=A[0]
for cnt in range(N-1):
    ans = ans * A[cnt+1]

if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

N=int(input())

A=list(map(int,input().split()))
ans=A[0]

if 0 in A:
    print(0)
    exit()

for cnt in range(N-1):
    ans = ans * A[cnt+1]
    if ans > 1000000000000000000:
        break
    elif ans == 0:
        break
if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(1, n+1):
    for j in range(n):
        if a[j] == i:
            ans.append(str(j+1))
print(" ".join(ans))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
l = []
for i in range(n):
    l.append([a[i], i+1])
l = sorted(l)
ans = []
for j in range(n):
    ans.append(str(l[j][1]))
print(" ".join(ans))