Harryxun/stf_run huggingface dataset:
inData = str(input())
ansList = []
dataLen = len(inData)
rpLen = len(inData)
for i in range(0, dataLen):
    for j in range(1, rpLen + 1):
        if inData[-j] != inData[-j - 1]:
            ansList.append(inData[-j])
            ansList.append(inData[-j - 1])
            tmp1 = str(inData[0:-j - 1])
            tmp2 = ''
            if -j + 1 != 0:
                tmp2 = str(inData[-j + 1:])
            reData = tmp1 + tmp2
            if reData == '[]':
                inData = '[]'
            else:
                inData = reData
            break
        else:
            if rpLen == j + 1:
                break
    if inData == '[]':
        break
    rpLen = len(inData)
    if rpLen < 2:
        break

print(len(ansList))


### FIXED CODE ###

inData = str(input())
ansList = []
dataLen = len(inData)
zeroCnt = 0
oneCnt = 0
for i in range(0, dataLen):
    if inData[i] == '0':
        zeroCnt += 1
    else:
        oneCnt += 1

print(2 * min([zeroCnt, oneCnt]))
# https://atcoder.jp/contests/abc081/tasks/abc081_b
import math

def div_list(list_num):
    _div_list = []
    can_iter = True
    for k in range(len(list_num)):
        if math.isclose(list_num[k]%2, 0) == False:
            can_iter = False
        _div_list.append(list_num[k] / 2)
    return can_iter, _div_list


n_input = int(input())
list_number = input().split()
list_number = list(map(float, list_number))

n_iter = 0
can_iter = True

while can_iter == True:
    can_iter, list_number = div_list(list_number)
    if can_iter == True:
        n_iter += 1

print(n_iter)



### FIXED CODE ###

# https://atcoder.jp/contests/abc081/tasks/abc081_b

def div_list(list_num):
    _div_list = []
    can_iter = True
    for k in range(len(list_num)):
        if list_num[k] % 2 != 0:
                can_iter = False
        _div_list.append(list_num[k] / 2)
    return can_iter, _div_list


n_input = int(input())
list_number = input().split()
list_number = list(map(int, list_number))

n_iter = 0
can_iter = True

while can_iter == True:
    can_iter, list_number = div_list(list_number)
    if can_iter == True:
        n_iter += 1

print(n_iter)
i = x ** 3

print(i)

### FIXED CODE ###

x = int(input())
print(x ** 3)
a,b,c = map(int, input().split())

x = A % B
y = C % B

if y % x == 0:
  print("YES")
else :
  print("NO")

### FIXED CODE ###

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

for i in range(1,b+1):
  if (a*i)%b == c:
    print("YES")
    exit()
    
print("NO")
a=list(map(int, input().split()))
n=a[0]
a[0]=a[2]
a[2]=a[1]
a[1]=n
for i in range (len(a)):
  print a[i],


### FIXED CODE ###


A = list(map(int,input().split()))
n = A[0]
A[0] = A[2]
A[2] = A[1]
A[1] = n
print(A[0], A[1], A[2])
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[m] < sum(a) / (4*m):
    print('No')
else:
    print('Yes')

### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
if a[m-1] < (sum(a) / (4*m)):
    print('No')
else:
    print('Yes')
n.l=map(int,input().split())

# l ~ l+n-1

min_abs=99999999999
min_abs_i=-1
n_aji=0
for i in range(1,n+1):
  aji=l+i-1
  aji_abs=abs(aji)
  if aji_abs < min_abs:
    min_abs = aji_abs
    aji_abs_i = i
  n_aji+=aji

print(n_aji-(l+aji_abs_i-1))

### FIXED CODE ###

n,l=map(int,input().split())
 
min_abs=99999999999
min_abs_i=-1
n_aji=0
for i in range(1,n+1):
  aji=l+i-1
  aji_abs=abs(aji)
  if aji_abs < min_abs:
    min_abs = aji_abs
    aji_abs_i = i
  n_aji+=aji
 
print(n_aji-(l+aji_abs_i-1))
def intMap(): return map(int,input().split())
def intList(): return list(map(int, input().split()))

n,x = intMap()
l = intList()

d = 0
i = 0

while d <= x:
    d = d + l[i]
    i += 1
    if i > n: break
    
ans = min(i,n)
print(ans)


### FIXED CODE ###

def intMap(): return map(int,input().split())
def intList(): return list(map(int, input().split()))

n,x = intMap()
l = intList()

ans = 1
d = 0

for i in range(n):
    d += l[i]
    if d > x: break
    ans += 1

print(ans)
def nCr(n, r): 
  return (fact(n) / (fact(r)  
                * fact(n - r))) 
  
# Returns factorial of n 
def fact(n): 
  res = 1  
  for i in range(2, n+1): 
	res = res * i 
  return res
n, m = list(map(int, input().split()))

print(nCr(n + m, n) * nCr(n + m - 1, n - 1) + nCr(n + m, m) * nCr(n + m - 1, m - 1))

### FIXED CODE ###

n, m = map(int, input().split())
print(n*(n-1)//2 + m*(m-1)//2)
n, m = map(int, input().split())


li = []

for i in range(m):
    p,q = map(str, input().split())
    li.append((int(p),q))

wa = 0

se = {i for i in li if i[1]=='AC'}
ac = len(se)

flag = True
for i in range(m-1):
    if li[i][0]!=li[i+1][0]:
        flag = True
    elif li[i][0]==li[i+1][0] and li[i][1]=='AC':
        flag = False
    elif li[i][0]==li[i+1][0] and li[i][1]=='WA' and flag:
        wa += 1

print(ac, wa)

### FIXED CODE ###

import string
c = input()

upper = string.ascii_lowercase
ind = upper.index(c)
print(upper[ind+1])
import math
n=int(input())
a=list(map(int,input().split()))
a.sort()
ls=[0]
cnt=0
for i in range(1,2**n):
  if a[i]>a[i-1]:
    cnt+=1
  ls.append(cnt)
for i in range(2**n):
  if i<2**n-1:
    lmt=n-int(math.log2(n-i-1))-1
    if ls[i]<lmt:
      print("No")
      break
  if i==2**n-1:
    if ls[i]<n-1:
      print("No")
      break
else:
  print("Yes")

### FIXED CODE ###

import math
def cmb(n,r):
  return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
n=int(input())
a=list(map(int,input().split()))
a.sort()
ls=[0]
cnt=0
for i in range(1,2**n):
  if a[i]>a[i-1]:
    cnt+=1
  ls.append(cnt)
lmt = []
for i in range(n+1):
  lmt.extend([i]*cmb(n,i))
bias = ls[-1]-lmt[-1]
jdg = 0
ulmt = 0
for i in range(n):
  jdg += ls.count(i)
  ulmt += 2**(n-i-1)
  if jdg > ulmt:
    print("No")
    exit()
for x,l in zip(ls,lmt):
  if x-l > bias:
    print("No")
    break
else:
  print("Yes")
h, w, m = map(int, input().split())
h_cnt = [0 for i in range(h)]
w_cnt = [0 for i in range(w)]
bomb = set()
for _ in range(m):
    c_h, c_w = map(int, input().split())
    h_cnt[c_h-1] +=1
    w_cnt[c_w-1]+=1
    bomb.add(((c_h-1),(c_w-1)))
    
h_max = max(h_cnt)
w_max = max(w_cnt)
    
max_h = [i for i in range(len(h_cnt)) if h_cnt[i] == h_max]
max_w = [i for i in range(len(w_cnt)) if h_cnt[i] == w_max]

flg = 0
for i in max_h:
    for j in max_w:
        if (i,j) not in bomb:
            flg = 1
            break

if flg:
    print(max_h + max_w)
else:
    print(max_h + max_w -1)

### FIXED CODE ###

h, w, m = map(int, input().split())
h_cnt = [0 for i in range(h)]
w_cnt = [0 for i in range(w)]
bomb = set()

for i in range(m):
    _h, _w = map(int, input().split())
    h_cnt[_h-1] += 1
    w_cnt[_w-1] += 1
    bomb.add(((_h-1),(_w-1))) #爆破対象の位置を判断

h_max = max(h_cnt)
w_max = max(w_cnt)

max_h = []
max_w = []

for i in range(h):
    if h_cnt[i] == h_max:
        max_h.append(i)

for i in range(w):
    if w_cnt[i] == w_max:
        max_w.append(i)

flg = True

for i in max_h:
    for j in max_w:
        if (i,j) not in bomb:
            flg = False
            break
print(h_max+w_max-1 if flg else h_max+w_max)
A=int(input())
B=int(input())
T=int(input())
print(T//A*B)

### FIXED CODE ###

A,B,T=map(int,input().split())
print(T//A*B)
N,K = [int(i) for i in input().split()]
num = list(map(int, input().split()))
k = K
ans = 0
count = 0
print(K)
if K == 0:
    print(sum(num))
else:
    K2 = []
    while K>0:
        K2.append(K % 2)
        K //= 2
    data = []
    for i in num:
        num2 = []
        while i > 0:
            num2.append(i % 2)
            i //= 2
        while len(num2) < len(K2):
            num2.append(0)
        data.append(list(reversed(num2)))
    for i in range(len(K2)):
        t = 0
        b = 2**(len(K2) - i - 1) #べき乗
        for j in range(N):
            t += data[j][i]
        if t >= N-t:
            ans += b * t
        else:
            count += b
            if count <= k:
                ans += b * (N-t)
            else:
                ans += b * t
    print(ans)

### FIXED CODE ###

N, Q = [float(i) for i in input().split()]
print(N/Q)
import math

def main():
  a, b = input().split()
  a = int(a)
  b = float(b)
  c = int(b)
  d = (b - c) * 100
  ans_a = a * c
  ans_b = (a * d) // 100
  ans = math.floor(ans_b) + ans_a
  print(ans)
 
 
if __name__ == '__main__':
  main()

### FIXED CODE ###

def main():
  n = int(input())
  li = list(map(int,input().split()))
  li.sort()
  ans = 1
  for i in range(n):
    ans *= li[i]
    if ans > (10 ** 18):
      print(-1)
      exit()
  print(ans)


if __name__ == '__main__':
  main()
x = input().split()
n = int(x[0]) # n == 比較文字列の長さ
q = int(x[1]) # q == 検討する回数
s = input()

        
t = [0] * n
if s[0] == "A":
    t[0] = 1
    
for i in range(0,n-1):
    if s[i:i+2] == "AC":
        
        if (i == 0) :
            t[i] =  + 1
        else:
            t[i] = t[i-1] + 1
    else :
        if i == 0:
            t[i] = 0
        else:
            t[i] = t[i-1]



def sc():
    global t
    global s
    global n
    global q
    global idbox
    maxx = 0
    count = 0
    com = [int(s)-1 for s in input().split()]
    
    idbox = ind_Multi(com[0],com[1])
    print(t[com[1]-1] - t[com[0]-1])
        
    

    

for i in range(q):
    
    sc()

    

### FIXED CODE ###


x = input().split()
n = int(x[0]) # n == 比較文字列の長さ
q = int(x[1]) # q == 検討する回数
s = input()

        
t = [0] * n
if s[0] == "A":
    t[0] = 1
    
for i in range(0,n-1):
    if s[i:i+2] == "AC":
        
        if (i == 0) :
            t[i] =  + 1
        else:
            t[i] = t[i-1] + 1
    else :
        if i == 0:
            t[i] = 0
        else:
            t[i] = t[i-1]



def sc():
    global t
    global s
    global n
    global q
    global idbox
    maxx = 0
    count = 0
    com = [int(s)-1 for s in input().split()]
    
    
    print(t[com[1]-1] - t[com[0]-1])
        
    

    

for i in range(q):
    
    sc()
n = int(input())
alist = list(map(int,input().split()))
dic = {}
mod = 10**9+7
for i in range(n):
    if alist[i] not in dic:
        dic[alist[i]] = 0
    dic[alist[i]] += 1
k = 0
while n-k-1 >= 2:
    p = n-k-1
    if p == 0:
        if dic[p] != 1:
            print(0)
            exit()
    else:
        if dic[p] != 2:
            print(0)
            exit()
    k += 2
else:
    print(2**(n//2)%mod)



### FIXED CODE ###

n = int(input())
cnts = [0]*n
alist = list(map(int,input().split()))
mod = 10**9+7

for i in range(n):
    cnts[alist[i]] += 1

p = n%2
if p == 1:
    cnts[0] += 1

for i in range(n):
    if p != (i%2):
        if cnts[i] != 2:
            print(0)
            exit()
    else:
        if cnts[i] != 0:
            print(0)
            exit()
print(pow(2,(n//2))%mod)
a, b, c = map(int,input().split())
if a + b = c or b + c = a or a + c = b:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a, b, c = map(int,input().split())
if a + b == c or b + c == a or a + c == b:
  print("Yes")
else:
  print("No")
h=int(input())
count=0
while  h>1:
	h = h // 2
	count += 1
print(2 ** (count+1) - 1)


### FIXED CODE ###

h,a=map(int,input().split())
if h % a ==0:
	print(h // a)
else:
	print((h // a ) + 1)
from collections import defaultdict

n = int(input())
d = defaultdict()
for _ in range(n):
    s = input()
    d[s] += 1
m = int(input())
for _ in range(m):
    s = input()
    d[s] -= 1

print(sorted([d[k] for k in d.keys()])[-1])


### FIXED CODE ###

from collections import defaultdict

n = int(input())
d = defaultdict(int)
for _ in range(n):
    s = input()
    d[s] += 1
m = int(input())
for _ in range(m):
    s = input()
    d[s] -= 1

answer = sorted([d[k] for k in d.keys()])[-1]
if answer < 0:
    answer = 0
print(answer)
#!/usr/bin/env python
import sys

sys.setrecursionlimit(10000)

matrix = []
vec = [[1,0],[-1,0],[0,1],[0,-1]]
visited =[]
h = 0
w = 0

def dfs(x,y,fruit):
  #visited.append((x,y))
  visited[y][x] = 1
  for v in vec:
    nx = x + v[0]
    ny = y + v[1]
    if nx in xrange(w) and ny in xrange(h):
      if visited[ny][nx]==0 and matrix[ny][nx] == fruit:
        dfs(nx,ny,fruit)
  return 0


while True:
  h,w = map(int,raw_input().split())
  if h == 0 and w == 0:
    break
#  print h,w
  matrix = []
  visited = []
  ans = 0
  for i in xrange(h):
    s = raw_input().rstrip()
    matrix.append(list(s))
    visited.append([0]*w)
  for i in xrange(h):
    for j in xrange(w):
      #if not (j,i) in visited:
      if visited[i][j] == 0:
        dfs(j,i,matrix[i][j])
        ans+=1
  print ans

### FIXED CODE ###

#!/usr/bin/env python
import sys

sys.setrecursionlimit(20000)

matrix = []
vec = [[1,0],[-1,0],[0,1],[0,-1]]
visited =[]
h = 0
w = 0

def dfs(x,y,fruit):
  #visited.append((x,y))
  visited[y][x] = 1
  for v in vec:
    nx = x + v[0]
    ny = y + v[1]
    if nx in xrange(w) and ny in xrange(h):
      if visited[ny][nx]==0 and matrix[ny][nx] == fruit:
        dfs(nx,ny,fruit)
  return 0


while True:
  h,w = map(int,raw_input().split())
  if h == 0 and w == 0:
    break
#  print h,w
  matrix = []
  visited = []
  ans = 0
  for i in xrange(h):
    s = raw_input().rstrip()
    matrix.append(list(s))
    visited.append([0]*w)
  for i in xrange(h):
    for j in xrange(w):
      #if not (j,i) in visited:
      if visited[i][j] == 0:
        dfs(j,i,matrix[i][j])
        ans+=1
  print ans
N,X =  map(int, input().split())

a = list(map(int, input().split()))
a.sort(reverse=True)

def deposit(n, trash):
    if n + 1 == N:
        return X + a[n] * ((trash+1) ** 2)
    
    return min(X+a[n]*((trash+1)**2)+X+a[n+1]+deposit(n+1,1),(a[n]-a[n+1])*((trash+1)**2)+X+deposit(n+1,trash+1))

print(deposit(0,1)+X+a[0])


### FIXED CODE ###


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

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

a = a[::-1]

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

ans = 10**100

for k in range(1,N+1):
    cur = (N+k) * X


    count = 1
    i = k
    while 1:
        first = i - k
        last = min(N,i)
        flag = False
        if i > N:
            flag = True

        if count == 1:
            cur += dp[last] * 5
        else:
            cur += (dp[last] - dp[first]) * (2*count + 1)

        count += 1
        i += k
        
        if flag:
            break


        
    ### print(dp, cur)
    ans = min(ans, cur)

print(ans)
#coding:utf-8
s=[int(i) for i in input().split()]
n=[]
for i in range(s[0]):
  n.append(int(input()))
n.sort()
print(n)
sa=abs(n[0]-n[s[1]]-1)
for i in range(s[1]):
  print(n[1],n[i+s[1]-1])
  if(sa>abs(n[i]-n[i+s[1]-1])):
    sa=abs(n[i]-n[i+s[1]-1])
print(sa)

### FIXED CODE ###

n=[int(i) for i in input().split()]
array=[]
for i in range(n[0]):
  array.append(int(input()))
array.sort()
ans=abs(array[0]-array[n[1]-1])
for i in range(n[0]-(n[1]-1)):
  if(ans>abs(array[i]-array[i+n[1]-1])):
    ans=abs(array[i]-array[i+n[1]-1])
print(ans)
#coding: utf-8
from collections import defaultdict

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

G = defaultdict(set)
for i in range(M):
    a, b = [int(x) - 1 for x in input().split()]
    G[a].add(b)
    G[b].add(a)

grp = [-1] * N

def dfs(node, color):
    if grp[node] != -1:
        return 
    grp[node] = color
    for n in G[node]:
        if grp[n] == -1:
            dfs(n, color)

for i in range(N):
    dfs(i, i)

n = defaultdict(int)
for i in range(N):
    n[grp[i]] += 1

ret = 0
for r in n:
    ret = max(ret, n[r])
print(ret)


### FIXED CODE ###

#coding: utf-8
from collections import defaultdict, deque

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

G = defaultdict(set)
for i in range(M):
    a, b = [int(x) - 1 for x in input().split()]
    G[a].add(b)
    G[b].add(a)

grp = [-1] * N

for i in range(N):
    q = deque()
    q.append((i,i))

    while(len(q) != 0):
        node, color = q.popleft()
        if grp[node] != -1:
            continue
        grp[node] = color
        for n in G[node]:
            if grp[n] == -1:
                q.append((n, color))

n = defaultdict(int)
for i in range(N):
    n[grp[i]] += 1

ret = 0
for r in n:
    ret = max(ret, n[r])
print(ret)
S = input()
K = input()

# if not(1 <= len(S) and len(S) <= 100):
#     exit()
# if not (S.isalpha() and S.islower()):
#     exit()
# if not float(K).is_integer():
#     exit()
# if not (1 <= int(K) and int(K) <= 10 ** 9):
#     exit()



L = []
tmp = []
pre = ""
for s in S:
    if len(tmp) == 0:
        pre = s
        tmp.append(s)
    elif pre == s:
        tmp.append(s)
    else:
        L.append(tmp)
        pre = s
        tmp = [s]
L.append(tmp)

count = 0
for l in L:
    count += int(len(l) / 2)

count *= int(K)
if len(L) == 1:
    print(count)
    exit()
if L[0][0] == L[len(L) - 1][0]:
    if len(L[0]) % 2 == 1 and len(L[len(L)]) % 2 == 1:
        count = count + 1 * int(K) - 1
print(count)


### FIXED CODE ###

S = input()
K = input()

if not(1 <= len(S) and len(S) <= 100):
    exit()
if not (S.isalpha() and S.islower()):
    exit()
if not float(K).is_integer():
    exit()
if not (1 <= int(K) and int(K) <= 10 ** 9):
    exit()

L = []
tmp = []
pre = ""
for s in S:
    if len(tmp) == 0:
        pre = s
        tmp.append(s)
    elif pre == s:
        tmp.append(s)
    else:
        L.append(tmp)
        pre = s
        tmp = [s]
L.append(tmp)

count = 0
for l in L:
    count += int(len(l) / 2)
    # print(l)
count *= int(K)
if len(L) == 1:
    if len(L[0]) == 1:
        count = int(int(K) / 2)
    elif len(L[0]) % 2 == 1:
        count += int(int(K) / 2)
    
elif L[0][0] == L[len(L)-1][0]:
    if len(L[0]) % 2 == 1 and len(L[len(L)-1]) % 2 == 1:
        count = count + int(K) - 1
print(count)
N=int(input())
S=input()
ans=0
for s in S:
    
    if s=="A":
        c=1
    elif s=="B" and c==1:
        c=2
    elif s=="C" and c==2:
        ans+=1
        c=0
    else:
        c=0

print(ans)

### FIXED CODE ###

N=int(input())
S=input()
ans=0
c=0
for s in S:
    
    if s=="A":
        c=1
    elif s=="B" and c==1:
        c=2
    elif s=="C" and c==2:
        ans+=1
        c=0
    else:
        c=0

print(ans)
a,b,c = map(int(),input().split())
res = a * b / 2
print(res)

### FIXED CODE ###

a,b,c = map(int,input().split())
res = a * b / 2
print(int(res))
S = input()
q = 0
for i in list(S):
  q += i
if int(S)% q == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = input()
q = 0
for i in list(S):
  q += int(i)
if int(S)% q == 0:
  print("Yes")
else:
  print("No")
# レベルLのN番目
def solve(L,N):
    if L == 0 and N == 1:
        return 1
    if N == 1:
        return 0
    elif N <= 2**(L+1)-2:
        return solve(L-1,N-1)
    elif N == int(2**(L+1) - 1):
        return 2**L
    return solve(L-1,N-2**(L+1)+1) + 2**L

N,X = map(int,input().split())
print(solve(N,X))

### FIXED CODE ###

# レベルLのN番目
def solve(L,N):
    if L == 0:
        return 1
    if N == 1:
        return 0
    elif N <= 2**(L+1)-2:
        return solve(L-1,N-1)
    elif N == int(2**(L+1)-1):
        return 2**L
    return solve(L-1,N-2**(L+1)+1)+2**L
    

N,X = map(int,input().split())
print(solve(N,X))
def count(n):
  p=0
  while n%2==0:
    p+=1
  return(p)

n=int(input())
l=list(map(int,input().split()))
count=0
for i in range(n):
  count+=count(l[i])
print(count)

### FIXED CODE ###

def count(n):
  p=0
  while n%2==0:
    p+=1
    n=n//2
  return(p)

n=int(input())
l=list(map(int,input().split()))
sum=0
for i in range(n):
  sum+=count(l[i])
print(sum)
N = input()
a = []
for i in range(N):
    a.append(input())
    print('case'{}':'{}.format(N,a))

### FIXED CODE ###

l = []
y = 1
while True:
    x = int(input())
    if x == 0:
        break
    l.append(x)
    print('Case {}: {}'.format(y,x))
    y += 1
h,w = map(int,input().split())
s=[]
for _ in range(h):
  s.append(str(input()))
for i in range(h):
  for j in range(w):
    flag=False
    if s[i][j]!="#":
      break
    for k in [-1,1]:
      if 0<=i+k<h:
        if s[i+k][j]=="#":
          flag=True
      if 0<=j+k<h:
        if s[i][j+k]=="#":
          flag=True
    if not flag:
      print("No")
      exit()
print("Yes")

### FIXED CODE ###

h,w = map(int,input().split())
s=[]
for _ in range(h):
  s.append(str(input()))
for i in range(h):
  for j in range(w):
    flag=False
    if s[i][j]!="#":
      continue
    for k in [-1,1]:
      if 0<=i+k<h:
        if s[i+k][j]=="#":
          flag=True
      if 0<=j+k<w:
        if s[i][j+k]=="#":
          flag=True
    if not flag:
      print("No")
      exit()
print("Yes")
import math

N, X, T = input().split(' ')
print(math.ceil(N/X) * T)

### FIXED CODE ###

import math

N, X, T = input().split(' ')
print(math.ceil(int(N)/int(X)) * int(T))
n = int(input())
s = input()

def z_algorythm(s):
    n = len(s)
    LCP = [0]*n
    c = 0
    for i in range(1, n):
        if i + LCP[i-c] < c + LCP[c]:
            LCP[i] = LCP[i-c]
        else:
            j = max(0, c+LCP[c]-i)
            while i+j < n and s[j] == s[i+j]:
                j += 1
                LCP[i] = j
                c = i
    LCP[0] = n
    return LCP

ans = 0
for i in range(n):
    LCP = z_algorythm(s[i:])
    for j, len in enumerate(LCP):
        tmp = min(len, j)
        ans = max(ans, tmp)
print(ans)

### FIXED CODE ###

s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
while True:
    n = int(input())
    if n == 0:
        break
    p = [10, 10]
    l = [list(map(int,input().split())) for _ in range(n)]
    for d,s in [input().split() for _ in range(int(input()))]:
        for _ in range(s):
            if d == 'N':
                p[1] += 1
            elif d == 'E':
                p[0] += 1
            elif d == 'W':
                p[0] -= 1
            elif d == 'S':
                p[1] -= 1
            if p in l:
                l.remove(p)
    if len(l) == 0:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

while True:
    n = int(input())
    if n == 0:
        break
    p = [10, 10]
    l = [list(map(int,input().split())) for _ in range(n)]
    for d,s in [input().split() for _ in range(int(input()))]:
        for _ in range(int(s)):
            if d == 'N':
                p[1] += 1
            elif d == 'E':
                p[0] += 1
            elif d == 'W':
                p[0] -= 1
            elif d == 'S':
                p[1] -= 1
            if p in l:
                l.remove(p)
    if len(l) == 0:
        print('Yes')
    else:
        print('No')