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

a = list(map(int, input().split()))
inp = []
for i in range(a[2]):
    inp.append(int(input()))
n_dict = {}
for i in range(a[0]):
    n_dict[i+1] = a[1]
for i in range(a[2]):
    for k , v in n_dict.items():
        if k != inp[i]:
            n_dict[k] -= 1
for kk , vv in n_dict.items():
    if int(vv) <= 0:
        print('No')
    else:
        print('Yes')

### FIXED CODE ###

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

hito_dict = {(i+1) : ((n[2]-n[1])*-1) for i in range(n[0])}
for i in range(n[2]):
    d = int(input())
    hito_dict[d] = hito_dict[d] + 1
for j in range(n[0]):
    if hito_dict[j + 1] > 0:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

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


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


k = n * m // gcd(n, m)


for i in range(k, n * m + 1, k):
    g = i * i // n // m // gcd(i // n, i // m)
    flag = True
    for c in range(0,i,g):
        if S[c * n // i] != T[c * m // i]:
            flag = False
            break
    if flag:
        print(i)
        exit()
print(-1)

### FIXED CODE ###

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


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


k = n * m // gcd(n, m)


for i in range(k, n * m + 1, k):
    g = i * i // n // m // gcd(i // n, i // m)
    flag = True
    for c in range(0, i, g):
        if S[c * n // i] != T[c * m // i]:
            flag = False
            break
    if flag:
        print(i)
        exit()
print(-1)
### BUGGY CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
# dp = [None] * N
dp = [10**9] * N

for i in range(N):
    if i == 0:
        dp[0] = 0
    elif i == 1:
        dp[1] = abs(h[0]-h[1])
    else:
        # ans = 10**10
        for j in range(1, K+1):
            if j > i:
                break
            # ans = min(ans, dp[i-j] + abs(h[i-j]-h[i]))
            dp[i] = min(dp[i], dp[i - j] + abs(h[i - j] - h[i]))
        # dp[i] = ans

print(dp[N-1])

### FIXED CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
dp = [0] * n

for i in range(n):
    if i == 0:
        dp[0] = 0
    elif i == 1:
        dp[1] = abs(h[0]-h[1])
    else:
        costs = []
        for j in range(1, k+1):
            if j > i:
                break
            if abs(h[i-j]-h[i]) == 0:
                costs.append(dp[i-j])
                break
            costs.append(dp[i-j] + abs(h[i-j]-h[i]))

        # if i == 3:
        #     print(costs)
        dp[i] = min(costs)

#print(dp)
print(dp[n-1])
### BUGGY CODE ###

k, s = map(int, input().split())
ans = []
for i in range(k+1):
    for j in range(k+1):
        for h in range(k+1):
            if i + j + h == s:
                ans.append([i, j, h])
                break
print(len(ans))
                

### FIXED CODE ###

k, s = map(int, input().split())
cnt = 0
for i in range(k+1):
    for j in range(min(k+1,s-i+1)):
        h = s- i- j
        if 0<= h <= k:
            cnt += 1
print(cnt)
### BUGGY CODE ###

a=input()
A,B,C=a.split(' ')
A=int(A)
B=int(B)
C=int(C)
count=0
for i in range(C):
    count+=1
    if B!=0:
        count+=1
        B-=1
    elif A!=0:
        A-=1
    else:
        break
for i in range(B):
    count+=1
print(count)

### FIXED CODE ###

a=input()
A,B,C=a.split(' ')
A=int(A)
B=int(B)
C=int(C)
count=0
if A+B<C:
    print(A+2*B+1)
else:
    print(B+C)
### BUGGY CODE ###

a = input()
b = input()
c = input()

aa = len(a)
bb = len(b)
cc = len(c)

lensum = aa + bb + cc # 文字列の長さの最大値
ab = [0]*(lensum+cc+1)
ac = [0]*(lensum+bb+1)
bc = [0]*(lensum+aa+1)

def match(v,w): # 2つの文字を合わせられるかどうかを調べる
    if(v != '?' and w != '?' and v != w):
        return 0
    else:
        return 1

def match2(A,B,k):
    AA = len(A)
    BB = len(B)
    if(k>=AA):
        return 1
    elif(k<-BB):
        return 1
    else:
        flg = 1
        st = max(0,k)
        la = min(AA,BB+k)
        for i in range(st,la):
            if(match(A[i],B[i-k])==0):
                flg = 0
                break
        return flg

for i in range(lensum+cc+1):
    ab[i] = match2(a,b,i-bb-cc)
for i in range(lensum+bb+1):
    ac[i] = match2(a,c,i-bb-cc)
for i in range(lensum+aa+1):
    bc[i] = match2(b,c,i-aa-cc)

def milen(a,b,c):
    minlen = lensum # 文字列の長さの最大値
    for i in range(-bb-cc,aa+cc+1): # iが文字列Bの開始位置
        for j in range(-bb-cc,aa+bb+1): # jが文字列Cの開始位置
            if(ab[i+bb+cc] == 0): 
                continue
            elif(ac[j+bb+cc] == 0):
                continue
            elif(j-i+aa+cc < 0 or j-i+aa+cc >= lensum+aa+1):
                continue  
            elif(bc[j-i+aa+cc] == 0):
                continue   
            else:
                sta = min(0,i,j) #文字列の中で一番左にある開始位置
                en = max(aa,i+bb,j+cc) #文字列の中で一番右にある終了位置
                minlen = min(minlen,en-sta) #更新
    return minlen

print(milen(a,b,c))

### FIXED CODE ###

a = input()
b = input()
c = input()

aa = len(a)
bb = len(b)
cc = len(c)

lensum = aa + bb + cc # 文字列の長さの最大値
ab = [0]*(lensum+cc+1) # 相対的位置に対して合わさるかどうかを記録
ac = [0]*(lensum+bb+1)
bc = [0]*(lensum+aa+1)

def match(v,w): # 2つの文字を合わせられるかどうかを調べる
    if(v != '?' and w != '?' and v != w):
        return 0
    else:
        return 1

def match2(A,B,k): # 2つの文字列とその相対的位置に対して合わさるかチェック
    AA = len(A)
    BB = len(B)
    if(k>=AA):
        return 1
    elif(k<-BB):
        return 1
    else:
        flg = 1
        st = max(0,k)
        la = min(AA,BB+k)
        for i in range(st,la):
            if(match(A[i],B[i-k])==0):
                flg = 0
                break
        return flg

#ab,ac,bcに対して計算する
for i in range(lensum+cc+1):
    ab[i] = match2(a,b,i-bb-cc)
for i in range(lensum+bb+1):
    ac[i] = match2(a,c,i-bb-cc)
for i in range(lensum+aa+1):
    bc[i] = match2(b,c,i-aa-cc)

def milen(a,b,c):
    minlen = lensum # 文字列の長さの最大値
    for i in range(-bb-cc,aa+cc+1): # iが文字列Bの開始位置
        for j in range(-bb-cc,aa+bb+1): # jが文字列Cの開始位置
            if(ab[i+bb+cc] == 0): 
                continue
            elif(ac[j+bb+cc] == 0):
                continue
            elif(j-i+aa+cc < 0 or j-i+aa+cc >= lensum+aa+1): #BとCが離れすぎている場合を除く
                continue  
            elif(bc[j-i+aa+cc] == 0):
                continue   
            else:
                sta = min(0,i,j) #文字列の中で一番左にある開始位置
                en = max(aa,i+bb,j+cc) #文字列の中で一番右にある終了位置
                minlen = min(minlen,en-sta) #更新
    return minlen

print(milen(a,b,c))
### BUGGY CODE ###

N, P = map(int, input().split())
S = input()

dp_table = list([0]*P for _ in range(N))

dp_table[0][int(S[0])%P] = 1

for i in range(N-1):
    d = dp_table[i]
    d_nxt = dp_table[i+1]
    s = int(S[i+1])
    d_nxt[s%P] += 1
    for j in range(P):
        if d[j] != 0:
            d_nxt[(j*10+s)%P] += d[j]

cnt = 0            
for i in range(N):
    cnt += dp_table[i][0]
    
print(cnt)

### FIXED CODE ###

N, P = map(int, input().split())
S = input()

cnt = 0
if P == 2 or P == 5:
    for i in range(N):
        if int(S[i]) % P == 0:
            cnt += (i+1)
            
else:
    dic = dict()
    dic[0] = 1
    r = 0
    for i in range(N):
        s = (pow(10,i,P)*int(S[N-1-i]) + r) % P
        r = s
        if not s in dic:
            dic[s] = 1
        else:
            dic[s] += 1
    for i in dic:
        cnt += dic[i]*(dic[i]-1)/2
        
print(int(cnt))
### BUGGY CODE ###

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

for i in range(0,N):
  print(A.count(i+1))

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
ans=[0]*(N+1)

for i in range(0,N-1):
  ans[A[i]]+=1

for i in range(1,N+1):
  print(ans[i])
### BUGGY CODE ###

from functools import lru_cache
import sys
sys.setrecursionlimit(20000000)
INF = float('inf')

N = int(input())
h = list(map(int, input().split()))
n = len(h)-1

@lru_cache(maxsize=None)
def rec(i):
    if i==0:
        return 0
    res = INF
    res = min(res, rec(i-1)+abs(h[i]-h[i-1]))
    if i>1:
        res = min(res, rec(i-2)+abs(h[i]-h[i-2]))
    return res
print(rec(n))

### FIXED CODE ###

def chmin(a, b):
    if a > b:
        return b
    else:
        return a

# input
N = int(input())
h = list(map(int, input().split()))

# dp table
dp = [float('inf')]*(10**5 + 10)

# 初期条件
dp[0] = 0

for i in range(1,N):
    dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i > 1:
        dp[i] = chmin(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

# ans
print(dp[N-1])
### BUGGY CODE ###


N = int(input())

alpha = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
num = {1:"a", 2:"b", 3:"c", 4:"d", 5:"e", 6:"f", 7:"g", 8:"h", 9:"i", 10:"j"}

D = []
for i in range(N):
    s = input()
    d = ""
    for j in alpha:
        c = s.count(j)
        if c:
            d += j + num[c]
    
    D.append(d)

D.sort()
#print(D)

count = 0
idx = 0
while idx < len(D):
    #print(D[idx])
    n = D.count(D[idx])
    count += n * (n-1) // 2
    idx += n

print(count)

### FIXED CODE ###


N = int(input())

l = []
for i in range(N):
    s = input()
    s = sorted(s)
    l.append("".join(s))
    
import collections

c = collections.Counter(l)
#print(c)
issubclass(type(c), dict)
C = list(c.values())
#print(C)

count = 0
for i in C:
    count += i * (i-1) // 2
    
print(count)
### BUGGY CODE ###

n = int(input())
s_list = []
for i in range(n):
    s = input()
    if not s in s_list:
        s_list.append(s)
print(len(s_list))
    

### FIXED CODE ###

n = int(input())
s_list = {}
count = 0
for i in range(n):
    s = input()
    if not s in s_list:
        s_list[s]=0
        count+=1
print(count)
### BUGGY CODE ###

import numpy as np
N,K=map(int,input().split())
a=[[int(i) for i in input().split()] for _ in range(N)]
a=np.array(a,dtype=np.int64)
MOD=10**9+7

def matmul(A,B,MOD):
    N=len(A)
    C=np.zeros((N,N),dtype=np.int64)

    for i in range(N):
        for j in range(N):
            for k in range(N):
                C[i][j] =(C[i][j]+ A[i][k]*B[k][j])%MOD
    return C

def mat_power(A,k,MOD):
    N=len(A)
    D=np.identity(N,dtype=np.int64)
    while k:
        if k & 1:
            D=matmul(D,A,MOD)
        A = matmul(A,A,MOD)
        k >>= 1

    return D

A=mat_power(a,K,MOD)
ans=0
for i in range(N):
    for j in range(N):
        ans=(ans+A[i][j])%MOD

print(ans)


### FIXED CODE ###

import numpy as np
N,K=map(int,input().split())
a=[[int(i) for i in input().split()] for _ in range(N)]
a=np.array(a,dtype=np.int64)
MOD=10**9+7

def matmul(A,B,MOD):
    N=len(A)
    C=np.zeros((N,N),dtype=np.int64)

    for n in range(N):
        C[n] = (A[n,:][:,None] * B % MOD).sum(axis=0) % MOD
    return C

def mat_power(A,k,MOD):
    N=len(A)
    D=np.identity(N,dtype=np.int64)
    while k:
        if k & 1:
            D=matmul(D,A,MOD)
        A = matmul(A,A,MOD)
        k >>= 1

    return D

A=mat_power(a,K,MOD)
ans=0
for i in range(N):
    for j in range(N):
        ans=(ans+A[i][j])%MOD

print(ans)
### BUGGY CODE ###

from functools import lru_cache


CHECK = False

N, K = list(map(int, input().split()))

MOD = 10 ** 9 + 7


@lru_cache(maxsize=None)
def modInverse(a, p):
    # Fermat's little theorem, a**(p-1) = 1 mod p
    return pow(a, p - 2, p)


fact = [1]
for i in range(1, 2 * N + 1):
    fact.append((fact[-1] * i) % MOD)


def nCr(n, r, p=MOD):
    # Modulo binomial coefficients
    numerator = fact[n]
    d1 = fact[r]
    d2 = fact[n - r]
    return (numerator * modInverse(d1, p) * modInverse(d2, p)) % p


if N - 1 <= K:
    # Any combo is achievable so this is stars and bars
    # N people into N rooms, which means N - 1 dividers
    stars = N
    bars = N - 1
    print(nCr(stars + bars, bars))
else:
    # Group by number of empty rooms
    # With K moves there can only be at most K empty rooms
    # Max of N - 1 empty rooms in general
    assert K + 1 < N
    tot = 0
    for numEmpty in range(K + 1):
        way2 = nCr(N, numEmpty) * nCr(N - 1, numEmpty)
        if CHECK:
            numNonEmpty = N - numEmpty
            stars = numEmpty  # Everyone moving into an occupied room
            bars = numNonEmpty - 1
            way1 = nCr(stars + bars, bars) * nCr(N, numEmpty)
            assert way1 == way2
        tot += way2
    print(tot % MOD)


### FIXED CODE ###

from functools import lru_cache


CHECK = False

N, K = list(map(int, input().split()))

MOD = 10 ** 9 + 7


@lru_cache(maxsize=None)
def modInverse(a, p):
    # Fermat's little theorem, a**(p-1) = 1 mod p
    return pow(a, p - 2, p)


if N - 1 <= K or CHECK:
    fact = [1]
    for i in range(1, 2 * N + 1):
        fact.append((fact[-1] * i) % MOD)

    def nCr(n, r, p=MOD):
        # Modulo binomial coefficients
        return (fact[n] * modInverse(fact[r], p) * modInverse(fact[n - r], p)) % p


if N - 1 <= K:
    # Any combo is achievable so this is stars and bars
    # N people into N rooms, which means N - 1 dividers
    stars = N
    bars = N - 1
    print(nCr(stars + bars, bars))
else:
    # Group by number of empty rooms
    # With K moves there can only be at most K empty rooms
    # Max of N - 1 empty rooms in general
    assert K + 1 < N
    tot = 0
    comb1 = 1
    comb2 = 1
    for numEmpty in range(K + 1):
        way3 = comb1 * comb2
        if CHECK:
            numNonEmpty = N - numEmpty
            stars = numEmpty  # Everyone moving into an occupied room
            bars = numNonEmpty - 1  # Number of dividers
            way1 = nCr(stars + bars, bars) * nCr(N, numEmpty)

            way2 = nCr(N, numEmpty) * nCr(N - 1, numEmpty)

            assert way1 % MOD == way2 % MOD == way3 % MOD
        tot += way3

        j = numEmpty + 1
        invJ = modInverse(j, MOD)
        comb1 = (N + 1 - j) * comb1 * invJ % MOD
        comb2 = (N - j) * comb2 * invJ % MOD
    print(tot % MOD)
### BUGGY CODE ###

import math
import itertools
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

l = int(input())
s = 0
li = list(range(1,l+1))
lis = list(itertools.product(li,repeat = 2))
for j in range(1,l+1):
  for i in range(len(lis)):
    s += gcd(lis[i][0],lis[i][1],j)
print(s)

### FIXED CODE ###

import math

l = int(input())
s = 0

for i in range(1, l+1):
  for j in range(1, l+1):
    tmp = math.gcd(i,j)
    for j in range(1, l+1):
      s += math.gcd(tmp,j)
  
print(s)
### BUGGY CODE ###

N, Q = map(int, input().split())
s = str(input())

t = []
d = []

for _ in range(Q):
    ti, di = map(str, input().split())
    t.append(ti)
    d.append(di)
    
spell_target = {}
for i, c in enumerate(s):
    if c in spell_target:
        spell_target[c].append(i+1)
    else:
        spell_target[c] = [i+1]
#print(spell_target)

golems_nums = [1 for _ in range(len(s) + 2)]
golems_nums[0] = 0
golems_nums[-1] = 0
#print(golems_nums)

for ti, di in zip(t, d):
    if not ti in spell_target:
        continue
    if di == 'L':
        targets = spell_target[ti]
        for n in targets:
            golems_nums[n-1] += golems_nums[n]
            golems_nums[n] = 0
    if di == 'R':
        targets = spell_target[ti]
        for n in reversed(targets):
            golems_nums[n+1] += golems_nums[n]
            golems_nums[n] = 0
#print(golems_nums)
ans = sum(golems_nums) - golems_nums[0] - golems_nums[-1]
print(ans)



### FIXED CODE ###

N, Q = map(int, input().split())
s = str(input())

t = []
d = []

for _ in range(Q):
    ti, di = input().split()
    t.append(ti)
    d.append(di)
    
LEFT_DIE = -1
RIGHT_DIE = N

def is_dead(i):
    for ti, di in zip(t, d):
        if s[i] == ti:
            if di == 'L':
                i -= 1
            if di == 'R':
                i += 1
            if i == LEFT_DIE:
                return LEFT_DIE
            if i == RIGHT_DIE:
                return RIGHT_DIE
    return 0

low = -1
high = N;
# LEFT
while high - low > 1:
    mid = (low + high) // 2;
    if is_dead(mid) == LEFT_DIE:
        low = mid
    else:
        high = mid
left_edge = high

low = -1
high = N;
# RIGHT
while high - low > 1:
    mid = (low + high) // 2;
    if is_dead(mid) == RIGHT_DIE:
        high = mid
    else:
        low = mid
right_edge = low

#print(left_edge, right_edge)
ans_s = s[left_edge:right_edge+1]
#print(ans_s)
ans = len(ans_s)
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

n,x,y = map(int,input().split())

import queue
# FIFOキューの作成
q = queue.Queue()

dst = [10**18] * (n+1)

kyori = [0] * (n+1)
"""
for i in range(n):
    dst[i+1][i+1] = 0
"""
#num = 1

for i in range(1,n):
    #num = 1
    dst[i] = 0
    q.put([i,0])
    while not q.empty():
        
        kari = q.get()
        tmp = kari[0]
        tmp_dst = kari[1]
        #print(tmp[0])
        #exit()
        """
        if tmp >= n+1:
            continue
        if tmp < 1:
            continue
        """
        if tmp == x:
            if dst[y] == 10**18:
                #kyori[tmp_dst+1] += 1
                dst[y] = tmp_dst+1
                q.put([y,tmp_dst+1])
                
        if tmp == y:
            if dst[x] == 10**18:
                #kyori[tmp_dst+1] += 1
                dst[x] = tmp_dst+1
                q.put([x,tmp_dst+1])
        if tmp+1 <= n:
            if dst[tmp+1] == 10**18:
                q.put([tmp+1,tmp_dst+1])
                #kyori[tmp_dst+1] += 1
                dst[tmp+1] = tmp_dst+1
        if tmp-1 >= 1:
            if dst[tmp-1] == 10**18:
                q.put([tmp-1,tmp_dst+1])
                #kyori[tmp_dst+1] += 1
                dst[tmp-1] = tmp_dst+1
        
        #num += 1
        #print(dst[i])
    #exit()
    for j in range(i+1,n+1):
        kyori[dst[j]] += 1
    dst = [10**18] * (n+1)
"""
#print(kyori)
print(dst)
exit()

kyori = [0] * (n+1)

for i in range(1,n):
    #print(dst[i],i)
    for j in range(i+1,n+1):
        #print(i,j,dst[i][j])
        kyori[dst[i][j]] += 1
"""
#print(kyori)
#exit()

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

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

n,x,y = map(int,input().split())

dst = [0] * n

#print(dst)

for i in range(1,n+1):
    for j in range(i+1,n+1):
        kyori = min(j-i,abs(x-i)+abs(y-j)+1)
        dst[kyori] += 1
        #print(i,j,kyori)
        
for i in range(n-1):
    print(dst[i+1])
#print(dst)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 6)

def main():
    n=int(input())
    s=input()
    pre=[set() for _ in range(26)]
    nx=[set() for _ in range(n)]
    oa=ord("a")
    for i in range(n-1,-1,-1):
        ci=ord(s[i])-oa
        nx[i]|=pre[ci]
        pre[ci].add(i)
    #print(pre)
    #print(nx)
    ans=0
    for i in range(n):
        for ii in nx[i]:
            for di in range(1,n):
                if (not ii+di in nx[i+di]) or (i+di==ii):
                    L=di
                    break
            ans=max(ans,L)
    print(ans)
main()


### FIXED CODE ###

# YouTube
def main():
    n = int(input())
    s = input()
    dp = [[0] * (n + 1) for _ in range(n + 1)]
    for i, c in enumerate(s):
        for j in range(n):
            if c == s[j]:
                dp[i + 1][j + 1] = dp[i][j] + 1
    ans = 0
    for i in range(n):
        for j in range(i+1,n+1):
            tmp=min(dp[i][j],j-i)
            ans=max(tmp,ans)
    print(ans)

main()
### BUGGY CODE ###

n = int(input())
a = map(int, input().split())
count = 0
while all([i%2==0 for i in a]):
  a = [i//2 for i in a]
  count += 1
print(count)

### FIXED CODE ###

n = int(input())
a = map(int, input().split())
m = float('inf')
for i in a:
  count = 0
  while i%2 == 0:
    i = i//2
    count += 1
  m = min(m, count)
  if m==0:
    break
print(m)
### BUGGY CODE ###

N, Q = map(int, input().split())
S = input()

Sl1 = list(S)
Sl2 = list(S)
del Sl2[-1]

idx = [i for i, a in enumerate(Sl2) if a=="A"]

AT = [0]*N

for i in idx:
    if Sl1[i+1]=="C":
        AT[i] += 1

for i in range(Q):
    l, r = map(int, input().split())
    print(sum(AT[:r-1]) - sum(AT[:l-1]))
    


### FIXED CODE ###


N, Q = map(int, input().split())
S = list(input())
lr = []
for i in range(Q):
    l, r = map(int, input().split())
    lr.append([l-1, r-1])
AC = []
pre = None
cnt = 0
for c in S:
    if c == "A":
        pre = "A"
    elif pre == "A" and c == "C":
        cnt += 1
        pre = None
    elif pre == "A":
        pre = None
    AC.append(cnt)
for l, r in lr:
    print(AC[r] - AC[l])
### BUGGY CODE ###

#C - Poll
import collections
N = int(input())
S = [str(input()) for i in range(N)]
S = sorted(S)
#print(S)

A = collections.Counter(S)
maxS = [kv[0] for kv in A.items() if kv[1] == max(A.values())]
maxS = sorted(maxS)
for l in range(len(maxS)):
    print(maxS[l])

### FIXED CODE ###

#C - Poll
N = int(input())
S = [str(input()) for i in range(N)]
S = sorted(S)
count = 1
tmpcount = 1
DP = [S[0]]
for i in range(1,N):
    if S[i] == S[i-1]:
        count += 1
        if tmpcount < count:
            DP.clear()
            DP.append(S[i])
            tmpcount = count
        elif tmpcount == count:
            DP.append(S[i])
        else:
            pass
    else:
        count = 1
        if tmpcount == count:
            DP.append(S[i])
        else:
            pass

for l in range(len(DP)):
     print(DP[l])
### BUGGY CODE ###


def solve():
    i = L//2019
    ans = 0
    is_ok = False
    while L <= 2019*i <= R:
        i += 1
        is_ok = True
#    print(i)
    if is_ok:
        print(ans)
    else:
        ans = 2020
        for n in range(L,R):
            for m in range(n+1,R+1):
                ans = min(ans, (n*m)%2019)
            if ans == 0:
                break
        print(ans)

if __name__ == "__main__":
    L,R = list(map(int, input().split()))
    solve()


### FIXED CODE ###


def solve():
    i = (L//2019) + 1
    ans = 0
    if L <= 2019*i <= R:
        print(ans)
    else:
        ans = 2020
        for n in range(L,R):
            for m in range(n+1,R+1):
                ans = min(ans, (n*m)%2019)
            if ans == 0:
                break
        print(ans)

if __name__ == "__main__":
    L,R = list(map(int, input().split()))
    solve()
### BUGGY CODE ###

s = input()

count = 0

while s != s.replace('ABC', 'BCA'):
  t = s
  s = s.replace('ABC', 'BCA')
  for i in range(len(s)):
    if s[i] != t[i]:
      count += 1
      
print(count//3)

### FIXED CODE ###

s = input()
s = s.replace('BC', 'D')
ans = 0
x = 0

#AとDだけでできた部分を考える(B,Cを挟む場合x=0とすることでreset)
#Aが出てくるたび、そのAより右にあるDは、Aを超える操作を挟むので、試行回数が増える。
for i in range(len(s)):
  if s[i] == 'A': 
    x +=1
  elif s[i] == 'D':
    ans += x
  else:
    x =0
    
print(ans)
### BUGGY CODE ###

import math
n = int(input())
ans = 0
for a in range(1,n+1):
    for b in range(1,n+1):
        for c in range(1,n+1):
            ans += math.gcd(a,math.gcd(b,c))
print(ans)


### FIXED CODE ###

import math
n = int(input())
ans = 0
for a in range(1,n+1):
    for b in range(1,n+1):
        for c in range(1,n+1):
            ans += math.gcd(a,math.gcd(b,c))
print(ans)
### BUGGY CODE ###

x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
s=sorted(p+q+r, reverse=True)
cntr,cntg=0,0
ans=0
for i in range(a+b+c):
    if cntr!="f" and (s[i] in p or s[i] in r):
        ans+=s[i]
        cntr+=1
    elif cntg!="f" and ( s[i] in q or s[i] in r):
        ans+=s[i]
        cntg+=1
    if cntr==x:
        cntr="f"
    if cntg==y:
        cntg="f"
print(ans)

### FIXED CODE ###

x,y,a,b,c=map(int,input().split()) #x,yだけ見る。
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p=sorted(p,reverse=True)[:x]
q=sorted(q,reverse=True)[:y]
print(sum(sorted(p+q+r, reverse=True)[:x+y]))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

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

ans = 1
max = 1000000000000000000
for i in range(len(N)):
  ans = ans * N[i]

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

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

ans = 1
max = 10**18
if 0 in N:
  print(0)
else:
  for i in range(len(N)):
    ans = ans * N[i]
    if ans > max:
      ans = -1
      break
  print(ans)