Harryxun/stf_run huggingface dataset:
s = input()
k = s[::2]
g = s[1::2]
 
if (k in "R" or "U" or "D") and (g in "L" or "U" or "D":)
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s=input()
if "L" in s[::2] or "R" in s[1::2]:
  print("No")
else:
  print("Yes")
a,b,c= map(int, input().split())
if a<c<b or b<c<a:
  print("Yes")
  else:
    print("No")

### FIXED CODE ###

a,b,c= map(int, input().split())
if a<c<b or b<c<a:
	print("Yes")
else:
	print("No")
while True:

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

  hit = blow = 0

  for i in range(4):

    if(a[i] == b[i]):
      hit += 1

    elif(a[i] in b):
      blow += 1

  print hit, blow

### FIXED CODE ###

while True:

  try:

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

    hit = blow = 0

    for i in range(4):

      if(a[i] == b[i]):
        hit += 1

      elif(a[i] in b):
        blow += 1

    print hit, blow

  except EOFError:
    break
input()
a = input().split()
print(" ".join(a.reverse()))

### FIXED CODE ###

input()
a = input().split()
a.reverse()
print(" ".join(a))
n = int(input())
a = list(map(int,input().split()))
a = a + [0]

a.sort(reverse = True)

b = 1
ichi = 0
r = []
for i in range(n):
    if a[i] != a[i+1]:
        if b != 1:
            r.append(b)
        else:
            ichi += 1
        b = 1
    else:
        b += 1

for i in range(len(r)-1):
    if r[i] % 2 == 0:
        r[i] = 1
        r[i+1] -= 1
    else:
        r[i] = 1
        
if r[-1] % 2 == 0:
    print(ichi + len(r) - 1)
else:
    print(ichi + len(r))

### FIXED CODE ###

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

a.sort(reverse = True)

b = 1
ichi = 0
r = []
for i in range(n):
    if a[i] != a[i+1]:
        if b != 1:
            r.append(b)
        else:
            ichi += 1
        b = 1
    else:
        b += 1

for i in range(len(r)-1):
    if r[i] % 2 == 0:
        r[i] = 1
        r[i+1] -= 1
    else:
        r[i] = 1
        
if r != []:
    if r[-1] % 2 == 0:
        print(ichi + len(r) - 1)
    else:
        print(ichi + len(r))
        
else:
    print(ichi)
x = int(input())
if 400 <= x < 600:
    prtint(8)
elif 600 <= x < 800:
    print(7)
elif 800 <= x < 1000:
    print(6)
elif 1000 <= x < 1200:
    print(5)
elif 1200 <= x < 1400:
    print(4)
elif 1400 <= x < 1600:
    print(3)
elif 1600 <= x < 1800:
    print(2)
elif 1800 <= x < 2000:
    print(1)

### FIXED CODE ###

import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
 
X=int(input())
ans=0
if(400<=X and X<=599):
    ans=8
if(600<=X and X<=799):
    ans=7
if(800<=X and X<=999):
    ans=6
if(1000<=X and X<=1199):
    ans=5
if(1200<=X and X<=1399):
    ans=4
if(1400<=X and X<=1599):
    ans=3
if(1600<=X and X<=1799):
    ans=2
if(1800<=X and X<=1999):
    ans=1
 
print(ans)
def Base_n_to_10(X,n):
    out = 0
    for i in range(1,len(str(X))+1):
        out += int(X[-i])*(n**(i-1))
    return out#int out

N, K = input().split()
N = int(N)
K = int(K)
x = str(len(Base_n_to_10(N,K)))
print(x)

### FIXED CODE ###

def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
x2 = 0
x10, n = input().split()
x10 = int(x10)
n = int(n)
x2 = Base_10_to_n(x10, n)
print(len(x2))
from collections import Counter

N = int(input())
pos = [list(map(int,input().split())) for _ in range(N)]

pos.sort(reverse = True)

cnt = Counter()

for i in range(N):
    a,b = pos[i]
    for j in range(i+1,N):
        c,d = pos[j]
        t = (a - c, b - d)
        cnt[t] += 1

ans = N - cnt.most_common()[0][1]
print(ans)

### FIXED CODE ###

from collections import Counter

N = int(input())
pos = [list(map(int,input().split())) for _ in range(N)]

if N == 1:
    print(1)
    exit()

pos.sort(reverse = True)

cnt = Counter()

for i in range(N):
    a,b = pos[i]
    for j in range(i+1,N):
        c,d = pos[j]
        t = (a - c, b - d)
        cnt[t] += 1

ans = N - cnt.most_common()[0][1]
print(ans)
def is_prime2(q,k=100):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    for i in xrange(3,k):
        x,y = q,i
        while y:
            x, y =  y, x % y
        if x != 1: continue
        if pow(i, q-1, q) != 1:
            return False
    return True

c = int(input())
for i in range(c, 10**6):
    if is_prime(i):
        print(i)
        break


### FIXED CODE ###

def is_prime2(q,k=100):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    for i in range(3,k):
        x,y = q,i
        while y:
            x, y =  y, x % y
        if x != 1: continue
        if pow(i, q-1, q) != 1:
            return False
    return True

c = int(input())
for i in range(c, 10**6):
    if is_prime2(i):
        print(i)
        break
N=int(input())
H=list(map(int,input().split()))
c=0
C=[]

for i in range(len(H)-1) :

    if H[i] >= H[i+1] :

        c+=1

    if i==len(H)-2 or H[i] < H[i+1]:

        C.append(c)

        c = 0

        
print(max(C))
    


### FIXED CODE ###

N=int(input())
H=list(map(int,input().split()))
c=0
C=[0]

for i in range(N-1) :

    if H[i] >= H[i+1] :

        c+=1

    if i==N-2 or H[i] < H[i+1]:

        C.append(c)

        c = 0

print(max(C))
n = int(input())
s = input().split()

if "Y" in s:
    print("Four")
else:
    print("Three")

### FIXED CODE ###

n = int(input())
print(n//3)
import math
a = int(input())
b = int(math.sqrt(a))-1
for i in range(b):
    x = a/b
    if x.is_integer():
        break
    else:
        b -= 1
print(int(x + b -2))

### FIXED CODE ###

import math
a = int(input())
b = int(math.sqrt(a))
for i in range(b):
    x = a/b
    if x.is_integer():
        break
    else:
        b -= 1
print(int(x + b -2))
import math
from fractions import gcd
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return set(divisors)

def primes(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, n + 1):
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return set([i for i in range(n + 1) if is_prime[i]])

A, B = map(int, input().split())
g = gcd(A, B)
if g==1:
    print(1)
else:
    nums = make_divisors(g)
    pn = primes(g)
    ans = set.intersection(nums, pn)
    print(len(ans)+1)

### FIXED CODE ###

def gcd(a, b):
    return gcd(b, a%b) if b!=0 else a

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

def isprime(n):
    sup = int(n**0.5)
    for i in range(2, sup+1):
        if n%i==0:
            return False
    return True

A, B = map(int, input().split())
g = gcd(A, B)
divs = make_divisors(g)
ans = 0
for d in divs:
    ans += 1 if isprime(d) else 0
print(ans)
N=int(input())
L=list(map(int,input().split()))
count=0
0<=a<=N,0<=b<=N,0<=c<=N
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]) a!=b, b!=c, c!=a:
                count=count+1
            else:
                continue
print(count)
    

### FIXED CODE ###

N=int(input())
L=list(map(int,input().split()))
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]<(L[b]+L[c]) and L[b]<(L[a]+L[c]) and L[c]<(L[b]+L[a]) and L[a]!=L[b] and L[a]!=L[c] and L[c]!=L[b] and a<b<c:
                count=count+1
            else:
                continue
print(count)
print(a + (a*a) + (a*a*a))

### FIXED CODE ###

a = int(input())
print(a + (a * a) + (a * a * a))
n = int(input())
A = [int(input()) for i in range(n)]

#shellSort
cnt = 0
m = 3
G = [n - 1,int((n - 1) / 2) 1]
for i in range(m):
    g = G[i]
    # insertionSort
    for j in range(g, n):
        k = j - g
        while (k >= 0) and (A[k] > A[k + g]):
            A[k + g], A[k] = A[k], A[k + g]
            k -= g
            cnt += 1

print(m)
print(*G)
print(cnt)
for i in A:
    print(i)

### FIXED CODE ###

import sys

def insertionSort(A, n, g):
    global cnt
    for i in range(g, n):
        v = A[i]
        j = i - g
        while (j >= 0) and (A[j] > v):
            A[j + g] = A[j]
            j = j - g
            cnt += 1
        A[j + g] = v

def shellSort(A, n):
    G = [i for i in [262913, 65921, 16577, 4193, 1073, 281, 77, 23, 8, 1] if i <= n]
    m = len(G)
    for k in range(m):
        insertionSort(A, n, G[k])
    return m, G

A = list(map(int, sys.stdin))
n = A[0]
del A[0]

cnt = 0

m, G = shellSort(A, n)

print(m)
print(*G)
print(cnt)
print("\n".join(map(str, A)))
N = int(input())

plist = [(0,0,0)]
for _ in range(N):
	plist.append(tuple(map(int, input().suplit())))

judge = True
for i in range(N):
	mae = plist[i]
	usi = plist[i+1]

	time_diff = usi[0] - mae[0]
	road = abs(usi[1] - mae[1]) + abs(usi[2] - mae[2])

	amari = time_diff % road

	if amari % 2 != 0:
		judge =False

print(judge)

### FIXED CODE ###

N = int(input())

plist = [(0,0,0)]
for _ in range(N):
	plist.append(tuple(map(int, input().split())))

judge = 'Yes'
for i in range(N):
	mae = plist[i]
	usi = plist[i+1]

	time_diff = usi[0] - mae[0]
	road = abs(usi[1] - mae[1]) + abs(usi[2] - mae[2])

	if time_diff < road:
		judge = 'No'
	elif time_diff >= road:
		yozyo = time_diff - road
		if yozyo % 2 != 0:
			judge = 'No'

print(judge)
N,M,X,Y = map(int,input().split())
Lx = list(map(int,input().split()))
Ly = list(map(int,input().split()))
count = 0
for i in range(X:Y):
    if max(Lx) < i <= min(Ly):
        count += 1
if count > 0:
    print("No War")
else:
    print("War")


### FIXED CODE ###

n,m,X,Y = map(int,input().split())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for i in range(max(x)+1,min(y)+1):
    if X < i <= Y:
        print("No War")
        exit()
print("War")
n,k = map(int,input().split())
h=[int(input()) for i in range(n)]
h=sorted(h)
mi=float('inf')
 
for i in range(n-k+1):
    mi = min(mi, h[i+k-1]-h[i])
 
print(mi)

### FIXED CODE ###

x = int(input())
if x == 25:
    print('Christmas')
elif x==24:
    print('Christmas Eve')
elif x==23:
    print('Christmas Eve Eve')
elif x==22:
    print('Christmas Eve Eve Eve')
def diff_is_unequal(a, b, c):
    s, m, l = sorted([a, b, c])
    return (m - s) != (l - m)

input()
indices = dict()
for idx, c in enumerate(input()):
    indices[c] = indices.get(c, []) + [idx]

print(sum(diff_is_unequal(r, g, b) for b in indices["B"] for g in indices["G"] for r in indices["R"]))


### FIXED CODE ###

from numpy import prod
N = int(input())
S = input()
appearances = {"R": 0, "G": 0, "B": 0}
for c in S:
    appearances[c] += 1
print(prod(list(appearances.values())) - sum(sum(len(set(S[start] + S[start + step] + S[start + step * 2])) == 3 for start in range(N - step * 2)) for step in range(1, N // 2 + 1)))
s = input()
ans = ""
for i in s:
  if(i == '9'):
    ans += '1'
  else if(i == '1'):
    ans += '9'
  else:
    ans += i
    
print(ans)


### FIXED CODE ###

s = input()
ans = ""
for i in s:
  if(i == '9'):
    ans += '1'
  elif(i == '1'):
    ans += '9'
  else:
    ans += i
    
print(ans)
from fraction import gcd

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

    dist_list = [abs(d-X) for d in x]

    alpha = gcd(dist_list[0],dist_list[1])
    for d in dist_list:
        alpha = gcd(alpha,d)

    print(alpha)

### FIXED CODE ###

if __name__ == '__main__' :
    A,B = list(map(int, input().split()))
    if A%2 == 0 or B%2 == 0:
        print('No')
    else:
        print('Yes')
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, a: "List[int]"):
    from collections import Counter
    ma, mi = max(a), min(a)
    if ma >= N or mi < 1:
        raise
    if ma - mi > 1:
        return False
    if ma == mi:
        return ma == N - 1 or  2 * ma <= N
    c = Counter(a)
    if c[ma] % 2 != 0:
        return False
    return mi != c[ma] // 2 + c[mi]

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(YES if solve(N, a) else NO)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, a: "List[int]"):
    from collections import Counter
    ma, mi = max(a), min(a)
    if ma >= N or mi < 1:
        raise
    if ma - mi > 1:
        return False
    if ma == mi:
        return ma == N - 1 or  2 * ma <= N
    c = Counter(a)
    # pairがpairでない
    if c[ma] % 2 != 0:
        return False
    x = ma - c[ma] // 2
    if x < 0:
        return False
    # pair以外、すべてalone(crowdが0個)
    if x == c[mi]:
        return True
    # crowdを1つ以上作れるなら0以上c[mi]-2以下の好きな數を作れる
    return x <= c[mi] - 2

# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(YES if solve(N, a) else NO)

if __name__ == '__main__':
    main()
N,M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

A = []
B = []
for i in AB:
    a,b = i
    A.append(a)
    B.append(b)

sortA = sorted(A)

ans = 0
num = M
for i in sortA:
    ind = A.index(i)
    k = B[ind]
    if num > k:
        num -= k
        ans += i* k
    else:
        while True:
            if K == 0:
                break
            ans += i
            k -=1
print(ans)

### FIXED CODE ###

N,M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

sortAB = sorted(AB)

ans = 0
num = M
for i in sortAB:
    a,b = i
    if num >= b:
        num -= b
        ans += a* b
    else:
        ans += a * num
        break

print(ans)
A,B = map(int,input().split())
x=0
def f():
  if A>B:
    x=x+A
    A=A-1
  else:
    x=x+B
    B=B-1
    
f()
f()
print(x)



### FIXED CODE ###

A,B = map(int,input().split())
x=0

if A>B:
  x=x+A
  A=A-1
else:
  x=x+B
  B=B-1
  
if A>B:
  x=x+A
  A=A-1
else:
  x=x+B
  B=B-1
   
print(x)
#include <iostream>
using namespace std;

int main(void){
	int a,b,c,s=0;
	int[101] arr={};
	cin >> a >> b >> c;
	int[a]=1;
	int[b]=1;
	int[c]=1;
	for(int i=0;i<101;i++){
		s+=arr[i];
	}
	cout << s;
	return 0;
}

### FIXED CODE ###

print(len(set(input().split())))
def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
return "APPROVED"      
n = int(input())
li = [int(num) for num in input.split(" ")]
print(fun(li))


### FIXED CODE ###

def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
  return "APPROVED"
n = int(input())
li = [int(num) for num in input().split(" ")]
print(fun(li))
mport numpy as np

N = int(input())
Stu = list(input().split())
Stu2 = [int(i) for i in Stu]
print(Stu2)

x = np.argsort(Stu2)
print(x)
for i in range(N):
    Stu[i] = x[i] + 1

print(' '.join(map(str, Stu)))


### FIXED CODE ###

import numpy as np

N = int(input())
Stu = list(input().split())
Stu2 = [int(i) for i in Stu]

x = np.argsort(Stu2)
for i in range(N):
    Stu[i] = x[i] + 1

print(' '.join(map(str, Stu)))
n = int(input())
c = input()
lists = list(c)
cnt = 0
while 1:
    if lists[cnt] == "W":
        cnt += 1
    else:
        break
number = 0
for i in range(len(lists) - cnt):
    if lists[i + cnt] == "W":
        number += 1
print(number)


### FIXED CODE ###

n = int(input())
c = input()
lists = list(c)
cnt = 0

for i in range(len(lists)):
    if lists[i] == "R":
        cnt += 1
change = 0
for i in range(cnt):
    if lists[i] == "W":
        change += 1
print(change)
from sys import exit

R, G, B, N = map(int, input().split())

count = 0

for r in range(N // R + 1):
	for g in range(N // G + 1):
		for b in range(N // B + 1)
			if r + g + b == N:
				count += 1

print(count)


### FIXED CODE ###

from sys import exit

R, G, B, N = map(int, input().split())

count = 0

for r in range(N // R + 1):
	for g in range((N - r * R) // G + 1):
		if (N - r * R - g * G) % B == 0:
			count += 1

print(count)
N,K = map(int, input().split())
A =[0]
B=list(map(int, input().split()))
for m in range(N):
    A.append(B[m])
place=set([])
p=[]
i=1
count=0
while i not in place:
    place.add(i)
    p.append(i)
    i=A[i]
    count+=1
if count>=K:
    print(place[K+1])
else:
    loop=[i]
    start=i
    j=A[i]
    count+=1
    while j!=start:
        loop.append(j)
        j=A[j]
        count+=1
    num=(K-count)%len(loop)
    print(loop[num])

### FIXED CODE ###

S=input()
T=input()
if S==T[:len(T)-1]:
    print("Yes")
else:
    print("No")
data_h = []
data_w = []
while True:
  h, w = (int(i) for i in input().split())
  if h == w == 0:
    break
  else:
   data_h.append(h)
   data_w.append(w)

for count in range(len(data_h)):
  h = data_h[count]
  w = data_w[count]
  for i in range(h):
    print('#',end='')
    for j in range(w):
      if i == 0 or i == range(h) or i == (range(h) - 1):
        print('#',end='')
      else:
        print('.',end='')
    print('')
  print('')

### FIXED CODE ###

data_h = []
data_w = []
while True:
  h, w = (int(i) for i in input().split())
  if h == w == 0:
    break
  else:
    data_h.append(h)
    data_w.append(w)

for i in range(len(data_h)):
  h = data_h[i]
  w = data_w[i]
  for j in range(1,h+1):
    for k in range(1,w+1):
      if j == 1 or j == h or k == 1 or k == w:
        print('#',end='')
      else:
        print('.',end='')
    print('')
  print('')
s = input()


def solve(query):
    if query == "":
        print("YES")
        exit()
    for frag in ("eraser", "erase", "dream", "dreamer"):
        if query.startswith(frag):
            solve(query[len(frag):])


solve(s)
print("NO")


### FIXED CODE ###

s = input()


def solve(query):
    while 1:
        for frag in ("erase", "eraser", "dream", "dreamer"):
            if query.endswith(frag):
                query = query[:-len(frag)]
                break
        else:
            print("NO")
            break
        if not query:
            print("YES")
            break



solve(s)
k = int(input())
 
a, b = map(int, input().split())
necounter = 0
for i in range(a, b+1):
  if i % k == 0:
    break
  else:
    ngcounter += 1
    
if ngcounter == b - a + 1:
  print("NG")
else :
  print("OK")


### FIXED CODE ###

k = int(input())
 
a, b = map(int, input().split())
ngcounter = 0
for i in range(a, b+1):
  if i % k == 0:
    break
  else:
    ngcounter += 1
    
if ngcounter == b - a + 1:
  print("NG")
else :
  print("OK")
A,B,K = map(int, input().split())

if B-A+1<= 2*K:
    print(*range(A,B+1), sep="\n")
else:
    a = list(range(A,A+K))
    b = list(range(B-K+1,B+1))
    C = set(a,b)
    print(*C, sep="\n")

### FIXED CODE ###

A,B,K = map(int, input().split())
if B - A + 1> 2*K:
    a = list(range(A, A+K))
    b = list(range(B-K+1,B+1))
    c = sorted(set(a+b))
    print(*c, sep="\n")
else:
    print(*range(A,B+1), sep="\n")
import sys
from collections import defaultdict
import collections

class UnionFindPathCompression():
    def __init__(self, n):
        self.parents = list(range(n))

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        self.parents[y] = x


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

for i in range(M):
    A, B = map(int, input().split())
    uf.union(A - 1, B - 1)

hoge = [uf.find(i) for i in range(N)]

#print(hoge)
hogehoge = collections.Counter(hoge).most_common()

print(hogehoge[0][1])

### FIXED CODE ###

import sys
from collections import defaultdict
import collections

sys.setrecursionlimit(1000000)

class UnionFindPathCompression():
    def __init__(self, n):
        self.parents = list(range(n))

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        self.parents[y] = x


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

for i in range(M):
    A, B = map(int, input().split())
    uf.union(A - 1, B - 1)

hoge = [uf.find(i) for i in range(N)]

#print(hoge)
hogehoge = collections.Counter(hoge).most_common()

print(hogehoge[0][1])
def main():
    n, q = inputAsIntArr()
    s = input()

    idxes = []
    for i in range(n):
        if s[i] != 'A':
            continue
        if s[i+1] == 'C':
            idxes.append(i)
            i += 1

    # num_acs = ""
    # for i in range(q):
    #     li, ri = inputAsIntArr()
    #     num_ac = len([v for v in idxes if li-2 < v < ri-1])
    #     num_acs += str(num_ac) + "\n"

    # print(num_acs.strip())


def inputAsIntArr():
    return [int(i) for i in input().split(' ')]


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n, q = map(int, input().split())
    s = input()

    # 累積出現数を格納: 指定される番号が1始まりなのでズラして格納
    p = [0] * (n+1)
    for i in range(n):
        p[i+1] = p[i] + (1 if s[i:i+2] == "AC" else 0)

    for i in range(q):
        l, r = map(int, input().split())
        # 終端(=l-1)から始端-1(=r-1)の累積出現数を引いた数が指定区間内での出現回数
        print(p[r-1] - p[l-1])


if __name__ == '__main__':
    main()
# 
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
a,b,c = map(str, input().split())
ans = ''
ans = a[0:1]+b[0:1]+c[0:1]
ans = ans.upper()
pritn(ans)

### FIXED CODE ###

# 
si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))
a,b,c = map(str, input().split())
ans = ''
ans = a[0:1]+b[0:1]+c[0:1]
ans = ans.upper()
print(ans)
n = int(input()) #長さ
a = input().split() #帽子の数
x = 0
y = 0
z = 0
ans = 1
 
for i in range(n): #1文字目
  if a[i] == x:
    if x == y & x == z:
      ans = ans * 3
    elif x == y:
      ans = ans * 2
   	x = x + 1
  elif a[i] == y:
    if y == z:
      ans = ans * 2
    y = y + 1
  else:
    z = z + 1
print(ans % 1000000007)

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
x=0
y=0
z=0
ans=1
for a in A:
    c=0
    X,Y,Z=x,y,z
    if a==x:
        x+=1
        c+=1
    if a==y:
        c+=1
        if a!=X:
            y+=1
    if a==z:
        c+=1
        if a!=X and a!=Y:
            z+=1
    ans=ans*c%1000000007
print(ans)
L = input()
L2 = L.split()

X = float(L2[0]) #float
K = int(L2[1])
D = int(L2[2])

A = [0]*(K+1)
A[0] = X

for i in range(1,K+1):
	if A[i-1]>0:
		A[i] = A[i-1] - D
	else:
		A[i] = A[i-1] +D

if A[K] > 0:
	print(int(A[K]))
else:
	print(int(-1 *A[K]))

### FIXED CODE ###


A = input().split()
X = float(A[0])
K = int(A[1])
D = int(A[2])

if abs(X) - K * D > 0:
	print(int(abs(X) - K*D))
else:
	K2 = abs(X)//D
	if (K - K2) % 2 == 0:
		print(int(abs(abs(X) - D * K2)))
	else:
		print(int(abs(abs(abs(X) - D * K2) - D)))