Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
#16D8103010K Ko Okasaki
#ALDS_4_C

from collections import deque

n=int(input())
S=deque()
A=deque()

for i in range(n):
	cnt=0
	str=input().split()
	if str[0][0]=="i":
		S.append(str[1])
	else:
		for i in range(len(S)):
			if S[i]==str[1]:
				cnt+=1
				break
		
		if cnt==1:
			A.append("yes")
		else:
			A.append("no")

for i in range(len(A)):
	print(A[i])


Fixed submission:
n=int(input())
dict={}
for i in range(n):
    str=input()
    if str[0]=="i":
        dict.update({str[7:]:1})
    else:
        if str[5:] in dict:
            print("yes")
        else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
#16D8103010K Ko Okasaki
#ALDS_4_C

from collections import deque

n=int(input())
S=deque()
A=deque()

for i in range(n):
	cnt=0
	str=input().split()
	if str[0][0]=="i":
		S.append(str[1])
	else:
		for i in range(len(S)):
			if S[i]==str[1]:
				cnt+=1
				break
		
		if cnt==1:
			A.append("yes")
		else:
			A.append("no")

for i in range(len(A)):
	print(A[i])


Fixed submission:
n=int(input())
dict={}
for i in range(n):
    str=input()
    if str[0]=="i":
        dict.update({str[7:]:1})
    else:
        if str[5:] in dict:
            print("yes")
        else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n=int(input())
S=deque()
A=deque()

for i in range(n):
	cnt=0
	str=input().split()
	if str[0][0]=="i":
		S.append(str[1])
	else:
		for i in range(len(S)):
			if S[i]==str[1]:
				cnt+=1
				break
		
		if cnt==1:
			print("yes")
		else:
			print("no")


Fixed submission:
n=int(input())
dict={}
for i in range(n):
    str=input()
    if str[0]=="i":
        dict.update({str[7:]:1})
    else:
        if str[5:] in dict:
            print("yes")
        else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n=int(input())
S=deque()
A=deque()

for i in range(n):
	cnt=-1
	str=input().split()
	if str[0][0]=="i":
		S.append(str[1])
	else:
		'''for i in range(len(S)):
			if S[i]==str[1]:
				cnt+=1
				break
		'''
		try:
			cnt=S.index(str[1])
		except:
			pass
		if cnt!=-1:
			print("yes")
		else:
			print("no")



Fixed submission:
n=int(input())
dict={}
for i in range(n):
    str=input()
    if str[0]=="i":
        dict.update({str[7:]:1})
    else:
        if str[5:] in dict:
            print("yes")
        else:
            print("no")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

n=int(input())
S=deque()

for i in range(n):
	cnt=-1
	str=input().split()
	if str[0][0]=="i":
		S.append(str[1])
	else:
		'''for i in range(len(S)):
			if S[i]==str[1]:
				cnt+=1
				break
		'''
		try:
			cnt=S.index(str[1])
		except:
			pass
		if cnt!=-1:
			print("yes")
		else:
			print("no")



Fixed submission:
n=int(input())
dict={}
for i in range(n):
    str=input()
    if str[0]=="i":
        dict.update({str[7:]:1})
    else:
        if str[5:] in dict:
            print("yes")
        else:
            print("no")
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())

print(a*b)
print(2*a+2*b)


Fixed submission:
a,b=map(int,input().split())

print(a*b,2*a+2*b)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())

print(a*b," ",2*a+2*b)


Fixed submission:
a,b=map(int,input().split())

print(a*b,2*a+2*b)
Buggy python submission (verdict: Runtime Error):
s=0
A=input().split()
n=(int)(A[0])
t=(int)(A[1])
x=[0 for i in range(2*n)]
for i in range(n):
    B=input().split()
    k=2*i
    x[k]=(B[0])
    x[k+1]=(int)(B[1])
while len(x)>0:
    s=x[1]-t
    if s>0: 
        sum+=t
        x.append(x[0])
        x.append(s)
        del x[0]
        del x[0]
    if s<=0:
        sum+=x[1]
        print( x[0],sum)
        del x[0]
        del x[0]



Fixed submission:
sum=0
s=0
A=input().split()
n=(int)(A[0])
t=(int)(A[1])
x=[0 for i in range(2*n)]
for i in range(n):
    B=input().split()
    k=2*i
    x[k]=(B[0])
    x[k+1]=(int)(B[1])
while len(x)>0:
    s=x[1]-t
    if s>0: 
        sum+=t
        x.append(x[0])
        x.append(s)
        del x[0]
        del x[0]
    if s<=0:
        sum+=x[1]
        print( x[0],sum)
        del x[0]
        del x[0]

Buggy python submission (verdict: Runtime Error):
s=0
A=input().split()
n=(int)(A[0])
t=(int)(A[1])
x=[0 for i in range(2*n)]
for i in range(n):
    B=input().split()
    k=2*i
    x[k]=(B[0])
    x[k+1]=(int)(B[1])
while len(x)>0:
    s=x[1]-t
    if s>0: 
        sum+=t
        x.append(x[0])
        x.append(s)
        del x[0]
        del x[0]
    if s<=0:
        sum+=x[1]
        print( x[0],sum)
        del x[0]
        del x[0]



Fixed submission:
sum=0
s=0
A=input().split()
n=(int)(A[0])
t=(int)(A[1])
x=[0 for i in range(2*n)]
for i in range(n):
    B=input().split()
    k=2*i
    x[k]=(B[0])
    x[k+1]=(int)(B[1])
while len(x)>0:
    s=x[1]-t
    if s>0: 
        sum+=t
        x.append(x[0])
        x.append(s)
        del x[0]
        del x[0]
    if s<=0:
        sum+=x[1]
        print( x[0],sum)
        del x[0]
        del x[0]
Buggy python submission (verdict: Time Limit Exceeded):
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 submission:
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 python submission (verdict: Runtime Error):
def gcd(x,y):
    if x < y:
        swap(x,y)
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

x,y = map(int,input().split())
print(gcd(x,y))


Fixed submission:
def gcd(x,y):
    while y > 0:
        r = x % y
        x = y
        y = r
    return x

x,y = map(int,input().split())
print(gcd(x,y))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = []
for i in range(n):
    x.append(int(input()))
m = float("inf") * (-1)
for i in range(n-1):
    for j in range(i+1,n):
        if m < (x[j] - x[i]):
            m = x[j] - x[i]
print(m)



Fixed submission:
n = int(input())
x = []
for i in range(n):
    x.append(int(input()))
mx = float("inf") * (-1)
mn = x[0]
for i in range(1,n):
    if mx < (x[i] - mn):
        mx = x[i] - mn
    if mn > x[i]:
        mn = x[i]
print(mx)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
q = collections.deque()
for i in range(n):
    x = input()
    l = len(x)
    if x[0] == "i":
        q.insert(0,x[7:])
    elif x[0] == "f":
        try:
            q.index(x[5:])
            print("yes")
        except:
            print("no")
        




Fixed submission:
n = int(input())
d = {}
for i in range(n):
    x = input()
    if x[0] == "i":
        d[x[7:]] = 1
    else :
        if(x[5:] in d.keys()) : print("yes")
        else : print("no")

Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
a = collections.deque()
c = collections.deque()
g = collections.deque()
t = collections.deque()
for i in range(n):
    x = input()
    l = len(x)
    if x[0] == "i":
        if x[7] == "A":
            a.insert(0,x[7:])
        elif x[7] == "C":
            c.insert(0,x[7:])
        elif x[7] == "G":
            g.insert(0,x[7:])
        elif x[7] == "T":
            t.insert(0,x[7:])

    elif x[0] == "f":
        if x[5] == "A":
            try:
                a.index(x[5:])
                print("yes")
            except:
                print("no")
        elif x[5] == "C":
            try:
                c.index(x[5:])
                print("yes")
            except:
                print("no")
        elif x[5] == "G":
            try:
                g.index(x[5:])
                print("yes")
            except:
                print("no")
        elif x[5] == "T":
            try:
                t.index(x[5:])
                print("yes")
            except:
                print("no")
        




Fixed submission:
n = int(input())
d = {}
for i in range(n):
    x = input()
    if x[0] == "i":
        d[x[7:]] = 1
    else :
        if(x[5:] in d.keys()) : print("yes")
        else : print("no")

Buggy python submission (verdict: Runtime Error):
n = int(input())
d = set()
for i in range(n):
    x = input()
    if x[0] == "i":
        d.append(x[7:])
    else :
        if(x[5:] in d) : print("yes")
        else : print("no")


Fixed submission:
n = int(input())
d = {}
for i in range(n):
    x = input()
    if x[0] == "i":
        d[x[7:]] = 1
    else :
        if(x[5:] in d.keys()) : print("yes")
        else : print("no")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())

max = a[1]-a[0]
for i in range(2,n):
    for j in range(0,i):
        tmp = a[i]-a[j]
        if max<tmp:
            max = tmp

print(max)



Fixed submission:
n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())

max = a[1]-a[0]
min = a[0]
for i in range(1,n):
    if max < (a[i]-min):
        max = (a[i]-min)
    if min > a[i]:
        min = a[i]
        
print(max)
Buggy python submission (verdict: Time Limit Exceeded):
def merge(S,left,right,mid,cnt):
    a = mid - left
    b = right - mid
    L = [0]*(a+1)
    R = [0]*(b+1)
    for i in range(a):
        L[i] = S[left+i]
    for i in range(b):
        R[i] = S[mid+i]
    L[a] = float("inf")
    R[b] = float("inf")
    j = 0
    k = 0
    for i in range(left,right):
        cnt[0] += 1
        if L[j] <= R[k]:
            S[i] = L[j]
            j += 1
        else:
            S[i] = R[k]
            k += 1
            
def mergeSort(S,left,right,cnt):
    if left+1<right:
        mid = (int)((left+right)/2)
        mergeSort(S,left,mid,cnt)
        mergeSort(S,mid,right,cnt)
        merge(S,left,right,mid,cnt)
        
n = int(input())
S = list(map(int, input().split()))
cnt = [0]
cnt[0] = 0
mergeSort(S,0,n,cnt)
print(*S)
print(*cnt)


Fixed submission:
cnt = 0
def merge(S,left,right,mid):
    a = mid - left
    b = right - mid
    L = S[left:left+a]+[float("inf")]
    R = S[mid:mid+b]+[float("inf")]
    j = 0
    k = 0
    for i in range(left,right):
        global cnt
        cnt+=1
        if L[j] <= R[k]:
            S[i] = L[j]
            j += 1
        else:
            S[i] = R[k]
            k += 1
            
def mergeSort(S,left,right):
    if left+1<right:
        mid = (int)((left+right)/2)
        mergeSort(S,left,mid)
        mergeSort(S,mid,right)
        merge(S,left,right,mid)
        
n = int(input())
S = list(map(int, input().split()))
mergeSort(S,0,n)
print(*S)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
cnt = 0
def merge(S,left,right,mid):
    a = mid - left
    b = right - mid
    L = [0]*(a+1)
    R = [0]*(b+1)
    for i in range(a):
        L[i] = S[left+i]
    for i in range(b):
        R[i] = S[mid+i]
    L[a] = float("inf")
    R[b] = float("inf")
    j = 0
    k = 0
    for i in range(left,right):
        global cnt
        cnt+=1
        if L[j] <= R[k]:
            S[i] = L[j]
            j += 1
        else:
            S[i] = R[k]
            k += 1
            
def mergeSort(S,left,right):
    if left+1<right:
        mid = (int)((left+right)/2)
        mergeSort(S,left,mid)
        mergeSort(S,mid,right)
        merge(S,left,right,mid)
        
n = int(input())
S = list(map(int, input().split()))
mergeSort(S,0,n)
print(*S)
print(cnt)


Fixed submission:
cnt = 0
def merge(S,left,right,mid):
    a = mid - left
    b = right - mid
    L = S[left:left+a]+[float("inf")]
    R = S[mid:mid+b]+[float("inf")]
    j = 0
    k = 0
    for i in range(left,right):
        global cnt
        cnt+=1
        if L[j] <= R[k]:
            S[i] = L[j]
            j += 1
        else:
            S[i] = R[k]
            k += 1
            
def mergeSort(S,left,right):
    if left+1<right:
        mid = (int)((left+right)/2)
        mergeSort(S,left,mid)
        mergeSort(S,mid,right)
        merge(S,left,right,mid)
        
n = int(input())
S = list(map(int, input().split()))
mergeSort(S,0,n)
print(*S)
print(cnt)
Buggy python submission (verdict: Runtime Error):
def L_common(str1,str2):
    d = [0 for i in range(len(str2)+1)]
    
    for n1 in str1:
        tmp = d[:]
        for (j,n2) in enumerate(str2):
            if n1 == n2:
                d[j+1] = tmp[j]+1
            elif d[j+1]<d[j]:
                d[j+1] = d[j]
    return d[len(str2)]

n = int(input())
stock = []
for i in range(n):
    x = input()
    y = input()
    if len(x)>len(y):
        stock.append(len(x)-L_common(x,y))
    else:
        stock.append(len(y)-L_common(x,y))

for i in stock:
    print(i)


Fixed submission:
x = input(); n_x = len(x);
y = input(); n_y = len(y);
s = [[i+j for j in range(n_y+1)] for i in range(n_x+1)]
for i in range(n_x):
    for j in range(n_y):
        s[i+1][j+1] = min(s[i+1][j]+1,s[i][j+1]+1,s[i][j]+1*(x[i]!=y[j]))   
print(s[n_x][n_y])
Buggy python submission (verdict: Runtime Error):
# 16D8101022L 小林勇希 ID:k_mb python3

import math

cou = 0
n = int(input())
A = [int(input()) for i in range(n)]

for i in range(n):
    a_sq = int(math.sqrt(A[i]))
    for j in range(2,a_sq+2):
        if(A[i]%j==0 and not(A[i]==j)):
            break
        if(j==a_sq+1):
            cou += 1

print(cou)

"""実行結果

5
2
3
4
5
6
3



5
2
2
2
2
2
5

"""



Fixed submission:
def insertion_sort(A,n):
    for i in range(n):
        v = A[i]
        j = i-1
        while(j>=0 and A[j]>v):
            A[j+1] = A[j]
            j = j-1
        A[j+1] = v
        for i in range(n-1):
            print(A[i],"",end="")
        print(A[n-1])

n = int(input())
A_idx = [int(i) for i in input().split()]

insertion_sort(A_idx,n)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
q = int(input())
r = list(map(int,input().split()))
cou = 0

for i in range(q):
    for j in range(n):
        if(s[i] == r[j]):
            cou += 1
            break
print(cou)


Fixed submission:
n = int(input())
s = list(map(int,input().split()))
q = int(input())
r = list(map(int,input().split()))
cou = 0

for i in range(q):
    for j in range(n):
        if(s[j] == r[i]):
            cou += 1
            break
print(cou)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
d=s.split()
n=int(d[0])
q=int(d[1])
end_t=0
processes=[]
for i in range(n):
    processes.append([])
    s=input()
    d=s.split()
    processes[i].append(d[0])
    processes[i].append(int(d[1]))

cnt=0
i=0
while True:
    if processes[i][1]<=q:
       if processes[i][1]==0:
           i=(i+1)%n
           continue
       end_t+=processes[i][1]
       processes[i][1]=0
       print(processes[i][0],end_t)
       i=(i+1)%n
       cnt+=1
       if cnt==n:
           break
   
    else:
       processes[i][1]-=q
       end_t+=q
       i=(i+1)%n


Fixed submission:
s=input()
d=s.split()
n=int(d[0])
q=int(d[1])
end_t=0
processes=[]
for i in range(n):
    processes.append([])
    s=input()
    d=s.split()
    processes[i].append(d[0])
    processes[i].append(int(d[1]))

cnt=0
i=0
while True:
    if processes[0][1]<=q:
       end_t+=processes[0][1]
       print(processes[0][0],end_t)
       processes.pop(0)
       cnt+=1
       if cnt==n:
           break
   
    else:
       processes[0][1]-=q
       end_t+=q
       processes.append(processes[0])
       processes.pop(0)
       i+=1

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
d=s.split()
n=int(d[0])
q=int(d[1])
end_t=0
processes=[]
for i in range(n):
    processes.append([])
    s=input()
    d=s.split()
    processes[i].append(d[0])
    processes[i].append(int(d[1]))

cnt=0
i=0
while True:
    if processes[i][1]<=q:
       if processes[i][1]==0:
           i=(i+1)%n
           continue
       end_t+=processes[i][1]
       processes[i][1]=0
       print(processes[i][0],end_t)
       i=(i+1)%n
       cnt+=1
       if cnt==n:
           break
   
    else:
       processes[i][1]-=q
       end_t+=q
       i=(i+1)%n



Fixed submission:
s=input()
d=s.split()
n=int(d[0])
q=int(d[1])
end_t=0
processes=[]
for i in range(n):
    processes.append([])
    s=input()
    d=s.split()
    processes[i].append(d[0])
    processes[i].append(int(d[1]))

cnt=0
i=0
while True:
    if processes[0][1]<=q:
       end_t+=processes[0][1]
       print(processes[0][0],end_t)
       processes.pop(0)
       cnt+=1
       if cnt==n:
           break
   
    else:
       processes[0][1]-=q
       end_t+=q
       processes.append(processes[0])
       processes.pop(0)
       i+=1
Buggy python submission (verdict: Runtime Error):
import numpy as np

def gcd(x,y):
    if y==0:
        return x
    else:
        x=x%y
        temp=x
        x=y
        y=temp
        return gcd(x,y)


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

print(gcd(A[0],A[1]))


Fixed submission:
def gcd(x,y):
    if y==0:
        return x
    else:
        x=x%y
        return gcd(y,x)

A=list(map(int,input().split(' ')))
print(gcd(A[0],A[1]))
Buggy python submission (verdict: Runtime Error):
#16D8101014F 久留米 竜之介 Python3
#a=[]
while(True):
	i=0
	tmp=0
	a=input().split('"') 
	aL=a.len()
	b=input().split('"')
	bL=b.len()
	if aL != bL:
		print("DIFFELENT")
	else:
		while(True):
			if a[i] != b[i]:
				print("DIFFERENT")
				break
			elif i > aL-2:
				if tmp==1:
					print("CLOSE")
					break
				else:
					print("IDENTICAL")
					break
			elif a[i+1] != b[i+1]:
				if tmp==1:
					print("DIFFERENT")
					break
				else: tmp=1
			i +=2
	


Fixed submission:
#16D8101014F 久留米 竜之介 Python3
#a=[]
while(True):
	i=0
	tmp=0
	a=input().split('"') 
	aL=len(a)
	if a[0] ==".":
		break
	b=input().split('"')
	bL=len(b)
		
	if aL != bL:
		print("DIFFERENT")
	else:
		while(True):
			if a[i] != b[i]:
				print("DIFFERENT")
				break
			elif i > aL-2:
				if tmp==1:
					print("CLOSE")
					break
				else:
					print("IDENTICAL")
					break
			elif a[i+1] != b[i+1]:
				if tmp==1:
					print("DIFFERENT")
					break
				else: tmp=1
			i +=2

Buggy python submission (verdict: Runtime Error):
#16D8101014F 久留米 竜之介 Python3
#a=[]
while(True):
	i=0
	tmp=0
	a=input().split('"') 
	aL=len(a)
	b=input().split('"')
	bL=len(b)
	if aL != bL:
		print("DIFFELENT")
	else:
		while(True):
			if a[i] != b[i]:
				print("DIFFERENT")
				break
			elif i > aL-2:
				if tmp==1:
					print("CLOSE")
					break
				else:
					print("IDENTICAL")
					break
			elif a[i+1] != b[i+1]:
				if tmp==1:
					print("DIFFERENT")
					break
				else: tmp=1
			i +=2
	


Fixed submission:
#16D8101014F 久留米 竜之介 Python3
#a=[]
while(True):
	i=0
	tmp=0
	a=input().split('"') 
	aL=len(a)
	if a[0] ==".":
		break
	b=input().split('"')
	bL=len(b)
		
	if aL != bL:
		print("DIFFERENT")
	else:
		while(True):
			if a[i] != b[i]:
				print("DIFFERENT")
				break
			elif i > aL-2:
				if tmp==1:
					print("CLOSE")
					break
				else:
					print("IDENTICAL")
					break
			elif a[i+1] != b[i+1]:
				if tmp==1:
					print("DIFFERENT")
					break
				else: tmp=1
			i +=2

Buggy python submission (verdict: Runtime Error):
#16D8101014F 久留米 竜之介 Python3
#a=[]
while(True):
	i=0
	tmp=0
	a=input().split('"') 
	aL=len(a)
	b=input().split('"')
	bL=len(b)
	if a[0]==".":
		break
		
	if aL != bL:
		print("DIFFELENT")
	else:
		while(True):
			if a[i] != b[i]:
				print("DIFFERENT")
				break
			elif i > aL-2:
				if tmp==1:
					print("CLOSE")
					break
				else:
					print("IDENTICAL")
					break
			elif a[i+1] != b[i+1]:
				if tmp==1:
					print("DIFFERENT")
					break
				else: tmp=1
			i +=2
	


Fixed submission:
#16D8101014F 久留米 竜之介 Python3
#a=[]
while(True):
	i=0
	tmp=0
	a=input().split('"') 
	aL=len(a)
	if a[0] ==".":
		break
	b=input().split('"')
	bL=len(b)
		
	if aL != bL:
		print("DIFFERENT")
	else:
		while(True):
			if a[i] != b[i]:
				print("DIFFERENT")
				break
			elif i > aL-2:
				if tmp==1:
					print("CLOSE")
					break
				else:
					print("IDENTICAL")
					break
			elif a[i+1] != b[i+1]:
				if tmp==1:
					print("DIFFERENT")
					break
				else: tmp=1
			i +=2
Buggy python submission (verdict: Runtime Error):

 e=input
 a=''
 for _ in[0]*int(e()):
  X,z=e(),[]
  for y in e():
   s=i=0
   for k in z:
    t=X.find(y,s)+1
    if t<1:break
    if t<k:z[i]=t
    s=k;i+=1
   else:
    t=X.find(y,s)+1
    if t:z+=[t]
  a+=f'\n{len(z)}'
 print(a[1:]


Fixed submission:
 
def lcs(X, Y):
    dp = [0]*(len(Y)+1)
     
    for x in X:
        tmp = dp[:]
        for j, y in enumerate(Y):
            if x == y:
                dp[j+1] = tmp[j] + 1
            elif dp[j+1] < dp[j]:
                dp[j+1] = dp[j]
                                
    return dp[-1]
 
n = int(input()) 

for i in range(n):
    X = input()
    Y = input()
    print(lcs(X, Y))
Buggy python submission (verdict: Runtime Error):
#16D8101014F KurumeRyunosuke 2018/6/20
import numpy as np
n=int(input())
ls=np.zeros((n,n))
for i in range(n):
	tmp=input().split()
	#print(tmp)
	for j in range(int(tmp[1])):
		#print("*")
		ls[i][int(tmp[j+2])-1]=1


for i in range(n):
    for j in range(n):
        if(j!=n-1):
            print(int(ls[i][j]), end=' ')
        else:
            print(int(ls[i][j]))



Fixed submission:
#16D8101014F KurumeRyunosuke 2018/6/20
#import numpy as np
n=int(input())
#ls=np.zeros((n,n))
ls=[[0 for i in range(n)]for j in range(n)]
for i in range(n):
	tmp=input().split()
	for j in range(int(tmp[1])):
		#print("*")
		ls[i][int(tmp[j+2])-1]=1


for i in range(n):
    for j in range(n):
        if(j!=n-1):
            print(int(ls[i][j]), end=' ')
        else:
            print(int(ls[i][j]))

Buggy python submission (verdict: Runtime Error):
#16D8101014F KurumeRyunosuke 2018/6/20
import numpy as np
n=int(input())
ls=np.zeros((n,n))
for i in range(n):
	tmp=input().split()
	#print(tmp)
	for j in range(int(tmp[1])):
		#print("*")
		ls[i][int(tmp[j+2])-1]=1


for i in range(n):
    for j in range(n):
        if(j!=n-1):
            print(int(ls[i][j]), end=' ')
        else:
            print(int(ls[i][j]))



Fixed submission:
#16D8101014F KurumeRyunosuke 2018/6/20
#import numpy as np
n=int(input())
#ls=np.zeros((n,n))
ls=[[0 for i in range(n)]for j in range(n)]
for i in range(n):
	tmp=input().split()
	for j in range(int(tmp[1])):
		#print("*")
		ls[i][int(tmp[j+2])-1]=1


for i in range(n):
    for j in range(n):
        if(j!=n-1):
            print(int(ls[i][j]), end=' ')
        else:
            print(int(ls[i][j]))

Buggy python submission (verdict: Runtime Error):
import numpy as np
n=int(input())
ls=np.zeros((n,n))
for i in range(n):
	tmp=input().split()
	for j in range(int(tmp[1])):
		ls[i][int(tmp[j+2])-1]=1

for i in range(n):
    for j in range(n):
        if(j!=n-1):
            print(int(ls[i][j]), end=' ')
        else:
            print(int(ls[i][j]))


Fixed submission:
#16D8101014F KurumeRyunosuke 2018/6/20
#import numpy as np
n=int(input())
#ls=np.zeros((n,n))
ls=[[0 for i in range(n)]for j in range(n)]
for i in range(n):
	tmp=input().split()
	for j in range(int(tmp[1])):
		#print("*")
		ls[i][int(tmp[j+2])-1]=1


for i in range(n):
    for j in range(n):
        if(j!=n-1):
            print(int(ls[i][j]), end=' ')
        else:
            print(int(ls[i][j]))