Harryxun/stf_run huggingface dataset:
import math
import collections
from collections import defaultdict

N = int(input())
iwa = []
mod = 10**9+7

for i in range(N):
    a, b = map(int,input().split())
    if a == 0 and b == 0:
        continue
    elif b == 0:
        iwa,append((1,0))
    elif a == 0:
        iwa.append((0,1))
    elif b > 0:
        c = math.gcd(a,b)
        iwa.append((a/c, b/c))#bは正
    else:
        c = math.gcd(a,b)
        iwa.append((-a/c, -b/c))#bは正
        
S = set(iwa)
I = collections.Counter(iwa)
#print(I)
jdg = defaultdict(int)

ans = 1
for i in S:
    if jdg[i] == 1:
        continue
    elif i == (1,0) or i == (0,1):
        k = I[(1,0)]
        l = I[(0,1)]
        if min(k,l) == 0:
            ans *= pow(2,max(l,k),mod)
        else:
            ans *= (pow(2,l,mod)-1) + (pow(2,k,mod)-1)+1
        jdg[(1,0)] = 1
        jdg[(0,1)] = 1
    else:
        k = I[i]
        a, b = i
        if a < 0:
            l = I[(b,-a)]
            jdg[(b, -a)] = 1
        else:
            l = I[(-b,a)]
            jdg[(-b,a)] = 1
        if min(l,k) == 0:
            ans *= pow(2,max(l,k),mod)
        else:
            ans *= (pow(2,l,mod)-1) + (pow(2,k,mod)-1)+1
        jdg[i] = 1
print(ans-1)

### FIXED CODE ###

from math import gcd
from collections import defaultdict

N = int(input())
AB = [tuple(map(int, input().split())) for _ in range(N)]
MOD = 10**9 + 7

d = defaultdict(int)#defaultdictで数えあげ
cnt_00 = 0
cnt_0b = 0
cnt_a0 = 0
for a,b in AB:
    if a == b == 0:
        cnt_00 += 1
    elif a == 0:
        cnt_a0 += 1
    elif b == 0:
        cnt_0b += 1
    else:
        num_gcd = gcd(a,b)
        grad = 1 if a * b > 0 else -1
        a //= num_gcd
        b //= num_gcd
        d[(grad, abs(a), abs(b))] += 1

ans = 1
for k in d.keys():
    if d[k] == 0:
        continue
    
    grad, a, b = k[0], k[1], k[2]
    if (-grad, b, a) in d:
        
        # 傾き a/bのものを一つ以上選ぶ場合（-b/aは選ばない） + -b/aから一つ以上選ぶ場合（a/bは選ばない） + どちらからも選ばない場合
        ans *= (pow(2, d[(grad, a, b)], MOD)-1) + (pow(2, d[(-grad, b, a)], MOD)-1) + 1
        ans %= MOD
        d[(grad, a, b)] = 0
        d[(-grad, b, a)] = 0
    else:
        # a/bから0個以上選ぶ場合
        ans *= pow(2, d[(grad, a, b)], MOD)
        ans %= MOD
        d[(grad, a, b)] = 0

# a,bの一方のみ0の場合 + どちらからも選ばない場合
ans *= (pow(2, cnt_a0, MOD)-1) + (pow(2, cnt_0b, MOD)-1) + 1
ans %= MOD

# 0,0のみを１つだけ入れる場合
ans += cnt_00
# なにも選ばない場合を除く
ans -= 1

ans %= MOD

print(ans)
import numpy as np
n, q = map(int, input().split())
e = np.eye(n + 1, dtype=int)
point = np.zeros(n+1, dtype=int)
for i in range(n - 1):
    a, b = map(int, input().split())
    if a != 1 and sum(e[1:a, a]) == 0:
        e[b][a] = 1
    else:
        e[a][b] = 1

def calc(x, y):
    for i in range(y):
        for j in range(y):
            if x[i][j] >= 1:
                x[i][j] = 1

for i in range(q):
    p, x = map(int, input().split())
    point[p] += x

for i in range(1, n+1):
    for j in range(i+1,n+1):
        if e[i][j] == 1:
            e[i] += e[j]
        else:
            continue

calc(e[1:, 1:], n)
ans = np.dot(point[1:], e[1:, 1:])
print(*ans)


### FIXED CODE ###

from collections import deque
n, q = map(int, input().split())
tree = [[] for _ in range(n+1)]
cnt = [0] * (n+1)

for _ in range(n-1):
    a, b = map(int, input().split())
    tree[a].append(b)
    tree[b].append(a)

for _ in range(q):
    p, x = map(int, input().split())
    cnt[p] += x

queue = deque([1])
visited = {1}
while queue:
    now = queue.popleft()
    visited.add(now)
    for t in tree[now]:
        if t in visited:
            pass
        else:
            queue.append(t)
            cnt[t] += cnt[now]

print(*cnt[1:])
import sys
from collections import Counter
import functools
import operator


def resolve(in_):
    N, M = map(int, next(in_).split())
    A = tuple(map(lambda x: int(x) // 2, next(in_).split()))

    max_a = max(A)
    temp = [0] * (max_a + 1)
    temp[1] = 1

    for i in range(2, max_a + 1):
        if temp[i]:
            continue

        j = i
        while j < max_a + 1:
            if not temp[j]:
                temp[j] = i
            j += i

    B = Counter()
    for a in A:
        C = Counter()
        while a > 1:
            C.update((temp[a],))
            a = a // temp[a]
        B |= C
    
    lcm = functools.reduce(operator.mul, (k * v for k, v in B.items()), 1)
    lcm2 = lcm + lcm

    answer = sum(1 for _ in range(lcm, M, lcm2))
    return answer


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import functools
from math import gcd


def lcm2(x, y):
    return x * y // gcd(x, y)


def lcm(x):
    return functools.reduce(lcm2, x)


def resolve(in_):
    N, M = map(int, next(in_).split())
    A = tuple(map(lambda x: int(x) // 2, next(in_).split()))

    a0 = A[0]
    x = 0
    while True:
        a0, b = divmod(a0, 2)
        if b:
            break
        x += 1
    x = 2 ** x
    for a in A[1:]:
        d, m = divmod(a, x)
        if m != 0 or not d % 2:
            return 0 

    l = lcm(A)
    l2 = l + l

    answer = len(range(l, M + 1, l2))

    return answer


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()
#6
h,w = map(int,input().split())
s = []
ans = [[] for i in range(h)]
for i in range(h):
    s.append(input())
    
cnt = 0
for i in range(h):
    for j in range(w):
        if s[i][j] !="#":
            if i == 0 :              #上底のコーナーケース
                if j == 0 :
                    for m in range(2):
                        for n in range(2):
                            if s[m][n] == "#":
                                cnt += 1
                elif j == w-1:
                    for m in range(2):
                        for n in range(w-2,w):
                            if s[m][n] == "#":
                                cnt += 1
                else:
                    for m in range(2):
                        for n in range(j-1,j+2):
                            if s[m][n] == "#":
                                cnt += 1
            elif i == h-1 :              #下底のコーナーケース
                if j == 0 :
                    for m in range(h-2,h):
                        for n in range(2):
                            if s[m][n] == "#":
                                cnt += 1
                elif j == w-1:
                    for m in range(h-2,h):
                        for n in range(w-2,w):
                            if s[m][n] == "#":
                                cnt += 1
                else:
                    for m in range(h-2,h):
                        for n in range(j-1,j+2):
                            if s[m][n] == "#":
                                cnt += 1
            else:
                if j == 0:             #上底下底以外の左端列
                    for m in range(i-1,i+2):
                        for n in range(2):
                            if s[m][n] == "#":
                                cnt += 1
                elif j == w-1:           #上底下底以外の右端列
                    for m in range(i-1,i+2):
                        for n in range(w-2,w):
                            if s[m][n] == "#":
                                cnt += 1
                else:                  #その他中央部
                    for m in range(i-1,i+2):
                        for n in range(j-1,j+2):
                            if s[m][n] == "#":
                                cnt += 1
            ans[i].append(str(cnt))
            cnt = 0
        else:
            ans[i].append("#")
        
for i in ans:
    print("".join(i))

### FIXED CODE ###

#6re
h,w = map(int,input().split())
s = []
s.append(list("." for i in range(w+2)))
for i in range(h):
    s.append(list("."+input()+"."))
s.append(list("." for i in range(w+2)))
ans = [[0 for j in range(w) ] for i in range(h) ]
    
for i in range(1,h+1):
    for j in range(1,w+1):
        if s[i][j] != "#":
            for m in range(i-1,i+2):
                for n in range(j-1,j+2):
                    if s[m][n] == "#":
                        ans[i-1][j-1] += 1
        else:
            ans[i-1][j-1] = "#"
                
for i in range(h):
    for j in range(w):
        ans[i][j] = str(ans[i][j])
        
for i in range(h):
    print("".join(ans[i]))
from collections import deque
def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    pos = []
    neg = []
    for a in As:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)
    pos = deque(sorted(pos))
    neg = deque(sorted(neg))
    x = 0
    y = 0
    ops = []
    while True:
        if len(pos) > 0 and len(neg) > 0:
            if len(pos) > len(neg):
                x = neg.popleft()
                y = pos.pop()
            else:
                x = pos.pop()
                y = neg.popleft()
        elif len(pos) > 1 and len(neg) == 0:
                x = pos.popleft()
                y = pos.pop()
        elif len(neg) > 1 and len(pos) == 0:
                x = pos.pop()
                y = pos.popleft()
        else:
            raise Exception("Unreachable?")
        
        ops.append("{} {}".format(x, y))
        xmy = x - y

        if xmy >= 0:
            pos.append(xmy)
        else:
            neg.appendleft(xmy)
        
        if len(list(pos) + list(neg)) == 1:
            print((list(pos) + list(neg))[0])
            break
    
    [print(i) for i in ops]

if '__main__' == __name__:
    resolve()

### FIXED CODE ###

from collections import deque
def resolve():
    N = int(input())
    As = list(map(int, input().split(" ")))
    pos = []
    neg = []
    for a in As:
        if a >= 0:
            pos.append(a)
        else:
            neg.append(a)
    pos = deque(sorted(pos))
    neg = deque(sorted(neg))
    x = 0
    y = 0
    ops = []
    while True:
        if len(pos) > 0 and len(neg) > 0:
            if len(pos) > len(neg):
                x = neg.popleft()
                y = pos.pop()
            else:
                x = pos.pop()
                y = neg.popleft()
        elif len(pos) > 1 and len(neg) == 0:
                x = pos.popleft()
                y = pos.pop()
        elif len(neg) > 1 and len(pos) == 0:
                x = neg.pop()
                y = neg.popleft()
        else:
            raise Exception("Unreachable?")
        
        ops.append("{} {}".format(x, y))
        xmy = x - y

        if len(pos) == 0 and len(neg) == 0:
            print(xmy)
            break

        if xmy >= 0:
            pos.append(xmy)
        else:
            neg.appendleft(xmy)
        
    [print(i) for i in ops]

if '__main__' == __name__:
    resolve()
import queue
h,w = map(int,input().split())

#aij = [input() for i in range(h)]

moji = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    aij = input()
    #print(aij)
    for j in range(w):
        moji[i][j] = aij[j]

#moji = aij
#print(moji,aij)
#exit()

#print(aij)
vx = [0,1,0,-1]
vy = [1,0,-1,0]

ans = 0
flag = False

for i in range(h*w):
    y = i//w
    x = i%w
    #print(i)
    if moji[y][x] == '#':
        continue
    else:
        q = queue.Queue()
        q.put(i,0)
        
        while flag == False:
            tmp,num = q.get()
            for j in range(4):
                nx = x+vx[j]
                ny = y+vy[j]
                #print(ny,nx)
                if nx < 0 or nx >= w or ny < 0 or ny >= h:
                    continue
                if moji[ny][nx] == "#":
                    flag = True
                    break
                else:
                    q.put([ny*w+nx,num+1])
                    
        ans = max(ans,num)

print(ans)

### FIXED CODE ###

import queue
from collections import deque
h,w = map(int,input().split())

#aij = [input() for i in range(h)]

moji = [[0 for i in range(w)] for j in range(h)]

dist = [[-1]*w for _ in range(h)]

for i in range(h):
    aij = input()
    #print(aij)
    for j in range(w):
        moji[i][j] = aij[j]

#moji = aij
#print(moji,aij)
#exit()

#print(aij)
vx = [0,1,0,-1]
vy = [1,0,-1,0]

ans = 0
q = deque()

for i in range(h*w):
    y = i//w
    x = i%w
    #print(i)
    if moji[y][x] == '#':
        q.append(i)
        dist[y][x] = 0

#ans = -1

ans = 0

while q:
    #print(q.qsize())
    tmp = q.popleft()
    y = tmp//w
    x = tmp%w
    d = dist[y][x]
    #print(tmp,num)
    for j in range(4):
        nx = x+vx[j]
        ny = y+vy[j]
        #print(ny,nx)
        if nx < 0 or nx >= w or ny < 0 or ny >= h:
            continue
        if dist[ny][nx] == -1:
            dist[ny][nx] = d+1
            #moji[ny][nx] = '#'
            q.append(ny*w+nx)
    #ans += 1
    ans = max(d,ans)

print(ans)
a,b=map(int,input().split())
s=0
g=0
if a==1:
  s=300000
elif a==2:
  s=200000
elif a==3:
  s=100000
else:
  pass
if b==1:
  g=300000
elif b==2:
  g=200000
elif b==3:
  g=100000
else:
  pass
if a=1 and b=2:
  print(g+s+400000)
else:
  print(s+g)

### FIXED CODE ###

a,b=map(int,input().split())
s=0
g=0
if a==1:
  s=300000
elif a==2:
  s=200000
elif a==3:
  s=100000
else:
  s=0
if b==1:
  g=300000
elif b==2:
  g=200000
elif b==3:
  g=100000
else:
  g=0
if a==1 and b==1:
  print(g+s+400000)
else:
  print(s+g)
import sys
import numpy as np
from fractions import gcd
a, b = [int(i) for i in sys.stdin.readline().split()]
_gcd = gcd(a,b)
memo_ls = np.zeros(_gcd)
#memo_set = set()
cnt = 0
if _gcd == 1:
    print(1)
else:
    for i in range(2, _gcd+1):
        if _gcd % i == 0 and memo_ls[i-1] != 1:
            memo_ls[i-1::i] = 1
            cnt += 1
            #memo_set.add(i)
    #print(memo_set)
    print(cnt + 1)

### FIXED CODE ###

import sys
from fractions import gcd
def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a

def main(a, b):
    #a, b = [int(i) for i in sys.stdin.readline().split()]
    _gcd = gcd(a,b)
    #memo_ls = [0 for i in range(_gcd)]
    #memo_set = set()
    cnt = 0
    if _gcd == 1:
        print(1)
    else:
        res = prime_factorize(_gcd)
        print(len(res) + 1)
if __name__ == "__main__":
    a, b = [int(i) for i in sys.stdin.readline().split()]
    main(a, b)
def main:
  s=0
  N=int(input())
  for i in range(1,N+1):
    if (len(str(i)))%2!=0:
      s+=1
  print(s)
  

### FIXED CODE ###

s=0
N=int(input())
for i in range(1,N+1):
  if (len(str(i)))%2!=0:
    s+=1
print(s)
n = int(input())

new = 1
a = list(map(int,input().split()))
for i in a:
	new = new * i 
val = 10**18
if new > val:
	print(-1)
else:
	print(new)	 


### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
new = 1
if 0 in a:
	print(0)
	exit()
for i in a:
	new *= i
	if new > (10**18):
		new = -1
		break
print(new)
s=input()
cnt=0

if len(s)%2==0:
  for i in range(len(s)/2):
    if s[i]!=s[len(s)-1-i]:
      cnt+=1
      
else:
  for i in range((len(s)+1)/2):
    if s[i]!=s[len(s)-1-i]:
      cnt+=1
print(cnt)

### FIXED CODE ###

s = input()
 
cnt = 0
b = int(len(s))
 
for a in range(int(b/2)):
    if s[a] != s[(b-a-1)]:
       cnt = cnt +1
print(cnt)
n=input()
s=c=h=d=range(1,14)
trump={'S':s,'C':c,'H':h,'D':d}
for i in range(n):
    suit,num=raw_input().split()
    num=int(num)
    trump[suit].remove(num)
for suit in ['S','H','C','D']:
    for num in trump[suit]:
        print('%s %d'%(suit,num))

### FIXED CODE ###

n=input()
s=range(1,14)
h=range(1,14)
c=range(1,14)
d=range(1,14)
trump={'S':s,'C':c,'H':h,'D':d}
for i in range(n):
    suit,num=raw_input().split()
    num=int(num)
    trump[suit].remove(num)
count=0
for suit in ['S','H','C','D']:
    for num in trump[suit]:
        print('%s %d'%(suit,num))
n, k= map(int, input().split())
s=input()
s[k], lower()
print("s")

### FIXED CODE ###

n,k=map(int,input().split())
s=input()
print(s[:k-1]+s[k-1].lower()+s[k:])
a, b, k = map(int, input().split())
 
d1 = [i for i in range(1, a//2+2) if a%i == 0]
d2 = [i for i in range(1, b//2+2) if b%i == 0]
print(sorted(set(d1) & set(d2))[k-1])

### FIXED CODE ###

a, b, k = map(int, input().split())
 
def get_divisors(n):
    return [i for i in range(1, n//2+1) if n%i == 0] + [n]

print(sorted(set(get_divisors(a)) & set(get_divisors(b)), reverse=True)[k-1])
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Cs = list(input())
from collections import deque
Q = deque()
for i, c in enumerate(Cs):
    if c=='R':
        Q.append(i)

ans = 0
for i in range(N):
    c = Cs[i]
    if c=='W':
        r = Q.pop()
        if r>i:
            ans += 1
        else:
            break
print(ans)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Cs = list(input())
from collections import deque
Q = deque()
for i, c in enumerate(Cs):
    if c=='R':
        Q.append(i)

ans = 0
for i in range(N):
    c = Cs[i]
    if c=='W':
        if not Q:
            break
        r = Q.pop()
        if r>i:
            ans += 1
        else:
            break
print(ans)
while True:
    num = str(input())
    if(num == 0): break
    ret = 0
    for i in num:
        ret += int(i)
    print(ret)


### FIXED CODE ###

while True:
    num = input()
    if(num == "0"): break
    ret = 0
    for i in num:
        ret += int(i)
    print(ret)
A,B=list(map(int,input().split()))
A=A-1
B=[int(c) for c in format(B,'b')]
A=[int(c) for c in format(A,'b')]

n=len(B)
dp=[[0,0] for _ in range(n+1)]
dp[0][0]=1

cnt=[0]*(n+1)

s=''

for i in range(1,n+1):
    dp=[[0,0] for _ in range(n+1)]
    dp[0][0]=1
    for j in range(n):
        for k in range(2):
            if i==j+1:
                dp[j+1][k]=0 if B[j]==0 and k==0 else dp[j][k]
            else:
                for l in range(0,2 if k==1 else B[j]+1):
                    dp[j+1][k or l<B[j]]+=dp[j][k]
    
    cnt[i]=dp[n][0]+dp[n][1]

if sum(A)>=0:
    n=len(A)
    for i in range(1,n+1):
        dp=[[0,0] for _ in range(n+1)]
        dp[0][0]=1
        for j in range(n):
            for k in range(2):
                if i==j+1:
                    dp[j+1][k]=0 if A[j]==0 and k==0 else dp[j][k]
                else:
                    for l in range(0,2 if k==1 else A[j]+1):
                        dp[j+1][k or l<A[j]]+=dp[j][k]
        
        cnt[i+len(B)-n]-=dp[n][0]+dp[n][1]

for i in range(1,len(B)+1):
    if cnt[i]%2==0:
        s+='0'
    else:
        s+='1'

print(int(s,2))


### FIXED CODE ###

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

B=[int(c) for c in format(B,'b')]

n=len(B)
dp=[[0,0] for _ in range(n+1)]
dp[0][0]=1

cnt=[0]*(n+1)

s=''

for i in range(1,n+1):
    dp=[[0,0] for _ in range(n+1)]
    dp[0][0]=1
    for j in range(n):
        for k in range(2):
            if i==j+1:
                dp[j+1][k]=0 if B[j]==0 and k==0 else dp[j][k]
            else:
                for l in range(0,2 if k==1 else B[j]+1):
                    dp[j+1][k or l<B[j]]+=dp[j][k]
    
    cnt[i]=dp[n][0]+dp[n][1]

if A>1:
    A-=1
    A=[int(c) for c in format(A,'b')]
    n=len(A)
    
    for i in range(1,n+1):
        dp=[[0,0] for _ in range(n+1)]
        dp[0][0]=1
        for j in range(n):
            for k in range(2):
                if i==j+1:
                    dp[j+1][k]=0 if A[j]==0 and k==0 else dp[j][k]
                else:
                    for l in range(0,2 if k==1 else A[j]+1):
                        dp[j+1][k or l<A[j]]+=dp[j][k]
        
        cnt[i+len(B)-n]-=dp[n][0]+dp[n][1]

for i in range(1,len(B)+1):
    if cnt[i]%2==0:
        s+='0'
    else:
        s+='1'

print(int(s,2))
data = [
    "{0} {1}".format(s, r)
    for s in ('S', 'H', 'C', 'D')
    for r in range(1, 13 + 1)
    ]
 
count = int(input())
for c in range(count):
    card = input()
    data.remove(card)
 
for c in data:
    print(c)

### FIXED CODE ###

input()
a = input().split()
a.reverse()
print(" ".join(a))
a=int(input())
li = list(map(int,input().split()))	
count = 0
for i in range(1:a):
  if li[i-1]<li[i] and li[i]<li[i+1]:
    count += 1
  else:
    pass
print(count)

### FIXED CODE ###

a=int(input())
li = list(map(int,input().split()))	
count = 0
for i in range(1,a-1):
  if li[i-1]<li[i] and li[i]<li[i+1]:
    count += 1
  elif li[i-1]>li[i] and li[i]>li[i+1]:
    count += 1
  else:
    pass
print(count)
from scipy.special import comb as c
N = int(input())
if N == 1: print(0)
else:
  ans = 0
  for i in range(1, N):
    ans += c(i+1, N-1, exact=True)
print(ans % (10 ** 9 + 7))

### FIXED CODE ###

N = int(input())
ans = 10 ** N - ((9 ** N) * 2 - 8 ** N)
print(ans % (10 ** 9 + 7))
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  s = input()
  if s == 'AC':
    ac += 1
  elif s == 'WA':
    wa += 1
  elif s == 'tle':
    tle += 1
  else:
    re += 1
print('AC x ' + ac)
print('WA x ' + wa)
print('TLE x ' + tle)
print('RE x ' + re)


### FIXED CODE ###

n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(n):
  s = input()
  if s == 'AC':
    ac += 1
  elif s == 'WA':
    wa += 1
  elif s == 'TLE':
    tle += 1
  else:
    re += 1
print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))
a,b = map(int, input().split())
print(a*b, 2*(a+b))

### FIXED CODE ###

print(int(input())**3)
l=list(input())
for i in range(len(l)):
    if l[i]==l[i+1]:
        print('Bad')
        break
else:
    print('Good')

### FIXED CODE ###

l=input()
for i in range(len(l)-1):
    if l[i]==l[i+1]:
        print('Bad')
        break
else:
    print('Good')
w, h, x, w, y, r = map(int, input().split())

if (x - r) >= 0 and (x + r) <= w:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

w, h, x, y, r = map(int, input().split())

if x + r <= w and y + r >= 0 and x - r >= 0 and y + r <= h:
    print("Yes")
else:
    print("No")
S = input()
K = int(input())

alp = [chr(i) for i in range(97, 97+26)]

ans = ''
for s in S:
    loc = alp.index(s)
    if s == 'a': continue
    if loc + K >= 26:
        K -= 26 - loc
        ans += 'a'
    else:
        ans += s
if K > 0:
    K %= 26
    ans = ans[:-1] + alp[(alp.index(ans[-1])+K)%26]
print(ans)

### FIXED CODE ###

S = input()
K = int(input())

alp = [chr(i) for i in range(97, 97+26)]

ans = ''
for s in S:
    loc = alp.index(s)
    if s == 'a' or loc + K < 26:
        ans += s
    else:
        K -= 26 - loc
        ans += 'a'

if K > 0:
    K %= 26
    ans = ans[:-1] + alp[(alp.index(ans[-1])+K)%26]
print(ans)
def solve(place):
    if place == 0:
        return ('Left')
    elif place == N+1:
        return ('Right')
    for td in TD:
        char,to=td
        if S[place]!=char:continue

        if to=='L':place-=1
        elif to=='R':place+=1

        if place==0:
            return('Left')
        elif place==N+1:
            return('Right')
    return('Not Drop')

l,r=0,N+1
L,R=0,N+1

while abs(r-l)>1:
    m=(l+r)//2
    if solve(m)=='Left':
        L=m
        l,r=m,r
    else:
        l,r=l,m

l,r=0,N+1

while abs(r-l)>1:
    m=(l+r)//2
    if solve(m)=='Right':
        R=m
        l,r=l,m
    else:
        l,r=m,r

print(max(R-L-1,0))


### FIXED CODE ###

N,Q=map(int,input().split())
S=list(input())
S=[0]+S+[N+1]
TD=[list(input().split()) for _ in range(Q)]

def solve(place):
    if place == 0:
        return ('Left')
    elif place == N+1:
        return ('Right')
    for td in TD:
        char,to=td
        if S[place]!=char:continue

        if to=='L':place-=1
        elif to=='R':place+=1

        if place==0:
            return('Left')
        elif place==N+1:
            return('Right')
    return('Not Drop')

l,r=0,N+1
L,R=0,N+1

while abs(r-l)>1:
    m=(l+r)//2
    if solve(m)=='Left':
        L=m
        l,r=m,r
    else:
        l,r=l,m

l,r=0,N+1

while abs(r-l)>1:
    m=(l+r)//2
    if solve(m)=='Right':
        R=m
        l,r=l,m
    else:
        l,r=m,r

print(max(R-L-1,0))