Harryxun/stf_run huggingface dataset:
h,w = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(h)]

flg = [[False]*w for _ in range(h)]

cnt = 0
ans = []

for i in range(h):
    for j in range(w-1):
        if lst[i][j] %2 == 1:
            lst[i][j] -= 1
            lst[i][j+1] += 1
            ans.append([i+1,j+1,i+1,j+2])

for i in range(h-1):
    if lst[i][-1] %2 == 1:
        lst[i][-1] -= 1
        lst[i+1][-1] += 1
        ans.append([i+1,j+1,i+2,j+1])
        
print(len(ans))
for l in ans:
    print(*l)

### FIXED CODE ###

h,w = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(h)]

cnt = 0
ans = []

for i in range(h):
    for j in range(w-1):
        if lst[i][j] %2 == 1:
            lst[i][j] -= 1
            lst[i][j+1] += 1
            ans.append([i+1,j+1,i+1,j+2])

for i in range(h-1):
    if lst[i][-1] %2 == 1:
        lst[i][-1] -= 1
        lst[i+1][-1] += 1
        ans.append([i+1,w,i+2,w])

print(len(ans))
for a in ans:
    print(*a)
l = list(input().split())
print("Yes") if l in "9" else print("No")

### FIXED CODE ###

l = list(input())
print("Yes") if "9" in l else print("No")
import copy
from collections import Counter
from math import factorial

def comb(n,r):
  a = factorial(n) / factorial(r) // factorial(n - r)
  return int(a)

N=int(input())
A=list(map(int,input().split() ))
B=[-1]*N   #メモ化。iの時の方法の総数

f_cnt=Counter(A)
f_dic=dict(f_cnt)

for i,item in enumerate(A):
  if B[item-1]>-1:
    print(B[item-1])
  else:
    D=copy.deepcopy(f_dic)
    D[item] -= 1
    opt=0
    for item3 in D:
      if D[item3]>=2:
        opt += comb(D[item3],2)
    B[item-1]=opt
    print(opt)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split() ))
from collections import Counter
d=dict(Counter(A))
#print(d)
cnt=0
for item in d:
    cnt += (d[item])*(d[item]-1)//2

#print("cnt",cnt)
   
for num in A:
    new = max(0, (d[num]-1)*(d[num]-2)//2)
    print(cnt- d[num]*(d[num]-1)//2 + new)
a, b = map(int, input().split())
def func(n):
  if n == 0:
    return 0
  else:
    return func(n-1) + n
print(func(b-a-1) - a)

### FIXED CODE ###

a, b = map(int, input().split())
ans = 0
for i in range(1, b-a):
  ans += i
print(ans - a)
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
w=len(l1)
all=0
for i in range(0,w):
    if (l1[i]==l2[i]):
        all=all+1
print(all)

### FIXED CODE ###

l1=list(input())
l2=list(input())
w=len(l1)
all=0
for i in range(0,w):
    if (l1[i]==l2[i]):
        all=all+1
print(all)
t=input()
tl=list(t)

tl1=tl
pd1=0

for i in range(len(tl1)):
  if tl1[i]=="?":
    if i==0:
      pass
    elif tl1[i-1]=="P":
      tl1[i]="D"
    elif tl1[i+1]=="D":
      tl1[i]="P"
    elif tl1[i+1]=="?":
      tl1[i]="P"
    else:
      tl1[i]="D"
  if tl1[i]=="D":
    if i==0:
      pass
    elif tl1[i-1]=="P":
      pd1+=1
d1=tl1.count('D')
s1=d1+pd1

print(''.join(tl1))

### FIXED CODE ###

t=input()

tla=list(t)
tlb=list(t)
pd1=0
pd2=0

for i in range(len(tla)):
  if tla[i]=="?":
    if i==0:
      pass
    elif i==len(tla)-1:
      tla[i]="D"
    elif tla[i-1]=="P":
      tla[i]="D"
    elif tla[i+1]=="D":
      tla[i]="P"
    elif tla[i+1]=="?":
      tla[i]="P"
    else:
      tla[i]="D"
  if tla[i]=="D":
    if i==0:
      pass
    elif tla[i-1]=="P":
      pd1+=1
d1=tla.count('D')
s1=d1+pd1

for i in range(len(tlb)):
  if tlb[i]=="?":
    tlb[i]="D"
  if tlb[i]=="D":
    if i==0:
      pass
    elif tlb[i-1]=="P":
      pd2+=1
d2=tlb.count('D')
s2=d2+pd2

if s1>=s2:
  print(''.join(tla))
else:
  print(''.join(tlb))
import numpy as np

def search(now,r,dist,ans):
    print(r,ans)
    if len(r)==0:
        return ans
    min_=float('inf')
    for i,x in enumerate(r):
        if i < len(r)-1:
            min_=min(min_,search(x,r[:i]+r[i+1:],dist,ans+dist[now][x]))
        else:
            min_=min(min_, search(x,r[:i],dist,ans+dist[now][x]))
    return min_

N,M,R=list(map(int,input().split()))
r=list(map(int,input().split()))
r=[x-1 for x in r]
dist=[[float('inf') for _ in range(N)] for _ in range(N)]
for i in range(M):
    A,B,C=list(map(int,input().split()))
    dist[A-1][B-1]=C
    dist[B-1][A-1]=C
for i in range(N):
    dist[i][i]=0
dist=np.array(dist)

ans=float('inf')
for i in range(N):
    for j in range(N):
        dist[i][j]=min(dist[i]+dist[j])
print(dist)
ans=float('inf')
for i,x in enumerate(r):
    if i < len(r)-1:
        ans=min(ans, search(x,r[:i]+r[i+1:],dist,0))
    else:
        ans=min(ans, search(x,r[:i],dist,0))
print(int(ans))

### FIXED CODE ###

from itertools import permutations
from scipy.sparse.csgraph import floyd_warshall as ws

def search(r,dist,ans):
    sum_=0
    for i in range(1,len(r)):
        sum_+=dist[r[i-1]][r[i]]
    return sum_

N,M,R=list(map(int,input().split()))
r=list(map(int,input().split()))
r=[x-1 for x in r]
dist=[[float('inf') for _ in range(N)] for _ in range(N)]
for i in range(M):
    A,B,C=list(map(int,input().split()))
    dist[A-1][B-1]=C
    dist[B-1][A-1]=C
for i in range(N):
    dist[i][i]=0
dist=ws(dist)

ans=float('inf')

ans=float('inf')
r=permutations(r)
for x in r:
    ans=min(ans,search(x,dist,0))
print(int(ans))
n,k = map(int, input().split())
h = list(map(int, input().split()))
INF = 999999999999999999999999999
dp = [INF] * n
dp[0] = 0
for i in range(1, n):
    for j in range(1, k+1):
        if i - j < 0:
            continue
        dp[i] = min(dp[i], dp[i-j] + abs(h[i] - h[i-j]))
    
print(dp[n-1])
        

### FIXED CODE ###

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

dp = [0] * n
dp[0] = 0
for i in range(1, n):
    if i - 2 < 0:
        dp[i] = dp[i-1] + abs(h[i] - h[i-1])
    else: 
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))

print(dp[n-1])
a, b, t = input().split()
t = t + 0.5
o = 0

while t > 0:
	t = t - a
    o = o + b

print(o)

### FIXED CODE ###

a, b, t = map(int, input().split())
n = int((t + 0.5) // a)
print(n * b)
n = int(input)
print(n*n*n)

### FIXED CODE ###

n = int(input())
print(n*n*n)
a,b,k = map(int,input().split())
c = list(range(a,b+1))

if 2*k <= len(c):
    ans = c[:k] + c[-k:]
else:
    ans = c

for i in ans:
    print(i)

### FIXED CODE ###

a,b,k = map(int,input().split())
ans = [a+i for i in range(k) if a+i <= b] + [b-i for i in range(k) if b-i >= a]
ans = list(set(ans))
ans.sort()

for i in ans:
    print(i)
n = int(input())
cnt = 0
x = len(str(n))

if n % 2 == 1:
  print(0)
  EXIT()
for i in range(1,26):
  cnt += n//((5**i)* 2)


print(cnt)

### FIXED CODE ###


n = int(input())
cnt = 0
i = 1
x = 10
if n % 2 == 1:
  print(0)
else:
  while x <= n:
    
    cnt += n//x
    x *= 5


  print(cnt)
a, b = map(int, input().split())
c = a * b
if c %= 0:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a, b = map(int, input().split())
c = a * b
if c % 2 ==0:
  print('Even')
else:
  print('Odd')
n, k, s = map(int, input().split())
if s = 10**9:
    ans = [s]*k + [s-1]*(n-k)
else:
    ans = [s]*k + [s+1]*(n-k)
print(*ans)

### FIXED CODE ###

n, k, s = map(int, input().split())
if s == 10**9:
    ans = [s]*k + [s-1]*(n-k)
else:
    ans = [s]*k + [s+1]*(n-k)
print(*ans)
n=int(input())
zahyo=[list(map(int,input().split())) for i in range(n)]

zahyo.sort(key=lambda x:x[2], reverse = 1)
mx,my,mh=zahyo[0]
for Cx in range(101):
    for Cy in range(101):
        H = mh+abs(mx-Cx)+abs(my-Cy)
        if all(h == max(H-abs(x-Cx)+abs(y-Cy),0) for x,y,h in zahyo):
            print(Cx,Cy,h)
            break
            

### FIXED CODE ###

n=int(input())
zahyo=[list(map(int,input().split())) for i in range(n)]

zahyo.sort(key=lambda x:x[2], reverse = 1)
mx,my,mh=zahyo[0]
for Cx in range(101):
    for Cy in range(101):
        H = mh+abs(mx-Cx)+abs(my-Cy)
        if all(h == max(H-abs(x-Cx)-abs(y-Cy),0) for x,y,h in zahyo):
            print(Cx,Cy,H)
            break
N = int(input())
print(N // 10 + sum[N // (50 ** i) for i in range(100)])


### FIXED CODE ###

N = int(input())  
if N%2==0: 
  r = 0 
  for i in range(99): 
    r += N // 10 // 5 ** i 
  print(r) 
else: 
  print(0)
import math
x, y = map(int, input().split())
print(round(log2(float(y/x))))

### FIXED CODE ###

X,Y=map(int,input().split())
count=1
while True:
    X*=2
    if X>Y: break
    else: count+=1
print(count)
N = int(input())
A = map(int, input().split())
B = map(int, input().split())
C = map(int, input().split())

s = 0
prev = 0
for f in A:
  if prev != 0:
    s += B[f-1]
    s += C[prev-1]
  else:
    s += B[f-1]
  prev = f
print(s)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
add_s = 0
for idx in range(N-1):
  cur_f = A[idx]
  nxt_f = A[idx+1]
  add_s += C[cur_f-1] if nxt_f == cur_f + 1 else 0

print(sum(B) + add_s)
#098_B
n=int(input())
s=input()
print(max([len(set(s[:i])&set(s[i:])) for i in range(1,n-1)]))

### FIXED CODE ###

#098_B
n=int(input())
s=input()
print(max([len(set(s[:i])&set(s[i:])) for i in range(1,n)]))
for s in input().split():
  print(upper(s[0]),end='')

### FIXED CODE ###

for s in input().split():
  print(s[0].upper(),end='')
data = []
for i in range(N):
    data.append(list(map(int, input().split())))
#print(data)
counter1 = 0
counter2 = 0
for i in range(1, M + 1):
    for ans in data:
        num = ans[0]
        #print(ans[1 : num + 1])
        if i in ans[1 : num + 1]:
            counter1 += 1
        else:
            counter1 = 0
            break
    if counter1 == N:
        print(i)
        counter2 += 1
print(counter2)


### FIXED CODE ###

N, M = map(int, input().split())
data = []
for i in range(N):
    data.append(list(map(int, input().split())))
#print(data)
counter2 = 0
for i in range(1, M + 1):
    counter1 = 0
    for ans in data:
        num = ans[0]
        if i in ans[1 : num + 1]:
            counter1 += 1
        else:
            counter1 = 0
            break
    if counter1 == N:
        counter2 += 1
print(counter2)
S = str(input())
T = str(input())

for i in range(int(len(S) / 2)):
    if S[i] == T[i]:
        continue
    else:
        s_before = S[i]
        S = S.replace(T[i], ',')
        S = S.replace(S[i], T[i])
        S = S.replace(',', s_before)
    if S[len(S) - i] == T[len(S) - i]:
        continue
    else:
        s_before = S[len(S) - i]
        S = S.replace(T[len(S) - i], ',')
        S = S.replace(S[len(S) - i], T[len(S) - i])
        S = S.replace(',', s_before)

if (S == T):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import string

alphabet = string.ascii_lowercase

S = str(input())
T = str(input())
start = [-1 for i in range(len(alphabet))]
goal = [-1 for i in range(len(alphabet))]
tf = True

for i in range(len(S)):
    a = alphabet.index(S[i])
    b = alphabet.index(T[i])

    if (start[a] != -1 or goal[b] != -1):
        if (start[a] != b or goal[b] != a):
            tf = False
            break
    else:
        start[a] = b
        goal[b] = a

if tf:
    print("Yes")
else:
    print("No")
a,b,k = map(int, input().split())
if a==0 and b==0:
    print(0)
else:
    a = a - k
    a2 = a
    if a<0:
        a=0
    b= b + a2
    if b<0:
        b=0
	print(a,b)



### FIXED CODE ###

def solve(a,b,k):
    if a==0 and b==0:
        return '0 0'
    if a>=k:
        str = '%d %d' % (a-k,b)
        return str
    else:
        b = b + a - k
        a = 0
        if b<0:
            return '0 0'
        str = '0 %d' % (b)
        return str 
        

a,b,k = map(int, input().split())
print(solve(a,b,k))
N = int(input())
A = list(map(int, input().split()))

S = sum(A)
M = S // 4
C = A.copy()

k   = 1
XYZ = []

for n in range(N):
    if n == 0:
        pass
    else:
        C[n] = C[n] + C[n-1]
    if C[n] > k * M:
        XYZ.append(n)
        k += 1

XYZ = XYZ[:3]

X = [XYZ[0] + i for i in list(range(-2, 2+1)) if 0 <= XYZ[0] + i and XYZ[0] + i <= N-1]
Y = [XYZ[1] + i for i in list(range(-2, 2+1)) if 0 <= XYZ[1] + i and XYZ[1] + i <= N-1]
Z = [XYZ[2] + i for i in list(range(-2, 2+1)) if 0 <= XYZ[2] + i and XYZ[2] + i <= N-1]
R = []

for x in X:
    for y in Y:
        for z in Z:
            if x < y and y < z:
                PQRS = [C[x], C[y] - C[x], C[z] - C[y], S - C[z]]
                R.append(max(PQRS) - min(PQRS))
            else:
                pass

print(min(R))


### FIXED CODE ###

# 解説みて実装
import numpy as np


N = int(input())
A = list(map(int, input().split()))
C = np.cumsum(A).tolist()

LL = [np.inf] * N
LR = [np.inf] * N

l = 0

for m in range(N-1):
    if l < m:
        LL[m] = C[l]
        LR[m] = C[m] - C[l]
        while l < m:
            LL_tmp = C[l+1]
            LR_tmp = C[m] - C[l+1]
            if abs(LL[m] - LR[m]) >= abs(LL_tmp - LR_tmp):
                l    += 1
                LL[m] = C[l]
                LR[m] = C[m] - C[l]
            else:
                break

B = A[::-1]
D = np.cumsum(B).tolist()

RL = [np.inf] * N
RR = [np.inf] * N

r = 0

for m in range(N-1):
    if r < m:
        RR[m] = D[r]
        RL[m] = D[m] - D[r]
        while r < m:
            RR_tmp = D[r+1]
            RL_tmp = D[m] - D[r+1]
            if abs(RR[m] - RL[m]) >= abs(RR_tmp - RL_tmp):
                r    += 1
                RR[m] = D[r]
                RL[m] = D[m] - D[r]
            else:
                break

RR = RR[::-1]
RL = RL[::-1]

X = np.array([LL[:-1], LR[:-1], RL[1:], RR[1:]])[:, 1:-1]

print(int(np.min(np.abs(np.max(X, axis=0) - np.min(X, axis=0)))))
N, M = list(map(int, input().split()))
a = []
for _ in range(M):
    a.append(int(input()))
a = list(set(a))
if len(a)>0:
    dif = [a[0]-1]
    dif.extend([(a[i]-1)-(a[i-1]+1) for i in range(1,len(a))])
    dif.extend([N-a[-1]-1])
else:
    dif = [N]
max_dif = max(dif)
Fiblist = {-1:0,0:1,1:1,2:2}
for n in range(3,max_dif+1):
    Fiblist[n]=Fiblist[n-1]+Fiblist[n-2]
ans = 1
for part in dif:
    ans= ans*Fiblist[part]%1000000007
print(ans)

### FIXED CODE ###

N, M = list(map(int, input().split()))
a = []
for _ in range(M):
    a.append(int(input()))
a = sorted(list(set(a)))
if len(a)>0:
    dif = [a[0]-1]
    dif.extend([(a[i]-1)-(a[i-1]+1) for i in range(1,len(a))])
    dif.extend([N-a[-1]-1])
else:
    dif = [N]
max_dif = max(dif)
Fiblist = {-1:0,0:1,1:1,2:2}
for n in range(3,max_dif+1):
    Fiblist[n]=Fiblist[n-1]+Fiblist[n-2]
ans = 1
for part in dif:
    ans= ans*Fiblist[part]%1000000007
print(ans)
for i in range(1, n + 1):
        if a <= sum(list(map(int, list(str(i))))) <= b:
           ans += i
    print(ans) 

### FIXED CODE ###

#!usr/bin/env python3
s = input()
K = int(input())

l = {s}
for n in range(1, K+1):
    for i in range(0, len(s)-n+1):
        l.add(s[i:i+n])
l = list(l)

l.sort()

print(l[K-1])
a,b = map(int,raw_input().split())
if a < b:
    print("a < b")
elif a>b:
    print("a > b")
elif a==b
print("a == b")

### FIXED CODE ###

a,b = map(int,raw_input().split())

if a < b:
    print ("a < b")
elif a > b:
    print ("a > b")
elif a == b:
    print ("a == b")
n, m = map(int, raw_input().split())

target = m / n

while True:
    if (m - target * n) % target == 0:
        print target
        exit(0)
    target -= 1

### FIXED CODE ###

n = int(raw_input())
if n == 1:
    print "Hello World"
else:
    print int(raw_input()) + int(raw_input())
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N = int(readline())
    X = readline().rstrip().decode('utf-8')
    nx = int(X, 2)

    ans = [0] * N

    oc = X.count('1')

    if oc - 1 != 0:
        mx = nx % (oc - 1)
        f = True
    else:
        f = False

    px = nx % (oc + 1)

    for i in range(N):

        if X[i] == '0':
            a = (px + pow(2, N - i - 1, oc + 1)) % (oc + 1)
        elif f:
            a = (mx - pow(2, N - i - 1, oc - 1)) % (oc - 1)
        else:
            ans[i] = 0

        count = 1
        while a:
            a = a % bin(a).count('1')
            count += 1

        ans[i] = count

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N = int(readline())
    X = readline().rstrip().decode('utf-8')
    nx = int(X, 2)

    ans = [0] * N

    oc = X.count('1')

    if oc - 1 != 0:
        mx = nx % (oc - 1)
        f = True
    else:
        f = False

    px = nx % (oc + 1)

    for i in range(N):

        if X[i] == '0':
            a = (px + pow(2, N - i - 1, oc + 1)) % (oc + 1)
        elif f:
            a = (mx - pow(2, N - i - 1, oc - 1)) % (oc - 1)
        else:
            ans[i] = 0
            continue

        count = 1
        while a:
            a = a % bin(a).count('1')
            count += 1

        ans[i] = count

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()
N = int(input())
A=list(map(int, input().split()))

def sol(i,want):
    num=int(N/(i+1))
    wa=-A[0]
    for j in range(num):
        wa+=A[i+j*i]
    wa=wa%2
    if wa==want:
        x=0
    else:
        x=1
#     print(num)
    return x 

B=A[:]
for i in range(half):
    j=half-1-i
#     print(j)
    B[j]=sol(j,A[j])
print(sum(B))
ans=''
for b in B:
    ans+=str(b)+ ' '
print(ans)

### FIXED CODE ###

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




def sol(i,want):
    num=N//(i+1)
    wa=B[i]

    for j in range(num):
        k=i+j*(i+1)
        wa+=B[k]
#         print(i,wa,B[i])
#         print((i+1)+j*(i+1)-1)
#     print(i,wa,B[i])
    wa=wa%2
#     print(i,wa,A[i])
    
    if wa==want:
        x=0
    else:
        x=1
#     print(num)
    return x 

B=A[:]
half=N//2
for i in range(half):
    j=half-1-i
#     print(j)
    B[j]=sol(j,A[j])
    
C=[i+1 for i, x in enumerate(B) if x ==1]

m=sum(B)
print(m)
print(*C)
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行あり
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

N行M列の初期化
dp = [[INF] * M for i in range(N)]

'''


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

# コストの小さいものから更新していけばいい
C.sort()

# 2のべき乗は先に計算しておく
beki = []
for i in range(3*N+20):
    beki.append(int(math.pow(2, i))%MOD)


ans = 0
for i in range(N):
    ans += (C[i] * beki[2*N-2] * (N-i+1))%MOD
    

print(ans % MOD)


### FIXED CODE ###

import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint
N, K = map(int, input().split())

1行のstring
S, T = input().split()

1行の整数配列
P = list(map(int,input().split()))

改行あり
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

N行M列の初期化
dp = [[INF] * M for i in range(N)]

'''


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

# コストの小さいものから更新していけばいい
C.sort()

# 2のべき乗は先に計算しておく
beki = [1]
for i in range(1, 3*N+20):
    beki.append((beki[i-1]*2)%MOD)


ans = 0
for i in range(N):
    ans += (C[i] * beki[2*N-2] * (N-i+1))%MOD
    

print(ans % MOD)
while True:
  str = input()
  if str == "EOF" :
      break
  d = 1
  a , b = str.split(' ')
  s = int(a) + int(b)
  while s > 9:
     s = s / 10
     d = d + 1
  print(d)

### FIXED CODE ###

while True:
    try:
        a, b = map(int, input().split())
        print(len(str(a+b)))
    except EOFError:
        break
o = list(input())
e = list(input())

for i in range(len(o)):
  print(o[i]+e[i],end="")

### FIXED CODE ###

o = list(input())
e = list(input())+[""]
for x,y in zip(o,e):
  print(x+y,end="")
def lcs_size():
  X = input()
  Y = input()
  
  a = len(X)
  b = len(Y)
  
  c[1][1] = 0
  for i in range(a):
    for j in range(b):
      if X[i] == Y[j]:
        c[i][j] = c[i-1][j-1] + 1
      else:
        c[i][j] = max(c[i-1][j], c[i][j-1])
      maxl = max(maxl, c[i][j])
  
  return maxl

q = input()

for i in range(q):
  print lcs_siz()

### FIXED CODE ###

def lcs_size():
  X = raw_input()
  Y = raw_input()
  a = len(X)
  b = len(Y)
  z2 = [0 for i in range(b+1)]

  for i in range(a):
    ch = X[i]
    z1 = z2 + []
    for j in range(b):
      if ch == Y[j]:
        z2[j+1] = z1[j] + 1
      elif z2[j+1] < z2[j]:
        z2[j+1] = z2[j]

  return z2[-1]

q = input()
for k in range(q):
  print lcs_size()
N, Q = map(int, input().split())
s = input()
TD = [sys.stdin.readline().split() for _ in range(Q)]

def check(k):
    np = k
    for t, d in TD:
        if s[np] == t:
            if d == 'L':
                np -= 1
            else:
                np += 1
        if not 0 <= np <= N-1:
            return False
    return True

ok = N
ng = -1
while abs(ok - ng) > 1:
    med = (ok + ng)//2
    if check(med):
        ok = med
    else:
        ng = med

L = ok

ok = -1
ng = N
while abs(ok - ng) > 1:
    med = (ok + ng)//2
    if check(med):
        ok = med
    else:
        ng = med

R = ok
print(R - L + 1)

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
TX = [list(input().split()) for _ in range(Q)]
def checkl(i):
    for t, x in TX:
        if S[i] == t:
            i += 1 if x == 'R' else -1
        if i < 0:
            return False
        if i == N:
            i = N - 1
    return True
def checkr(i):
    for t, x in TX:
        if S[i] == t:
            i += 1 if x == 'R' else -1
        if i > N - 1:
            return False
        if i == -1:
            i = 0
    return True

ok = N
ng = -1
while abs(ok - ng) > 1:
    med = (ok + ng)//2
    if checkl(med):
        ok = med
    else:
        ng = med
L = ok
ok = -1
ng = N
while abs(ok - ng) > 1:
    med = (ok + ng)//2
    if checkr(med):
        ok = med
    else:
        ng = med
R = ok
print(max(0, R - L + 1))
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
start = time.time()
y = 0
for i in range(2 ** n):
  v_total = 0
  c_total = 0
  for j in range(n):  # このループが一番のポイント
    if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
      v_total += v[j]
      c_total += c[j]
  if (v_total-c_total) > y:
    y = v_total-c_total
print(y)

### FIXED CODE ###

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
y = 0
for i in range(2 ** n):
  v_total = 0
  c_total = 0
  for j in range(n):  # このループが一番のポイント
    if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
      v_total += v[j]
      c_total += c[j]
  if (v_total-c_total) > y:
    y = v_total-c_total
print(y)
n,k = map(int, input().split())
count0 = 0
count1 = 0
for i in range(1,n+1):
    if i%k==0:
        count0+=1
    if i%k==k/2:
        count+=1

if k%2==0:
    print(count0**3+count1**3)
else:
    print(count0**3)

### FIXED CODE ###

n,k = map(int, input().split())
count0 = 0
count1 = 0
for i in range(1,n+1):
    if i%k==0:
        count0 +=1
    if i%k==k/2:
        count1 +=1

if k%2==0:
    print(count0**3+count1**3)
else:
    print(count0**3)
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


n = int(input())
a = list(map(int, input().split()))
lcm_a = a[0]

for i in range(1, n):
    lcm_a = lcm(lcm_a, a[i])

ans = 0

for i in a:
    ans += lcm_a // i

print(ans%1000000007)


### FIXED CODE ###

n, m = map(int,input().split())
print("Yes") if n == m else print("No")