Harryxun/stf_run huggingface dataset:
import math

r= float(input().rstrip().split(' ')

a = r * 2pi

b = r * pi

print(a, b)

### FIXED CODE ###

import math

r= float(input())

a = r * r * math.pi

b = 2 * math.pi * r

print(a, b)
import sys
from bisect import bisect_left,bisect

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
n,m=map(int,input().split())

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

for i in range(m):
	A.insert(bisect_left(A,max(A)//2),max(A)//2)
	del A[n]
	
print(sum(A))

### FIXED CODE ###

import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
S=input()

if S=="Sunny":
	print("Cloudy")
if S=="Cloudy":
	print("Rainy")
if S=="Rainy":
	print("Sunny")
a, b, c, d = map(int, input().split())
while True:
    if (c - b) <= 0:
        print("Yes")
        exit()
    else:
        c = c - d
        if a - d <= 0:
            print("No")
            exit()
        else:
            a = a - 

### FIXED CODE ###

a, b, c, d = map(int, input().split())
while True:
    if (c - b) <= 0:
        print("Yes")
        exit()
    else:
        c = c - b
        if a - d <= 0:
            print("No")
            exit()
        else:
            a = a - d
mod = 998244353
N,K = map(int,input().split())

D = [list(map(int,input().split())) for _ in range(K)]
D.sort()

dp = [0]*N
dp[0] = 1
dp[D[0][0]] = 1

for n in range(D[0][0],N-1):
    dp[n+1] = dp[n]
    for i in range(K):
        L,R = D[i]
        if n-L+1>=0:
            dp[n+1] += dp[n-L+1]
        if n-R+1>0:
            dp[n+1] -= dp[n-R]
        dp[n+1] %= mod
print(dp[N-1])

### FIXED CODE ###

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

D = [list(map(int,input().split())) for _ in range(K)]
D.sort()

dp = [0]*N
dp[0] = 1
if D[0][0]<N:
    dp[D[0][0]] = 1

    for n in range(D[0][0],N-1):
        dp[n+1] = dp[n]
        for i in range(K):
            L,R = D[i]
            if n-L+1>=0:
                dp[n+1] += dp[n-L+1]
            if n-R+1>0:
                dp[n+1] -= dp[n-R]
            dp[n+1] %= mod
print(dp[N-1])
a=int(input())
if a[0]==c[2]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a=input()
if a[0]==a[2]:
  print("Yes")
else:
  print("No")
n=int(input())
s = input()
n=len(s)

post = ''
ans=0
data=[]

left=[]
right=[]

tmp=0
for i in range(n):
    if s[i]=='#':
        tmp+=1
    elif tmp!= 0:
        left.append(tmp)
        tmp=0


tmp=0
for i in range(n):
    if s[n-i-1]=='.':
        tmp+=1
    if n-i-1-1 >=0 and s[n-i-1-1]=="#" and tmp!=0:
        right.append(tmp)
        tmp=0

right.reverse()
# print(s)
# print(left)
# print(right)

for i in range(len(left)):
    if i == len(left)-1:
        ans+=min(left[i],right[i])
        break
    l = left[i]
    r = right[i]
    if l >= r:
        ans+=r
        left[i+1]=l+r+left[i+1]
    else:
        ans+=l


print(ans)

### FIXED CODE ###

a,b,c=list(map(int,input().split()))

if (a<=c and c <= b) or (b<=c and c <= a):
    print('Yes')
else:
    print('No')
from fractions import gcd
N=int(input())
A=list(map(int,input().split()))
Asorted = sorted(A)


L=[0]*N
R=[0]*N
L[0]=A[0]
R[0]=A[N-1]

for n in range(1,N):
  L[n]=gcd(A[n],L[n-1])
  R[n]=gcd(A[N-n-1],R[n-1])
  
  ans=max(L[N-2],R[N-2])

for i in range(1,N-1):
  ans=max(ans,gcd(L[i-1],R[N-i-2]))

print(ans)

### FIXED CODE ###

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

print(int((T+0.5)//A*B))
N , M = [int(n) for n in input.split(' ')]

list_AC = []
count_WA = {}

for i in range(M):
    p , S = input.split(' ')
    
    if (p in list_AC):
        # 既にAC済みの場合は何もしない
        continue 
    else:
        if S = 'AC':
            list_AC.append(p)
        else:
            if p in count_WA:
                count_WA[p] += 1
            else:
                count_WA[p] = 1
        
for i in list_AC:
    if i in count_WA:
        print(count_WA[i])
    else:
        print(0)

### FIXED CODE ###


N , M = [int(n) for n in input().split(' ')]

list_AC = [0] * N
list_WAcount = [0] * N
sumAC = 0
sumWA = 0

for i in range(M):
    sp , S = input().split(' ')
    p = int(sp)
    
    if (list_AC[p-1] != 0):
        # 既にAC済みの場合は何もしない
        continue 
    else:
        # 最初に正解したときにそれまでのWA回数を加算
        if S == 'AC':
            sumAC += 1
            list_AC[p-1] = 1
            sumWA += list_WAcount[p-1]
        else:
            list_WAcount[p-1] += 1

print("{} {}".format(sumAC,sumWA))
a = int(input())
print("T" if a == "A" else "A" if a == "T" else "G" if a == "C" else "C")

### FIXED CODE ###

a = input()
print("T" if a == "A" else "A" if a == "T" else "G" if a == "C" else "C")
h, w = map(int,input().split())
grids = []
for i in range(h):
    grids.append(input())
    
start = []
for i in range(len(grids)):
    if "#" in grids[i]:
        start = [i, grids[i].index("#")]
        break

if len(start) == 0:
    print("No")
    quit

queue = [start]
check = [start]
ans = "No"
while len(queue) != 0:
    x, y = queue[0][0], queue[0][1]
    queue.pop(0)

    if x > 0:
        if grids[x-1][y] == "#" and [x-1, y] not in check:
            queue.append([x-1, y])
            check.append([x-1, y])
    if x < h-1:
        if grids[x+1][y] == "#" and [x+1, y] not in check:
            queue.append([x+1, y])
            check.append([x+1, y])
    if y > 0:
        if grids[x][y-1] == "#" and [x, y-1] not in check:
            queue.append([x, y-1])
            check.append([x, y-1])
    if y < w-1:
        if grids[x][y+1] == "#" and [x, y+1] not in check:
            queue.append([x, y+1])
            check.append([x, y+1])

cnt = 0
for grid in grids:
    cnt += grid.count("#")
    
if cnt == len(check):
    ans = "Yes"
print(ans)


### FIXED CODE ###

H,W = map(int, input().split())
s = []
answer = "Yes"

for i in range(H):
    s.append(str(input()))

for i in range(H):
    for j in range(W):
        if s[i][j] == "#":
            if j != 0 and s[i][j-1] == ".":
                if j+1 != W and s[i][j+1] == ".":
                    if i != 0 and s[i-1][j] == ".":
                        if i+1 != H and s[i+1][j] == ".":
                            answer ="No"

print(answer)
import numpy as np

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

next = np.zeros((N, N))

for i in range(M):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    next[u][v] = 1

s, t = map(int, input().split())
s -= 1
t -= 1

next = np.dot(next, np.dot(next, next))
for i in range(N):
    next[i][i] = 0

now = t
step = 0
check_list = [[now, step]]
ok = False
check = [False] * N
check[now] = True
while len(check_list) > 0:
    now, step = check_list.pop(0)
    for i in range(N):
        if next[i][now] > 0:
            if not check[i]:
                if i == s:
                    print(step+1)
                    # print(check)
                    ok = True
                    break
                check_list.append([i, step+1])
                check[i] = True
    if ok:
        break
if not ok:
    print(-1)


### FIXED CODE ###

N, M = map(int, input().split())
nodes = [[] for i in range(N)]

for i in range(M):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    nodes[u].append(v)

s, t = map(int, input().split())
s -= 1
t -= 1

num = s
step = 0
q = [[num, step]]
check = [[False for i in range(N)] for j in range(3)]
ok = False
while len(q) > 0:
    num, step = q.pop(0)
    tmp = step % 3
    if tmp == 0 and num == t:
        print(step//3)
        ok = True
        break
    for next in nodes[num]:
        if not check[tmp][next]:
            check[tmp][next] = True
            q.append([next, step+1])
if not ok:
    print(-1)
from scipy.special import perm, comb
li = input().split()
N=int(li[0])
A=int(li[1])
B=int(li[2])
K=int(li[3])
count=0
for i in range (N+1):
    for k in range(N+1):
        if((A+B)*N-A*i-B*k==K):
            ca=comb(N, i, exact=True)
            cb=comb(N,k,exact=True)
            count=count+ca*cb
print(count%998244353)

### FIXED CODE ###

li = input().split()
N=int(li[0])
A=int(li[1])
B=int(li[2])
K=int(li[3])
mod = 998244353 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0;
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
count=0
for i in range (N+1):
    if(((A+B)*N-A*i-K)%B==0):
        k=((A+B)*N-A*i-K)//B
        ca=cmb(N,i,mod)
        cb=cmb(N,k,mod)
        count=count+ca*cb
print(count%mod)
#coding utf-8
x=input()
y=input()
if x > y:
    print("a > b")
elif x==y:
        print("a == b")
else:
        print("a < b")

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
data = map(int, raw_input().split())
if data[0] < data[1]:
    print "a < b"
elif data[0] == data[1]:
    print "a == b"
else:
    print "a > b"
N = list(map(int,input().split()))
N2 = N[:-1]
for i in range(N[3]):
    N2[0] = N[1] + N[2]
    N2[1] = N[0] + N[2]
    N2[2] = N[0] + N[1]
    N = N2.copy
ans = N2[0] - N2[1]
if abs(ans) > 10**18:
    print('Unfair')
else:
    print(ans)

### FIXED CODE ###

a,b,c,k = map(int, input().split())
cheak = 10**18
ans = a-b
def calc(a,b,c,k):
    if a == b:
        return 0
    elif ans < 0:
        if k % 2 == 1:
            return -ans
        else:
            return ans
    else:
        if k % 2 == 1:
            return -ans
        else:
            return ans
ans_n = calc(a,b,c,k)
if ans_n > cheak:
    print("Unfair")
else:
    print(ans_n)
def start():
    n = int(input())
    arr = [int(v) for v in input().split(" ")]
    dp = [-1] * n
    def frog_1(i, arr):
        if i == n - 1:
            return 0
        if dp[i] != -1:
            return dp[i]
        left = abs(arr[i] - arr[i + 1]) + frog_1(i + 1, arr)
        right = float("inf")
        if i+2 < n:
            right = abs(arr[i] - arr[i + 2]) + frog_1(i + 2, arr)
        dp[i] = min(left, right)
        return dp[i]
    print(frog_1(0,arr), end="")



start()

# frog_1([10,10])

### FIXED CODE ###

import sys

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

dp = [sys.maxsize] * n
dp[0] = 0
for i in range(n):
    for j in (i + 1, i + 2):
        if j < n:
            dp[j] = min(dp[j], dp[i] + abs(a[i] - a[j]))
print(dp[n - 1], end="")
import numpy as np
from scipy.ndimage.interpolation import shift as scipy_shift

class shift:
    def __init__(self,a):
        self.arr = a
        self.height = a.shape[0]
        self.width = a.shape[1]
    def shifted(self,down,right):
        temp1 = self.arr[list(np.linspace(-down, -down + self.height - 1, self.height, dtype=int) % self.height), :]
        temp2 = temp1[:, list(np.linspace(-right, -right + self.width - 1, self.width, dtype=int) % self.width)]
        return temp2
    def shifted_zero(self,down,right):
        index_vertical = np.arange(self.height)
        index_horizontal = np.arange(self.width)
        temp1 = self.arr[list(scipy_shift(index_vertical, down, output = int, mode = 'constant')),:]
        temp2 = temp1[:,list(scipy_shift(index_horizontal, right, output = int, mode = 'constant'))]
        return temp2
    def is_sym(self,down,right):
        temp = self.shifted(down,right)
        delta = temp - temp.T
        return(not (delta*delta).sum())



N = int(input())
array = [list(input()) for i in range(N)]
array_int = np.array([[ord(i) for i in j] for j in array])

count = np.array([[shift(array_int).is_sym(i,j) for i in range(N)] for j in range(N)])
print(count)
print(count.sum())

### FIXED CODE ###

import numpy as np
from scipy.ndimage.interpolation import shift as scipy_shift

class shift:
    def __init__(self,a):
        self.arr = a
        self.height = a.shape[0]
        self.width = a.shape[1]
    def shifted(self,down,right):
        temp1 = self.arr[list(np.linspace(-down, -down + self.height - 1, self.height).astype(np.int32) % self.height), :]
        temp2 = temp1[:, list(np.linspace(-right, -right + self.width - 1, self.width).astype(np.int32) % self.width)]
        return temp2
    def shifted_zero(self,down,right):
        index_vertical = np.arange(self.height)
        index_horizontal = np.arange(self.width)
        temp1 = self.arr[list(scipy_shift(index_vertical, down, output = int, mode = 'constant')),:]
        temp2 = temp1[:,list(scipy_shift(index_horizontal, right, output = int, mode = 'constant'))]
        return temp2
    def is_sym(self,down,right):
        temp = self.shifted(down,right)
        delta = temp - temp.T
        return(not (delta*delta).sum())



N = int(input())
array = [list(input()) for i in range(N)]
array_int = np.array([[ord(i) for i in j] for j in array])

if N >= 2:
    count = np.array([shift(array_int).is_sym(0,i)*(N-i) for i in range(N)]).sum() + np.array([shift(array_int).is_sym(i,0)*(N-i) for i in range(1,N)]).sum()
else:
    count =  int(shift(array_int).is_sym(0,0))
print(count)
a = int(input())
2a = 3 * (a ** a)
 
print (2a)

### FIXED CODE ###

r = int(input())
print(3*r*r)
a = input()
if a >= 1200:
  print('ARC')
else:
  print('ABC')

### FIXED CODE ###

a = int(input())
if a >= 1200:
  print('ARC')
else:
  print('ABC')
class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'
      
a = int(input())
b = int(input())
solver = ABC109Solver()
solver.input(a,b)

print( solver.solve() )


### FIXED CODE ###

class ABC109Solver():
    def __init__(self):
        self.a = int()
        self.b = int()
    def input(self, a, b):
        self.a = a
        self.b = b
    def solve(self):
        # return 'Yes'
        # return 'No' if self.b%2 == 0 else 'Yes'
        return 'No' if self.a%2 == 0 or self.b%2 == 0 else 'Yes'

vals = input().split(' ')
a, b = int(vals[0]), int(vals[1])
solver = ABC109Solver()
solver.input(a,b)
 
print( solver.solve() )
import math
a = int(raw_input())

b = (pow(a, 2) * math.pi)
c = 2 * a * math.pi
print format(b,"0.6f"), format(c, ".6f")

### FIXED CODE ###

import math
a = float(raw_input())

b = (pow(a, 2) * math.pi)
c = 2 * a * math.pi
print format(b,".6f"), format(c, ".6f")
n=int(input())
a=[]*4
for i range(4):
  a[i]=int(input())
if(a[0]<a[1]):print(a[2]*a[0])
else:print(a[2]*(a[1]-1)+a[3]*(a[0]-a[1]+1))

### FIXED CODE ###

a=[0]*4
for i in range(4):
  a[i]=int(input())
if(a[0]<a[1]):print(a[2]*a[0])
else:print(a[2]*(a[1])+a[3]*(a[0]-a[1]))
s=input()
array=[]
for i in range (len(s)):
    array.append(s[i])
for i in range(len(set(s)+1)):
    if chr(97+i) in array:
        continue
    else:
        print(chr(97+i))
        exit()
print("None")

### FIXED CODE ###

s=input()
a="abcdefghijklmnopqrstuvwxyz"
for i in a:
    if i not in s:
        print(i)
        exit()
print("None")
s = input().split()
if s in 'A' and s in 'B':
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()
if 'A' in s and 'B' in s:
  print('Yes')
else:
  print('No')
n = int(input())

li = []
for i in range(n):
    li.append(list(map(float, input().split())))


for money in li:
    if money[1] == 'JPN':
        continue
    else:
        money[0] *= 380000.0

sum_money = sum([i[0] for i in li])


### FIXED CODE ###

n = int(input())
 
li = []
for i in range(n):
    li.append(list(input().split()))
 
 
for money in li:
    if money[1] == 'JPY':
        continue
    else:
        money[0] = float(money[0]) * 380000.0
 
sum_money = sum([float(i[0]) for i in li])
  
print(sum_money)
if a < b:
  return print('a < b')
elif a > b:
  return print('a > b')
elif a == b:
  return print('a == b')
else:
  pass

### FIXED CODE ###

a, b = map(int, input().split())
if a < b:
  print('a < b')
elif a > b:
  print('a > b')
elif a == b:
  print('a == b')
else:
  pass
money=input()
sum=input()
money500=500*money
if money500>=sum:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

money,sum=map(int,input().split())
money500=500*money
if money500>=sum:
    print('Yes')
else:
    print('No')
al = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N = int(input())
S = list(input())

for i in S:
  x = al.index(S[i])
  c = x+N
  if c < 25:
      S[i] = al[c]
  else:
      S[i] = al[c-25]
      
print(S)

### FIXED CODE ###

al = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
N = int(input())
S = list(input())

for i in range(len(S)):
  x = al.index(S[i])
  c = x+N
  if c <= 25:
      S[i] = al[c]
  else:
      S[i] = al[c-26]
      
print("".join(S))
n,m = list(map(int, input().split()))
x = []
ans = [0]*m
answ = 0
s,c = [], []

def has_duplicates(seq):
    return len(seq) != len(set(seq))

for i in range(m):
  x.append(list(map(int,input().split())))
  
#重複を取り除く
x = list(map(list, set(map(tuple, x))))

for i,j in x:
  s.append(i)
  c.append(j)
  
#sに重複があれば－１を出力
if has_duplicates(s):
  print(-1)
else:
  for i,j in x:
    ans[i-1] = j
    
  if ans.count(0) == m:
    print(-1)
  else:
    for i in range(len(ans)):
      answ += ans[i]*(10**(m-1-i))
    
    if len(str(answ)) == n:
    	print(answ)
    else:
      print(-1)

### FIXED CODE ###

n,m = list(map(int, input().split()))
x = []
ans = [0]*n
answ = 0
s,c = [], []

def has_duplicates(seq):
    return len(seq) != len(set(seq))

for i in range(m):
  x.append(list(map(int,input().split())))
  
#重複を取り除く
x = list(map(list, set(map(tuple, x))))

for i,j in x:
  s.append(i)
  c.append(j)

if (n == 1) and (m == 0):
  print(0)
elif m == 0:
  ans[0] = 1
  for i in range(len(ans)):
    answ += ans[i]*(10**(n-1-i))
    
  print(answ)
elif has_duplicates(s):
  print(-1)
elif (n == 1) and (c.count(0) == 1):
  print(0)
else:
  for i,j in x:
    ans[i-1] = j
    
  if (ans[0] == 0) and (s.count(1) == 0):
    ans[0] = 1
    
  for i in range(len(ans)):
    answ += ans[i]*(10**(n-1-i))

  if ans[0] == 0:
    print(-1)
  else:
    print(answ)
from itertools import accumulate

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

def solve():
    cnt=0
    l=[]
    prev = "1"
    for i in s:
        if prev ==i:
            cnt += 1
        else:
            l.append(cnt)
            cnt = 1
        prev =i
    l.append(cnt)
    if prev=="0":
        l.append("0")

    w = 2 * k + 1

    if len(l) <=w:
        return n

    acc=[0]+list(accumulate(l))
    ans = 0
    for i in range(0,len(l) - w+ 1,2):
        ans = max(ans, acc[i+w] - acc[i])

    return ans
print(solve())

### FIXED CODE ###

from itertools import accumulate

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


def solve():
    l = []
    prev = '1'
    cnt = 0
    for c in s:
        if prev == c:
            cnt += 1
        else:
            l.append(cnt)
            cnt = 1
        prev = c
    l.append(cnt)
    if prev == '0':
        l.append(0)

    w = 2 * k + 1

    if len(l) <= w:
        return n

    acc = [0] + list(accumulate(l))
    ans = 0
    for i in range(0, len(l) - w + 1, 2):
        ans = max(ans, acc[i + w] - acc[i])
    return ans


print(solve())
import math
def lcm(x,y):
    return x*y/math.gcd(x,y)

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

print(int(lcm(a,b)))

### FIXED CODE ###

import fractions
def lcm(x,y):
    return x*y/fractions.gcd(x,y)

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

print(int(lcm(a,b)))
N,M=map(int,input().split())
box=[[] for i in range(M)]
for i in range(M):
    a,b=map(int,input().split())
    box[a-1].append(b-1)
    box[b-1].append(a-1)
ans=[0]*(N)
que=[]
ans[0]=1
for i in range(N):
    if ans[i]!=0:
        que.extend(box[i])
    while len(que)>0:
        c=que.pop()
        if ans[c]==0:
            ans[c]=i+1
for i in range(1,N):
    if ans[i]==0:
        flag=0
        break
    else:
        flag=1
if flag==0:
    print("No")
else:
    print("Yes")
    for i in range(1,N):
        print(ans[i])


### FIXED CODE ###

N,M=map(int,input().split())
box=[[] for i in range(N)]
for i in range(M):
    a,b=map(int,input().split())
    box[a-1].append(b-1)
    box[b-1].append(a-1)
ans=[None]*(N)
ans[0]=0
que=[0]
while len(que)>0:
    index=que.pop(0)
    for x in box[index]:
        if ans[x]==None:
            ans[x]=index+1
            que.append(x)
print("Yes")
for i in range(1,N):
    print(ans[i])
import numpy as np
k=int(input())
s=input()
ls=len(s)
r1=26**ls
a=np.array([range(k+1,k+ls+1)])
m2= np.prod(a)
a=np.array([range(1,ls+1)])
m3= np.prod(a)
m=m2//m3
#r2=25**ls
r3=26**k
#print(r2)
#print(m2)
print((m*r3)%1000000007)

### FIXED CODE ###

s=input()
if s in "ABCDEFGHIJKLMNOPQRSTUVWXYZ":
  print("A")
else:
  print("a")
from collections import defaultdict
q = int(input())
for _ in range(q):
    x = input()
    y = input()
    len_x = len(x)
    len_y = len(y)
    if len_x < len_y:
        len_x, len_y = len_y, len_x
        x, y = y, x
    c = defaultdict(list)
    for i, s in enumerate(x):
        c[s].append(i)
    ans = 0
    def g(li, a):
        for i in li:
            if i >= a:
                return i
        return -1
    def f(x_i, y_i, cnt):
        if x_i >= len_x or y_i >= len_y:
            global ans
            if ans < cnt:
                ans = cnt
            return
        f(x_i, y_i + 1, cnt)
        s = g(c[y[y_i]], x_i)
        if s != -1:
            f(s + 1, y_i + 1, cnt + 1)
    f(0, 0, 0)
    print(ans)



### FIXED CODE ###

for _ in range(int(input())):
    a = input()
    b = input()
    if len(a) < len(b):
        a, b = b, a
    indices = []
    for cb in b:
        bgn_idx = 0
        for i, cur_idx in enumerate(indices):
            chr_idx = a.find(cb, bgn_idx) + 1
            if not chr_idx:
                break
            if chr_idx < cur_idx:
                indices[i] = chr_idx
            bgn_idx = cur_idx
        else:
            chr_idx = a.find(cb, bgn_idx) + 1
            if chr_idx:
                indices.append(chr_idx)
    print(len(indices))