Harryxun/stf_run huggingface dataset:
import sys
def input(): return sys.stdin.readline().strip()
from collections import Counter
def resolve():
    n=int(input())
    l=[input() for i in range(n)]
    l.sort()
    c=Counter(l)
    maxl=[]
    syutugenmax=max(c.values())
    for name,kazu in c.items():
        if kazu==syutugenmax:
            maxl.append(name)
    maxl.sort()
    for i in maxl:
        print(i)
resolve()

### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b!=c:
    print('Yes')
elif a==c!=b:
    print('Yes')
elif b==c!=a:
    print('Yes')
else:
    print('No')
X = int(input())
pow5 = [pow(i,5) for i in range(-150,150)]
for a in range(-150,150):
  for b in range(-150,150):
    if pow5[a+150]+pow[b+150] ==X:
      print(a,b)
      break


### FIXED CODE ###

import math
X = int(input())


def fif_root(arg):
    def root(x):
        return math.floor(math.pow(x,1/5)*pow(10,10))/pow(10,10)
    return list(map(lambda x: root(x), arg))

def check_integer(arg):
    return list(map(lambda x: x.is_integer(), arg))

a = 0
while (A:= math.pow(a, 5))-math.pow(a-1, 5) <= X:
    #a,-aの時それぞれの5乗根を計算する。
    root = fif_root([abs(X-A), X+A])
    if True in (c := check_integer(root)):
        idx = c.index(True)
        b = int(root[idx])
        if idx == 1:
            a, b = -a, -b
        else:
            if X - A >= 0:
                b = -b
        print(a, b)
        break
    a += 1
import copy
n,m = map(int,input().split())

#取得
scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for p in range(8):
    x=math.floor((p/4)%2)
    y=math.floor((p/2)%2)
    z=math.floor((p/1)%2)
    
    scores_=copy.deepcopy(scores)
    sumlist=list()

    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
        scores_[i][1] = pow(-1,y)*scores[i][1]
        scores_[i][2] = pow(-1,z)*scores[i][2]
        sumlist.append(sum(scores_[i]))
    sumlist.sort()
    
    tmp=0
    for eat in range(m):
        tmp+=sumlist[-1]
        sumlist.pop()
    if smax==None or tmp>smax:
        smax=tmp
print(smax)

### FIXED CODE ###

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

#取得
scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for x in range(2):
    scores_=copy.deepcopy(scores)
    
    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
    for y in range(2):
        for i in range(n):
            scores_[i][1] = pow(-1,y)*scores[i][1]
        for z in range(2):
            for i in range(n):
                scores_[i][2] = pow(-1,z)*scores[i][2]
        
            sumlist=list()
            for i in range(n):
                sumlist.append(sum(scores_[i]))
            sumlist.sort()
            
            tmp=0
            for eat in range(m):
                tmp+=sumlist[-1]
                sumlist.pop()
            if smax==None or tmp>smax:
                smax=tmp
print(smax)
s = input()
if s == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
else:
    full_lst = [i for i in range(ord('a'), ord('z')+1)]
    lst = []
    for i in range(len(s)):
        lst.append(ord(s[i]))
    
    if len(lst)!=len(full_lst):
        w = chr(min(set(full_lst)-set(lst)))
        print(s+w)
    else:
        res = ''
        for i in range(len(lst)):
            if lst[i]!=full_lst[i]:
                x = s[:i]
                y = lst[i:]
                break
        print(x[:-1] + chr(min(y)))

### FIXED CODE ###

from string import ascii_lowercase
s = input()

if s == ascii_lowercase[::-1]:
    print(-1)
elif len(s)!=len(ascii_lowercase):
    s1 = set(list(s))
    s2 = set(list(ascii_lowercase))
    w = min(s2-s1)
    print(s+w)
else:
    back = ''
    tmp = ''
    pos = 0
    for i in range(len(s))[::-1]:
        if i==25:
            back += s[i]
            tmp = s[i]
        elif s[i]>tmp:
            back += s[i]
            tmp = s[i]
        else:
            pos = i
            break
    
    res = s[:pos]
    w = s[pos]
    l = []
    for b in back:
        if b > w:
            l.append(b)
    print(res + min(l))
import copy
import sympy
N = int(input())
a = list(map(int, input().split()))

count = 0
for x in a:
    check = a.copy()
    check.remove(x)
    yaku = sympy.divisors(x)
    count_flag = True
    for y in yaku:
        if y != 1 and y in check:
            count_flag = False
            break

    if count_flag:
        count += 1
print(count)


### FIXED CODE ###

from collections import Counter

N = int(input())
a = sorted(list(map(int, input().split())))

M = 10**6

table = [1] * (M + 1)

B = Counter(a)
Key = list(B.keys())

count = 0
for x in Key:
    if B[x] == 1 and table[x] == 1:
        count += 1

    for i in range(M):
        if i * x > M:
            break
        else:
            table[i * x] = 0

print(count)
A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(a)==0:
    print("A")
elif len(b)==0:
    print("B")
else:
    print("C")


### FIXED CODE ###

A=input()
B=input()
C=input()
s="a"
while (len(A)!=0 or s!="a") and (len(B)!=0 or s!="b") and (len(C)!=0 or s!="c"):
  if s=="a":
    s=A[0]
    A=A[1:]
  elif s=="b":
    s=B[0]
    B=B[1:]
  else:
    s=C[0]
    C=C[1:]
if len(A)==0 and s=="a":
    print("A")
elif len(B)==0 and s=="b":
    print("B")
else:
    print("C")
import itertools
L,R=map(int,input().split())
ans=2019
for i in itertools.combinations(range(L,R+1),2):
	ans=min(ans,(i[0]*i[1])%2019)
print(ans)

### FIXED CODE ###

L,R=map(int,input().split())
ans=2019
for i in range(L,R):
	for j in range(i+1, R+1):
		if j%2019==0:
			print(0)
			exit()
		ans=min(ans,(i*j)%2019)
print(ans)
s = input()
for i in range(0, n, 2):
  print(s[i], end='')
print()

### FIXED CODE ###

s = input()
for i in range(0, len(s), 2):
  print(s[i], end='')
print()
import copy

N, Q = map(int, input().split())
S = input()
for i in range(Q):
    l ,r = map(int, input().split())
    SS = copy.copy(S)
    SS[l:r]
    ANS = 0
    for j in range(len(SS)):
        if SS[j] == "A" and SS[j+1] == "C":
            ANS += 1
    
    print(ANS)





### FIXED CODE ###

import copy

N, Q = map(int, input().split())
S = input()
t = [0]*(N+1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == "AC" else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1]-t[l-1])
import numpy as np

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

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def __call__(self, a, b=None): # calc [a, b) summation by O(1)
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[min(self.n-1, a-1)]
        return res


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

s = input()
ar = np.array(list(map(int, s)))

idx = -1
b = []

for i in np.where(ar[:-1] - ar[1:] != 0)[0]:
    b.append(i-idx)
    idx = i

b.append(N-1-idx)

b_int = Interval(b)

if s[0] == '1':
    print(max(
        b_int(i, i+2*K+1) for i in range(0, b_int.n) if i%2 == 0
    ))    
else:
    res = b_int(0, 2*K)
    print(max(res, max(
        b_int(i, i+2*K+1) for i in range(1, b_int.n) if i%2 == 0        
    )))


### FIXED CODE ###

import numpy as np

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

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def __call__(self, a, b=None): # calc [a, b) summation by O(1)
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[min(self.n-1, a-1)]
        return res


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

s = input()
ar = np.array(list(map(int, s)))

idx = -1
b = []

for i in np.where(ar[:-1] - ar[1:] != 0)[0]:
    b.append(i-idx)
    idx = i

b.append(N-1-idx)

b_int = Interval(b)

if s[0] == '1':
    print(max(
        b_int(i, i+2*K+1) for i in range(0, b_int.n) if i%2 == 0
    ))    
else:
    res = b_int(0, 2*K)
    if b_int.n > 1:
        res = max(res,max(
            b_int(i, i+2*K+1) for i in range(1, b_int.n) if i%2 == 1
        ))
    print(res)
while 1:
	n = input()
	if n == 0: break
	item = {}
	for i in range(n):
		name,cost = raw_input().split()
		item[name] = int(cost)
	m = input()
	recipes = [raw_input().split() for i in range(m)]
	recipes = sorted(recipes, key = lambda x: item[x[0]] if x[0] in item else 2<<31)
	for recipe in recipes:
		name = recipe[0]
		needs = recipe[2:]
		cost = 0
		for need in needs:
			cost += item[need]
		item[name] = min(cost, item[name]) if name in item else cost
	print item[raw_input()]

### FIXED CODE ###

while 1:
	n = input()
	if n == 0: break
	item = {}
	for i in range(n):
		name,cost = raw_input().split()
		item[name] = int(cost)
	for i in range(input()):
		recipe = raw_input().split()
		cost = sum(item[name] if name in item else 0 for name in recipe[2:])
		item[recipe[0]] = min(cost, item[recipe[0]])
	print item[raw_input()]
N = int(input())
 
if N in [1, 2, 3, 5, 6, 7, 9, 10, 13, 17]:
   print("Yes")
else:
   print("No")


### FIXED CODE ###

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

if N % K == 0:
    print(0)
else:
    print(1)
import copy
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
ans=[]
for i in range(n):
  x1=l[i][0]
  y1=l[i][1]
  for j in range(n):
    if i!=j:
      x2=l[j][0]
      y2=l[j][1]
      if (x1-x2)!=0:
        p=(y1-y2)/(x1-x2)
        L=[]
        for k in range(n):
          L.append(round(l[k][1]-l[k][0]*p,9))
        ans.append(len(set(L)))
      else:
        L=[]
        for k in range(n):
          L.append(l[k][0])
        ans.append(len(set(L)))
print(min(ans))

### FIXED CODE ###

class UF():
  def __init__(self, N):
    self._parent=[n for n in range(0, N)]
    self._size=[1] * N

  def find_root(self, x):
    if self._parent[x]==x:return x
    self._parent[x]=self.find_root(self._parent[x])
    return self._parent[x]

  def unite(self, x, y):
    gx=self.find_root(x)
    gy=self.find_root(y)
    if gx==gy:return

    if self._size[gx]<self._size[gy]:
      self._parent[gx]=gy
      self._size[gy]+=self._size[gx]
    else:
      self._parent[gy]=gx
      self._size[gx]+=self._size[gy]

  def size(self, x):
    return self._size[self.find_root(x)]

  def samegroup(self, x, y):
    return self.find_root(x)==self.find_root(y)

  def groupnum(self):
    N=len(self._parent)
    ans=0
    for i in range(N):
      if self.find_root(i)==i:
        ans+=1
    return ans

  def reset(self):
    self._parent=[n for n in range(0, n)]

n=int(input())
UF=UF(n)
l=[list(map(int,input().split())) for i in range(n)]
if n==1:
  print(1)
else:
  ans=[]
  for i in range(n):
    x1=l[i][0]
    y1=l[i][1]
    for j in range(n):
      if i!=j:
        x2=l[j][0]
        y2=l[j][1]
        p=x1-x2
        q=y1-y2
        for k1 in range(n):
          for k2 in range(n):
            if k1!=k2:
              if (l[k1][0]-p==l[k2][0] and l[k1][1]-q==l[k2][1]) or (l[k1][0]+p==l[k2][0] and l[k1][1]+q==l[k2][1]):
                UF.unite(k1,k2)
        ans.append(UF.groupnum())
        UF.reset()
  print(min(ans))
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())


N,K,Q = MI()

X = [0]*(N+1)  # 各参加者の正解数
for _ in range(Q):
    a = I()
    X[a] += 1

for i in range(1,N+1):
    x = X[i]
    print('Yes' if K-(Q-x) > 0 else 'No')


### FIXED CODE ###

import sys
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
N = len(S)
S1 = S[::2]
S2 = S[1::2]

r = sum(s in ['R','U','D'] for s in S1) + sum(s in ['L','U','D'] for s in S2)
print('Yes' if r == N else 'No')
# -*- coding: utf-8 -*-
a,b,x = map(int,input().split())
a = []
for i in range(a:b+1):
  if i % x == 0:
    a.append(1)
print(sum(a))

### FIXED CODE ###

a,b,x = map(int,input().split())

def func(i):
    if i != -1:
        return i//x+ 1
    else:
        return 0

print(func(b) - func(a-1))
a,b = MAP()
ans=1
while a<b:
    a += a-1
    ans += 1
print(ans)

### FIXED CODE ###

def MAP(): return map(int,input().split())
import math

a,b = MAP()
print(math.ceil((b-a)/(a-1))+1)
text = input().split("\n")
T = int(text[0])
W = [int(i) for i in text[1]]
S_1 = sum(W[:T])
S_2 = sum(W[T:])
print(abs(S_1 - S_2))


### FIXED CODE ###

n_text = input()
w_text = input()

N = int(n_text)
W = w_text.split()

W = [int(i) for i in W]

ans = 100 * 100

for T in range(N):
  ans_tmp = abs(sum(W[:T]) - sum(W[T:]))
  if ans_tmp < ans:
    ans = ans_tmp

print(ans)
n, a, b = map(int, input().split())
res = 0

for i in range(1:n+1):
  sum = 0
  j=0
  while True:
    num = i/(10**j)%10
    if num != 0:
      sum += num
      j+=1
    else:
      break
  if a<=sum && sum<=b:
    res += sum;

print(res)
    

### FIXED CODE ###

def main():
    N, A, B = [int(_) for _ in input().split()]

    ans = 0

    for num in range(1, N + 1):
        if A <= sum(map(int, list(str(num)))) <= B:
            ans += num

    print(ans)

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

ps=sorted(int(i) for i in input().split())

if n>=m:
    print(0)
    exit()

dis2=sorted(ps[i+1]-ps[i] for i in range(m-1))


print(sum(dis2[:m-n]))


### FIXED CODE ###

a,b=map(float,input().split())
print(a/b)
n = int(input)
moji = input()
res = 'Yes'
if n % 2 == 1:res = 'No'
else:
  for i in range(len(n/2)):
    if moji[i] != moji[n/2+1]:
      res = 'No'
      
print(res)

### FIXED CODE ###

n = int(input())
moji = input()
res = 'Yes'
if n % 2 == 1:
    res = 'No'
else:
    for i in range(int(n/2)):
        if moji[i] != moji[int(n/2)+i]:
            res = 'No'
            break
      
print(res)
a = int(input())
b = int(input())
c = int(input())
d=0
if (a==b):
    d+=1
if (b==c):
    d+=1
if (c==a):
    d+=1
if (d==1):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
if (a==b):
    d+=1
if (b==c):
    d+=1
if (c==a):
    d+=1
if (d==1):
    print('Yes')
else:
    print('No')
x,y,z = map(int, input().split())
D=x*y
T=z
 if( D<T,print(D))
 else(D>T,print(T)
  

### FIXED CODE ###

x,y,z = map(int, input().split())
D = x * y
T=z
if  D < T :
      print(D)
else : print(T)
n=int(input())
X=[]
Y=[]
for i in range(n):
  A=int(input())
  x=[]
  y=[]
  for j in range(A[i]):
    x,y=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
c=0
for i in range(n):
  l=[1]*n
  for j in range(i, n-i):
    if l[j]==0:continue
    for k in range(A[j]):
    　　l[X[j][k]] *= Y[j][k]
if c<l.count(1):
  c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
a = list(map(int, input().split()))
#print(a)
b=[0]*a[1]
c=[0]*(a[1]+1)
b[0]=int(input())
c[0]=b[0]-0
for x in range(a[1]-1):
    b[x+1]=int(input())
    c[x+1]=b[x+1]-b[x]-1
c[-1]=a[0]-b[-1]
max = 0
min = a[0]+100
for x in c:
    if x>max:
        max=x
    if x<min:
        min=x
        
#print(c)
#print(max," ",min)
if min==0:
    print(0)
else:
    num=[0]*(max)
    for x in range(max):
        if x==0:
            num[0]=1
        elif x==1:
            num[1]=1
        else:
            num[x]=num[x-1]+num[x-2]
        #print("num[",x,"]=",num[x])
        
    answer=1
    for x in c:
        answer *=num[x-1]
        if answer==0:
            print(0)
            break
        else:
            answer%=1000000007
    print(answer)

### FIXED CODE ###

n,m = list(map(int, input().split()))
a=[]
a.append(-1)
for x in range(m):
  tmp=int(input())
  a.append(tmp)
a.append(n+1)
diff = []
for x in range(len(a)-1):
  diff.append(a[x+1]-a[x])
              
large = 0
small = 123456789012345
for x in diff:
  large=max(large,x)
  small=min(small,x)

num=[0,0,1]
for _ in range(large):
  num.append((num[-1]+num[-2])%1000000007)
    
answer=1
for x in diff:
  #print(x,num[x])
  answer *=num[x]
  answer%=1000000007
print(answer)
import sys
input = sys.stdin.readline

def gcd(x, y):
    x = abs(x)
    y = abs(y)

    if x < y:
        x, y = y, x

    while y:
        x, y = y, x%y
        
    return x

N = int(input())
seen = dict()
for _ in range(N):
    a, b = map(int, input().split())
    if a < 0:
        a, b = -a,-b
    if b < 0:
        a, b = -b, a
        flip = 1
    else:
        flip = 0
    g = gcd(a,b)
    a//=g
    b//=g
    if (a,b) not in seen:
        seen[(a,b)] = [0,0]
    
    seen[(a,b)][flip] += 1

MOD = 10 ** 9 + 7
    
out = 1
for v in seen:
    a, b = seen[v]
    out *= (pow(2,a,MOD) + pow(2,b,MOD) - 1)
    out %= MOD
out -= 1
out %= MOD
print(out)


### FIXED CODE ###

import sys
input = sys.stdin.readline

def gcd(x, y):
    x = abs(x)
    y = abs(y)

    if x < y:
        x, y = y, x

    while y:
        x, y = y, x%y
        
    return x

N = int(input())
seen = dict()
zeroes = 0
for _ in range(N):
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        zeroes += 1
        continue
    
    if a < 0 or a == 0 and b < 0:
        a, b = -a,-b
    if b <= 0:
        a, b = -b, a
        flip = 1
    else:
        flip = 0
    g = gcd(a,b)
    a//=g
    b//=g
    if (a,b) not in seen:
        seen[(a,b)] = [0,0]
    
    seen[(a,b)][flip] += 1

MOD = 10 ** 9 + 7
    
out = 1
for v in seen:
    a, b = seen[v]
    out *= (pow(2,a,MOD) + pow(2,b,MOD) - 1)
    out %= MOD
out -= 1

out += zeroes
out %= MOD
print(out)
A,B=map(int(input().split()))
if A%B==0:
    print(A+B)
else:
    print(A-B)

### FIXED CODE ###

A,B=map(int,input().split())
if B%A==0:
    print(A+B)
else:
    print(B-A)
H, W = map(int,input().split())
S = [list(input()) for i in range(H)]
ansm = [[""]*W for i in range(H)]
for i in range(H):
    for j in range(W):
        cnt = 0
        if S[i][j]=="#":
            ansm[i][j]="#"
        else:
            if i>0 and j>0:
                if S[i-1][j-1]=="#":
                    cnt +=1
            if i>0:
                if S[i-1][j]=="#":
                    cnt+=1
            if i>0 and j<(W-1):
                if S[i-1][j+1]=="#":
                    cnt+=1
            if j>0:
                if S[i][j-1]=="#":
                    cnt+=1
            if j<W-1:
                if S[i][j+1]=="#":
                    cnt+=1
            if i<H-1 and j>0:
                if S[i+1][j-1]=="#":
                    cnt+=1
            if i<H-1:
                if S[i+1][j]=="#":
                    cnt+=1
            if i<H-1 and j<(W-1):
                if S[i+1][j+1]=="#":
                    cnt+=1
            ansm[i][j]=str(cnt)
ans = [""]*3
for i in range(H):
    for j in range(W):
        ans[i]=ans[i]+ansm[i][j]
for i in range(H):
    print(ans[i])

### FIXED CODE ###

H, W = map(int,input().split())
S = [list(input()) for i in range(H)]
ansm = [[""]*W for i in range(H)]
for i in range(H):
    for j in range(W):
        cnt = 0
        if S[i][j]=="#":
            ansm[i][j]="#"
        else:
            if i>0 and j>0:
                if S[i-1][j-1]=="#":
                    cnt +=1
            if i>0:
                if S[i-1][j]=="#":
                    cnt+=1
            if i>0 and j<(W-1):
                if S[i-1][j+1]=="#":
                    cnt+=1
            if j>0:
                if S[i][j-1]=="#":
                    cnt+=1
            if j<W-1:
                if S[i][j+1]=="#":
                    cnt+=1
            if i<H-1 and j>0:
                if S[i+1][j-1]=="#":
                    cnt+=1
            if i<H-1:
                if S[i+1][j]=="#":
                    cnt+=1
            if i<H-1 and j<(W-1):
                if S[i+1][j+1]=="#":
                    cnt+=1
            ansm[i][j]=str(cnt)
ans = [""]*H
for i in range(H):
    for j in range(W):
        ans[i]=ans[i]+ansm[i][j]
for i in range(H):
    print(ans[i])
import sys

def longestcommonsubsequence():
    seq1 = raw_input()
    seq2 = raw_input()

    a,b = len(seq1), len(seq2)
    x1 = [0 for i in range(b+1)]
    for i in range(a+1):
        e1 = seq1[i]
        x2 = x1
        x1 = [0 for i2 in range(b+1)]
        tmp = 0
        for j in range(b):
            if e1 == seq2[j]:
                tmp = x2[j] + 1
            else:
                tmp = max(x2[j+1], tmp)
            x1[j+1] = tmp
    return x1[-1]

n = input()
for i2 in range(n):

    print longestcommonsubsequence()

### FIXED CODE ###

import sys

def longestcommonsubsequence():
    seq1 = raw_input()
    seq2 = raw_input()

    a, b = len(seq1), len(seq2)
    x1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = seq1[i]
        x2 = x1+[]
        #x1 = [0 for i2 in range(b+1)]
        for j in range(b):
            if e1 == seq2[j]:
                x1[j+1] = x2[j] + 1
            elif x1[j+1]<x1[j]:
                x1[j+1] = x1[j]
    return x1[-1]

n = input()
for i2 in range(n):

    print longestcommonsubsequence()
n = int(input())
a = sorted([int(input()) for _ in range(N)])
print(a[-1]-a[0])

### FIXED CODE ###

N = int(input())
a = map(int, input().split())
a = sorted(a)
print(a[-1]-a[0])
S = input()
ACGT = ['A', 'C', 'G', 'T']
ans = []

for i in range(len(S)):
    j = 0
    while i + j < len(S):
        if S[i + j] in ACGT:
            j += 1
        else:
            ans.append(S[i : i + j])
            break
print(max([len(x) for x in ans]))

### FIXED CODE ###

S = input()
ACGT = ['A', 'C', 'G', 'T']
ans = []
if len(S) == 1:
    if S in ACGT:
        print(1)
    else:
        print(0)
else:
    for i in range(len(S)):
        j = 0
        while i + j < len(S):
            if S[i + j] in ACGT:
                j += 1
            else:
                ans.append(S[i : i + j])
                break
        if i + j == len(S):
            ans.append(S[i : len(S)])
    
    print(max([len(x) for x in ans]))
[a.b]=map(int,input().split( ))
if a>b:
 print("a>b")
elif a<b:
 print("a<b")
else:
 print("a==b")

### FIXED CODE ###

a,b=[int(x) for x in input().split()]
op = ">" if a > b else "<" if a < b else "=="
print("a",op,"b")
import sys

readline = sys.stdin.buffer.readline
a, b = map(int, readline().split())
c = set(map(int, readline().split()))

L = [(i, i - a) for i in range(1, 100) if i not in c]
L.sort(key=lambda x: abs(x[1]))
print(L[0][0])

### FIXED CODE ###

import sys
import operator

readline = sys.stdin.buffer.readline
a, b = map(int, readline().split())
c = set(map(int, readline().split()))

L = [(i, abs(i - a)) for i in range(0, 102) if i not in c]
L.sort(key=operator.itemgetter(1))
print(L[0][0])
# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan(a/(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan(c/b)
    deg = math.degrees(theta)

print("{:.9}".format(90-deg))


### FIXED CODE ###

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

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan2(a,(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan2(c,b)
    deg = math.degrees(theta)

print("{}".format(90.0-deg))
S = input()
c = collections.Counter(S)
values, counts = zip(*c.most_common())
a = 0
for i in counts:
    if i==2:
        a += 1
    else:
        a *= 0
if a:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

import collections
S = input()
c = collections.Counter(S)
values, counts = zip(*c.most_common())
a = 0
for i in counts:
    if i==2:
        a += 1
    else:
        a *= 0
if a:
    print("Yes")
else:
    print("No")